Skip to Content

My requirement was to update the Move-Out Reversed Flag of Contracts with a Report having a test mode flag in it which will show the details of the rows of the tables getting updated.

1. The report’s test mode should show the details of rows getting updated for the contracts provided in a single screen.

This can be achieved using splitter control

The tables getting updated are EAUS,EAUSV & EVER.

The reason behind me writing this document is to help technical people achieve this requirement with basic details of what is required.

Step 1. Write a report for updation of the flag.

Step 2 . To have splitter, you first have to create a screen for your program. For this go to SE51 and create a screen for the same program

For Ex : If your program name is : ZTEST, create a screen, 9000 (or any other number ) for the same program.

Step 3. In this screen, create a Custom Container.

This custom container actually will be called in the report and then we will split it into the desired format.

Give a name to this custom control . Ex : give name : CCONTAINER

Now the source code :

TABLES :

ever,

eaus,

eausv.

** Selection ScreenSELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text001.SELECT-OPTIONS : s_vert FOR eververtrag.SELECTION-SCREEN SKIP.PARAMETERS : p_mout RADIOBUTTON GROUP r1,
             p_min
RADIOBUTTON GROUP r1,
             p_tmode
AS CHECKBOX DEFAULT ‘X’.SELECTION-SCREEN END OF BLOCK b1.SELECTION-SCREEN SKIP.
***– for splitterDATA splitter_1 TYPE REF TO cl_gui_splitter_container.DATA splitter_2 TYPE REF TO cl_gui_splitter_container.DATA container TYPE REF TO cl_gui_custom_container.DATA container_1 TYPE REF TO cl_gui_container.DATA container_2 TYPE REF TO cl_gui_container.DATA container_3 TYPE REF TO cl_gui_container.DATA : gt_sflight_1 TYPE TABLE OF sflight,
      gt_sflight_2
TYPE TABLE OF sflight,
      gt_sflight_3
TYPE TABLE OF sflight,
      g_container
TYPE scrfname VALUE ‘CCONTAINER’,
       grid1
TYPE REF TO cl_gui_alv_grid,
       grid2
TYPE REF TO cl_gui_alv_grid,
        grid3
TYPE REF TO cl_gui_alv_grid.
DATA : ok_code TYPE syucomm.

** Type DeclarationsTYPES : BEGIN OF st,
        vkonto
TYPE evervkonto,
      
END OF st.
TYPES : BEGIN OF ty_evr,
        vertrag
TYPE vertrag,
  loevm
TYPE vertrag,
  anlage
TYPE anlage,
  einzdat
TYPE einzdat,
  auszdat
TYPE auszdat,
 
END OF ty_evr.
** Data DeclarationsDATA : lt_eausv TYPE TABLE OF eausv,
       ls_eausv
LIKE LINE OF lt_eausv,
       lt_vkonto
TYPE TABLE OF st,“ever-vkonto,
       lt_eaus
TYPE TABLE OF eaus,
       ls_eaus
LIKE LINE OF lt_eaus,
       lt_ever_min
TYPE TABLE OF ever,“ty_evr,
       ls_ever_min
LIKE LINE OF lt_ever_min.
DATA: lcl_alv TYPE REF TO cl_gui_alv_grid,
      t_eaus
TYPE STANDARD TABLE OF eausv,
      t_eaus1
TYPE STANDARD TABLE OF eaus,
      t_ever
TYPE STANDARD TABLE OF ever,
      ls_fli 
TYPE eausv,
      lr_data
TYPE REF TO data,
      lr_alv
TYPE REF TO cl_salv_table,
      lr_alv1
TYPE REF TO cl_salv_table,
      lr_desc
TYPE REF TO cl_abap_datadescr,
      lr_str 
TYPE REF TO cl_abap_structdescr,
      lr_fun 
TYPE REF TO cl_salv_functions_list.
DATA lin TYPE i.
** For splitter Container
DATA:
      g_alv_grid1
TYPE REF TO cl_gui_alv_grid,
      g_alv_grid2
TYPE REF TO cl_gui_alv_grid,
      g_alv_grid3
TYPE REF TO cl_gui_alv_grid,
            g_title 
TYPE lvc_title,
   gr_display  
TYPE REF TO cl_salv_display_settings,
   gr_function       
TYPE REF TO cl_salv_functions,
gr_columns        
TYPE REF TO cl_salv_columns_table,
g_custom_container
TYPE REF TO cl_gui_custom_container,
      g_splitter_container
TYPE REF TO cl_gui_splitter_container,
      g_top_container
TYPE REF TO cl_gui_container,
      g_middle_container
TYPE REF TO cl_gui_container,
      g_bottom_container
TYPE REF TO cl_gui_container.** End
FIELD-SYMBOLS: <l_tab> TYPE ANY TABLE,
               <ls_eausv>
TYPE eausv,
               <ls_eaus>
TYPE eaus,
               <fs_ever_min>
TYPE ever.” ty_evr.
** Local Variables*Data lv_vkonto type VKONT_KK.
** ConstantsCONSTANTS : c_col_x  TYPE sap_bool VALUE ‘X’.

**– Start of Logic
IF p_mout = ‘X’.
 
PERFORM update_mout_dtab.ELSEIF p_min = ‘X’.
 
PERFORM update_min_dtab.ENDIF.

*&———————————————————————**&      Form  UPDATE_MOUT_DTAB*&———————————————————————**       text*———————————————————————-**  –>  p1        text*  <–  p2        text*———————————————————————-*FORM update_mout_dtab RAISING cx_salv_msg .** To check move-out reversal indicator for EAUSV

  SELECT * FROM eausv INTO TABLE lt_eausv WHERE vertrag IN s_vert.

  IF sysubrc = 0.
   
SORT lt_eausv BY vertrag.
   
LOOP AT lt_eausv INTO ls_eausv.
     
IF ls_eausvstorausz = ‘X’.
       
DELETE TABLE lt_eausv FROM ls_eausv.
     
ENDIF.
   
ENDLOOP.
   
IF p_tmode = ‘X’.
*INSERT ls_fli INTO TABLE t_eaus.
      t_eaus[]
= lt_eausv[].
     
ASSIGN t_eaus TO <l_tab>.
**—-test splitter for tables

    ELSE.
     
LOOP AT lt_eausv ASSIGNING <ls_eausv>.
        <ls_eausv>
storausz = ‘X’.
     
ENDLOOP.

      DESCRIBE TABLE lt_eausv LINES lin.
     
MODIFY eausv FROM TABLE lt_eausv.
     
IF sysubrc = 0.
       
WRITE : lin, ‘records updated in EAUSV table’.
     
ENDIF.
   
ENDIF.
 
ENDIF.
** To check move-out reversal indicator for EAUS.

  SELECT vkonto FROM ever INTO TABLE lt_vkonto WHERE vertrag IN s_vert.

  IF sysubrc = 0.

    SELECT * FROM eaus INTO TABLE lt_eaus FOR ALL ENTRIES IN lt_vkonto WHERE vkont EQ lt_vkontovkonto.

    IF sysubrc = 0.
     
SORT lt_eaus BY vkont.
     
LOOP AT lt_eaus INTO ls_eaus.
       
IF ls_eausstorausz = ‘X’.
         
DELETE TABLE lt_eaus FROM ls_eaus.
       
ENDIF.
     
ENDLOOP.
     
IF p_tmode = ‘X’.*        CLEAR : t_eaus,lt_eausv.

        CALL SCREEN 9010.

      ELSE.
       
LOOP AT lt_eaus ASSIGNING <ls_eaus>.
          <ls_eaus>
storausz = ‘X’.
       
ENDLOOP.
       
CLEAR lin.
       
DESCRIBE TABLE lt_eaus LINES lin.
       
MODIFY eaus FROM TABLE lt_eaus.
       
IF sysubrc = 0.
         
WRITE : /  lin, ‘records updated in EAUS table’.
       
ENDIF.
     
ENDIF.
   
ENDIF.

  ENDIF.ENDFORM.                    ” UPDATE_MOUT_DTAB*&———————————————————————**&      Form  UPDATE_MIN_DTAB*&———————————————————————**       text*———————————————————————-**  –>  p1        text*  <–  p2        text*———————————————————————-*FORM update_min_dtab RAISING cx_salv_msg.** get all the Contracts

  SELECT * FROM ever INTO CORRESPONDING FIELDS OF TABLE lt_ever_min WHERE vertrag IN s_vert.   “vertrag loevm anlage einzdat auszdat
** check if deletion indicator is already set.
 
SORT lt_ever_min BY vertrag.
 
LOOP AT lt_ever_min INTO ls_ever_min.
   
IF ls_ever_minloevm = ‘X’.
     
DELETE TABLE lt_ever_min FROM ls_ever_min.
   
ENDIF.
 
ENDLOOP.** test mode
 
IF p_tmode = ‘X’.
   
CLEAR : t_ever.
   
CLEAR lr_alv1.
    t_ever[]
= lt_ever_min[].
   
ASSIGN t_ever TO <l_tab>.
   
CALL METHOD cl_salv_table=>factory*        EXPORTING*          r_container  = g_middle_container
     
IMPORTING
        r_salv_table
= lr_alv1
     
CHANGING
        t_table     
= <l_tab>.

    gr_function = lr_alv1->get_functions( ).

    gr_function->set_all( abap_true ).

    gr_columns = lr_alv1->get_columns( ).

    gr_columns->set_optimize( c_col_x ).

    CLEAR g_title.
   
MOVE ‘Following enteries will get modified in EVER Table’ TO g_title.

    gr_display = lr_alv1->get_display_settings( ).

    gr_display->set_striped_pattern( if_salv_c_bool_sap=>true ).

    gr_display->set_list_header( g_title ).

    CALL METHOD lr_alv1->display.

  ENDIF.

  IF lt_ever_min IS NOT INITIAL AND p_tmode NE ‘X’.
   
CLEAR ls_ever_min.
   
LOOP AT lt_ever_min ASSIGNING <fs_ever_min>.
      <fs_ever_min>
loevm = ‘X’.
      <fs_ever_min>
anlage = ‘ ‘.
      <fs_ever_min>
einzdat = ‘ ‘.
      <fs_ever_min>
auszdat = ‘ ‘.
   
ENDLOOP.
   
MODIFY ever FROM TABLE lt_ever_min.
   
IF sysubrc = 0.
     
CLEAR lin.
     
DESCRIBE TABLE lt_ever_min LINES lin.
     
WRITE : / lin, ‘records have been updated in EVER table for Move-In Mismatch Issue’.
   
ENDIF.
 
ENDIF.ENDFORM.                    ” UPDATE_MIN_DTAB*&———————————————————————**&      Module  STATUS_9010  OUTPUT*&———————————————————————**       text*———————————————————————-*MODULE status_9010 OUTPUT.*  SET PF-STATUS ‘xxxxxxxx’.*  SET TITLEBAR ‘xxx’.*  SET PF-STATUS ‘TEST’.* creating object reference for container
 
CREATE OBJECT container
   
EXPORTING
      container_name
= ‘CCONTAINER’.
 
” pass name of the container created in Screen no 9010
*Spliting the main container in to 1 row & 2 coloum
 
CREATE OBJECT splitter_1
   
EXPORTING
      parent 
= container
     
rows    = 2
      columns
= 1.
*getting the reference for the splited container( row 1 & col 1 container )

  CALL METHOD splitter_1->get_container
   
EXPORTING
      row      
= 1
      column   
= 1
    RECEIVING
      container
= container_1.
*getting the reference for the splited container (row 1 & col 2 container)

  CALL METHOD splitter_1->get_container
   
EXPORTING
      row      
= 2
      column   
= 1
    RECEIVING
      container
= container_2.
* Populating first internal table to the container
 
CREATE OBJECT container
   
EXPORTING
      container_name
= g_container.

  CREATE OBJECT grid1
   
EXPORTING
      i_parent
= container_1.

  CALL METHOD grid1->set_table_for_first_display
   
EXPORTING
      i_structure_name
= ‘EAUSV’
   
CHANGING
      it_outtab       
= lt_eausv.
* Populating second internal table

  CREATE OBJECT container
   
EXPORTING
      container_name
= g_container.

  CREATE OBJECT grid2
   
EXPORTING
      i_parent
= container_2.
 
CALL METHOD grid2->set_table_for_first_display
   
EXPORTING
      i_structure_name
= ‘EAUS’
   
CHANGING
      it_outtab       
= lt_eaus.
** Populating third internal table
ENDMODULE.                 ” STATUS_9010  OUTPUT
*———————————————————————-**  MODULE exit INPUT*———————————————————————-***———————————————————————-*MODULE exit INPUT.* free the container memory when exit
 
CALL METHOD container->free.
 
LEAVE PROGRAM.ENDMODULE. ” EXIT INPUT*&———————————————————————**&      Module  USER_COMMAND_9010  INPUT*&———————————————————————**       text*———————————————————————-*MODULE user_command_9010 INPUT.
 
CALL METHOD cl_gui_cfw=>dispatch.
 
CASE ok_code.
   
WHEN ‘BACK’.
     
LEAVE SCREEN.
   
WHEN ‘CANCEL’.
     
LEAVE PROGRAM.
   
WHEN ‘EXIT’.
     
LEAVE SCREEN .
 
ENDCASE .ENDMODULE.                 ” USER_COMMAND_9010  INPUT

Result Screen added as attachment. This structure will get poplualted based on the contract.

Note : Create an attribute OK_CODE type OK in the screen to use user_command module.

These modules get called whenever screen is getting called, or there is any user input.

Feel free to ask me in comments,if you have doubt displaying the ALV Splitter Control .

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. William Eastman

    You really should not be updating the tables directly in this manner.  I dont see any checks against billing history or subsequent transactions.  I would recommend using standard bapi for making updates like these.  Otherwise you risk creating inconsistencies.

    (0) 

Leave a Reply