Alv related prob

hello all experts,
i made an alv,which shows display like this
do no(likp-vbeln) | name(kna1-name1) | batch| qty| shipment no(vttk-tknum)| trucck no(vttk-signi)
now the fact is
likp-traid (truck no) is in my selection-screen,
by which i fill all my itabs.
the list will show the truck no, such a way
when likp-traid has a value , but vttk-signi (truck no) has not, the list will show truck no for likp-traid,
when likp-traid has a value , but vttk-signi (truck no) has that same value, the list will show truck no by vttk-signi , how to do that? plz help

*& Report  ZLOADINGSLIP_***_GATEPASS
REPORT  zloadingslip_***_gatepass.
*************tables declaration****************
TABLES: likp.
***************type groups declaration*********
TYPE-POOLS: slis.
**************INTERNAL TABLE DECLARATION*****************
DATA: BEGIN OF it_likp_lips OCCURS 0,
        vbeln TYPE likp-vbeln," do no
        erdat TYPE likp-erdat," date
        kunnr TYPE likp-kunnr,"Ship-to party
        traid TYPE likp-traid,"Transport ID
        vbTYP TYPE liKP-VbTYP,
        matnr TYPE lips-matnr,"item
        vrkme TYPE lips-vrkme,"UOM
        charg TYPE lips-charg," batch
        lfimg TYPE lips-lfimg," quantity
        arktx TYPE lips-arktx,"sku CODE
      END OF it_likp_lips.
DATA: BEGIN OF it_kna1 OCCURS 0,
          kunnr TYPE kna1-kunnr,
          name1 TYPE kna1-name1,"party name
      END OF it_kna1.
DATA: BEGIN OF it_mch1 OCCURS 0,
          charg TYPE mch1-charg,
          ersda TYPE mch1-ersda,
          END OF it_mch1.
DATA: BEGIN OF itab1 OCCURS 0,
       vbeln TYPE likp-vbeln," do no
       erdat TYPE likp-erdat," date
       kunnr TYPE likp-kunnr,"Ship-to party
       traid TYPE likp-traid,"Transport ID
       text type string,
       vbTYP TYPE liKP-VbTYP,
       matnr TYPE lips-matnr,"item
       vrkme TYPE lips-vrkme,"UOM
       charg TYPE lips-charg," batch
       lfimg TYPE lips-lfimg," quantity
       arktx TYPE lips-arktx,"sku
       name1 TYPE kna1-name1,"party name
       END OF itab1.
DATA: BEGIN OF itab2 OCCURS 0,
        vbeln TYPE likp-vbeln," do no
        erdat TYPE likp-erdat," date
        kunnr TYPE likp-kunnr,"Ship-to party
        text TYPE likp-traid,"Transport ID
        vbTYP TYPE liKP-VbTYP,
        matnr TYPE lips-matnr,"item
        vrkme TYPE lips-vrkme,"UOM
        charg TYPE lips-charg," batch
        lfimg TYPE lips-lfimg," quantity
        arktx TYPE lips-arktx,"sku
        name1 TYPE kna1-name1,"party name
        ersda TYPE mch1-ersda,
        END OF itab2.
    DATA: BEGIN OF itab3 OCCURS 0,
        vbeln TYPE likp-vbeln," do no
        erdat TYPE likp-erdat," date
        kunnr TYPE likp-kunnr,"Ship-to party
        text TYPE string,"Transport ID
        vbTYP TYPE liKP-VbTYP,
        matnr TYPE lips-matnr,"item
        vrkme TYPE lips-vrkme,"UOM
        charg TYPE lips-charg," batch
        lfimg TYPE lips-lfimg," quantity
        arktx TYPE lips-arktx,"sku
        name1 TYPE kna1-name1,"party name
        ersda TYPE mch1-ersda,
        tknum TYPE vttk-tknum," SHIPMENT NO
        S_erdat TYPE vttk-erdat,"DATED
        signi TYPE vttk-signi,"TRUCK NO
        tdlnr TYPE vttk-tdlnr,
        lifnr TYPE lfa1-lifnr,
        V_name1 TYPE lfa1-name1,"TRANSPORTER NAME
        END OF itab3.
DATA: BEGIN OF it_vttk OCCURS 0,
        tknum TYPE vttk-tknum," SHIPMENT NO
        erdat TYPE vttk-erdat,"DATED
        signi TYPE vttk-signi,"TRUCK NO
        tdlnr TYPE vttk-tdlnr,
      END OF it_vttk.
DATA: BEGIN OF it_lfa1 OCCURS 0,
           lifnr TYPE lfa1-lifnr,
           name1 TYPE lfa1-name1,"TRANSPORTER NAME
         END OF it_lfa1.
**************************ALV DATA DECLARATION********************
DATA:  it_fcat TYPE slis_t_fieldcat_alv,   " FIELDCAT DECLARATION
       wa_fcat TYPE  slis_fieldcat_alv,
**local work area of event catalog********
it_event TYPE slis_t_event,
wa_event TYPE slis_alv_event,
****************STRUCTURE FOR LAYOUT****
is_layout TYPE slis_layout_alv,"LAYOUT
************ALV SORTING******************
it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv,
    repid TYPE sy-repid.
repid = sy-repid." PROGRAM  NAME
**************************** SELECTION-SCREEN design***************************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: date  FOR likp-erdat ,
                truck_no FOR likp-traid OBLIGATORY." truck no
SELECTION-SCREEN END OF BLOCK b1.
************************START-OF-SELECTION**************************
START-OF-SELECTION.
  PERFORM get_likp_lips_data.
  IF NOT it_likp_lips[] IS INITIAL.
    PERFORM get_kna1_data.
  ENDIF.
  PERFORM get_itab1.
  IF NOT itab1[] IS INITIAL.
    PERFORM get_mch1_data.
  ENDIF.
  PERFORM get_itab2.
  IF NOT itAB2[] IS INITIAL.
    PERFORM get_vttk_data.
  ENDIF.
  IF NOT it_vttk[] IS INITIAL.
    PERFORM get_lfa1_data.
  ENDIF.
PERFORM GET_ITAB3.
*********************SUBROUTINE FOR ALV LAYOUT***********
  PERFORM build_layout_alv.
************************ SUBROUTINE FOR ALV EVENT **********
  PERFORM build_events.
********************** SUBROUTINE FOR ALV FIELDCATALOG *******
  PERFORM build_fcat USING:
     '01' 'VBELN' 'ITAB3' 'DO NO',
     '02' 'NAME1' 'ITAB3' 'PARTY NAME',
     '03' 'ARKTX' 'ITAB3' 'SKU CODE',
     '04' 'CHARG' 'ITAB3' 'BATCH',
     '05' 'LFIMG' 'ITAB3' 'QUANTITY',
     '06' 'VRKME' 'ITAB3' 'UOM',
     '07' 'ERSDA' 'ITAB3' 'MFG DATE',
     '08' 'TKNUM' 'ITAB3' 'SHIPMENT NO',
     '09' 'S_ERDAT' 'ITAB3' 'DATED',
     '10' 'SIGNI' 'ITAB3' 'TRUCK NO',
     '11' 'V_NAME1' 'ITAB3' 'TRANSPORTER NAME'.
******************ALV SORTING*******************************
  PERFORM alv_sort_info.
****************************END-OF-SELECTION**********************************************
END-OF-SELECTION.
  PERFORM alv_grid_display.
*&      Form  GET_LIKP_LIPS_DATA
*       text
*  -->  p1        text
*  <--  p2        text
FORM get_likp_lips_data .
  SELECT likp~vbeln likp~erdat likp~kunnr likp~traid LIKP~VBTYP lips~matnr lips~vrkme lips~charg lips~lfimg lips~arktx
  INTO CORRESPONDING FIELDS OF TABLE it_likp_lips
  FROM likp JOIN lips
  ON likp~vbeln EQ lips~vbeln
  WHERE
  LIKP~TRAID IN TRUCK_NO AND
  likp~erdat IN date AND LIKP~VBTYP = 'J'.
  IF sy-subrc <> 0.
*    MESSAGE 'NO DATA IN IT_LIKP_LIPS..' TYPE 'E'.
  ELSE.
    SORT it_likp_lips BY vbeln.
DELETE IT_LIKP_LIPS WHERE LFIMG  EQ '0.0'.
*    DELETE ADJACENT DUPLICATES FROM IT_LIKP_LIPS.
  ENDIF.
ENDFORM.                    " GET_LIKP_LIPS_DATA
*&      Form  GET_KNA1_DATA
*       text
*  -->  p1        text
*  <--  p2        text
FORM get_kna1_data .
  SELECT
        kunnr
        name1
        INTO CORRESPONDING FIELDS OF TABLE it_kna1
        FROM kna1
        FOR ALL ENTRIES IN it_likp_lips
        WHERE kunnr = it_likp_lips-kunnr.
  IF sy-subrc <> 0.
* MESSAGE 'NO DATA IN IT_KNA1.' TYPE 'E'.
  ELSE.
    SORT it_kna1 BY kunnr.
*    DELETE ADJACENT DUPLICATES FROM IT_LIKP_LIPS.
  ENDIF.
ENDFORM.                    " GET_KNA1_DATA
*&      Form  GET_ITAB1
*       text
*  -->  p1        text
*  <--  p2        text
FORM get_itab1 .
  LOOP AT it_likp_lips.
    itab1-vbeln = it_likp_lips-vbeln.
    itab1-erdat = it_likp_lips-erdat.
    itab1-kunnr = it_likp_lips-kunnr.
    itab1-traid = it_likp_lips-traid.
    itab1-text  = itab1-traid.
    itab1-matnr = it_likp_lips-matnr.
    itab1-vrkme = it_likp_lips-vrkme.
    itab1-charg = it_likp_lips-charg.
    itab1-lfimg = it_likp_lips-lfimg.
    itab1-arktx = it_likp_lips-arktx.
*    translate itab1-text to lower case.
    READ TABLE it_kna1 WITH KEY kunnr = it_likp_lips-kunnr BINARY SEARCH.
    IF sy-subrc = 0.
      itab1-name1 = it_kna1-name1.
    ENDIF.
    APPEND itab1.
    CLEAR itab1.
  ENDLOOP.
*CALL FUNCTION 'TERM_TRANSLATE_TO_UPPER_CASE'
*  EXPORTING
**   LANGU                     = SY-LANGU
*    text                      =
** IMPORTING
**   TEXT_UC                   =
** EXCEPTIONS
**   NO_LOCALE_AVAILABLE       = 1
**   OTHERS                    = 2
*IF sy-subrc <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
**         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
ENDFORM.                                                    " GET_ITAB1
*&      Form  GET_MCH1_DATA
*       text
*  -->  p1        text
*  <--  p2        text
FORM get_mch1_data .
  SELECT
        charg
        ersda
        INTO CORRESPONDING FIELDS OF TABLE it_mch1
        FROM mch1
        FOR ALL ENTRIES IN itab1
        WHERE charg = itab1-charg.
  IF sy-subrc <> 0.
* MESSAGE 'NO DATA IN IT_MCH1.' TYPE 'E'.
  ELSE.
    SORT it_mch1 BY charg.
*    DELETE ADJACENT DUPLICATES FROM IT_LIKP_LIPS.
  ENDIF.
ENDFORM.                    " GET_MCH1_DATA
*&      Form  GET_ITAB2
*       text
*  -->  p1        text
*  <--  p2        text
FORM get_itab2 .
  LOOP AT itab1.
    itab2-vbeln = itab1-vbeln." FINAL DISPLAY
    itab2-name1 = itab1-name1." FINAL DISPLAY
    itab2-kunnr = itab1-kunnr." FINAL DISPLAY
    itab2-text = itAB1-text.
    itab2-matnr = itab1-matnR.
    itab2-arktx = itab1-arktx." FINAL DISPLAY
    itab2-lfimg = itab1-lfimg." FINAL DISPLAY
    itab2-vrkme = itab1-vrkme.
    itab2-charg = itab1-charg." FINAL DISPLAY
    READ TABLE it_mch1 WITH KEY charg = itab1-charg BINARY SEARCH.
    IF sy-subrc = 0.
      itab2-ersda = it_mch1-ersda." FINAL DISPLAY
    ENDIF.
    APPEND itab2.
    CLEAR itab2.
  ENDLOOP.
ENDFORM.                                                    " GET_ITAB2
*&      Form  GET_VTTK_DATA
*       text
*  -->  p1        text
*  <--  p2        text
FORM get_vttk_data .
  SELECT
         tknum
         erdat
         signi
         tdlnr
       INTO CORRESPONDING FIELDS OF TABLE it_vttk
          FROM vttk
               FOR ALL ENTRIES IN itaB2
          WHERE signi = itaB2-Text.
  IF sy-subrc <> 0.
* MESSAGE 'NO DATA IN IT_VTTK.' TYPE 'E'.
  ELSE.
    SORT it_vttk BY tknum tdlnr.
*    DELETE ADJACENT DUPLICATES FROM IT_VTTK.
  ENDIF.
ENDFORM.                    " GET_VTTK_DATA
*&      Form  GET_LFA1_DATA
*       text
*  -->  p1        text
*  <--  p2        text
FORM get_lfa1_data .
  SELECT
        lifnr
        name1
        INTO CORRESPONDING FIELDS OF TABLE it_lfa1
        FROM lfa1
        FOR ALL ENTRIES IN it_vttk
        WHERE lifnr = it_vttk-tdlnr.
  IF sy-subrc <> 0.
* MESSAGE 'NO DATA IN IT_LFA1.' TYPE 'E'.
  ELSE.
    SORT it_lfa1 BY lifnr name1.
*    DELETE ADJACENT DUPLICATES FROM IT_LFA1.
  ENDIF.
ENDFORM.                    " GET_LFA1_DATA
*&      Form  GET_ITAB3
*       text
*  -->  p1        text
*  <--  p2        text
form GET_ITAB3 .
*DATA: t1 TYPE c LENGTH 10 VALUE 'We',
*      t2 TYPE c LENGTH 10 VALUE 'have',
*      t3 TYPE c LENGTH 10 VALUE 'all',
*      t4 TYPE c LENGTH 10 VALUE 'the',
*      t5 TYPE c LENGTH 10 VALUE 'time',
*      t6 TYPE c LENGTH 10 VALUE 'in',
*      t7 TYPE c LENGTH 10 VALUE 'the',
*      t8 TYPE c LENGTH 10 VALUE 'world',
*      result TYPE string.
*CONCATENATE t1 t2 t3 t4 t5 t6 t7 t8
*            INTO result.
LOOP AT ITAB2.
    itab3-vbeln = itab2-vbeln." FINAL DISPLAY
    itab3-name1 = itab2-name1." FINAL DISPLAY
    itab3-kunnr = itab2-kunnr." FINAL DISPLAY
    itab3-text = itAB2-text.
    itab3-matnr = itab2-matnR.
    itab3-arktx = itab2-arktx." FINAL DISPLAY
    itab3-lfimg = itab2-lfimg." FINAL DISPLAY
    itab3-vrkme = itab2-vrkme." FINAL DISPLAY
    itab3-charg = itab2-charg." FINAL DISPLAY
    itab3-ersda = itab2-ersda." FINAL DISPLAY
    itab3-text  = itab2-text.
READ TABLE IT_VTTK WITH KEY SIGNI = ITAB2-Text.
    IF SY-SUBRC = 0.
    ITAB3-TKNUM = IT_VTTK-TKNUM." FINAL DISPLAY
    ITAB3-S_erdat = IT_vttk-erdat." FINAL DISPLAY
    ITAB3-SIGNI = IT_VTTK-SIGNI." FINAL DISPLAY
*    ITAB3-TDLNR = IT_VTTK-TDLNR.
    ENDIF.
READ TABLE IT_LFA1 WITH KEY LIFNR = IT_VTTK-TDLNR BINARY SEARCH.
   IF SY-SUBRC = 0.
ITAB3-V_NAME1 = IT_LFA1-NAME1." FINAL DISPLAY
    ENDIF.
APPEND ITAB3.
CLEAR ITAB3.
ENDLOOP.
endform.                    " GET_ITAB3
*&      Form  BUILD_LAYOUT_ALV
*       text
*  -->  p1        text
*  <--  p2        text
FORM build_layout_alv .
  is_layout-colwidth_optimize = 'X'.
ENDFORM.                    " BUILD_LAYOUT_ALV
*&      Form  BUILD_EVENTS
*       text
*  -->  p1        text
*  <--  p2        text
FORM build_events .
* Populating all the supported events in the ALV
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      i_list_type     = 0
    IMPORTING
      et_events       = it_event
    EXCEPTIONS
      list_type_wrong = 1
      OTHERS          = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
  READ TABLE it_event INTO wa_event WITH KEY name =
  slis_ev_top_of_page.
  IF sy-subrc EQ 0.
    wa_event-form = 'TOP'.
    MODIFY it_event FROM wa_event INDEX sy-tabix TRANSPORTING form.
  ENDIF.
ENDFORM.                    " BUILD_EVENTS
*&      Form  TOP
*       text
FORM top.
*Alv list header decleration
  DATA: it_header TYPE STANDARD TABLE OF slis_listheader,
        wa_header TYPE slis_listheader.
*Title
  wa_header-typ = 'H'.
  wa_header-info = 'LOADING SLIP *** GATEPASS'.
  APPEND wa_header TO it_header.
*Date
  wa_header-typ = 'S'.
  wa_header-key = 'Date:'.
  CONCATENATE sy-datum+6(2) '.'
              sy-datum+4(2) '.'
              sy-datum(4)
        INTO  wa_header-info.
  APPEND wa_header TO it_header.
*Username
  wa_header-typ = 'S'.
  wa_header-key = 'User:'.
  wa_header-info = sy-uname.
  APPEND wa_header TO it_header.
*Time
  wa_header-typ = 'S'.
  wa_header-key = 'Time:'.
  CONCATENATE sy-uzeit(2)':'
              sy-uzeit+2(2)':'
              sy-uzeit+4(2)'.'
        INTO  wa_header-info.
*  LWA_HEADER-INFO = SY-UZEIT.
  APPEND wa_header TO it_header.
  wa_header-typ = 'A'.
  APPEND wa_header TO it_header.
   CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = it_header
      i_logo             = 'KAL_LOGO'.
*   I_END_OF_LIST_GRID       =
ENDFORM.
*&      Form  BUILD_FCAT
*       text
*      -->P_0425   text
*      -->P_0426   text
*      -->P_0427   text
*      -->P_0428   text
FORM build_fcat  USING    fp_col_pos
                          fp_fieldname
                          fp_tabname
                          fp_seltext_l.
  wa_fcat-col_pos =  fp_col_pos.
  wa_fcat-fieldname = fp_fieldname.
  wa_fcat-tabname = fp_tabname.
  wa_fcat-seltext_l = fp_seltext_l.
  APPEND wa_fcat TO it_fcat.
  CLEAR wa_fcat.
ENDFORM.                    " BUILD_FCAT
*&      Form  ALV_SORT_INFO
*       text
*  -->  p1        text
*  <--  p2        text
FORM alv_sort_info .
  wa_sort-spos = 1.
  wa_sort-fieldname = 'VBELN'.
  wa_sort-tabname = 'ITAB3'.
  wa_sort-up = 'X'.
  APPEND wa_sort TO it_sort.
  CLEAR wa_sort.
wa_sort-spos = 3.
  wa_sort-fieldname = 'ARKTX'.
  wa_sort-tabname = 'ITAB3'.
  wa_sort-up = 'X'.
  APPEND wa_sort TO it_sort.
  CLEAR wa_sort.
wa_sort-spos = 4.
  wa_sort-fieldname = 'CHARG'.
  wa_sort-tabname = 'ITAB3'.
  wa_sort-up = 'X'.
  APPEND wa_sort TO it_sort.
  CLEAR wa_sort.
wa_sort-spos = 5.
  wa_sort-fieldname = 'LFIMG'.
  wa_sort-tabname = 'ITAB3'.
  wa_sort-up = 'X'.
  APPEND wa_sort TO it_sort.
  CLEAR wa_sort.
wa_sort-spos = 4.
  wa_sort-fieldname = 'ERSDA'.
  wa_sort-tabname = 'ITAB3'.
  wa_sort-up = 'X'.
  APPEND wa_sort TO it_sort.
  CLEAR wa_sort.
*'08' 'TKNUM' 'ITAB3' 'SHIPMENT NO',
*     '09' 'S_ERDAT' 'ITAB3' 'DATED',
*     '10' 'SIGNI' 'ITAB3' 'TRUCK NO',
*     '11' 'V_NAME1' 'ITAB3' 'TRANSPORTER NAME'.
wa_sort-spos = 8.
  wa_sort-fieldname = 'TKNUM'.
  wa_sort-tabname = 'ITAB3'.
  wa_sort-up = 'X'.
  APPEND wa_sort TO it_sort.
  CLEAR wa_sort.
wa_sort-spos = 9.
  wa_sort-fieldname = 'S_ERDAT'.
  wa_sort-tabname = 'ITAB3'.
  wa_sort-up = 'X'.
  APPEND wa_sort TO it_sort.
  CLEAR wa_sort.
wa_sort-spos = 10.
  wa_sort-fieldname = 'SIGNI'.
  wa_sort-tabname = 'ITAB3'.
  wa_sort-up = 'X'.
  APPEND wa_sort TO it_sort.
  CLEAR wa_sort.
wa_sort-spos = 11.
  wa_sort-fieldname = 'V_NAME1'.
  wa_sort-tabname = 'ITAB3'.
  wa_sort-up = 'X'.
  APPEND wa_sort TO it_sort.
  CLEAR wa_sort.
ENDFORM.                    " ALV_SORT_INFO
*&      Form  ALV_GRID_DISPLAY
*       text
*  -->  p1        text
*  <--  p2        text
FORM alv_grid_display .
DATA:repid TYPE sy-repid.
  repid = sy-repid." PROGRAM  NAME
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*     I_INTERFACE_CHECK                 = ' '
*     I_BYPASSING_BUFFER                = ' '
*     I_BUFFER_ACTIVE                   = ' '
     I_CALLBACK_PROGRAM                = REPID
*     I_CALLBACK_PF_STATUS_SET          = ' '
*     I_CALLBACK_USER_COMMAND           = ' '
*     I_CALLBACK_TOP_OF_PAGE            = ' '
*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*     I_CALLBACK_HTML_END_OF_LIST       = ' '
*     I_STRUCTURE_NAME                  =
*     I_BACKGROUND_ID                   = ' '
*     I_GRID_TITLE                      =
*     I_GRID_SETTINGS                   =
     IS_LAYOUT                         = IS_LAYOUT
     IT_FIELDCAT                       = IT_FCAT
*     IT_EXCLUDING                      =
*     IT_SPECIAL_GROUPS                 =
     IT_SORT                           = IT_SORT
*     IT_FILTER                         =
*     IS_SEL_HIDE                       =
*     I_DEFAULT                         = 'X'
*     I_SAVE                            = ' '
*     IS_VARIANT                        =
     IT_EVENTS                         = IT_EVENT
*     IT_EVENT_EXIT                     =
*     IS_PRINT                          =
*     IS_REPREP_ID                      =
*     I_SCREEN_START_COLUMN             = 0
*     I_SCREEN_START_LINE               = 0
*     I_SCREEN_END_COLUMN               = 0
*     I_SCREEN_END_LINE                 = 0
*     I_HTML_HEIGHT_TOP                 = 0
*     I_HTML_HEIGHT_END                 = 0
*     IT_ALV_GRAPHICS                   =
*     IT_HYPERLINK                      =
*     IT_ADD_FIELDCAT                   =
*     IT_EXCEPT_QINFO                   =
*     IR_SALV_FULLSCREEN_ADAPTER        =
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER           =
*     ES_EXIT_CAUSED_BY_USER            =
    TABLES
      t_outtab                          = ITAB3
   EXCEPTIONS
     PROGRAM_ERROR                     = 1
     OTHERS                            = 2
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " ALV_GRID_DISPLAY

Similar Messages

  • Advice needed on possible virus related prob - please help!

    Evening everyone,
    I previously posted on here about an issue I was having with my external hard drive not mounting. I erased it and got it to mount but now I get an error message saying File could not be transferred as it could not be read or written.
    I have recently come to suspect I might be harbouring viruses on my macbook as one turned up on my pendrive and on some email attatchments I've sent and was wondering if you think this could be causing the problem with the hard drive? If not - what might be? I've read that some people think it's a prob with tiger. Also can anyone recommend some virus software? I know a lot of people use clam but does that work with intel macs? Also I don't know much about the technical side of things and it doesn't look too user friendly - do you think it would be worth buying a full package like Norton?
    Thanks in advance for all of your help!

    Hi Sherman,
    Thanks for your help! The ignore ownership box was already ticked. Tried to repair the disk and it did find errors but the repair did not work - it says that the underlying task report failure on exit. Any more suggestions? Is it not possible that I am harbouring a PC virus - it isn't affecting my mac but could it not be playing havoc with the hard drive? Or is that just broken and I should send it back?
    I am currently studying in spain for the year but am from the UK and will be back there this weekend so am hoping to sort the problem out before then, or go visit the genius bar in london while I am home.
    Thanks again!

  • ALV Report Prob with Sys Status & Totl Planned Costs

    Hi,
    Ive dev the report. now ive a few chages on report. I need to add this three frields in my report.
    For the getting the system status. For Each works Order find the recors in the table JEST.
    JEST-OBJNR = AUFK-OBJNR AND JEST-STAT <> 'X' AND CHARG = '01'.
    THEN we need to find each record  TJ024-txt04.
    And Getting the Tot Planned cost..First we use table PMCO and list all entries for the orders selected for the report where PMCO-objnr = aufk-objnr. and Sum of (PMCO-wrt00 To PMCO-wrt16) where pmco-wrttp = '1'.
    Sum of all records of the order.
      IF ip_out = 'X' AND ip_rel = 'X' AND ip_com = 'X'. "means  if its ourstanding or completed or progress are selected.
      PERFORM select_else.
    FORM select_else.
      SELECT   aufk~aufnr
               aufk~auart
               aufk~werks
               aufk~objnr  
               aufk~ktext
               aufk~idat1
               aufk~zzwref
               aufk~zzhmrg
               afih~kunum
               afih~serialnr
               afih~sermat
               afih~ilart
      INTO TABLE itab
      FROM aufk INNER JOIN afih ON aufk~aufnr = afih~aufnr
      WHERE aufk~aufnr IN so_order
      AND   aufk~auart IN so_ordrt
      AND   aufk~erdat IN so_per
      AND   afih~ilart IN so_mat
      AND   afih~sermat IN so_mat1
    *  AND   afih~gewrk IN so_mwc
      AND   aufk~vaplz IN so_mwc
      AND   aufk~werks IN so_plnt.
    ENDFORM.
    In the itab iam getting OBJNR for every order number. now i need to get the system status as well Totl Planned Costs .
    Ive a bit confussed.
    For getting System stastus.. but its not working.
    loop at itab into wa .
    select single stat from jest into lv_stat where OBJNR = wa-objnr AND
                                                    stat  NE 'X' AND
                                                    chgnr = '01'.
    clear:wa.
    select single txt04 from tj02t into lv_STTXT where ISTAT = lv_stat.
    wa-sttxt = lv_sttxt.
    append wa to itab.
    clear:lv_stat,
           lv_sttxt,
           wa.
    endloop.
    Plz let me know  while append to itab. its not append the status to final itab. as well. how to calc  the Total planned costs.
    Bcoz in the PMCO, ive WRT00,WRt01,WRT02 Up to WRT16. I need to sum every column as well as every row then last final figure , i need to add to itab-dgeskoplan[total planned cost field]. how to do this.
    Plz give me solution.
    Regards

    hi,
    thank you for repy.Ive cleared but its not working.
    can u plz tell me the to create the status color in other way
    FORM monitor_create .
      ls_layout-excp_fname = 'TRAFFIC1'.
      IF sy-datum BETWEEN orange2 AND orange .
         wa-traffic1 = '2'.
        clear:orange2,
              orange.
      ELSEIF sy-datum > green.
        wa-traffic1 = '1'.
         clear:green.
      ELSEIF sy-datum < red.
        wa-traffic1 = '3'.
        clear:red.
      ENDIF.
      If gray is not initial.
    *    if sy-datum > gray.
        wa-traffic1 = '0'.
        clear:gray.
    *  endif.
      endif.
    ENDFORM.
    Regards

  • Looping and append related prob

    hi experts,
    i need to populate a final internal table from 4 diffrent internal tables,
    namely it_vbrk,
    it_vbrp,
    it_lips, it_mch1
    logic here
    **loop at it_vbrk into wa_vbrk.
    wa_final -   = wa_vbrk----
    loop at it_vbrp from idx.   then i use parallel cursor, as i needed multiple items based on single vbrk-vbeln
    wa_final---- = wa_vbrk ---
    loop at it_lips into wa_lips." based on some cond on where clause
        here also i ve to used loop , as there r multiple batch no .
    wa_final - = wa_lips-
    loop at it_mch1 into wa_mch1 where charg = wa_lips-charg
    wa_final --- = wa_mch1 .
    APPEND wa_final TO it_final.
        CLEAR wa_final.
        endloop.
    endloop.
        endloop  
      ENDLOOP."
    but in this code data getting populated are wrong ones,
    can u plz tell me  the exact sequence how to used endloops and append work area values and clear that.
    i getting confused ,plz help

    Hi,
    Reading data from 4 database table into different internal table and then read these table into a final internal table using 'FOR ALL ENTRIES'.
    Use this code, its working:-
    *          RANGES DECLARATION
    *          RANGE VALUE TO BE USED FOR THE ORDER TYPE
    RANGES : r_auart FOR aufk-auart. "for order type
    *          TYPE DECLARATION
    TYPES :
    * for table aufk (work order details)
            BEGIN OF t_aufk,
              aufnr TYPE aufk-aufnr, " order number
              ktext TYPE aufk-ktext, " description
              objnr TYPE aufk-objnr, " object number
            END OF t_aufk,
    * for table jest (object status details)
            BEGIN OF t_jest,
              objnr TYPE jest-objnr, " object number
            END OF t_jest,
    * for table afko (basic finish date details)
            BEGIN OF t_afko,
              aufnr TYPE afko-aufnr, " order number
              gltrp TYPE afko-gltrp, "basic finish date
            END OF t_afko,
    * for table qmel (notification number details)
            BEGIN OF t_qmel,
              aufnr TYPE qmel-aufnr, " order number
              qmnum TYPE qmel-qmnum, " notification number
            END OF t_qmel,
    * final table from which the records need to be displayed
            BEGIN OF t_final,
              aufnr TYPE aufk-aufnr, " order number
              ktext TYPE aufk-ktext, " description
              qmnum TYPE qmel-qmnum, " notification number
              flag(1), " for selection of records
            END OF t_final.
    *          INTERNAL TABLE & WORK AREA DECLARATIONS
    * TYPE OF T_AUFK
    * internal table to select records for damaged order types
    DATA : it_aufk TYPE STANDARD TABLE OF t_aufk,
    * work area for damaged order types
           wa_aufk TYPE t_aufk.
    * TYPE OF T_JEST
    * internal table to select object number based upon user status
    DATA : it_jest TYPE STANDARD TABLE OF t_jest,
    * work area to select object number based upon user status
           wa_jest TYPE t_jest.
    * TYPE OF T_AFKO
    * internal table to select the basic finish date corresopnding to work order
    DATA : it_afko TYPE STANDARD TABLE OF t_afko,
    * work area to select the basic finish date corresopnding to work order
           wa_afko TYPE t_afko.
    * TYPE OF T_QMEL
    * internal table to select the notification number corresopnding to object number
    DATA : it_qmel TYPE STANDARD TABLE OF t_qmel,
    * work area to select the notification number corresopnding to object number
           wa_qmel TYPE t_qmel.
    * TYPE OF T_FINAL
    * final internal table to select final records to be displayed
    DATA : it_final TYPE STANDARD TABLE OF t_final,
    * final work area to select final records to be displayed
           wa_final TYPE t_final.
    *          INITIALIZATION
    *          TO INITIALIZE ALL THE VARIABLES TO BE USED
    *          IN THE PROGRAM
    INITIALIZATION.
      r_auart-sign = 'I'.             " for inclusive
      r_auart-option = 'BT'.          " for between operator
      r_auart-low = 'PM01'.           " order type(low value)
      r_auart-high = 'PM02'.          " order type(high value)
      APPEND r_auart.                 " append values for range
    *          START-OF-SELECTION
    START-OF-SELECTION.
    *          CLEAR ALL THE CONTENTS OF ALL INTERBAL TABLES
      REFRESH it_jest.
      REFRESH it_aufk.
      REFRESH it_afko.
      REFRESH it_qmel.
      REFRESH it_final.
    *          select user status from TJ02T for TXT04(status of an object)
    *          into variable V_ISTAT
      SELECT SINGLE
        istat
      FROM tj02t
      INTO (v_istat)
      WHERE
        txt04 EQ 'TECO' AND
        spras EQ 'E'.
    *          select object number based upon the user status selected
      SELECT
        objnr
      FROM jest
      INTO TABLE it_jest
      WHERE
        stat EQ v_istat.
      IF sy-subrc  0.
        MESSAGE e003.
      ELSE.
    *         select into it_aufk table: object number, description and
    *         object number based on object number selected and order type
    *         in PM01 and PM02
        SELECT
          aufnr
          ktext
          objnr
        FROM aufk
        INTO TABLE it_aufk
        FOR ALL ENTRIES IN it_jest
        WHERE
          objnr EQ it_jest-objnr AND
          auart IN r_auart.
        IF sy-subrc  0.
          MESSAGE e002.
        ELSE.
    *         select into it_afko table: order number and basic finish date
    *         based upon order number selected and basic finish date as
    *         v_cdate variable
          SELECT
            aufnr
            gltrp
          FROM afko
          INTO TABLE it_afko
          FOR ALL ENTRIES IN it_aufk
          WHERE
            aufnr EQ it_aufk-aufnr AND
            gltrp LE sy-datum.
    *         select into it_qmel table: order number and notification
    *         number based on the order number selected
          SELECT
            aufnr
            qmnum
          FROM qmel
          INTO TABLE it_qmel
          FOR ALL ENTRIES IN it_aufk
          WHERE
            aufnr EQ it_aufk-aufnr.
        ENDIF.
      ENDIF.
    *          READ THE RECORDS FOMR THE ABOVE POPULATED INTERNAL TABLE
    *          INTO WORK AREA AND THEN POPULATE THE FINAL INTERNAL
    *          TABLE
    * read internal table it_jest into work area wa_jest
      LOOP AT it_jest INTO wa_jest.
    * read it_aufk based on object number from wa_jest
        READ TABLE it_aufk INTO wa_aufk WITH KEY objnr = wa_jest-objnr.
    * if records found
        IF sy-subrc EQ 0.
    * read it_afko for order number and description based on order number
          READ TABLE it_afko INTO wa_afko WITH KEY aufnr = wa_aufk-aufnr.
    * if records found
          IF sy-subrc EQ 0.
            wa_final-aufnr = wa_afko-aufnr. "move order number to it_final
            wa_final-ktext = wa_aufk-ktext. "move description to it_final
          ELSE.
    * if no record found then move to next loop pass
            CONTINUE.
          ENDIF.
        ELSE.
    * if no record found then move to next loop pass
          CONTINUE.
        ENDIF.
    * read it_qmel for description based on the order number selected above
        READ TABLE it_qmel INTO wa_qmel WITH KEY aufnr = wa_final-aufnr.
    * if records found
        IF sy-subrc EQ 0.
          wa_final-qmnum = wa_qmel-qmnum. "move notification number to it_final
        ENDIF.
    * finally append the records into the final internal table
        APPEND wa_final TO it_final. "append wa_final into it_final
        CLEAR wa_final. "clear work area
        CLEAR wa_aufk.  "clear work area
        CLEAR wa_qmel.  "clear work area
      ENDLOOP.
    Hope this helps you.
    Thanks & Regards,
    Tarun Gambhir

  • Refcursor related prob

    i have a simple query it is working from sqlplus bt it is not working from refcursor.
    what should be the issue.
    (using refcursor) it does not return any row,

    v_cur_sql :=
    'select UNIV_FILE_NAME,NE_ID_KEY,SERVED_MSRN,OTHER_MSISDN,
                        CALL_START_TIME_SLOT_KEY,
                        CAUSE_OF_TERMINATION,
                        CHARGE,CDR_SEQ_NUM,SERVED_MSISDN,REC_TYPE_KEY,
                        EVENT_TYPE_KEY,CALL_DIRECTION_KEY,CHRG_UNIT_ID_KEY,
                        DIAL_DIGIT_KEY,CALL_START_TIME,OUT_TG_ID_KEY,IN_TG_ID_KEY,
                        NULL,NULL,NULL,NULL,CALL_END_TIME FROM '
                        || p_cn_tab || ' WHERE ' || v_filter ||
         ' AND CALL_START_TIME between TO_DATE(''' || p_startDate ||''',''mm/dd/yyyy hh24:mi:ss'') AND TO_DATE('''|| p_endDate || ''',''mm/dd/yyyy hh24:mi:ss'') '
              ||' AND IS_RATED IS NULL';
    FETCH C_REF_CUR
    INTO
              <------>
    it return 0 rows.

  • Subtotal calculation display in ALV report

    hi,
    i had made a report n alv which is almost complete but i want to add the feature that when i click on a field when output is displayed den the subtotal of all qty fields should be shown also.
    plz provide me with useful example as i am using the concept of INTERNAL TABLES.
    plzz reply fast as it is important to me and definately rewarded.

    Hi ric,
    check out this code.
    *& Report  ZST_ALV
    REPORT  ZST_ALV.
    type-POOLs: slis.
    --ALV Related Variables--
    DATA: lt_fcat          TYPE slis_t_fieldcat_alv,
          lw_fcat          TYPE slis_fieldcat_alv,
          lv_variant       TYPE disvariant,
          lv_layout        TYPE slis_layout_alv,
          lt_sort          type slis_t_sortinfo_alv,
          lw_sort          type slis_sortinfo_alv.
    types: begin of ty_vbap,
           vbeln type vbap-vbeln,
           posnr type vbap-posnr,
           zmeng type vbap-zmeng,
           end  of ty_vbap.
    data: lt_vbap type table of ty_vbap.
    start-of-selection.
    select vbeln posnr zmeng
           from  vbap
           into  table lt_vbap.
    sort lt_vbap descending.
    clear lw_fcat.
    lw_fcat-fieldname = 'VBELN'.
    lw_fcat-seltext_l = 'Sales document'.
    append lw_fcat to lt_fcat.
    clear lw_fcat.
    lw_fcat-fieldname = 'POSNR'.
    lw_fcat-seltext_l = 'Sales document'.
    append lw_fcat to lt_fcat.
    clear lw_fcat.
    lw_fcat-fieldname = 'ZMENG'.
    lw_fcat-seltext_l = 'Sales document'.
    lw_fcat-do_sum = 'X'.
    append lw_fcat to lt_fcat.
    lw_sort-spos = 1.
    lw_sort-fieldname = 'VBELN'.
    LW_SORT-Up = 'X'.
    append lw_sort to lt_sort.
    clear lw_sort.
    lw_sort-spos = 3.
    lw_sort-fieldname = 'ZMENG'.
    LW_SORT-Up = 'X'.
    lw_sort-subtot = 'X'.
    append lw_sort to lt_sort.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
      I_CALLBACK_PROGRAM                = ' '
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = lt_fcat[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
       IT_SORT                           = lt_sort[]
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = lt_vbap
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    regards,
    Santosh Thorat

  • Display line of total SUM at end of ALV.

    How i can display it? In some ALV i've seen this line yellow colored.
    Thanks for aswers.

    hi,
    in the fieldcat.
    give <b>wa_fieldcat-do_sum = 'X'.</b>
    **TABLES DECLN
    TABLES: VBRK,VBRP,T001.
    TYPE-POOLS: SLIS.
    TYPE-POOLS: ICON.
    ***DATA DECLN.
    DATA: V_VBELN LIKE VBRK-VBELN,
          V_MATNR LIKE VBRP-MATNR.
    CONSTANTS: C_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'F_USER_COMMAND',
               C_PF_STATUS TYPE SLIS_FORMNAME VALUE 'F_SET_PF_STATUS'.
    **ALV RELATED TABLES.
    *--Field Catalog
    DATA:   IT_FIELDCAT TYPE STANDARD TABLE OF
                            SLIS_FIELDCAT_ALV  WITH HEADER LINE,
            IT_FIELDCAT1 TYPE STANDARD TABLE OF
                            SLIS_FIELDCAT_ALV WITH HEADER LINE ,
            WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
    *--Layout
           WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
    *--Sort
           IT_SORT TYPE SLIS_T_SORTINFO_ALV,
           WA_SORT TYPE SLIS_SORTINFO_ALV  ,
    **-Structure for excluding function codes
           WA_EXTAB TYPE SLIS_EXTAB,
    **-To hold function codes to be excluded in ALV toolbar
           IT_EXTAB TYPE SLIS_T_EXTAB.
    ***INTERNAL TABLE DECLN.
    DATA: BEGIN OF IT_VBRK OCCURS 0,
          VBELN LIKE VBRK-VBELN,
          WAERK LIKE VBRK-WAERK,
          VKORG LIKE VBRK-VKORG,
          FKDAT LIKE VBRK-FKDAT,
          BUKRS LIKE VBRK-BUKRS,
          NETWR LIKE VBRK-NETWR,
          END OF IT_VBRK.
    DATA: BEGIN OF ITAB OCCURS 0,
          VBELN LIKE VBRP-VBELN,
          POSNR LIKE VBRP-POSNR,
          FKIMG LIKE VBRP-FKIMG,
          VRKME LIKE VBRP-VRKME,
          NETWR LIKE VBRP-NETWR,
          MATNR LIKE VBRP-MATNR,
          ARKTX LIKE VBRP-ARKTX,
          END OF ITAB.
    DATA: IT_VBRP LIKE ITAB OCCURS 0 WITH HEADER LINE.
    ***selection screen.
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: S_VBELN FOR VBRK-VBELN,
                    S_FKDAT FOR VBRK-FKDAT OBLIGATORY,
                    S_MATNR FOR VBRP-MATNR.
    SELECTION-SCREEN: END OF BLOCK B1.
    **INITIALIZATION.
    INITIALIZATION.
      S_FKDAT-LOW = SY-DATUM - 200.
      S_FKDAT-HIGH = SY-DATUM.
      APPEND S_FKDAT.
    ***AT SELECTION-SCREEN.
    AT SELECTION-SCREEN.
      IF NOT S_VBELN IS INITIAL.
        SELECT SINGLE VBELN FROM VBRK
               INTO V_VBELN
               WHERE VBELN IN S_VBELN.
        IF SY-SUBRC <> 0.
          MESSAGE E001(ZZ2).
        ENDIF.
      ENDIF.
      IF NOT S_MATNR IS INITIAL.
        SELECT SINGLE MATNR FROM MARA
               INTO V_MATNR
               WHERE MATNR IN S_MATNR.
        IF SY-SUBRC <> 0.
          MESSAGE E001(ZZ2).
        ENDIF.
      ENDIF.
    ***START-OF-SELECTION.
    START-OF-SELECTION.
      PERFORM GET_DATA_VBRK.
      PERFORM GET_DATA_VBRP.
    ***END-OF-SELECTION.
    END-OF-SELECTION.
    *--Sort the Output Fields
    PERFORM SORT_FIELDS.
    *--Build Field catalog for the Output fields
      PERFORM GET_FIELD_CATALOG.
    ***MODIFY LAYOUT.
    PERFORM MODIFY_LAYOUT.
    *--Display ALV output
      PERFORM LIST_DISP  TABLES IT_VBRK
                               USING  C_USER_COMMAND.
    *&      Form  GET_DATA_VBRK
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DATA_VBRK.
      SELECT VBELN
             WAERK
             VKORG
             FKDAT
             BUKRS
             NETWR
             INTO TABLE IT_VBRK
             FROM VBRK
             WHERE VBELN IN S_VBELN
             AND FKDAT IN S_FKDAT.
    ENDFORM.                    " GET_DATA
    *&      Form  GET_DATA_VBRP
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DATA_VBRP .
    SELECT VBELN
            POSNR
            FKIMG
            VRKME
            NETWR
            MATNR
            ARKTX
            FROM VBRP
            INTO TABLE IT_VBRP
            FOR ALL ENTRIES IN IT_VBRK
            WHERE VBELN = IT_VBRK-VBELN.
      SELECT VBELN
             POSNR
             FKIMG
             VRKME
             NETWR
             MATNR
             ARKTX
             FROM VBRP
             INTO TABLE ITAB
             FOR ALL ENTRIES IN IT_VBRK
             WHERE VBELN = IT_VBRK-VBELN.
    ENDFORM.                    " GET_DATA_VBRP
    *&      Form  GET_FIELD_CATALOG
          text
    -->  p1        text
    <--  p2        text
    FORM GET_FIELD_CATALOG .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          I_PROGRAM_NAME         = SY-REPID
          I_INTERNAL_TABNAME     = 'IT_VBRK'
          I_INCLNAME             = SY-REPID
        CHANGING
          CT_FIELDCAT            = IT_FIELDCAT[]
        EXCEPTIONS
          INCONSISTENT_INTERFACE = 1
          PROGRAM_ERROR          = 2
          OTHERS                 = 3.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " GET_FIELD_CATALOG
    *&      Form  SORT_FIELDS
          text
    -->  p1        text
    <--  p2        text
    FORM SORT_FIELDS .
      CLEAR WA_SORT.
      WA_SORT-SPOS = '01'.
      WA_SORT-FIELDNAME = 'VBELN' .
      WA_SORT-TABNAME   = 'IT_VBRK'.
      WA_SORT-UP        = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR  WA_SORT.
      WA_SORT-SPOS = '02'.
      WA_SORT-FIELDNAME = 'POSNR' .
      WA_SORT-TABNAME   = 'IT_VBRP'.
      WA_SORT-UP        = 'X'.
      APPEND WA_SORT TO IT_SORT.
    ENDFORM.                    " SORT_FIELDS
    *&      Form  MODIFY_LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM MODIFY_LAYOUT .
      WA_LAYOUT-DEFAULT_ITEM = 'X'.
      WA_LAYOUT-ZEBRA = 'X'.
      WA_LAYOUT-EXPAND_FIELDNAME = 'EXPAND'.
      WA_layout-colwidth_optimize = 'X'.
    ENDFORM.                    " MODIFY_LAYOUT
    *&      Form  LIST_DISP
          text
    -->  p1        text
    <--  p2        text
    FORM LIST_DISP  TABLES   P_IT_VBRK
                       USING    P_USER_COMMAND TYPE SLIS_FORMNAME.
    *CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM       = SY-REPID
         I_CALLBACK_PF_STATUS_SET = 'POPUP'
         I_CALLBACK_USER_COMMAND  = 'HANDLE_USER_COMMAND'
         IS_LAYOUT                = WA_LAYOUT
         IT_FIELDCAT              = IT_FIELDCAT[]
         IT_EXCLUDING             = IT_EXTAB[]
       TABLES
         T_OUTTAB                 = IT_VBRK
       EXCEPTIONS
         PROGRAM_ERROR            = 1
         OTHERS                   = 2.
    IF SY-SUBRC <> 0.
       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = SY-REPID
          I_CALLBACK_PF_STATUS_SET = 'POPUP'
          I_CALLBACK_USER_COMMAND  = 'HANDLE_USER_COMMAND'
          IS_LAYOUT                = WA_LAYOUT
          IT_FIELDCAT              = IT_FIELDCAT[]
        TABLES
          T_OUTTAB                 = P_IT_VBRK
        EXCEPTIONS
          PROGRAM_ERROR            = 1
          OTHERS                   = 2.
    ENDFORM.                    " LIST_DISP
    *&      Form  POPUP
          text
         -->P_EXTAB    text
    FORM POPUP USING IT_EXTAB TYPE SLIS_T_EXTAB.
    *- Pf status
      SET PF-STATUS 'POPUP'.
    ENDFORM.                 " POPUP
    *&      Form F_USER_COMMAND
    FORM HANDLE_USER_COMMAND USING R_UCOMM     LIKE SY-UCOMM
                                   RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
            clear it_fieldcat1[].
            CLEAR IT_VBRP[].
            IF RS_SELFIELD-FIELDNAME = 'VBELN'.
            READ TABLE IT_VBRK INDEX RS_SELFIELD-TABINDEX.
            LOOP AT ITAB WHERE VBELN = IT_VBRK-VBELN.
            MOVE-CORRESPONDING ITAB TO IT_VBRP.
            APPEND IT_VBRP.
            ENDLOOP.
            PERFORM INTERACTIVE_REPORT.
            ENDIF.
      ENDCASE.
    ENDFORM.                    "HANDLE_USER_COMMAND
    *&      Form  INTERACTIVE_REPORT
          text
    -->  p1        text
    <--  p2        text
    FORM INTERACTIVE_REPORT .
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
         I_PROGRAM_NAME         = SY-REPID
         I_INTERNAL_TABNAME     = 'ITAB'
         I_INCLNAME             = SY-REPID
       CHANGING
         CT_FIELDCAT            = IT_FIELDCAT1[]
       EXCEPTIONS
         INCONSISTENT_INTERFACE = 1
         PROGRAM_ERROR          = 2
         OTHERS                 = 3.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      WA_FIELDCAT-FIELDNAME = 'VBELN'.
      WA_FIELDCAT-SELTEXT_L = 'BILLING DOC'.
      WA_FIELDCAT-TABNAME = 'IT_VBRP'.
      WA_FIELDCAT-COL_POS  = 1.
      APPEND WA_FIELDCAT TO IT_FIELDCAT1.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'POSNR'.
      WA_FIELDCAT-SELTEXT_L = 'ITEM'.
      WA_FIELDCAT-TABNAME = 'IT_VBRP'.
      WA_FIELDCAT-COL_POS  = 2.
      APPEND WA_FIELDCAT TO IT_FIELDCAT1.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'FKIMG'.
      WA_FIELDCAT-SELTEXT_M = 'INV QTY'.
      WA_FIELDCAT-TABNAME = 'IT_VBRP'.
      WA_FIELDCAT-COL_POS  = 3.
      APPEND WA_FIELDCAT TO IT_FIELDCAT1.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'VRKME'.
      WA_FIELDCAT-SELTEXT_M = 'SALES UNIT'.
      WA_FIELDCAT-TABNAME = 'IT_VBRP'.
      WA_FIELDCAT-COL_POS  = 4.
      APPEND WA_FIELDCAT TO IT_FIELDCAT1.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'NETWR'.
      WA_FIELDCAT-SELTEXT_M = 'NET PRICE'.
      WA_FIELDCAT-TABNAME = 'IT_VBRP'.
      WA_FIELDCAT-DO_SUM = 'X'.
      WA_FIELDCAT-COL_POS  = 5.
      APPEND WA_FIELDCAT TO IT_FIELDCAT1.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-SELTEXT_M = 'MATERIAL'.
      WA_FIELDCAT-TABNAME = 'IT_VBRP'.
      WA_FIELDCAT-COL_POS  = 6.
      APPEND WA_FIELDCAT TO IT_FIELDCAT1.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'ARKTX'.
      WA_FIELDCAT-SELTEXT_M = 'SALES ORDER'.
      WA_FIELDCAT-TABNAME = 'IT_VBRP'.
      WA_FIELDCAT-COL_POS  = 7.
      APPEND WA_FIELDCAT TO IT_FIELDCAT1.
      CLEAR WA_FIELDCAT.
    *CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM       = SY-REPID
         IS_LAYOUT                = WA_LAYOUT
         IT_FIELDCAT              = IT_FIELDCAT1[]
         IT_SORT                  = IT_SORT
       TABLES
         T_OUTTAB                 = IT_VBRP
       EXCEPTIONS
         PROGRAM_ERROR            = 1
         OTHERS                   = 2.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = SY-REPID
          IS_LAYOUT          = WA_LAYOUT
          IT_FIELDCAT        = IT_FIELDCAT1[]
        TABLES
          T_OUTTAB           = IT_VBRP
        EXCEPTIONS
          PROGRAM_ERROR      = 1
          OTHERS             = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " INTERACTIVE_REPORT
    hope this helps,
    priya.

  • AT SELECTION-SCREEN-ON FIELD  event IN ALV

    Hai all,
               Is there any event in ALV similar to AT SELECTION-SCREEN-ON FIELD  .
    if so how can this be achieved ,pls give me an example .
    Regards,
    Dev

    Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length. In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output. The report output can contain upto 90 columns in the display with the wide array of display options.
    The commonly used ALV functions used for this purpose are;
    1. REUSE_ALV_VARIANT_DEFAULT_GET
    2. REUSE_ALV_VARIANT_F4
    3. REUSE_ALV_VARIANT_EXISTENCE
    4. REUSE_ALV_EVENTS_GET
    5. REUSE_ALV_COMMENTARY_WRITE
    6. REUSE_ALV_FIELDCATALOG_MERGE
    7. REUSE_ALV_LIST_DISPLAY
    8. REUSE_ALV_GRID_DISPLAY
    9. REUSE_ALV_POPUP_TO_SELECT
    The different steps used for getting the above function modules into use are:
    Step 1
    DATA DECLARATION
    Sap standard type pools: SLIS , KKBLO .
    Sap standard tables types taken from the type pools are: SLIS_LAYOUT_ALV ,
    SLIS_T_FIELDCAT_ALV,
    SLIS_T_LISTHEADER,
    SLIS_T_EVENT,
    SLIS_SELFIELD.
    Internal tables to used in the program declared based on the above table types
    DATA: I_LAYOUT TYPE SLIS_LAYOUT_ALV,
    I_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,
    I_HEADING TYPE SLIS_T_LISTHEADER,
    I_EVENTS TYPE SLIS_T_EVENT.
    TYPES: KKBLO_SELFIELD TYPE SLIS_SELFIELD.
    Step 2 (Optional)
    SELECTING THE VARIANTS FOR INITIAL LIST DISPLAY (DEFAULT VARIANT)
    The variants in the list display can be both user-specific and general. The user can programmatically set the initial (default) variant for list display.
    The default variant can be found using the function module 'REUSE_ALV_VARIANT_DEFAULT_GET'.
    Sample code:
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
    i_save = variant save condition ( A=all, U = user-specific )
    CHANGING
    cs_variant = internal table containing the program name (and the default variant---optional )
    EXCEPTIONS
    not_found = 2.
    The user can also choose from the list of existing variants using the function module ‘REUSE_ALV_VARIANT_F4’.
    Step 3
    DEFININING OUTPUT CHARACTERISTICS: PREPARING DISPLAY FIELDS CATALOG
    A field catalog is prepared using the internal table (I_FIELDCAT) of type SLIS_T_FIELDCAT_ALV. Field catalog containing descriptions of the list output fields (usually a subset of the internal output table fields).
    A field catalog is required for every ALV list output to add desired functionality (i.e. Key, Hotspot, Specific headings, Justify, Col. position etc) to certain fields of the output. If not mentioned specifically, then the defaults are taken. The possible values and defaults are listed below.
    The field catalog for the output table is built-up in the caller's coding. The build-up can be completely or partially automated by calling the REUSE_ALV_FIELDCATALOG_MERGE module.
    The minimal field catalog is documented below. This can be done in a routine using a local variable. The user can use the other optional parameters to assign output attributes to different fields in the output, which differ from the default.
    A field catalog need not be built-up and passed explicitly only under the following conditions:
    1. The internal table to be output has the same structure as a Data Dictionary structure which is referred to in the internal table declaration using LIKE or INCLUDE STRUCTURE. In this case the attributes of the different fields is taken directly from the table and the attributes (key fields, length, texts etc) need to state explicitly.
    2. all fields in this structure are to be output
    3. The structure name is passed to ALV in the parameter I_STRUCTURE_NAME of the function module REUSE_ALV_LIST_DISPLAY.
    All the values entered in the catalog is specific to the particular field whose name is entered in the fieldname FIELDNAME of the fieldcat structure. The name of the table is also entered in the corr. Fieldname TABNAME of the structure.
    The different possible attributes are:
    • Row_pos (row position): Only relevant if the list output is to be multi-line (two or three lines) by default. So, this attribute can be used maintain certain level of alignment in the output.
    Value set: 0, 1 – 3
    • Col_pos (column position): This parameter is relevant when the fields in the output are to be different from the sequence of the fields in the internal table used for display. The parameter specifies the relative column position of the field in the list output. The column order can be changed interactively by the user. If this parameter is initial for all field catalog entries, columns appear in the internal table field sequence.
    Value set: 0, 1 – 60
    • Fieldname (field name): This is the name of the internal table field for which the parameters are passed in the catalog.
    Value set: internal output table field name (required parameter)
    • Tabname (internal output table): Name of the internal output table that contains the field FIELDCAT-FIELDNAME above.
    Value set: SPACE, internal output table name.
    • Ref_fieldname (reference field name): Name of the Data Dictionary field referred to. This parameter is only used when the internal output table field described by the current field catalog entry has a reference to the Data Dictionary (not a program field), and the field name in the internal output table is different from the name of the field in the Data Dictionary. If the field names are identical, naming the Data Dictionary structure or table in the FIELDCAT-REF_TABNAME parameter is sufficient.
    Value set: SPACE, Data Dictionary field name.
    • Ref_tabname (reference table/structure field name): Structure or table name of the referred Data Dictionary field. This parameter is only used when the internal output table field described by the current field catalog entry has a Data Dictionary reference (not a program field).
    Value set: SPACE, name of a Data Dictionary structure or table
    Link to currency unit
    • Cfieldname (currency unit field name): This is used for currency fields that have a reference to any unit field. This is only relevant for amount columns with associated unit. This parameter contains the Name of the internal output table field containing the currency unit associated with the amount field FIELDCAT-FIELDNAME. The field in FIELDCAT-CFIELDNAME must have its own field catalog entry.
    Value set: SPACE, output table field name
    • Ctabname (internal currency unit field output table): Name of the internal output table containing the FIELDCAT-CFIELDNAME field.
    Value set: SPACE, output table field name.
    Link to measurement unit
    • Qfieldname (measurement unit field name): Only relevant for quantity columns with unit link. Name of the internal output table field containing the measurement unit associated with the quantity field FIELDCAT-FIELDNAME. The field in FIELDCAT-QFIELDNAME must have its own field catalog entry.
    Value set: SPACE, output table field name.
    • Qtabname (internal measurement unit field output table): Name of the internal output table containing the FIELDCAT-QFIELDNAME field.
    Value set: SPACE, output table field name.
    • Outputlen (column width): This parameter is used if the desired output length for a field is desired to be different from the internal output table field. For fields with a Data Dictionary link this parameter can be left initial. For fields without a Data Dictionary link (program field) the parameter must be given the value of the desired field list output length (column width).
    Initial = column width is the output length of the referred Data Dictionary field (domain).
    N = column width is n characters.
    Value set: 0 (initial), n.
    • Key (key column): By default, the system makes some fields in the output as key fields, provided the fields are key fields in their referencing table. Using this parameter, fields other than key fields of the referencing table can be made key field. This parameter is most important if the output needs to contain some field which are not scrollable or cannot be hidden.
    If the internal output table contains fields that are key fields from different tables, then all those fields in the report output becomes unscrollable and cannot be hidden. So, the fields in the output internal table should not be referenced from tables in which they are key fields. Instead, they should be referenced to the tables in which they are not key fields, incase they are not desired as key field in the output.
    'X' = key field (key field output in color) and Key fields can not be interactively hidden. Parameter FIELDCAT-NO_OUT must be left initial.
    Value set: SPACE, 'X'.
    • Key_sel (hideable key column): This parameter is only relevant for the fields which are made key fields using FIELDCAT-KEY = 'X'. Using this parameter the Key field can be hidden interactively.
    The key column sequence cannot be changed interactively by the user. The output is controlled by the FIELDCAT-NO_OUT parameter analogously to non-key fields.
    Value set: SPACE, 'X'.
    • No_out (field in field list): This parameter is used to remove certain fields from the output during initial display. The user can however interactively choose the field for output from the field list in the display variant.
    'X' = field is not displayed in the current list.
    Value set: SPACE, 'X'.
    • Tech (technical field): This parameter is used to make certain field display only in the field catalog. The fields with this parameter set cannot be output in the list nor can they be displayed interactively from the catalog.
    'X' = technical field.
    Value set: SPACE, 'X'.
    • Emphasize (highlight columns in color): As name suggests, this field parameter is used to highlight certain field with chosen colors.
    Value set: SPACE, 'X' or 'Cxyz' (x:'1'-'9'; y,z: '0'=off ,'1'=on).
    'X' = column is colored with the default column highlight color.
    'Cxyz' = column is colored with a coded color:
    - C: Color (coding must begin with C)
    - X: color number
    - Y: bold
    - Z: inverse
    • Hotspot (column as hotspot): This parameter is used to make certain field appear as hotspot i.e. a hand is displayed if the cursor is positioned on the field value. Single click on such fields cause the PICK OR F2 events to happen.
    Value set: SPACE, 'X'.
    'X' = column cells are output as hotspots.
    • Fix_column (fix column): This parameter is used to fix certain columns in the output. All columns to be fixed must have this flag, starting from the left. If a column without this flag is output, only the columns to the left of this column are fixed. The user can change the column fixing interactively.
    Value set: SPACE, 'X'.
    'X' = column fixed (does not scroll horizontally).
    • Do_sum (sum over column): the user can also call this function interactively.
    Value set: SPACE, 'X'.
    'X' = a sum is calculated over this internal output table field.
    • No_sum (sums forbidden): No sum can be calculated over this field, although the data type of the field would allow summing.
    Value set: SPACE, 'X'.
    • Icon: The parameter displays certain column contents as icons. The internal output table column contents must be valid icon strings.
    Value set: SPACE, 'X'.
    'X' = column contents to be output as an icon.
    • Symbol: The internal output table column must be a valid symbol character.
    Value set: SPACE, 'X'
    'X' = column contents are to be output as a symbol.
    • Just (justification): This parameter is used for alignment of the contents of the output table. This is only relevant for CHAR or NUMC fields in the output internal table. The justification of the column header always follows the justification of the columns. Independent justification of the column header is not possible.
    Value set: SPACE, 'R', 'L', and ‘C’.
    ' ' = Default justification for this data type
    'R' = right-justified output
    'L' = left-justified output
    'C' = centered output.
    • Lzero (leading zeros): By default ALV outputs NUMC fields right-justified without leading zeros. Using this parameter only the NUMC fields can be displayed with leading zeroes.
    Value set: SPACE, 'X'.
    'X' = output with leading zeros.
    • No_sign (no +/- sign): This parameter is used to suppress the signs of the output fields. It is only relevant for the value fields.
    Value set: SPACE, 'X'.
    'X' = value output without +/ sign.
    • No_zero (suppress zeros): Only relevant for value fields.
    Value set: SPACE, 'X'.
    'X' = suppress zeros.
    • Edit_mask (field formatting): To apply the report output formatting options same as in the WRITE statement in report writing.
    Value set: SPACE, template.
    The following parameters are used for customizing the texts in the heading of the output of the columns. The texts are taken from the Data Dictionary for fields with a Data Dictionary reference. If this is not desired, the text parameters can also be specified. The Data Dictionary texts are then ignored.
    If the user changes the column width interactively, the column header text with the appropriate length is always used.
    The interactive function 'Optimize column width' takes account of both the field contents and the column headers: if all field contents are shorter than the shortest column header, the column width depends on the column header.
    The 'long field label' is also used in display variant definition,
    Sort, etc. Popup.
    • seltext_l (long field label)
    • seltext_m (medium field label)
    • seltext_s (short field label)
    • reptext_ddic(header) Analogous to the Data element main header
    • Ddictxt (specify text) : You can specify with values 'L', 'M', and 'S', the keyword that should always be used as column header. If the column width changes, no attempt is made in this case to find an appropriate header for the new output width.
    Value set: SPACE, 'L', 'M', and ‘S’.
    Sample code:
    Suppose I_PO_DETAILS is an internal table containing two fields EBELN (PO number) and EBELP (PO item no).
    DATA: L_FIELDCAT TYPE SLIS_FIELDCAT_ALV. “Local variable to hold the parameters
    for a particular field of the field catalog
    CLEAR L_FIELDCAT.
    L_FIELDCAT-TABNAME = 'I_PO_DETAILS'.
    L_FIELDCAT-FIELDNAME = 'EBELN'.
    L_FIELDCAT-KEY = 'X'. “The PO no is made the key field,
    “Colored and non scrollable
    L_FIELDCAT-HOTSPOT = 'X'. “The po no becomes a hotspot
    L_FIELDCAT-SELTEXT_S = ‘P.O No’.
    L_FIELDCAT-SELTEXT_M = 'P order No'.
    L_FIELDCAT-SELTEXT_L = 'Purchase order No'.
    APPEND L_FIELDCAT TO I_FIELDTAB.
    CLEAR L_FIELDCAT
    L_FIELDCAT-TABNAME = 'I_PO_DETAILS'.
    L_FIELDCAT-FIELDNAME = 'EBELN'.
    L_FIELDCAT-KEY = 'X'. “The po item no is made the key field,
    “Colored and non scrollable
    L_FIELDCAT-SELTEXT_S = 'Item No'.
    L_FIELDCAT-SELTEXT_M = 'Item No`.
    L_FIELDCAT-SELTEXT_L = 'PO Item No'.
    APPEND L_FIELDCAT TO I_FIELDTAB.
    CLEAR L_FIELDCAT
    Thus the catalog for the report output is prepared.
    Step 4
    The next step is to build an event table, which are used for firing both user commands and the system dependent events i.e. top of page, end of page etc.
    A list of possible events is populated into an event table (I_EVENTS) when this table is passed to the function module REUSE_ALV_EVENT_NAMES_GET. The return table from this function module contains all the possible events.
    The function module contains following import and export parameters.
    IMPORTING PARAMETERS: I_LIST_TYPE
    This parameter has possible values from 0-4.
    The parameter I_LIST_TYPE is of TYPE SLIS_LIST_TYPE and is DEFAULT 0 .
    EXPORTING PARAMETERS: I_EVENTS table.
    This table is of TYPE SLIS_T_EVENT and returns to the program the name of all the possible events.
    The table structure contains the fields:
    I_EVENTS-NAME: Name of the Callback event.
    I_EVENTS-FORM: Name of the form routine that should be called in the calling program at the event.
    Only events with a form routine name are processed.
    The I_EVENTS table returns with the following possible constants:
    1. Slis_ev_item_data_expand TYPE slis_formname VALUE 'ITEM_DATA_EXPAND'.
    Only relevant for hierarchical-sequential lists using the layout parameter IS_LAYOUT-EXPAND_FIELDNAME of the structure IS_LAYOUT. Exit for passing item entries (ITEM table) for a header record that was expanded interactively by the user.
    2. Slis_ev_reprep_sel_modify TYPE slis_formname VALUE 'REPREP_SEL_MODIFY'.
    RS_SELFIELD-TABINDEX contains the header table index for which the item entries are to be put in the global item output table (T_OUTTAB_SLAVE). The Callback is only called if ALV has no items for a header that is to be expanded.
    RFLG_ALL is passed with 'X' if the user shows all items. The application must ensure that entries are not repeated in the item table.
    RS_SELFIELD is initial in this case.
    3. Slis_ev_caller_exit_at_start TYPE slis_formname VALUE 'CALLER_EXIT'.
    Is called at the beginning of the function module to make special settings. It is not usually used.
    4. Slis_ev_user_command TYPE slis_formname VALUE 'USER_COMMAND'.
    As this is a frequently-used Callback event, the form routine can also be passed directly in the interface by passing the user command in the IMPORTING parameter I_CALLBACK_USER_COMMAND.
    5. Slis_ev_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    Equivalent to the list processing TOP-OF-PAGE event.
    6. Slis_ev_top_of_coverpage TYPE slis_formname VALUE 'TOP_OF_COVERPAGE'.
    The selection information and list status are output together (if they exist) on a separate page by default
    7. Slis_ev_end_of_coverpage TYPE slis_formname VALUE 'END_OF_COVERPAGE'.
    Analogously to TOP_OF_COVERPAGE the user can add other information
    to the information output by ALV (selection information, list status) at this event.
    8. Slis_ev_foreign_top_of_page TYPE slis_formname VALUE ‘FOREIGN_TOP_OF_PAGE'.
    The Top-of-page event is always processed in ALV and is only passed to the caller via the Callback mechanism. This is still the case if the caller, e.g. by a user action, processes a branch list which was not formatted by ALV (e.g. a popup with additional information about the list record selected and displayed by ALV).
    In this case, top-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event top-of-page still occurs in ALV. When ALV notices a top-of-page which was not caused by an ALV output, the form routine in FOREIGN_TOP_OF_PAGE is called.
    9. Slis_ev_foreign_end_of_page TYPE slis_formname VALUE 'FOREIGN_END_OF_PAGE'.
    The event end-of-page is always processed in ALV and only passed to the caller via callback. This is still the case, e.g. when the caller processes a details list which was not formatted by ALV (e.g. a popup with further information about selected list records which were displayed by ALV).
    In this case, end-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event end-of-page still occurs in ALV. When ALV notices an end-of-page that was not caused by an ALV output, the form routine in FOREIGN_END_OF_PAGE is called.
    10. Slis_ev_pf_status_set TYPE slis_formname VALUE 'PF_STATUS_SET'.
    If a user list status is to be set, it must be done in the form routine assigned to this event. The ALV function codes, which must not be active, are in the Parameter RT_EXTAB. This table must be passed with the SET PF-STATUS command (with inactive user function codes as well, if necessary).
    The STANDARD status of the function group SALV should be used as a template for a user-specific status. As this is a frequently used Callback event, its form routine can also be passed directly in the interface in the IMPORTING parameter I_CALLBACK_PF_STATUS_SET.
    11. Slis_ev_list_modify TYPE slis_formname VALUE 'LIST_MODIFY'.
    LIST_MODIFY USING R_TABNAME TYPE SLIS_TABNAME
    R_INDEX LIKE SY-TABIX
    R_INDEX_ITEM LIKE SY-TABIX
    R_INDEX_SUM LIKE SY-TABIX.
    12. Slis_ev_top_of_list TYPE slis_formname VALUE 'TOP_OF_LIST'.
    Information output at the start of the list
    13. Slis_ev_end_of_page TYPE slis_formname VALUE 'END_OF_PAGE'.
    Information output at the end of a page. This is only called for printing.
    14. Slis_ev_end_of_list TYPE slis_formname VALUE 'END_OF_LIST'.
    Information output at the end of the list
    15. Slis_ev_after_line_output TYPE slis_formname VALUE 'AFTER_LINE_OUTPUT'.
    Output information after each output line. Should only be used in justified cases because it costs a lot of performance.
    16. Slis_ev_before_line_output TYPE slis_formname VALUE 'BEFORE_LINE_OUTPUT'.
    Output information before each output line. Should only be used in justified cases because it costs a lot of performance.
    17. Slis_ev_subtotal_text TYPE slis_formname VALUE 'SUBTOTAL_TEXT'.
    This event table (I_EVENTS) is now checked with the desired constants. If the desired constant is found, then the corresponding field for the FORM NAME is populated with the name of the routine containing the corresponding event.
    Sample code :
    FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
    FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE', FORMNAME_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
    DATA: L_I_EVENT TYPE SLIS_ALV_EVENT.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = I_EVENTS.
    READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
    INTO L_I_EVENT.
    IF SY-SUBRC = 0.
    MOVE FORMNAME_TOP_OF_PAGE TO L_I_EVENT-FORM.
    APPEND L_I_EVENT TO I_EVENTS.
    ENDIF.
    READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
    INTO L_I_EVENT.
    IF SY-SUBRC = 0.
    MOVE FORMNAME_END_OF_PAGE TO L_I_EVENT-FORM.
    APPEND L_I_EVENT TO I_EVENTS.
    ENDIF.
    CLEAR L_I_EVENT.
    READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND
    INTO L_I_EVENT.
    IF SY-SUBRC = 0.
    MOVE FORMNAME_USER_COMMAND TO L_I_EVENT-FORM.
    APPEND L_I_EVENT TO I_EVENTS.
    ENDIF.
    This will prepare the events table for the report.
    The report will contain three forms for the above events:
    1. FORM TOP_OF_PAGE : This form will contain the top of page event for the report i.e header etc
    Using the function module ‘REUSE_ALV_COMMENTARY_WRITE’, the internal table containing the headings for top of page event can be passed to the list output. Also, any logo specific to the report can be passed to the function module.
    2. FORM END_OF_PAGE : This form will contain the end of page event for the report i.e footer etc
    3. FORM USER_COMMAND : This form will contain the desired user command i.e pick/line selection
    Step 5
    A layout is build for the report output list description USING the internal table declared above (I_LAYOUT).
    Output list description structure.
    The parameters are described under the following heads:
    • Display options
    • Exceptions
    • Totals
    • Interaction
    • Detail screen
    • Display variants (only for hierarchical-sequential lists)
    • Color
    • Other
    The layout table is of type slis_layout_alv_spec and has the following fields:
    Display options
    1. Colwidth_optimize (1) TYPE c: This parameter optimizes the length of the different columns in the output. The width of the different col. now depends on the max. Length of the data in the column.
    Value set: SPACE, 'X'
    'X' = optimizes the column width so that all contents are displayed completely.
    2. No_colhead(1) TYPE c : This parameter suppresses the column headings
    Value set: SPACE, 'X'.
    'X' = column headers are not output
    3. No_hotspot(1) TYPE c : The heading of the report output are not output as hotspot.
    Value set: SPACE, 'X'.
    'X' = column headers are not output as hotspot
    4. Zebra(1) TYPE c : The report is output in the striped pattern.
    Value set: SPACE, 'X'.
    'X' = striped pattern (e.g. for wide lists)
    5. No_vline(1) TYPE c : The report output contains columns only separated by space and no lines. It is not relevant for: hierarchical-sequential lists and multiple-line lists.
    Value set: SPACE, 'X'.
    'X' = columns separated by SPACE
    6. No_min_linesize(1) TYPE c : The report line size is equal to the width of the list. It is not relevant for block lists.
    Value set: SPACE, 'X’.
    'X' = line size depends on list width
    ' ' = Line size is set to 80 or MIN_LINESIZE (if > 0) .
    7. Min_linesize LIKE sy-linsz: The report output contains a minimum possible length of line. If initial min_linesize is set to 80 by default, then this parameter is used to customize it. The prerequisite for this is that the parameter no_min_linesize should be ' '.
    Value set: 0, 10 - 250
    If the list is wider, the format uses the list width (maximum 250 or MAX_LINESIZE (if > 0)).
    8. Max_linesize LIKE sy-linsz: The default max. Linesize is 250. To change this default value, this parameter can interactively-define the maximum list width setting.
    Value set: 0, 80 - 1020
    9. Window_titlebar LIKE rsmpe-tittext: To set the titlebar on the report output.
    10. No_uline_hs(1) TYPE c.
    Exceptions
    11. Lights_fieldname TYPE slis_fieldname: Internal output table field containing the codes of exceptions to be output.
    Output table field code: '1' = red traffic light
    '2' = yellow traffic light
    '3' = green traffic light Fieldname for exception
    Value set: SPACE, internal output table field name.
    12. Lights_tabname TYPE slis_tabname: Name of the internal output table that contains the field in the parameter LIGHTS_FIELDNAME. If LIGHTS_FIELDNAME is not empty, this field must also be filled for hierarchical-sequential lists. Only relevant for hierarchical-sequential lists.
    . Value set: SPACE, internal output table name.
    13. Lights_rollname LIKE dfies-rollname: The documentation of this data element is displayed when you call F1 help for an exception column.
    Value set: SPACE, data element name.
    14. Lights_condense(1) TYPE c : If a list record is output with 'red traffic light', each
    Subtotal that includes this record is also output with 'red traffic light'.
    Value set: SPACE, 'X'
    'X' = the 'maximum' exception of the items in the subtotal is output at subtotal level.
    Sums
    15. No_sumchoice(1) TYPE c : This parameter allows the choice for summing up
    Only by fieldcatalog.
    Value set: SPACE, 'X'
    'X' = fields which are to be summed, passed by the calling program (FIELDCAT-DO_SUM = 'X'). The user should not be able to change this value interactively.
    16. No_totalline(1) TYPE c : Removes the option of having totals after sub-totals.
    Value set: SPACE, 'X'
    'X' = no total record is to be output. Subtotals can still be calculated and output. The fields in the subtotals are flagged DO_SUM = 'X' in the field list.
    17. No_subchoice(1) TYPE c : Does not allow the user to interactively change the field chosen for subtotals.
    Value set: SPACE, 'X'
    'X' = value whose change triggers subtotals, provided by the calling program. The user should not be able to change this value interactively.
    18. No_subtotals(1) TYPE c : No subtotals possible
    Value set: SPACE, 'X'
    'X' = no subtotals.
    19. Numc_sum(1) TYPE c : Totals only possible for NUMC-Fields.
    20. No_unit_splitting TYPE c: No separate total lines by inh.units
    21.totals_before_items TYPE c: Display totals before the items
    22. Totals_only(1) TYPE c : Show only totals
    Value set: SPACE, 'X'
    'X' = only total records are output.
    23. Totals_text(60) TYPE c : Text for 1st col. in totals
    Value set: SPACE, string (max.60)
    ' ' = The first column in the total record contains an appropriate number of '*'s to indicate the total by default. If the first column is wide enough, the string 'Total' is output after the asterisks.
    'String’ = The string passed is output after the total indicated by '*', if the column is wide enough.
    24. Subtotals_text(60) TYPE c : Texts for subtotals
    Value set: SPACE, string (max.60)
    ' ' = In the first column of subtotal records, the subtotal is indicated by an appropriate number of '*' by default. If the first column is not a subtotal criterion, the string 'Total' is output after the asterisks, if the column is wide enough.
    'String’ = the string passed is output after the subtotal indicated by '*', if the column is wide enough and the first column is not a subtotal criterion. If it is a subtotal criterion, its value is repeated after the total, if the column is wide enough.
    Interaction
    25. Box_fieldname TYPE slis_fieldname: Fieldname for checkbox in the report output. If the list has checkboxes at the start of records (for selecting several records), this parameter contains the internal output table field name indicated by the checkbox selection column. The field is a checkbox at the start of list records without a list header.
    Value set: SPACE, internal output table field name
    26. Box_tabname TYPE slis_tabname: Name of the internal output table that contains the field in the parameter BOX_FIELDNAME. If BOX_FIELDNAME is not empty, this field must also be filled for hierarchical-sequential lists.
    Value set: SPACE, internal output table name.
    27. Box_rollname LIKE dd03p-rollname: rollname for checkbox
    28. Expand_fieldname TYPE slis_fieldname: fieldname flag ‘expand’. The user can show or hide the items by clicking on the folder symbol (hotspot). If the items for a header entry are only to be read by the calling program and passed to ALV when a header has been expanded interactively, this can be controlled via the CALLBACK event 'ITEM_DATA_EXPAND'.
    29. Hotspot_fieldname TYPE slis_fieldname: Used to make the fieldname flag hotspot.
    30. No_input(1) TYPE c : The fields are only display fields.
    Value set: SPACE, 'X'
    'X' = all ready-for-input fields in a list are displayed as not ready-for-input. (Record selection checkboxes and fields which can be made ready-for-input via the field list parameter FIELDCAT-INPUT = 'X')
    31. F2code LIKE sy-ucomm: To assign an ALV standard function code to double-click (F2), assign the function code to this parameter. Ex.: to assign the ALV standard function 'Detail' ('&ETA') to F2.
    => LAYOUT-F2CODE = '&ETA'.
    Value set: SPACE, function code
    32. Confirmation_prompt: confirm. Prompt when leaving
    Value set: SPACE, 'X'
    'X' = if one of the functions ‘Back (F03)', ‘Exit (F15)' or ‘Cancel (F12)' occurs, a confirmation prompt appears.
    33. Key_hotspot(1) TYPE c : The key fields are displayed as hotspot. The columns defined in the field catalog as key fields (FIELDCAT-KEY = 'X') are output as hotspots, i.e. clicking on a key column (highlighted in color in the list) calls the function under F2.
    Value set: SPACE, 'X'.
    34. Reprep(1) TYPE c : report report interface active.
    35. Group_buttons(1) TYPE c : group-buttons for COL1 - COL5 . Group output fields via FIELDCAT-SP_GROUP in the field list, and pass the group name to the list module in the interface parameter IT_SPECIAL_GROUPS.
    Value set: SPACE, 'X'.
    36. No_keyfix(1) TYPE c : Used to make the key fields scrollable.
    Value set: SPACE, 'X'.
    ' ' = The key columns defined in the field catalog by FIELDCAT-KEY = 'X' are fixed in the list output. These columns do not scroll horizontally. The item table key columns are fixed in hierarchical-sequential lists. The header table key fields are not considered here.
    'X' = key columns not fixed
    37. Get_selinfos(1) TYPE c : To read selection screen.
    Value set: SPACE, 'X'.
    If the calling program is a report with an ABAP/4 selection screen, setting this parameter makes ALV read the selection screen again. If the selections are read successfully, a pushbutton, via which the user can call a popup which lists the report selections in a simple form, becomes active on the results list output by ALV.
    38. group_change_edit(1) TYPE c : Settings by user for new group
    Value set: SPACE, 'X'
    'X' = the user can enter a format option for each sort criterion in the sort/subtotal popup, for the list format when this value changes (e.g. new page or underline).
    39. No_scrolling(1) TYPE c : Does not allow scrolling of the list to the right.
    Value set: SPACE, 'X'.
    40. Expand_all(1) TYPE c : Expand all positions
    Detailed screen
    40. Detail_popup(1) TYPE c : show detail in popup.
    Value set: SPACE, 'X'
    ' ' = List record detail display in full-screen mode, with top-of-page.
    'X' = list record detail display in popup (without top-of-page).
    41. Detail_initial_lines(1) TYPE c : show also initial lines
    Value set: SPACE, 'X'
    ' ' = Only fields whose contents are not initial are output in the detail view.
    'X' = initial field contents are also output in detail.
    41. detail_titlebar(30) type c : Titlebar for detail screen
    Value set: SPACE, string (max.30)
    ` ' = ' Detail: Display' is output as the title of the detail window.
    'String’ = the string passed is output as the title of the detail window.
    Display variants
    42. Header_text (20) TYPE c: Text for header button. Only relevant for hierarchical-sequential lists. You can toggle between display field and field list views via pushbuttons in the display variant definition popup for hierarchical-sequential lists. The views refer to the hierarchy level of the fields. This is technically a toggle between the header table and item table fields.
    Value set: SPACE, CHAR (20)
    ' ' = The header table field pushbutton text is 'Header' by default.
    CHAR (20) = header table field pushbutton text.
    43.item_text(20) TYPE c : Text for item button. Only relevant for hierarchical-sequential lists. You can toggle the view between the display fields and the field list via pushbuttons in the display variant definition popup for hierarchical-sequential lists. The views refer to the hierarchy level of the fields. This is technically a toggle between the header table and item table fields.
    Value set: SPACE, CHAR (20)
    ' ' = The pushbutton text for the item table fields is 'Item' by default.
    CHAR (20) = item table field pushbutton text.
    44.default_ item(1) TYPE c : Items as default. Only relevant for hierarchical-sequential lists.
    Value set: SPACE, 'X'
    ' ' = The header table fields are displayed by default in the display variant definition popup. The user can switch to the item table fields interactively.
    'X' = the item table fields are displayed by default in the display variant Definition Popup. The user can switch to the header table fields interactively.
    Colour
    45. Info_fieldname TYPE slis_fieldname: infofield for listoutput. A whole list record can be colored individually using a color code in a column of the internal output table for the record. Assign the name of the field containing the color code to this parameter.
    Value set: SPACE, internal output table field name
    The internal output table field must be of type CHAR(3).
    The code must have the following syntax: 'Cxy':
    C = color (all codes must start with 'C')
    X = color number ('1'-'9')
    Y = bold ('0' = off, '1' = on)
    46. Coltab_fieldname TYPE slis_fieldname: Cells can be colored individually using a color code which is contained in a column of the internal output table for the record containing the cell. Assign the name of the field to this parameter.
    Others
    47. List_append(1) TYPE c : no call screen. It is only useful to output block-lists without specifying the above modules if the number of list blocks exceeds, or may exceed, the maximum number specified in the block module documentation. These operations are not possible for user-defined block lists.
    Example code :
    I_LAYOUT-f2code = ws_fcode.
    I_LAYOUT-zebra = 'X'.
    I_LAYOUT-colwidth_optimize = 'X'.
    I_LAYOUT-no_keyfix = 'X'.
    I_LAYOUT-get_selinfos = 'X'.
    I_LAYOUT-no_hotspot = 'X'.
    I_LAYOUT-no_input = 'X'.
    I_LAYOUT-hotspot_fieldname = FIELDNAME.
    I_LAYOUT-no_input = ‘X’.
    I_LAYOUT-no_vline = `X’.
    I_LAYOUT-no_colhead = ‘ ‘.
    I_LAYOUT-lights_condense = ` `.
    I_LAYOUT-totals_text = ` `.
    I_LAYOUT-subtotals_text = ` `.
    I_LAYOUT-totals_only = ` `.
    I_LAYOUT-key_hotspot = ‘X’.
    I_LAYOUT-detail_popup = ‘X’.
    I_LAYOUT-group_change_edit = ‘X’.
    I_LAYOUT-GROUP_BUTTONS = ‘X’.
    Step 6
    This step is required to get the selection screen information in the report output.
    The prerequisite for this is to set the parameter LAYOUT-GET_SELINFOS of the IMPORTING structure.
    The parameters to be passed in the IS_SEL_HIDE table are:
    o mode: 'R' = only the entries passed in the internal table IS_SEL_HIDE-T_ENTRIES
    Are output in the pop up. Selection info, which the list tool read in the selection screen (when called by a report with a selection screen), is replaced by the values passed.
    'S' = the selection info which the list tool read in the selection screen of the calling report are modified by the entries in the table IS_SEL_HIDE-T_ENTRIES.
    o t_entries: Selection info table
    o t_entries-mode: 'A' = output the selection info for the current table record in the info popup.
    'D' = do not output select option or SELNAME parameter selection info in the popup.
    o t_entries-selname: (only used in t_entries-mode = 'D') : Name of the select option or parameter.
    The following table fields are only used in t_entries-mode = 'A'. They contain the selection information to be added.
    • t_entries-field: DDIC field name of the field for which selection information is to be output.
    • t_entries-table: DDIC table names of t_entries-field.
    • t_entries-stext: Field name in info popup.
    • If t_entries-field and t_entries-table have been entered, this text is taken from DDIC.
    • t_entries-valuf: Selection condition 'from' value (external format)
    • t_entries-valut: Selection condition 'to' value (external format)
    • t_entries-sign0: (I)nclusive (E)xclusive
    • t_entries-option: All values of the select options Option field allowed.
    Step 6
    The Table IT_SORT is populated with the sort criteria for the different fields.
    The caller specifies the sorting and/or subtotaling of the basic list in the internal table IT_SORT.
    This internal table has the following fields:
    o spos : Sort sequence
    o fieldname : Internal output table field name
    o tabname : Only relevant for hierarchical-sequential lists. Name of the internal output table.
    o up : 'X' = sort in ascending order
    o down : 'X' = sort in descending order
    o subtot : 'X' = subtotal at group value change
    o group : '* ' = new page at group value change ,'UL' = underline at group value change
    Step 7
    The final step in the output of the report is the use of two ALV functions modules.
    1. REUSE_ALV_FIELDCATALOG_MERGE
    2. REUSE_ALV_LIST_DISPLAY
    The first function module is used to pass the field catalog to the report output and merge it with the internal output table.
    FUNCTION reuse_alv_fieldcatalog_merge.
    ""Lokale Schnittstelle:
    *” IMPORTING
    *" VALUE(I_PROGRAM_NAME) LIKE SY-REPID OPTIONAL
    *" VALUE(I_INTERNAL_TABNAME) TYPE SLIS_TABNAME OPTIONAL
    *" VALUE(I_STRUCTURE_NAME) LIKE DD02L-TABNAME OPTIONAL
    *" VALUE(I_CLIENT_NEVER_DISPLAY) TYPE SLIS_CHAR_1
    *" DEFAULT 'X'
    *" VALUE(I_INCLNAME) LIKE TRDIR-NAME OPTIONAL
    *" CHANGING
    *" VALUE(CT_FIELDCAT) TYPE SLIS_T_FIELDCAT_ALV
    *" EXCEPTIONS
    *" INCONSISTENT_INTERFACE
    *" PROGRAM_ERROR
    Import parameters
    I_PROGRAM_NAME: Program in which the internal output table is declared and populated
    I_INTERNAL_TABNAME: Internal output table name
    I_STRUCTURE_NAME: Structure name (structure, table, and view)
    I_CLIENT_NEVER_DISPL: Hide client fields default ‘X’
    I_INCLNAME: Data declarations include name
    CHANGING parameter
    CT_FIELDCAT: Field catalog with field descriptions
    The variant based on a program-internal table should only be used for rapid prototyping since the following restrictions apply:
    1. Performance is affected since the code of the table definition must always be read and interpreted at runtime.
    2. Dictionary reference are only considered if the keywords LIKE or INCLUDE STRUCTURE (not TYPE) are used.
    Step 8
    The other function module is used to display the internal output table with the contents
    FUNCTION reuse_alv_list_display.
    ""Lokale Schnittstelle:
    *” IMPORTING
    *" VALUE(I_INTERFACE_CHECK) DEFAULT SPACE
    *" VALUE(I_CALLBACK_PROGRAM) LIKE SY-REPID DEFAULT SPACE
    *" VALUE(I_CALLBACK_PF_STATUS_SET) TYPE SLIS_FORMNAME
    *" DEFAULT SPACE
    *" VALUE(I_CALLBACK_USER_COMMAND) TYPE SLIS_FORMNAME
    *" DEFAULT SPACE
    *" VALUE(I_STRUCTURE_NAME) LIKE DD02L-TABNAME OPTIONAL
    *" VALUE(IS_LAYOUT) TYPE SLIS_LAYOUT_ALV OPTIONAL
    *" VALUE(IT_FIELDCAT) TYPE SLIS_T_FIELDCAT_ALV OPTIONAL
    *" VALUE(IT_EXCLUDING) TYPE SLIS_T_EXTAB OPTIONAL
    *" VALUE(IT_SPECIAL_GROUPS) TYPE SLIS_T_SP_GROUP_ALV
    *" OPTIONAL
    *" VALUE(IT_SORT) TYPE SLIS_T_SORTINFO_ALV OPTIONAL
    *" VALUE(IT_FILTER) TYPE SLIS_T_FILTER_ALV OPTIONAL
    *" VALUE(IS_SEL_HIDE) TYPE SLIS_SEL_HIDE_ALV OPTIONAL
    *" VALUE(I_DEFAULT) DEFAULT 'X'
    " VALUE(I_SAVE) DEFAULT SPACE
    " VALUE(IS_VARIANT) LIKE DISVARIANT
    " STRUCTURE DISVARIANT DEFAULT SPACE
    " VALUE(IT_EVENTS) TYPE SLIS_T_EVENT OPTIONAL
    " VALUE(IT_EVENT_EXIT) TYPE SLIS_T_EVENT_EXIT OPTIONAL
    " VALUE(IS_PRINT) TYPE SLIS_PRINT_ALV OPTIONAL
    " VALUE(IS_REPREP_ID) TYPE SLIS_REPREP_ID OPTIONAL
    " VALUE(I_SCREEN_START_COLUMN) DEFAULT 0
    " VALUE(I_SCREEN_START_LINE) DEFAULT 0
    " VALUE(I_SCREEN_END_COLUMN) DEFAULT 0
    " VALUE(I_SCREEN_END_LINE) DEFAULT 0
    " EXPORTING
    " VALUE(E_EXIT_CAUSED_BY_CALLER)
    " VALUE(ES_EXIT_CAUSED_BY_USER) TYPE SLIS_EXIT_BY_USER
    " TABLES
    " T_OUTTAB
    " EXCEPTIONS
    " PROGRAM_ERROR
    Import parameters
    I_INTERFACE_CHECK: Interface consistency check log output.
    I_CALLBACK_PROGRAM: Name of the calling program
    I_CALLBACK_PF_STATUS_SET: Set EXIT routine to status.
    I_CALLBACK_USER_COMMAND: EXIT routine for command handling
    I_STRUCTURE_NAME: Internal output table structure name
    IS_LAYOUT: List layout specifications
    IT_FIELDCAT: Field catalog with field descriptions
    IT_EXCLUDING: Table of inactive function codes
    IT_SPECIAL_GROUPS: Grouping fields for column selection
    IT_SORT: Sort criteria for first list display
    IT_FILTER: Filter criteria for first list output
    IS_SEL_HIDE : Selection information modification
    I_DEFAULT: Initial variant active/inactive logic
    I_SAVE: Variants can be saved
    IS_VARIANT : Variant information
    IT_EVENTS: Table of events to perform IT_EVENT_EXIT : Standard fcode exit requests table
    IS_PRINT: Print information
    IS_REPREP_ID: Initialization keys for Re/Re interface
    I_SCREEN_START_COLUMN: Coordinates for list in dialog box
    I_SCREEN_START_LINE: Coordinates for list in dialog box
    I_SCREEN_END_COLUMN: Coordinates for list in dialog box
    I_SCREEN_END_LINE: Coordinates for list in dialog box
    IT_EVENT_EXIT: Standard fcode exit requests table
    IS_PRINT: Print information
    IS_REPREP_ID: Initialization keys for Re/Re interface
    I_SCREEN_START_COLUMN: Coordinates for list in dialog box
    I_SCREEN_START_LINE: Coordinates for list in dialog box
    I_SCREEN_END_COLUMN: Coordinates for list in dialog box
    I_SCREEN_END_LINE: Coordinates for list in dialog box
    Export parameters
    E_EXIT_CAUSED_BY_CALLER: Delete list in CALLBACK_USER_COMMAND
    ES_EXIT_CAUSED_BY_USER: How the user left the list Tables
    T_OUTTAB: Table with data to be displayed ---mandatory
    Example Code
    WS_REPNAME = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = WS_REPNAME
    I_INTERNAL_TABNAME = Internal output table field name
    I_INCLNAME = WS_REPNAME
    CHANGING
    CT_FIELDCAT = I_FIELDTAB.
    IF SY-SUBRC <> 0.
    WRITE: 'SY-SUBRC: ', SY-SUBRC, 'REUSE_ALV_FIELDCATALOG_MERGE'.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = WS_REPNAME
    I_STRUCTURE_NAME = Internal output table field name
    IS_LAYOUT = I_LAYOUT
    IT_FIELDCAT = I_FIELDTAB
    I_DEFAULT = 'A'
    I_SAVE = 'A'
    IS_VARIANT = 'X'
    IT_EVENTS = I_EVENTS[]
    IT_SORT = I_SORT
    IS_SEL_HIDE = I_SELINFO
    TABLES
    T_OUTTAB = Internal output table field name.
    IF SY-SUBRC <> 0.
    WRITE: 'SY-SUBRC: ', SY-SUBRC, 'REUSE_ALV_LIST_DISPLAY'.
    ENDIF
    THIS IS THE POP UP TO ALLOW THE USER TO DYNAMICALLY SELECT THE FIELDS FOR DISPLAY. HE CAN CHOOSE FROM THIS FIELDS ACC. TO REQUIREMENT AND HIDE THE OTHER FIELDS
    Example report output based prior to selection of the field
    THE USER HAS HIDDEN SOME OF THE FIELD FROM THE TOTAL FIELDS TO CUSTOMIZE THE REPORT OUTPUT
    Example report output after hiding some of the fields
    USER CAN CHOOSE A PARTICULAR SET OF FIELD FROM THE OUTPUT AND CAN SAVE IT AS VARIANTS
                                                                                    Using other function module 'REUSE_ALV_GRID_DISPLAY’ can help us get list output in the form of a grid and also attach logos to the report output.
    Sample code
    1 Simple list output:
    REPORT Y_DEMO_ALV NO STANDARD PAGE HEADING.
    Data to be displayed
    DATA: I_SFLIGHT TYPE TABLE OF SFLIGHT.
    Selection
    SELECT * FROM SFLIGHT INTO TABLE I_SFLIGHT.
    Call ABAP List Viewer (ALV)
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_STRUCTURE_NAME = 'SFLIGHT'
    TABLES
    T_OUTTAB = I_SFLIGHT.
    2.Simple grid output:
    REPORT Y_DEMO_ALV_1.
    Data to be displayed
    DATA: I_SFLIGHT TYPE TABLE OF SFLIGHT.
    Selection
    SELECT * FROM SFLIGHT INTO TABLE I_SFLIGHT.
    Call ABAP List Viewer (ALV)
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_STRUCTURE_NAME = 'SFLIGHT'
    TABLES
    T_OUTTAB = I_SFLIGHT.
    3. Demo for 'REUSE_ALV_POPUP_TO_SELECT'
    REPORT y_demo_alv_3.
    TYPE-POOLS: slis.
    DATA: BEGIN OF i_outtab OCCURS 0.
    INCLUDE STRUCTURE sflight.
    DATA: w_chk TYPE c. "For multiple selection
    DATA: END OF i_outtab.
    I_OUTTAB TYPE SFLIGHT OCCURS 0,
    DATA: i_private TYPE slis_data_caller_exit,
    i_selfield TYPE slis_selfield,
    W_exit(1) TYPE c.
    PARAMETERS: p_title TYPE sy-title.
    START-OF-SELECTION.
    SELECT * FROM sflight INTO TABLE i_outtab.
    CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
    EXPORTING
    i_title = p_title
    i_selection = 'X'
    i_zebra = 'X'
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    i_checkbox_fieldname = 'W_CHK'
    I_LINEMARK_FIELDNAME =
    I_SCROLL_TO_SEL_LINE = 'X'
    i_tabname = 'I_OUTTAB'
    i_structure_name = 'SFLIGHT'
    IT_FIELDCAT =
    IT_EXCLUDING =
    I_CALLBACK_PROGRAM =
    I_CALLBACK_USER_COMMAND =
    IS_PRIVATE = I_PRIVATE
    IMPORTING
    es_selfield = i_selfield
    e_exit = w_exit
    TABLES
    t_outtab = i_outtab
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE i000(0k) WITH sy-subrc.
    ENDIF.
    *****the internal table is modified with a cross sign for marking the
    ***rows selected
    LOOP AT i_outtab WHERE w_chk = 'X'.
    WRITE: / i_outtab-carrid, i_outtab-price.
    ENDLOOP.
    4. Demo for ALV output using field catalog and layout:
    REPORT y_demo_alv NO STANDARD PAGE HEADING.
    ALV related data declaration
    TYPE-POOLS: slis.
    DB-Table
    TABLES sflight.
    Includes
    INCLUDE &lt

  • ALV and Interactive Reports

    Hi,
      Can anyone email me a documentation on ALV reports and Interactive reports at [email protected]
    Amit

    Hi,
    Check this link for ALV GRID control
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
    You can check the development class SLIS for ALV related sample programs..
    Thanks,
    Naren

  • Puting buttons in the appl bar with alv reporting

    hai
    im trying to put buttons in alv in  applctn bar
    the coding i made is
    perform eventtab.
    form eventtab.
    wa_event-name='set_pf_status'.
    wa_event-form = 'status'.
    append wa_event to tab_event.
    endform.
    form status.
    set pf-status 'ystatus'.----
    >status havin buttons.
    endform.
    the result is
    program is geting run time error(shortdump)
    error is too many parameters in the perform.
    in coding itis pointing arroe mark like this
    >form status.
    plz help me how to add buttons in application bar
    tahnks in advance
    sindu.

    you should not populate FORM name of STATUS to EVENTS. instead you have to give the FORM name to the FUnction module.
    check this link,to know how to give our own GUI status.
    Re: own PF-Status for REUSE_ALV_GRID_DISPLAY
    FORM F_SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
      CLEAR : WA_EXTAB,
              IT_EXTAB.
    *--Set the Modified PF status for the ALV.
      SET PF-STATUS 'STATUS_01' EXCLUDING RT_EXTAB.
    you have to copy any ALV related GUI status (from SE41 transaction) to STATUS_01. standard alv programs starts with BCALV*. so check it in SE41
    copy it and add your own button to the Application tool bar.
    ENDFORM.                               " SET_PF_STATUS
    Regards
    Srikanth
    Message was edited by: Srikanth Kidambi

  • Getting runtime Error 'UC_OBJECTS_NOT_CHARLIKE'  for ALV grid

    Hi,
    When I call method SET_TABLE_FOR_FIRST_DISPLAY of ALV I get runtime error 'UC_OBJECTS_NOT_CHARLIKE'.
    Actually i have set in the fieldcatalog the field 'CHK' of internal table as checkbox.
    wa_fcat-fieldname = 'CHK' .
    wa_fcat-coltext = 'Clear' .
    wa_fcat-seltext = 'Clear' .
    wa_fcat-checkbox = 'X' .
    wa_fcat-edit = 'X' .
    APPEND wa_fcat to p_lt_fieldcatalog .
    Field CHK is of type c.
    when i dont set the field as checkbox, I stop getting the error.
    Please find a solution.
    regards,
    auro

    Relevant parts of code are:
    Data Declaration:
    types:  begin of tt_revenue_det,
           chk type c,
           budat like zefit0006-zefibudat,
           racct_txt like skat-txt50,
           amount like zefit0006-zefihsl,
           pbar_txt like tgsbt-gtext,
           sgtxt like zefit0006-zefisgtxt,
           costcentertxt like cskt-ktext,
           bar_txt like skat-txt50,
           doctype like zefit0006-zefiblart,
           ch_flag type c,
           end of tt_revenue_det,
    data:    gt_revenue_det type table of tt_revenue_det.
    FIELD CATALOG
    *&      Form  set_fieldcatalog_rev_det
          text
         -->P_LT_FIELDCATALOG  text
    form set_fieldcatalog_rev_det  using    p_lt_fieldcatalog type lvc_t_fcat.
    data:wa_fcat type lvc_s_fcat.
    wa_fcat-fieldname = 'P_GT_REVENUE_DET-CHK' .
    wa_fcat-coltext = 'Clear' .
    wa_fcat-seltext = 'Clear' .
    wa_fcat-checkbox = 'X' .
    wa_fcat-edit = 'X' .
    APPEND wa_fcat to p_lt_fieldcatalog .
    wa_fcat-fieldname = 'BUDAT' .
    wa_fcat-coltext = 'Posting Date' .
    wa_fcat-seltext = 'Posting Date' .
    APPEND wa_fcat to p_lt_fieldcatalog .
    wa_fcat-fieldname = 'RACCT_TXT' .
    wa_fcat-coltext = 'Account Item Text' .
    wa_fcat-seltext = 'Account Item Text' .
    APPEND wa_fcat to p_lt_fieldcatalog .
    wa_fcat-fieldname = 'AMOUNT' .
    wa_fcat-coltext = 'Amount' .
    wa_fcat-seltext = 'Amount' .
    APPEND wa_fcat to p_lt_fieldcatalog .
    wa_fcat-fieldname = 'PBAR_TXT' .
    wa_fcat-coltext = 'Partner Business Area' .
    wa_fcat-seltext = 'Partner Business Area' .
    APPEND wa_fcat to p_lt_fieldcatalog .
    wa_fcat-fieldname = 'SGTXT' .
    wa_fcat-coltext = 'Item Text' .
    wa_fcat-seltext = 'Item Text' .
    APPEND wa_fcat to p_lt_fieldcatalog .
    wa_fcat-fieldname = 'COSTCENTERTXT' .
    wa_fcat-coltext = 'Cost Center' .
    wa_fcat-seltext = 'Cost Center' .
    APPEND wa_fcat to p_lt_fieldcatalog .
    wa_fcat-fieldname = 'BAR_TXT' .
    wa_fcat-coltext = 'Business Area' .
    wa_fcat-seltext = 'Business Area' .
    APPEND wa_fcat to p_lt_fieldcatalog .
    wa_fcat-fieldname = 'DOCTYPE' .
    wa_fcat-coltext = 'Type' .
    wa_fcat-seltext = 'Type' .
    APPEND wa_fcat to p_lt_fieldcatalog .
    wa_fcat-fieldname = 'CH_FLAG' .
    wa_fcat-coltext = 'Split' .
    wa_fcat-seltext = 'Split' .
    APPEND wa_fcat to p_lt_fieldcatalog .
    endform.                    " set_fieldcatalog_rev_det
    CREATE ALV
    *&      Form  create_alv_revenue_det
          text
         -->P_GT_REVENUE_DET  text
    form create_alv_revenue_det  using    p_gt_revenue_det.
    ALV related data declaration
    DATA: lf_layout TYPE lvc_s_layo,  "alv layout
          lt_fieldcatalog type table of lvc_s_fcat, "field catalog internal table
          wa_fieldcatalog type lvc_s_fcat. "work area for field catalog
    create alv only if container is initial
    IF G_CUSTOM_CONTAINER_REV_DET IS INITIAL.
    lf_layout-no_toolbar = 'X'. " no toolbar
    lf_layout-sel_mode = 'B'.
    populate field catalog
    perform set_fieldcatalog_rev_det using lt_fieldcatalog.
    create instance of container class
        CREATE OBJECT G_CUSTOM_CONTAINER_REV_DET
               EXPORTING CONTAINER_NAME = G_CONTAINER_REV2.
    create instance of alv grid class
        CREATE OBJECT GR_ALVGRID_REV_DET
               EXPORTING I_PARENT = G_CUSTOM_CONTAINER_REV_DET.
    call method to display table in alv grid by passing layout and fieldcatalog
        CALL METHOD GR_ALVGRID_REV_DET->SET_TABLE_FOR_FIRST_DISPLAY
             EXPORTING
             is_layout = lf_layout
             CHANGING
             IT_OUTTAB        = p_gt_revenue_det
             IT_FIELDCATALOG  = lt_fieldcatalog.
      ENDIF.
    endform.                    " create_alv_revenue_det

  • Hide alv column of a standard tcode...

    Hello Experts,
    I was just given a task to hide a certain column in a standard tcode(LI14). So what
    I tried first was to just create a transaction variant but it did not work since
    the column that I need to hide is an alv list display. So I debugged the transaction
    and it calls another standard program but it doesn't contain any ALV related FMs either in
    the calling or the called program.
    Anyone encountered this type of problem?

    Hi,
    I just debug the standard transaction(LI14) and it calls another program that to my surprise, does not use ALV but uses WRITE statement instead. I asked our functional guy and he said that there are no config available for it. So I think I'll just create a custom program for this one.

  • ALV query

    hi all,
    i have a small query regarding alv report.
    How to make individual cells in alv editable and noneditable??
    Regards,
    Satya.

    hi,
    please refer to the below mentioned link... it wil solve almost all your alv related queries.
    http://www.sap-partner.hu/ABAP_HELP_INFO/An%20Easy%20Reference%20for%20ALV%20Grid%20Control.pdf
    <removed_by_moderator>
    preet
    Edited by: Julius Bussche on Aug 26, 2008 11:55 AM

  • ALV Report Event

    Hi All
    Can you please tell me 'under which event do we write fieldcatalog ' in ALV Report.
    Thanks in Advance!
    Kiran

    Hi
    We fetch the data in start-of-selection and write the ALV related data in end of selection
    See the sample report
    report ZRGRIRNA no standard page heading
           line-count 65
           line-size 255
           message-id mm.
                       GR IR Detail Report                               *
    Description          : The output has to be displayed
                           in the ALV Grid format with the Selection     *
                           screen appearing on the output. In The Output *
                           Subtotals for Vendor, Plant, Period, Material,*
                           Valuation Class, Purchase Order,Cost Center,  *
                           Cost Element and Receipt Date are displayed   *
                           after sorting the data by same fields.        *
    Declaration for Tables
    tables: t001,      " Company Codes
            t001w,     " Plants/Branches
            lfa1,      " Vendor Master
            ska1,      " GL Account Master
            mara,      " Material Master
            mbew,      " Material Valuation
            ekko,      " PO Header Data
            cska,      " Cost Elements
            csks,      " Cost Centers
            bsis,      " GL Accounts: Open Items Data
            bkpf.      " Accounting Doc: Header Data
    Type-pools
    Type pools for ALV display
    type-pools : slis.
    Global variables
    data: g_repid       like sy-repid,
          g_exit        type c,
          g_events      type slis_t_event,
          g_list_top_of_page type slis_t_listheader,
          g_exit_caused_by_caller,
          g_exit_caused_by_user type slis_exit_by_user,
          g_top_of_page  type slis_formname value 'TOP_OF_PAGE',
          g_variant like disvariant,
          g_save.
    Declaration for Constants
    constants : c_x  type c  value 'X',         " Flag
                c_c  type c  value 'C',         " Flag
                c_l  type c  value 'L',         " Flag
                c_a  type c  value 'A',         " Line Type
                c_h  type c  value 'H',         " Dr/Cr
                c_s  type c  value 'S',         " Line Type
                c_mkpf(4) type c value 'MKPF'.  " Table
    Declaration of Internal Tables
    Internal Table for BSIS Table data
    data: begin of i_bsis occurs 0,
            bukrs like bsis-bukrs,          " Company Code
            hkont like bsis-hkont,          " GR IR Account
            gjahr like bsis-gjahr,          " Fiscal Year
            belnr like bsis-belnr,          " Acc Document
            buzei like bsis-buzei,          " Item No
            budat like bsis-budat,          " Receipt Date(Posting)
            monat like bsis-monat,          " Period
          end of i_bsis.
    Internal Table for BSEG Table data
    data: begin of i_bseg occurs 0,
            bukrs like bsis-bukrs,          " Company Code
            belnr like bsis-belnr,          " Acc Document
            buzei like bsis-buzei,          " Item No
            gjahr like bsis-gjahr,          " Fiscal Year
            shkzg like bseg-shkzg,          " Dr/Cr Indicator
            lifnr like bseg-lifnr,          " Vendor Code
            matnr like bseg-matnr,          " Material No
            ebeln like bseg-ebeln,          " Purchase Order
            ebelp like bseg-ebelp,          " PO Item
            werks like bseg-werks,          " Plant
            menge like bseg-menge,          " PO Quantity
            meins like bseg-meins,          " UOM
            dmbtr like bseg-dmbtr,          " Amount in Local Currency
            wrbtr like bseg-wrbtr,          " Amount in Trans.Currency
          end of i_bseg.
    Internal Table for BKPF Table data
    data: begin of i_bkpf occurs 0,
            bukrs like bkpf-bukrs,          " Company Code
            belnr like bkpf-belnr,          " Acc Document
            gjahr like bkpf-gjahr,          " Fiscal Year
            waers like bkpf-waers,          " Trans. Currency
            awkey like bkpf-awkey,          " Object Key
            awtyp like bkpf-awtyp,          " Reference Procedure
          end of i_bkpf.
    Internal Table for MSEG Table data
    data: begin of i_mseg occurs 0,
            mblnr like mseg-mblnr,          " Material Document
            mjahr like mseg-mjahr,          " Fiscal Year
            bwart like mseg-bwart,          " Movement Type
            matnr like mseg-matnr,          " Material No
            menge like mseg-menge,          " PO Quantity
            meins like mseg-meins,          " UOM
          end of i_mseg.
    Internal Table for MBEW Table data
    data: begin of i_mbew occurs 0,
            matnr like mbew-matnr,          " Material No
            werks like mbew-bwkey,          " Plant
            bklas like mbew-bklas,          " Valuation Class
          end of i_mbew.
    Internal Table for EKPO Table data
    data: begin of i_ekpo occurs 0,
            ebeln like ekpo-ebeln,          " Purchase Order
            ebelp like ekpo-ebelp,          " PO Item
            matnr like ekpo-matnr,          " Material No
            txz01 like ekpo-txz01,          " Material Text
          end of i_ekpo.
    Internal Table for EKKN Table data
    data: begin of i_ekkn occurs 0,
            ebeln like ekkn-ebeln,          " Purchase Order
            ebelp like ekkn-ebelp,          " PO Item
            kostl like ekkn-kostl,          " Cost Center
            sakto like ekkn-sakto,          " Cost Element
          end of i_ekkn.
    Internal Table for LFA1 Table data
    data: begin of i_lfa1 occurs 0,
            lifnr like lfa1-lifnr,          " Vendor
            name1 like lfa1-name1,          " Name
          end of i_lfa1.
    Declaration of Output Internal Table
    data: begin of i_final occurs 0,
            lifnr like lfa1-lifnr,     " Vendor
            werks like bseg-werks,     " Plant
            monat like bsis-monat,     " Period
            matnr like mara-matnr,     " Material Number
            bklas like mbew-bklas,     " Val Class
            ebeln like bseg-ebeln,     " PO
            kostl like ekkn-kostl,     " Cost Center
            sakto like ekkn-sakto,     " Cost Element
            budat like bsis-budat,     " Rec. Date
            name1 like lfa1-name1,     " Vendor Name
            belnr like bsis-belnr,     " FI Document
            bwart like mseg-bwart,     " Movement Type
            txz01 like ekpo-txz01,     " Material Text
            menge like bseg-menge,     " Quantity
            meins like bseg-meins,     " UOM
            dmbtr like bseg-dmbtr,     " Local Amount
            wrbtr like bseg-wrbtr,     " Tran.Amount
            waers like bkpf-waers,     " Tran.Currency
            status type c,             " Material Status
          end of i_final.
    Internal table to hold field catgory data
    data:  i_fldcat  type slis_t_fieldcat_alv.   " Table - field catgory
    Internal table to hold Sort/Subtotals criteria data
    data:  i_sort  type slis_t_sortinfo_alv.     " Table - sort/Subtotals
    Structure
    data:  x_layout   type slis_layout_alv,      " Structure-layout
           x_fldcat   like line of i_fldcat,     " Structure-field catagory
           x_sort     like line of i_sort.       " Structure-Sort/Subtotals
           Selection screen
    selection-screen : begin of block b1 with frame title text-000.
    parameters:
       p_bukrs like t001-bukrs obligatory,          " Company Code
       p_grira like ska1-saknr default '0241101000' obligatory. " Account
    select-options:
       s_budat for bkpf-budat,        " Posting Date
       s_werks for t001w-werks,       " Plant
       s_lifnr for lfa1-lifnr,        " Vendor
       s_matnr for mara-matnr,        " Material Number
       s_kostl for csks-kostl,        " Cost Center
       s_kstar for cska-kstar,        " Cost Element
       s_ebeln for ekko-ebeln,        " Purchase Order
       s_monat for bsis-monat.        " Period
    selection-screen skip.
    parameters:
       p_incmt as checkbox default 'X',
       p_incnm as checkbox default 'X'.
    selection-screen end of block b1.
    Initialization
    initialization.
      g_repid = sy-repid.
      perform layout_init using x_layout.
      perform eventtab_build using g_events[].
      g_variant-report = g_repid.
      g_save           = 'A'.
    At selection screen
    at selection-screen.
    Validation of Selection Screen Fields
      perform validate_screen.
    Start of selection
    start-of-selection.
    Read Data from Database Tables
      perform read_data.
    End of selection
    end-of-selection.
    Build layout report layout.
      perform populate_layout_stucture.
    Perform build_field_catalog and Sort Table
      perform build_field_catalog.
      perform build_sort_totals.
    List Header for Top-Of-Page
      perform comment_build using g_list_top_of_page[].
    Call list viewer function module
      perform call_list_viewer .
    ****************Form - Routines**************************************
          Form        : layout_init
          Description : Form to Build layout for list display
    form layout_init using rs_layout type slis_layout_alv.
      rs_layout-detail_popup      = c_x.
    endform.
    Form         : Eventtab_build
    Description  : Registration of events to happen during list display
    form eventtab_build using rt_events type slis_t_event.
    Registration of events to happen during list display
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = rt_events.
      read table rt_events with key name = slis_ev_top_of_page
                               into ls_event.
      if sy-subrc = 0.
        move g_top_of_page to ls_event-form.
        append ls_event to rt_events.
      endif.
    endform.                                   "eventtab_build
          Form : top_of_page
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
             I_LOGO             = 'ENJOYSAP_LOGO'
                it_list_commentary = g_list_top_of_page.
    endform.
          Form validate_screen
    Validation of Selection Screen fields
    form validate_screen.
    Validation of Company Code
      clear t001.
      if not p_bukrs is initial.
        select single bukrs
          into t001-bukrs
          from t001
          where bukrs eq p_bukrs.
        if sy-subrc <> 0.
          message e899 with 'Enter Valid Company Code'(012).
        endif.
      endif.
    Validation of GL Account (GR/IR)
      clear ska1.
      if not p_grira is initial.
        select saknr
          into ska1-saknr
          from ska1
          up to 1 rows
          where saknr eq p_grira.
        endselect.
        if sy-subrc <> 0.
          message e899 with 'Enter Valid GR/IR Account'(013).
        endif.
      endif.
    Validation of Vendor Code
      clear lfa1.
      if not s_lifnr[] is initial.
        select single lifnr
          into lfa1-lifnr
          from lfa1
          where lifnr in s_lifnr.
        if sy-subrc <> 0.
          message e899 with 'Enter Valid Vendor'(001).
        endif.
      endif.
    Validation of Plant Code
      clear t001w.
      if not s_werks[] is initial.
        select single werks
          into t001w-werks
          from t001w
          where werks in s_werks.
        if sy-subrc <> 0.
          message e899 with 'Enter Valid Plant'(014).
        endif.
      endif.
    Validation of Material Code
      clear mara.
      if not s_matnr[] is initial.
        select single matnr
          into mara-matnr
          from mara
          where matnr in s_matnr.
        if sy-subrc <> 0.
          message e899 with 'Enter Valid Material'(015).
        endif.
      endif.
    Validation of Purchase Order
      clear ekko.
      if not s_ebeln[] is initial.
        select single ebeln
          into ekko-ebeln
          from ekko
          where ebeln in s_ebeln.
        if sy-subrc <> 0.
          message e899 with 'Enter Valid Purchase Order'(016).
        endif.
      endif.
    Validation of Cost Center
      clear csks.
      if not s_kostl[] is initial.
        select kostl
          into csks-kostl
          from csks
          up to 1 rows
          where kostl in s_kostl.
        endselect.
        if sy-subrc <> 0.
          message e899 with 'Enter Valid Cost Center'(017).
        endif.
      endif.
    Validation of Cost Element
      clear cska.
      if not s_kstar[] is initial.
        select kstar
          into cska-kstar
          from cska
          up to 1 rows
          where kstar in s_kstar.
        endselect.
        if sy-subrc <> 0.
          message e899 with 'Enter Valid Cost Element'(018).
        endif.
      endif.
    endform.                          "validate_screen
    *&      Form  read_data
    Read the Data from the database Tables
    form read_data.
    Get the Accounting Documents for the GR/IR Account Entered on
    Selection Screen
      clear i_bsis.
      refresh i_bsis.
      select bukrs           " Company Code
             hkont           " GR IR Account
             gjahr           " Fiscal Year
             belnr           " Acc Document
             buzei           " Item No
             budat           " Receipt Date(Posting)
             monat           " Period
       into table i_bsis
       from  bsis
       where  bukrs = p_bukrs
         and  hkont = p_grira
         and  budat in s_budat
         and  monat in s_monat .
      if sy-subrc <> 0.
        message i899 with 'No data found'(043).
        g_exit = c_x.
        stop.
      endif.
      sort i_bsis by bukrs hkont gjahr belnr buzei.
    Get the Vendor,PO,Material,Qty details from BSEG Table
      if not i_bsis[] is initial.
        clear i_bseg.
        refresh i_bseg.
        select bukrs           " Company Code
               belnr           " Acc Document
               buzei           " Item No
               gjahr           " Fiscal Year
               shkzg           " Dr/Cr Indicator
               lifnr           " Vendor Code
               matnr           " Material No
               ebeln           " Purchase Order
               ebelp           " PO Item
               werks           " Plant
               menge           " PO Quantity
               meins           " UOM
               dmbtr           " Amount in Local Currency
               wrbtr           " Amount in Trans.Currency
        into table i_bseg
        from   bseg
        for all entries in i_bsis
        where  bukrs = p_bukrs
        and    belnr = i_bsis-belnr
        and    gjahr = i_bsis-gjahr
        and    buzei = i_bsis-buzei
        and    lifnr in s_lifnr
        and    werks in s_werks
        and    matnr in s_matnr
        and    ebeln in s_ebeln.
        sort i_bseg by bukrs belnr buzei gjahr.
    Select the Trans.Currency from BKPF Table
        clear i_bkpf.
        refresh i_bkpf.
        select bukrs           " Company Code
               belnr           " Acc Document
               gjahr           " Fiscal Year
               waers           " Trans. Currency
               awkey           " Object Key
               awtyp           " Reference Procedure
        into table i_bkpf
        from   bkpf
        for all entries in i_bsis
        where  bukrs = p_bukrs
        and    belnr = i_bsis-belnr
        and    gjahr = i_bsis-gjahr.
      endif.
      sort i_bkpf by bukrs belnr gjahr.
    Get the Quantity and UOM of Material from MSEG Table
      if not i_bkpf[] is initial.
        clear i_mseg.
        refresh i_mseg.
        select mblnr           " Material Document
               mjahr           " Fiscal Year
               bwart           " Movement Type
               matnr           " Material No
               menge           " PO Quantity
               meins           " UOM
          into table i_mseg
          from   mseg
          for all entries in i_bkpf
          where  mblnr = i_bkpf-awkey(10).
      endif.
      sort i_mseg by mblnr mjahr.
    Get the Material And Description from EKPO Table
      if not i_bseg[] is initial.
        clear i_ekpo.
        refresh i_ekpo.
        select ebeln           " Purchase Order
               ebelp           " PO Item
               matnr           " Material No
               txz01           " Material Text
        into table i_ekpo
        from   ekpo
        for all entries in i_bseg
        where  ebeln = i_bseg-ebeln
        and    ebelp = i_bseg-ebelp.
        sort i_ekpo by ebeln ebelp.
    Get the Valuation Class from MBEW Table
        clear i_mbew.
        refresh i_mbew.
        select matnr           " Material No
               bwkey           " Plant
               bklas           " Valuation Class
        into table i_mbew
        from   mbew
        for all entries in i_bseg
        where  matnr = i_bseg-matnr
        and    bwkey = i_bseg-werks.
        sort i_mbew by matnr werks.
    Get the Cost Center and Cost Element of the PO from EKKN Table
        clear i_ekkn.
        refresh i_ekkn.
        select ebeln           " Purchase Order
               ebelp           " PO Item
               kostl           " Cost Center
               sakto           " Cost Element
        into table i_ekkn
        from   ekkn
        for all entries in i_bseg
        where  ebeln = i_bseg-ebeln
        and    ebelp = i_bseg-ebelp
        and    kostl in s_kostl
        and    sakto in s_kstar.
        sort i_ekkn by ebeln ebelp.
    Get the Vendor Name
        clear i_lfa1.
        refresh i_lfa1.
        select lifnr            " Vendor
               name1            " Name
        into table i_lfa1
        from   lfa1
        for all entries in i_bseg
        where  lifnr = i_bseg-lifnr.
      endif.
      sort i_lfa1 by lifnr.
    Move the data to Final Output Internal Table
      loop at i_bsis.
        i_final-belnr = i_bsis-belnr.     " FI Document
        i_final-monat = i_bsis-monat.     " Period
        i_final-budat = i_bsis-budat.     " Rec. Date
    Read the Transaction Currency from BKPF Internal Table
        read table i_bkpf with key bukrs = i_bsis-bukrs
                                   belnr = i_bsis-belnr
                                   gjahr = i_bsis-gjahr
                                   binary search.
        if sy-subrc = 0.
          i_final-waers = i_bkpf-waers.     " Tran.Currency
    Read the Movement Type for all Material Related
    Documents from MSEG Internal Table
          if i_bkpf-awtyp = c_mkpf.
            read table i_mseg with key mblnr = i_bkpf-awkey(10)
                                       mjahr = i_bkpf-awkey+10(4).
            if sy-subrc = 0.
              i_final-bwart = i_mseg-bwart.     " Movement Type
            endif.
          endif.
        endif.
    Read Vendor, Plant, PO Document, Local And Trans.Amounts
    from BSEG Internal Table
        read table i_bseg with key bukrs = i_bsis-bukrs
                                   belnr = i_bsis-belnr
                                   gjahr = i_bsis-gjahr
                                   buzei = i_bsis-buzei
                                   binary search.
        if sy-subrc = 0.
          i_final-lifnr = i_bseg-lifnr.     " Vendor
          i_final-werks = i_bseg-werks.     " Plant
          i_final-ebeln = i_bseg-ebeln.     " PO
          i_final-dmbtr = i_bseg-dmbtr.     " Local Amount
          i_final-wrbtr = i_bseg-wrbtr.     " Tran.Amount
          i_final-menge = i_bseg-menge.     " Quantity
          i_final-meins = i_bseg-meins.     " UOM
    For Credit Indicator(SHKZG = H) amounts should be (-)ve
          if i_bseg-shkzg = c_h.
            i_final-dmbtr = i_final-dmbtr * -1.
            i_final-wrbtr = i_final-wrbtr * -1.
            i_final-menge = i_final-menge * -1.
          endif.
    Read the Material and its Description from EKPO Internal Table
          read table i_ekpo with key ebeln = i_bseg-ebeln
                                     ebelp = i_bseg-ebelp
                                     matnr = i_bseg-matnr
                                     binary search.
          if sy-subrc = 0.
            i_final-matnr = i_ekpo-matnr.     " Material Number
            i_final-txz01 = i_ekpo-txz01.     " Material Text
    Populate the Material Status depending on the Input Checkbox
    On Selection Screen
            if not i_ekpo-matnr is initial.
              i_final-status = c_x.
            endif.
          endif.
    Read the PO related Cost Element and Cost Centers
    from EKKN Internal Table
          read table i_ekkn with key ebeln = i_bseg-ebeln
                                     ebelp = i_bseg-ebelp
                                     binary search.
          if sy-subrc = 0.
            i_final-kostl = i_ekkn-kostl.     " Cost Center
            i_final-sakto = i_ekkn-sakto.     " Cost Element
          endif.
    Read the Valuation Class from MBEW Internal Table
          read table i_mbew with key matnr = i_bseg-matnr
                                     werks = i_bseg-werks
                                     binary search.
          if sy-subrc = 0.
            i_final-bklas = i_mbew-bklas.     " Val Class
          endif.
    Read the Vendor Name from LFA1 Internal Table
          read table i_lfa1 with key lifnr = i_bseg-lifnr
                                     binary search.
          if sy-subrc = 0.
            i_final-name1 = i_lfa1-name1.     " Vendor Name
          endif.
        endif.
        append i_final.
        clear i_final.
      endloop.
      sort i_final by lifnr werks monat matnr.
    Depending on the check Box Selected display the data
      if p_incmt = c_x and p_incnm ne c_x.
        delete i_final where matnr eq space.
      elseif p_incnm = c_x and p_incmt ne c_x.
        delete i_final where matnr ne space.
      endif.
    endform.           "Read Data
         Form        : populate_layout_stucture
         Description : Populating the layout structure
    form populate_layout_stucture.
      clear x_layout .
    Layout properties
      x_layout-zebra                = c_x.
      x_layout-detail_popup         = c_x.
      x_layout-detail_initial_lines = c_x.
      x_layout-colwidth_optimize    = c_x.
    endform.                    " populate_layout_stucture
         Form        : build_field_catalog
         Description : Building the field catalog data
    form build_field_catalog.
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
           exporting
                i_program_name         = g_repid
                i_internal_tabname     = 'I_FINAL'
                i_inclname             = g_repid
           changing
                ct_fieldcat            = i_fldcat
           exceptions
                inconsistent_interface = 1
                program_error          = 2
                others                 = 3.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    Getting the Header text for the coloums
      loop at i_fldcat into x_fldcat where fieldname = 'LIFNR' or
                                           fieldname = 'NAME1' or
                                           fieldname = 'WERKS' or
                                           fieldname = 'MONAT' or
                                           fieldname = 'MATNR' or
                                           fieldname = 'BKLAS' or
                                           fieldname = 'EBELN' or
                                           fieldname = 'KOSTL' or
                                           fieldname = 'SAKTO' or
                                           fieldname = 'BUDAT' or
                                           fieldname = 'BELNR' or
                                           fieldname = 'BWART' or
                                           fieldname = 'TXZ01' or
                                           fieldname = 'MENGE' or
                                           fieldname = 'MEINS' or
                                           fieldname = 'DMBTR' or
                                           fieldname = 'WRBTR' or
                                           fieldname = 'WAERS' or
                                           fieldname = 'STATUS'.
        if x_fldcat-fieldname = 'LIFNR'.
          x_fldcat-seltext_l   = 'Vendor'(003).
          x_fldcat-seltext_m   = 'Vendor'(003).
          x_fldcat-seltext_s   = 'Vendor'(003).
          x_fldcat-reptext_ddic = 'Vendor'(003).
          x_fldcat-inttype   = c_c.
        endif.
        if x_fldcat-fieldname = 'NAME1'.
          x_fldcat-seltext_l   = 'Vendor Name'(002).
          x_fldcat-seltext_m   = 'Vendor Name'(002).
          x_fldcat-seltext_s   = 'Vendor Name'(002).
          x_fldcat-reptext_ddic = 'Vendor Name'(002).
          x_fldcat-inttype   = c_c.
        endif.
        if x_fldcat-fieldname = 'WERKS'.
          x_fldcat-seltext_l   = 'Plant'(010).
          x_fldcat-seltext_m   = 'Plant'(010).
          x_fldcat-seltext_s   = 'Plant'(010).
          x_fldcat-reptext_ddic   = 'Plant'(010).
          x_fldcat-ddictxt   = c_l.
        endif.
        if x_fldcat-fieldname = 'MONAT'.
          x_fldcat-seltext_l   = 'Period'(011).
          x_fldcat-seltext_m   = 'Period'(011).
          x_fldcat-seltext_s   = 'Period'(011).
          x_fldcat-reptext_ddic   = 'Period'(011).
          x_fldcat-ddictxt   = c_l.
        endif.
        if x_fldcat-fieldname = 'MATNR'.
          x_fldcat-seltext_l   = 'Material'(004).
          x_fldcat-seltext_m   = 'Material'(004).
          x_fldcat-seltext_s   = 'Material'(004).
          x_fldcat-reptext_ddic   = 'Material'(004).
          x_fldcat-ddictxt   = c_l.
        endif.
        if x_fldcat-fieldname = 'BKLAS'.
          x_fldcat-seltext_l   = 'Valuation Class'(009).
          x_fldcat-seltext_m   = 'Valuation Class'(009).
          x_fldcat-seltext_s   = 'Valuation Class'(009).
          x_fldcat-reptext_ddic   = 'Valuation Class'(009).
          x_fldcat-ddictxt   = c_l.
        endif.
        if x_fldcat-fieldname = 'EBELN'.
          x_fldcat-seltext_l   = 'Purchase Order'(005).
          x_fldcat-seltext_m   = 'Purchase Order'(005).
          x_fldcat-seltext_s   = 'Purchase Order'(005).
          x_fldcat-reptext_ddic   = 'Purchase Order'(005).
          x_fldcat-ddictxt   = c_l.
        endif.
        if x_fldcat-fieldname = 'KOSTL'.
          x_fldcat-seltext_l   = 'Cost Center'(006).
          x_fldcat-seltext_m   = 'Cost Center'(006).
          x_fldcat-seltext_s   = 'Cost Center'(006).
          x_fldcat-reptext_ddic   = 'Cost Center'(006).
          x_fldcat-ddictxt   = c_l.
        endif.
        if x_fldcat-fieldname = 'SAKTO'.
          x_fldcat-seltext_l   = 'Cost Element'(007).
          x_fldcat-seltext_m   = 'Cost Element'(007).
          x_fldcat-seltext_s   = 'Cost Element'(007).
          x_fldcat-reptext_ddic   = 'Cost Element'(007).
          x_fldcat-ddictxt   = c_l.
        endif.
        if x_fldcat-fieldname = 'BUDAT'.
          x_fldcat-seltext_l   = 'Receipt Date'(008).
          x_fldcat-seltext_m   = 'Receipt Date'(008).
          x_fldcat-seltext_s   = 'Receipt Date'(008).
          x_fldcat-reptext_ddic   = 'Receipt Date'(008).
          x_fldcat-ddictxt   = c_l.
        endif.
        if x_fldcat-fieldname = 'BELNR'.
          x_fldcat-seltext_l   = 'Acc.Document'(100).
          x_fldcat-seltext_m   = 'Acc.Document'(100).
          x_fldcat-seltext_s   = 'Acc.Document'(100).
          x_fldcat-reptext_ddic   = 'Acc.Document'(100).
          x_fldcat-ddictxt   = c_l.
        endif.
        if x_fldcat-fieldname = 'BWART'.
          x_fldcat-seltext_l   = 'Movement Type'(101).
          x_fldcat-seltext_m   = 'Movement Type'(101).
          x_fldcat-seltext_s   = 'Movement Type'(101).
          x_fldcat-reptext_ddic   = 'Movement Type'(101).
          x_fldcat-ddictxt   = c_l.
        endif.
        if x_fldcat-fieldname = 'TXZ01'.
          x_fldcat-seltext_l   = 'Material Text'(102).
          x_fldcat-seltext_m   = 'Material Text'(102).
          x_fldcat-seltext_s   = 'Material Text'(102).
          x_fldcat-reptext_ddic   = 'Material Text'(102).
          x_fldcat-ddictxt   = c_l.
        endif.
        if x_fldcat-fieldname = 'MENGE'.
          x_fldcat-seltext_l   = 'Quantity'(103).
          x_fldcat-seltext_m   = 'Quantity'(103).
          x_fldcat-seltext_s   = 'Quantity'(103).
          x_fldcat-reptext_ddic   = 'Quantity'(103).
          x_fldcat-ddictxt   = c_l.
          x_fldcat-do_sum    = c_x.
        endif.
        if x_fldcat-fieldname = 'MEINS'.
          x_fldcat-seltext_l   = 'UOM'(104).
          x_fldcat-seltext_m   = 'UOM'(104).
          x_fldcat-seltext_s   = 'UOM'(104).
          x_fldcat-reptext_ddic   = 'UOM'(104).
          x_fldcat-ddictxt   = c_l.
        endif.
        if x_fldcat-fieldname = 'DMBTR'.
          x_fldcat-seltext_l   = 'Amount in Local Curr'(105).
          x_fldcat-seltext_m   = 'Amount in Local Curr'(105).
          x_fldcat-seltext_s   = 'Amount in Local Curr'(105).
          x_fldcat-reptext_ddic   = 'Amount in Local Curr'(105).
          x_fldcat-ddictxt   = c_l.
          x_fldcat-do_sum    = c_x.
        endif.
        if x_fldcat-fieldname = 'WRBTR'.
          x_fldcat-seltext_l   = 'Amount in Trans.Curr'(106).
          x_fldcat-seltext_m   = 'Amount in Trans.Curr'(106).
          x_fldcat-seltext_s   = 'Amount in Trans.Curr'(106).
          x_fldcat-reptext_ddic   = 'Amount in Trans.Curr'(106).
          x_fldcat-ddictxt   = c_l.
          x_fldcat-do_sum    = c_x.
        endif.
        if x_fldcat-fieldname = 'WAERS'.
          x_fldcat-seltext_l   = 'Trans.Currency'(107).
          x_fldcat-seltext_m   = 'Trans.Currency'(107).
          x_fldcat-seltext_s   = 'Trans.Currency'(107).
          x_fldcat-reptext_ddic   = 'Trans.Currency'(107).
          x_fldcat-ddictxt   = c_l.
        endif.
        if x_fldcat-fieldname = 'STATUS'.
          x_fldcat-seltext_l   = 'Material Status'(019).
          x_fldcat-seltext_m   = 'Material Status'(019).
          x_fldcat-seltext_s   = 'Material Status'(019).
          x_fldcat-reptext_ddic   = 'Material Status'(019).
          x_fldcat-ddictxt   = c_l.
        endif.
        modify i_fldcat from x_fldcat index sy-tabix.
      endloop.
    endform.                    " build_field_catalog
         Form        : build_sort_totals
         Description : Building the Criteria for Sort/Subtotals
    form build_sort_totals.
      x_sort-fieldname = 'LIFNR'.
      x_sort-tabname   = 'I_FINAL'.
      x_sort-spos      =  1.
      x_sort-up        =  c_x.
      x_sort-subtot    = c_x.
      append x_sort to i_sort.
      clear  x_sort.
      x_sort-fieldname = 'WERKS'.
      x_sort-tabname   = 'I_FINAL'.
      x_sort-spos      =  2.
      x_sort-up        =  c_x.
      x_sort-subtot    = c_x.
      append x_sort to i_sort.
      clear  x_sort.
      x_sort-fieldname = 'MONAT'.
      x_sort-tabname   = 'I_FINAL'.
      x_sort-spos      =  3.
      x_sort-up        =  c_x.
      x_sort-subtot    = c_x.
      append x_sort to i_sort.
      clear  x_sort.
      x_sort-fieldname = 'MATNR'.
      x_sort-tabname   = 'I_FINAL'.
      x_sort-spos      =  4.
      x_sort-up        =  c_x.
      x_sort-subtot    = c_x.
      append x_sort to i_sort.
      clear  x_sort.
      x_sort-fieldname = 'BKLAS'.
      x_sort-tabname   = 'I_FINAL'.
      x_sort-spos      =  5.
      x_sort-up        =  c_x.
      x_sort-subtot    = c_x.
      append x_sort to i_sort.
      clear  x_sort.
      x_sort-fieldname = 'EBELN'.
      x_sort-tabname   = 'I_FINAL'.
      x_sort-spos      =  6.
      x_sort-up        =  c_x.
      x_sort-subtot    = c_x.
      append x_sort to i_sort.
      clear  x_sort.
      x_sort-fieldname = 'KOSTL'.
      x_sort-tabname   = 'I_FINAL'.
      x_sort-spos      =  7.
      x_sort-up        =  c_x.
      x_sort-subtot    = c_x.
      append x_sort to i_sort.
      clear  x_sort.
      x_sort-fieldname = 'SAKTO'.
      x_sort-tabname   = 'I_FINAL'.
      x_sort-spos      =  8.
      x_sort-up        =  c_x.
      x_sort-subtot    = c_x.
      append x_sort to i_sort.
      clear  x_sort.
      x_sort-fieldname = 'BUDAT'.
      x_sort-tabname   = 'I_FINAL'.
      x_sort-spos      =  9.
      x_sort-up        =  c_x.
      x_sort-subtot    = c_x.
      append x_sort to i_sort.
      clear  x_sort.
    endform.                    " build_sort_totals
      Form        : comment_build
      Description : This form is used to display the Report Header(ALV)
    form comment_build using lt_top_of_page type
                                            slis_t_listheader.
      data: l_line type slis_listheader,
            l_heading1 like rs38m-repti,
            l_date(10), l_time(8).
      clear l_line.
      l_heading1 = 'GR/IR DETAIL REPORT'(021).
      g_repid = sy-repid.
      write sy-uzeit to l_time.
      write sy-datum to l_date.
      l_line-typ = c_h.
      move l_heading1 to l_line-info.
      append l_line to lt_top_of_page.
      clear l_line.
      l_line-typ  = c_s.
      concatenate 'System:'(023) sy-sysid
                  'Date:'(024) l_date
                  ' Time:'(025)
                  l_time into l_line-info.
      append l_line to lt_top_of_page.
      concatenate 'Report:'(026) g_repid
                  ' User:'(027) sy-uname into
                  l_line-info.
      append l_line to lt_top_of_page.
      l_line-typ = c_a.
      move 'SELECTION CRITERIA:'(028) to l_line-info.
      append l_line to lt_top_of_page.
      concatenate ' Company Code : '(029)
                  p_bukrs into l_line-info.
      append l_line to lt_top_of_page.
      concatenate ' GR/IR Account: '(030)
                  p_grira into l_line-info.
      append l_line to lt_top_of_page.
      concatenate ' Posting Date : '(032) s_budat-low
                  ' To: '(031) s_budat-high into l_line-info.
      append l_line to lt_top_of_page.
      concatenate ' Plant : '(033) s_werks-low
                  ' To: '(031) s_werks-high into l_line-info.
      append l_line to lt_top_of_page.
      concatenate ' Vendor: '(034) s_lifnr-low
                  ' To: '(031) s_lifnr-high into l_line-info.
      append l_line to lt_top_of_page.
      concatenate ' Material: '(035) s_matnr-low
                  ' To: '(031) s_matnr-high into l_line-info.
      append l_line to lt_top_of_page.
      concatenate ' Cost Center : '(036) s_kostl-low
                  ' To: '(031) s_kostl-high into l_line-info.
      append l_line to lt_top_of_page.
      concatenate ' Cost Element: '(037) s_kstar-low
                  ' To: '(031) s_kstar-high into l_line-info.
      append l_line to lt_top_of_page.
      concatenate ' Purchase Order: '(038) s_ebeln-low
                  ' To: '(031) s_ebeln-high into l_line-info.
      append l_line to lt_top_of_page.
      concatenate ' Period : '(039) s_monat-low
                  ' To: '(031) s_monat-high into l_line-info.
      append l_line to lt_top_of_page.
      concatenate ' Include Material Items: '(040)
                  p_incmt into l_line-info.
      append l_line to lt_top_of_page.
      concatenate ' Include Non-Material Items: '(041)
                  p_incnm into l_line-info.
      append l_line to lt_top_of_page.
    endform.
         Form        : call_list_viewer
         Description : This form is used to display the grid through ALV
    form call_list_viewer.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = g_repid
                is_layout               = x_layout
                it_fieldcat             = i_fldcat[]
                i_default               = c_x
                it_sort                 = i_sort[]
                i_save                  = g_save
                is_variant              = g_variant
                it_events               = g_events[]
           importing
                e_exit_caused_by_caller = g_exit_caused_by_caller
                es_exit_caused_by_user  = g_exit_caused_by_user
           tables
                t_outtab                = i_final
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
        write: / 'Problem in calling the ALV report'(042).
      endif.
    endform.                    " call_list_viewer
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • ALV and TABSTRIP

    Hi,
    I have an alv and tabstrip on the same page. When i click one field( hotspot ) i wanna change the selected tab of tabstrip. Is there any way to do this ?

    Hi ,
    First of all you need to set 'X' to i_appl_events parameter when creating your alv object. It will trigger PAI after , ALV related event. Maybe you can use a global variable to set which indicates hotspot event was triggered to cahnge tabstrip and than in a module at the pai for example module go_to_tabstrip.
    i_parent = gv_custom_container
    i_appl_events = 'X'
    module go_to_tabstrip.
    CHECK gv_hotsp_clicked = 'X'.
    *** Your Action
    *** Set initial on exit
    gv_hotsp_clicked = space.
    endmodule.

Maybe you are looking for

  • USB-6009 Temperature Acquisition

    Hi All I seem to have some brain fade today. I need to use the USB-6009 to with a J type thermocouple. When I hook it up the temperature is not correct and widely varies. I am getting reading from 0 to 60 C at room temperature. I need to incorporate

  • How do sync my iPad with another computer?

    How do I sync my iPad with my new computer?  I have imported all my songs, books, apps, etc. but did not do it by dragging over the old iTunes folder because the file structure is different and I did not want to mess up the new file structure with th

  • I need an AC Adapter for Satellite P300

    I'm from Canada first off, I know this is a Europe forum... Ok, so my question is my AC stopped working and it's not covered under the warrenty, So I was hoping that you guys could put me in the right direction of getting an adapter cheap, whether of

  • Some ipod songs are not displayed in itunes

    I discovered several duplicated songs on my ipod touch, so I connected to itunes (PC), but the duplicated songs were only listed once when viewing the ipod music in itunes. While in itunes, viewing my ipod music, I erased all the music on my ipod and

  • Bacground job cancelled in Solman system.

    Hi experts, Two bacground job cancelled in Solman system. 1. SM:SELFDIAGNOSIS Job started Step 001 started (program RDSWP_SELF_DIAGNOSIS, variant &0000000001018, user ID SAP*) ABAP/4 processor: MOVE_TO_LIT_NOTALLOWED_NODATA Job cancelled 2.SM:SYNC SA