Calling infotype 0002 in ALV  report for showing employee photo

Hi all,
The requirment from business side is a report in which employees personal data shuold be shown with employee photo, I had tried for employee photo in ALV report but it didnt sucessed, then I went for other solution like calling transaction in ALV report.
In this case I am calling Infotype 0002 but the issue is that the transaction PA20 is coming with PERNR but I am not able to go directlly to infotype which shows employee Photo,please suggest any solution.
Thaks.
JAY

Hi Jay,
It is possible. Please refer the syntax for the CALL TRANSACTION
CALL TRANSACTION ta { [AND SKIP FIRST SCREEN]
                    | [USING bdc_tab [bdc_options]] }.
You can do a recording till the required page comes & call the transaction accordingly. Hope, you are aware about the same.
For example, I just had a solution to go to the roles tab in the user profile and I did as below:
    CLEAR wa_bdcdata.
    wa_bdcdata-program  = 'SAPLSUU5'.
    wa_bdcdata-dynpro   = '0050'.
    wa_bdcdata-dynbegin = k_ok.
    APPEND wa_bdcdata TO it_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-fnam  = 'BDC_CURSOR'.
    wa_bdcdata-fval   = 'USR02-BNAME'.
    APPEND wa_bdcdata TO it_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-fnam  = 'USR02-BNAME'.
    wa_bdcdata-fval   = g_value.
    APPEND wa_bdcdata TO it_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-fnam  = 'BDC_OKCODE'.
    wa_bdcdata-fval   = 'SHOW'.
    APPEND wa_bdcdata TO it_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-program  = 'SAPLSUU5'.
    wa_bdcdata-dynpro   = '0100'.
    wa_bdcdata-dynbegin = k_ok.
    APPEND wa_bdcdata TO it_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-fnam  = 'BDC_OKCODE'.
    wa_bdcdata-fval   = '=ACTG'.
    APPEND wa_bdcdata TO it_bdcdata.
    g_opt-dismode = 'E'.
    g_opt-defsize = k_ok.
*** if user click on the User Name, call SU01
    CALL TRANSACTION 'SU01' USING it_bdcdata
                OPTIONS FROM g_opt.
Regards,
Selva K.

Similar Messages

  • Need to create alv report to show pan card number.

    Hi,
    I need to create alv report to show employee and vendor  name , number ,  Pan card number .This is for hr module.
    could any one tell me table and fields for this and how I can relate them with foriegn and primary key.
    Regards,
    Moderator Message: Do your own work
    Edited by: kishan P on Oct 5, 2010 10:38 AM

    Yes, but it only has one generic Date column, no start date and end date. I can't use that twice in the prompt. Although I can specify it to be 'between', but I'm not sure I can pass values to both variables like that.
    Currently I have used Campaign Start Date and Campaign End Date to enter values in calender format to the variables.

  • Alv Report for invoice details

    Dear All,
                 I need to develop one alv report for following details. i developed coding for this requirment but i am getting some error.kindley help me to how to move data from different internal table to final internal table. I used LOOP AT and READ Statement even i didn't get any output.
    kindley help me out.
    TYPES: BEGIN OF XT_TAB,
             LIFNR  LIKE LFA1-LIFNR,
             NAME1  LIKE LFA1-NAME1,
             STCD1  LIKE LFA1-STCD1,
             STCD2  LIKE LFA1-STCD2,
             STCD3  LIKE LFA1-STCD3,
             STCD4  LIKE LFA1-STCD4,
           END OF XT_TAB.
    TYPES: BEGIN OF YT_TAB,
            BUKRS LIKE BSEG-BUKRS,
            BELNR LIKE BSEG-BELNR,
            BUZEI LIKE BSEG-BUZEI,
            LIFNR LIKE BSEG-LIFNR,
            GJAHR LIKE BSEG-GJAHR,
           END OF YT_TAB.
    TYPES: BEGIN OF ZT_TAB,
            LIFNR  LIKE LFA1-LIFNR,
            NAME1  LIKE LFA1-NAME1,
            STCD2  LIKE LFA1-STCD2,
            BELNR  LIKE BSEG-BELNR,
            BUZEI  LIKE BSEG-BUZEI,
            GJAHR  LIKE BSEG-GJAHR,
           END OF ZT_TAB.
           I N T E R N A L   T A B L E   D E C L A R A T I O N S         *
    *-----Internal table to store data
    DATA: ITAB1   TYPE STANDARD TABLE OF XT_TAB INITIAL SIZE 0,
          WA_TAB1 TYPE XT_TAB.
    DATA: ITAB2   TYPE STANDARD TABLE OF YT_TAB INITIAL SIZE 0,
          WA_TAB2 TYPE YT_TAB.
    DATA:   ITAB  TYPE STANDARD TABLE OF  ZT_TAB  WITH HEADER LINE,
            WA_ITAB TYPE ZT_TAB,
            ITAB_FINAL2 TYPE STANDARD TABLE OF ZT_TAB.
    DATA: ITAB_TEMP1 TYPE STANDARD TABLE OF ZT_TAB  WITH HEADER LINE.
                    Selection Screen Declarations                        *
    SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN begin OF LINE.
    SELECTION-SCREEN COMMENT (23) text-003 FOR FIELD P_LIFNR.
    PARAMETERS P_LIFNR LIKE LFA1-LIFNR OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN END OF BLOCK bk1.
    START-OF-SELECTION.
          PERFORM XTRACT_DATA.
    END-OF-SELECTION.
    *-----Filling the Output table
      PERFORM populate_main_table.
          PERFORM BUILD_FIELDCATALOG.
         PERFORM SORTING.
          PERFORM BUILD_LAYOUT.
          PERFORM BUILD_ALV_GRID_DISPLAY.
         Form  XTRACT_DATA
    FORM XTRACT_DATA .
    *SELECT
          a~LIFNR
          a~NAME1
          a~STCD2
          b~BELNR
          b~BUZEI
          b~GJAHR
    INTO TABLE ITAB
    FROM LFA1 as a INNER JOIN BSEG as b
      ON  aLIFNR = bLIFNR
    WHERE  a~LIFNR = P_LIFNR.
    SELECT LIFNR
           NAME1
           STCD1
           STCD2
           STCD3
           STCD4
      FROM LFA1
      INTO TABLE ITAB1
      WHERE LIFNR = P_LIFNR.
    IF NOT ITAB1[] IS INITIAL.
        SORT ITAB1 BY LIFNR.
        SELECT BELNR
               BUZEI
               LIFNR
               GJAHR
    INTO TABLE ITAB2
          FROM BSEG
    FOR ALL ENTRIES IN ITAB1
    WHERE LIFNR = ITAB1-LIFNR.
    ENDIF.
    ENDFORM.                    " XTRACT_DATA
    *&      Form  POPULATE_MAIN_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM POPULATE_MAIN_TABLE .
       LOOP AT ITAB1 INTO WA_TAB1.
               ITAB-LIFNR = ITAB1-LIFNR.
               ITAB-NAME1 = ITAB1-NAME1.
               ITAB-STCD2 = ITAB1-STCD2.
       READ TABLE ITAB2 INTO WA_TAB2 WITH KEY LIFNR = WA_TAB1-LIFNR.
               IF sy-subrc = 0.
               ITAB-BELNR = ITAB1-BELNR.
               ITAB-BUZEI = ITAB1-BUZEI.
               ITAB-GJAHR = ITAB1-GJAHR.
               ENDIF.
      ENDLOOP.
      ENDFORM.                    " POPULATE_MAIN_TABLE
         Form  BUILD_FIELDCATALOG
    FORM BUILD_FIELDCATALOG .
      REFRESH t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 1.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Vendor Number'.
      wa_fcat-seltext_m = 'Vendor Number'.
      wa_fcat-seltext_l = 'Vendor Number'.
      wa_fcat-fieldname = 'LIFNR'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 2.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Vendor Name'.
      wa_fcat-seltext_m = 'Vendor Name'.
      wa_fcat-seltext_l = 'Vendor Name'.
      wa_fcat-fieldname = 'NAME1'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 3.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Vendor TIN Number'.
      wa_fcat-seltext_m = 'Vendor TIN Number'.
      wa_fcat-seltext_l = 'Vendor TIN Number'.
      wa_fcat-fieldname = 'STCD2'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 4.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Document No'.
      wa_fcat-seltext_m = 'Document No'.
      wa_fcat-seltext_l = 'Document No'.
      wa_fcat-fieldname = 'BELNR'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 5.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Item Number'.
      wa_fcat-seltext_m = 'Item Number'.
      wa_fcat-seltext_l = 'Item Number'.
      wa_fcat-fieldname = 'BUZEI'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 6.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Fiscal Year'.
      wa_fcat-seltext_m = 'Fiscal Year'.
      wa_fcat-seltext_l = 'Fiscal Year'.
      wa_fcat-fieldname = 'GJAHR'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
    ENDFORM.                    " BUILD_FIELDCATALOG
         Form  BUILD_LAYOUT
    FORM BUILD_LAYOUT .
    GD_LAYOUT-NO_INPUT = 'X'.
    GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    GD_LAYOUT-TOTALS_TEXT = 'TOTALS'.
    ENDFORM.                    " BUILD_LAYOUT
         Form  BUILD_ALV_GRID_DISPLAY
    FORM BUILD_ALV_GRID_DISPLAY .
    gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program      = gd_repid
                i_callback_top_of_page  = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
                is_layout               = gd_layout
                it_fieldcat             = t_fcat[]
                it_events               = gt_events
                is_print                = gd_prntparams
                it_sort                 = it_sortcat[]
                i_save                  = 'X'
           TABLES
                t_outtab                = ITAB
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
    thanks and regards
    Murugesh

    TYPES: BEGIN OF XT_TAB,
             LIFNR  LIKE LFA1-LIFNR,
             NAME1  LIKE LFA1-NAME1,
             STCD1  LIKE LFA1-STCD1,
             STCD2  LIKE LFA1-STCD2,
             STCD3  LIKE LFA1-STCD3,
             STCD4  LIKE LFA1-STCD4,
           END OF XT_TAB.
    TYPES: BEGIN OF YT_TAB,
            BUKRS LIKE BSEG-BUKRS,
            BELNR LIKE BSEG-BELNR,
            BUZEI LIKE BSEG-BUZEI,
            LIFNR LIKE BSEG-LIFNR,
            GJAHR LIKE BSEG-GJAHR,
           END OF YT_TAB.
    TYPES: BEGIN OF ZT_TAB,
            LIFNR  LIKE LFA1-LIFNR,
            NAME1  LIKE LFA1-NAME1,
            STCD2  LIKE LFA1-STCD2,
            BELNR  LIKE BSEG-BELNR,
            BUZEI  LIKE BSEG-BUZEI,
            GJAHR  LIKE BSEG-GJAHR,
           END OF ZT_TAB.
           I N T E R N A L   T A B L E   D E C L A R A T I O N S         *
    *-----Internal table to store data
    DATA: ITAB1   TYPE STANDARD TABLE OF XT_TAB INITIAL SIZE 0,
          WA_TAB1 TYPE XT_TAB.
    DATA: ITAB2   TYPE STANDARD TABLE OF YT_TAB INITIAL SIZE 0,
          WA_TAB2 TYPE YT_TAB.
    DATA:   ITAB  TYPE STANDARD TABLE OF  ZT_TAB  WITH HEADER LINE,
            WA_ITAB TYPE ZT_TAB,
            ITAB_FINAL2 TYPE STANDARD TABLE OF ZT_TAB.
    DATA: ITAB_TEMP1 TYPE STANDARD TABLE OF ZT_TAB  WITH HEADER LINE.
                    Selection Screen Declarations                        *
    SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN begin OF LINE.
    SELECTION-SCREEN COMMENT (23) text-003 FOR FIELD P_LIFNR.
    PARAMETERS P_LIFNR LIKE LFA1-LIFNR OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN END OF BLOCK bk1.
    START-OF-SELECTION.
          PERFORM XTRACT_DATA.
    END-OF-SELECTION.
    *-----Filling the Output table
      PERFORM populate_main_table.
          PERFORM BUILD_FIELDCATALOG.
         PERFORM SORTING.
          PERFORM BUILD_LAYOUT.
          PERFORM BUILD_ALV_GRID_DISPLAY.
         Form  XTRACT_DATA
    FORM XTRACT_DATA .
    *SELECT
          a~LIFNR
          a~NAME1
          a~STCD2
          b~BELNR
          b~BUZEI
          b~GJAHR
    INTO TABLE ITAB
    FROM LFA1 as a INNER JOIN BSEG as b
      ON  aLIFNR = bLIFNR
    WHERE  a~LIFNR = P_LIFNR.
    SELECT LIFNR
           NAME1
           STCD1
           STCD2
           STCD3
           STCD4
      FROM LFA1
      INTO TABLE ITAB1
      WHERE LIFNR = P_LIFNR.
    IF NOT ITAB1[] IS INITIAL.
        SORT ITAB1 BY LIFNR.
        SELECT BELNR
               BUZEI
               LIFNR
               GJAHR
    INTO TABLE ITAB2
          FROM BSEG
    FOR ALL ENTRIES IN ITAB1
    WHERE LIFNR = itab1-lifnr.
    ENDIF.
    ENDFORM.                    " XTRACT_DATA
    *&      Form  POPULATE_MAIN_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM POPULATE_MAIN_TABLE .
      LOOP AT ITAB1 INTO WA_TAB1.
              ITAB-LIFNR = ITAB1-LIFNR.
              ITAB-NAME1 = ITAB1-NAME1.
              ITAB-STCD2 = ITAB1-STCD2.
      READ TABLE ITAB2 INTO WA_TAB2 WITH KEY LIFNR = WA_TAB1-LIFNR.
              IF sy-subrc = 0.
              ITAB-BELNR = ITAB1-BELNR.
              ITAB-BUZEI = ITAB1-BUZEI.
              ITAB-GJAHR = ITAB1-GJAHR.
              ENDIF.
    ENDLOOP.
    LOOP AT itab1 INTO wa_tab1.
       MOVE:  wa_tab1-lifnr TO itab-lifnr,
              wa_tab1-name1 TO itab-name1,
              wa_tab1-stcd2 TO itab-stcd2.
          Append itab.
      READ TABLE itab2 TRANSPORTING NO FIELDS WITH KEY lifnr = wa_tab1-lifnr.
      IF sy-subrc eq 0.
        MOVE: wa_tab2-lifnr TO itab-lifnr,
              wa_tab2-belnr TO itab-belnr,
              wa_tab2-buzei TO itab-buzei,
              wa_tab2-gjahr TO itab-gjahr.
      Append itab.
    endif.
    endloop.
    *LOOP AT t_agr_tcodes INTO s_agr_tcodes.
    READ TABLE t_tstc
    TRANSPORTING NO FIELDS
    WITH KEY tcode = s_agr_tcodes-tcode.
    IF sy-subrc eq 0.
       MOVE: s_agr_tcodes-tcode TO it_agr_tcodes-tcode,
             s_agr_tcodes-agr_name to it_agr_tcodes-agr_name,
             t_tstc-pgmna to it_agr_pgmna.
    *Append it_agr_tcodes.
    *endif.
    *endloop.
      ENDFORM.                    " POPULATE_MAIN_TABLE
         Form  BUILD_FIELDCATALOG
    FORM BUILD_FIELDCATALOG .
      REFRESH t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 1.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Vendor Number'.
      wa_fcat-seltext_m = 'Vendor Number'.
      wa_fcat-seltext_l = 'Vendor Number'.
      wa_fcat-fieldname = 'LIFNR'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 2.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Vendor Name'.
      wa_fcat-seltext_m = 'Vendor Name'.
      wa_fcat-seltext_l = 'Vendor Name'.
      wa_fcat-fieldname = 'NAME1'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 3.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Vendor TIN Number'.
      wa_fcat-seltext_m = 'Vendor TIN Number'.
      wa_fcat-seltext_l = 'Vendor TIN Number'.
      wa_fcat-fieldname = 'STCD2'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 4.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Document No'.
      wa_fcat-seltext_m = 'Document No'.
      wa_fcat-seltext_l = 'Document No'.
      wa_fcat-fieldname = 'BELNR'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 5.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Item Number'.
      wa_fcat-seltext_m = 'Item Number'.
      wa_fcat-seltext_l = 'Item Number'.
      wa_fcat-fieldname = 'BUZEI'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 6.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Fiscal Year'.
      wa_fcat-seltext_m = 'Fiscal Year'.
      wa_fcat-seltext_l = 'Fiscal Year'.
      wa_fcat-fieldname = 'GJAHR'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
    ENDFORM.                    " BUILD_FIELDCATALOG
         Form  BUILD_LAYOUT
    FORM BUILD_LAYOUT .
    GD_LAYOUT-NO_INPUT = 'X'.
    GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    GD_LAYOUT-TOTALS_TEXT = 'TOTALS'.
    ENDFORM.                    " BUILD_LAYOUT
         Form  BUILD_ALV_GRID_DISPLAY
    FORM BUILD_ALV_GRID_DISPLAY .
    gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program      = gd_repid
                i_callback_top_of_page  = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
                is_layout               = gd_layout
                it_fieldcat             = t_fcat[]
                it_events               = gt_events
                is_print                = gd_prntparams
                it_sort                 = it_sortcat[]
                i_save                  = 'X'
           TABLES
                t_outtab                = ITAB
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
    Edited by: Murugesh P on Apr 6, 2009 10:54 AM
    Edited by: Murugesh P on Apr 6, 2009 10:54 AM

  • Devloped an ALV report for daily cash receipts for selected date range

    hi,   
                 how to devlop an ALV report for daily cash receipts for selected date range.for this report what are the tables and fields we have to use.what is the selectionscreen&what is logic.give me sample report.

    Hi,
    You can develop simple reports using Report Painter.
    You may be also interested in:
    Check report SAPMF05A for credit memo
    See the following Std reports on Payment Advices execute the Tcodes:
    S_ALR_87009888
    S_ALR_87009889
    S_ALR_87009890
    S_ALR_87009891
    S_ALR_87009892
    S_ALR_87009893
    S_ALR_87009978
    S_ALR_87009979
    S_ALR_87009980
    S_ALR_87009981
    S_ALR_87009982
    S_ALR_87009983
    S_ALR_87010056
    S_ALR_87010057
    S_ALR_87010058
    S_ALR_87010059
    S_ALR_87010060
    S_ALR_87010061
    S_ALR_87010066
    S_ALR_87010067
    S_ALR_87012106
    S_ALR_87012107
    S_ALR_87012108
    S_ALR_87012109
    S_ALR_87012110
    S_ALR_87012111
    S_ALR_87012116
    S_ALR_87012117
    S_ALR_87012200
    S_ALR_87012201
    S_ALR_87012202
    S_ALR_870122
    S_ALR_87012204
    S_ALR_87012205
    S_ALR_87012350
    S_ALR_87012351
    S_ALR_87012352
    S_ALR_87012353
    S_ALR_87012354
    S_ALR_87012355
    sample ALV report:
    tables:
    marav. "Table MARA and table MAKT
    Data to be displayed in ALV
    Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
    matically determine the fieldstructure from this source program
    Data:
    begin of imat occurs 100,
    matnr like marav-matnr, "Material number
    maktx like marav-maktx, "Material short text
    matkl like marav-matkl, "Material group (so you can test to make
                            " intermediate sums)
    ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
                            "make sums)
    gewei like marav-gewei, "weight unit (just to be complete)
    end of imat.
    Other data needed
    field to store report name
    data i_repid like sy-repid.
    field to check table length
    data i_lines like sy-tabix.
    Data for ALV display
    TYPE-POOLS: SLIS.
    data int_fcat type SLIS_T_FIELDCAT_ALV.
    select-options:
    s_matnr for marav-matnr matchcode object MAT1.
    start-of-selection.
    read data into table imat
      select * from marav
      into corresponding fields of table imat
      where
      matnr in s_matnr.
    end-of-selection.
    Now, we start with ALV
    To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
    The fieldcatalouge can be generated by FUNCTION
    'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
    report source, including this report.
    The only problem one might have is that the report and table names
    need to be in capital letters. (I had it )
    Store report name
    i_repid = sy-repid.
    Create Fieldcatalogue from internal table
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME         = sy-repid
                I_INTERNAL_TABNAME     = 'IMAT'  "capital letters!
                I_INCLNAME             = sy-repid
           CHANGING
                CT_FIELDCAT            = int_fcat
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM       = i_repid
                I_STRUCTURE_NAME         = 'marav'
                I_DEFAULT                = 'X'
                I_SAVE                   = 'A'
           TABLES
                T_OUTTAB                 = imat.
      IF SY-SUBRC <> 0.
        WRITE: 'SY-SUBRC: ', SY-SUBRC .
      ENDIF.
    Hope this will help.
    Regards,
    Naveen.

  • ALV report for individual fields (urgent...........)

    Hi all,
    using this ZUS_SDN_THREE_ALV_GRIDS program structure i have generated the all the fields from table.
    could you please guide me how to generate the ALV report for splecific fileds from  individual tables.
    if i click in click on grid1 (that is sales header details) we need populate the item details in grid2 and paralally customer details in grid3.
    please guide me how to resolve the issuee..
    thanks in advance
    Srinivas...

    Hi,
    I have done an example, like on 1st grid it displays header data (EKKO) and when you double click on any record, for that PO you will get item details (EKPO) on 2nd grid,
    In the similar way, you can add one more grid and populate it with your own data simultaneously along with 2nd grid.
    *& Report  ZOOABAP1_SOW
    report  zabap2.
    *                     TABLES
    tables:ekko.
    *                     DATA DECLARATIONS
    data: grid1 type ref to cl_gui_alv_grid,
          grid2 type ref to cl_gui_alv_grid,
          container1 type ref to cl_gui_custom_container,
          container2 type ref to cl_gui_custom_container,
          flag.
    *                     INTERNAL TABLES
    data: it_ekko type table of ekko.
    data: wa_ekko like line of it_ekko.
    data: it_ekpo type table of ekpo.
    data: it_fcat1 type lvc_t_fcat,
          wa_fcat1 type lvc_s_fcat,
          it_fcat2 type lvc_t_fcat,
          wa_fcat2 type lvc_s_fcat,
          wa_layout1 type lvc_s_layo,
          wa_layout2 type lvc_s_layo,
          wa_variant type disvariant.
    *                     SELECTION-SCREEN
    selection-screen begin of block b with frame title text-s01.
    select-options: s_ebeln for ekko-ebeln.
    selection-screen end of block b.
    *       CLASS lcl1 DEFINITION
    class lcl1 definition.
      public section.
        methods:
          handler_dbl_clk for event double_click
                                      of cl_gui_alv_grid
                                         importing e_row.
    endclass.                    "lcl1 DEFINITION
    *       CLASS lcl1 IMPLEMENTATION
    class lcl1 implementation.
      method handler_dbl_clk.
        read table it_ekko into wa_ekko index e_row-index.
        if sy-subrc = 0.
          perform get_ekpo.
        endif.
      endmethod.                    "handler_dbl_clk
    endclass.                    "lcl1 IMPLEMENTATION
    *                     START_OF_SELECTION
    start-of-selection.
    * Get PO header data
      perform get_ekko.
    * screen for container
      call screen 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    module status_0100 output.
      set pf-status 'PFS'.
      set titlebar 'TIT'.
      data: obj type ref to lcl1.
      if flag is initial.
        create object container1
          exporting
            container_name = 'CONT1'.
        create object container2
          exporting
            container_name = 'CONT2'.
        create object grid1
          exporting
            i_parent = container1.
        create object grid2
          exporting
            i_parent = container2.
        create object obj.
        set handler obj->handler_dbl_clk for grid1.
        perform build_fcat.
        perform build_layout.
        call method grid1->set_table_for_first_display
           exporting
    *        i_buffer_active               =
    *        i_bypassing_buffer            =
    *        i_consistency_check           =
    *          i_structure_name              = 'EKKO'
    *        is_variant                    = wa_variant
            i_save                        = 'X'
    *        i_default                     = 'X'
            is_layout                     = wa_layout1
    *        is_print                      =
    *        it_special_groups             =
    *        it_toolbar_excluding          =
    *        it_hyperlink                  =
    *        it_alv_graphics               =
    *        it_except_qinfo               =
    *        ir_salv_adapter               =
              changing
                it_outtab                     = it_ekko
                it_fieldcatalog               = it_fcat1
    *        it_sort                       =
    *        it_filter                     =
    *      EXCEPTIONS
    *        invalid_parameter_combination = 1
    *        program_error                 = 2
    *        too_many_lines                = 3
    *        others                        = 4
        if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
        flag = 'X'.
      endif.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Form  get_ekko
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form get_ekko .
      select ebeln bsart lifnr
             from ekko
             into corresponding fields of table it_ekko
             where ebeln in s_ebeln.
    endform.                    " get_ekko
    *&      Form  GET_EKPO
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form get_ekpo .
      select ebeln ebelp menge meins peinh from ekpo
       into corresponding fields of table it_ekpo
       where ebeln = wa_ekko-ebeln.
      if not it_ekpo[] is initial.
        call method grid2->set_table_for_first_display
      exporting
    *    i_buffer_active               =
    *    i_bypassing_buffer            =
    *    i_consistency_check           =
    *    i_structure_name              =
    *    is_variant                    =
    *    i_save                        =
    *    i_default                     = 'X'
        is_layout                     = wa_layout2
    *    is_print                      =
    *    it_special_groups             =
    *    it_toolbar_excluding          =
    *    it_hyperlink                  =
    *    it_alv_graphics               =
    *    it_except_qinfo               =
    *    ir_salv_adapter               =
          changing
            it_outtab                     = it_ekpo
            it_fieldcatalog               = it_fcat2
    *    it_sort                       =
    *    it_filter                     =
    *  EXCEPTIONS
    *    invalid_parameter_combination = 1
    *    program_error                 = 2
    *    too_many_lines                = 3
    *    others                        = 4
        if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
      endif.
    endform.                    " GET_EKPO
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    module user_command_0100 input.
      case sy-ucomm.
        when 'BACK' or 'EXIT' or 'CANC'.
          call method container1->free.
          call method container2->free.
          leave to screen 0.
      endcase.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Form  build_fcat
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form build_fcat .
    * fieldcatalog for EKKO table
      wa_fcat1-col_pos = '1'.
      wa_fcat1-fieldname = 'EBELN'.
      wa_fcat1-tabname = 'EKKO'.
      wa_fcat1-coltext = 'PO No.'.
      append wa_fcat1 to it_fcat1.
      clear wa_fcat1.
      wa_fcat1-col_pos = '2'.
      wa_fcat1-fieldname = 'BSART'.
      wa_fcat1-tabname = 'EKKO'.
      wa_fcat1-coltext = 'PO Type'.
      append wa_fcat1 to it_fcat1.
      clear wa_fcat1.
      wa_fcat1-col_pos = '3'.
      wa_fcat1-fieldname = 'LIFNR'.
      wa_fcat1-tabname = 'EKKO'.
      wa_fcat1-coltext = 'Vendor No.'.
      append wa_fcat1 to it_fcat1.
      clear wa_fcat1.
    * fieldcatalog for EKPO table
      wa_fcat2-col_pos = '1'.
      wa_fcat2-fieldname = 'EBELN'.
      wa_fcat2-tabname = 'EKPO'.
      wa_fcat2-coltext = 'PO No.'.
      append wa_fcat2 to it_fcat2.
      clear wa_fcat2.
      wa_fcat2-col_pos = '2'.
      wa_fcat2-fieldname = 'EBELP'.
      wa_fcat2-tabname = 'EKPO'.
      wa_fcat2-coltext = 'PO Item'.
      append wa_fcat2 to it_fcat2.
      clear wa_fcat2.
      wa_fcat2-col_pos = '3'.
      wa_fcat2-fieldname = 'MENGE'.
      wa_fcat2-tabname = 'EKPO'.
      wa_fcat2-coltext = 'Quantity'.
      append wa_fcat2 to it_fcat2.
      clear wa_fcat2.
      wa_fcat2-col_pos = '4'.
      wa_fcat2-fieldname = 'MEINS'.
      wa_fcat2-tabname = 'EKPO'.
      wa_fcat2-coltext = 'UOM'.
      append wa_fcat2 to it_fcat2.
      clear wa_fcat2.
      wa_fcat2-col_pos = '5'.
      wa_fcat2-fieldname = 'PEINH'.
      wa_fcat2-tabname = 'EKPO'.
      wa_fcat2-coltext = 'Price Unit'.
      append wa_fcat2 to it_fcat2.
      clear wa_fcat2.
    endform.                    " build_fcat
    *&      Form  build_layout
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form build_layout .
      clear wa_layout1.
      wa_layout1-grid_title = 'Header data'.
    *  wa_layout-sel_mode = 'A'.             "allow to select multiple lines
      clear wa_layout2.
      wa_layout2-grid_title = 'Item Data'.
    endform.                    " build_layout
    If you have any poblems while doing this, post it.
    Do reward points for all helpful answers
    Regards,
    Sowjanya

  • How we can use call transaction xd03 in alv report

    hey guys i want now that how we can use call transaction xd03 in alv report by using various tables in report or coding.
    can you tell me about that by the way of coding so that it can be easy for me to understand and help ful to make report by using alv report with many tables. so please send me .
    Moderator message: it seems to be XD03 day today, please search for available information/documentation/previous discussions.
    Edited by: Thomas Zloch on Nov 25, 2011 1:24 PM

    Where?
    Max

  • Report for showing pending (ageing) quantity according to store location w

    dear ABAP Gurus,
    I have made a roport for showing pending (ageiing) quantity acc to location wise.
    and i m sending here the code i made for same.Tell me if sme amendments required.
    Report for showing pending (ageing) quantity according to store location wise:   
    1.     Fields on selection screen (input screen) : Plant code From to , Material code From to , Current date, Numbers of days(for display the ageing(pending) balance for a given period,Storage locations from to.
    2.     Field in the output List : Material code , Material descriptions, Balance quantiy,Balance value ,Consumptions date. 
    the code is:
    REPORT  ZAGEIN_SUDHA.
    TABLES: mara,mseg,makt.
    TYPES: BEGIN OF t_mara,
    matnr LIKE mara-matnr,           "material number
    maktx LIKE makt-maktx,           "material description
    ersda LIKE mara-ersda,           "material creation date
    lgort like mseg-lgort,           "storage location
    bwart like mseg-bwart,           "goods received or issued
    menge like mseg-menge,           "value at movement type
    werks like mseg-werks,           "plant
    END OF t_mara.
    DATA: i_mara TYPE STANDARD TABLE OF t_mara with header line,
          itab type standard table of mara with header line,
    *wa_mara TYPE t_mara,
    v_date TYPE i,                      "age in days
    GI type mseg-menge,                 "goods issued
    GR type mseg-menge,                 "goods received
    bal type mseg-menge,                "balance
    total type i,
    grace type i,
    g_quan type mseg-menge.
    SELECTION-SCREEN BEGIN OF BLOCK b1.
    SELECT-OPTIONS: p_matnr FOR mara-matnr.
    select-options: p_werks for mseg-werks.
    select-options: p_lgort for mseg-lgort.
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
    REFRESH i_mara.
    SELECT mr~matnr                        "mara-matnr
    mk~maktx                               "makt-maktx
    mr~ersda                               "mara-ersda
    mg~lgort                               "mseg-lgort
    mg~bwart                               "mseg-bwart
    mg~menge                               "mseg-menge
    INTO corresponding fields of table i_mara
    FROM mara AS mr INNER JOIN
    makt AS mk
    ON mrmatnr = mkmatnr INNER JOIN mseg AS mg on mkmatnr = mgmatnr
    WHERE mrmatnr IN p_matnr and mgwerks IN p_werks and mg~lgort IN
    p_lgort.
    total = 0.
    IF sy-subrc = 0.
    *CLEAR wa_mara.
    LOOP AT i_mara.
    if i_mara-bwart = '101' .
    GR = total + i_mara-menge.
    total = GR.
    elseif
    i_mara-bwart = '102' or i_mara-bwart = '122'.
    GR = GR - i_mara-menge.
    endif.
    if i_mara-bwart = '261'.
    GI = total + i_mara-menge.
    elseif i_mara-bwart = '262'.
    GR = GR + i_mara-menge.
    endif.
    bal = GR - GI.
    if bal GE  GR.
    grace = 30.
    else.
    grace = 10.
    endif.
    g_quan = bal - GR.
    v_date = sy-datum - i_mara-ersda.
    endloop.
    WRITE: / i_mara-matnr ,i_mara-maktx,' is ',v_date,' ,days old  and
    stored at' ,i_mara-lgort ,   ' with balance =', bal ,'the grace time is
    ', grace, 'and' ,'grace quantity is ' ,g_quan.
    *ENDLOOP.

    Hi,
    That sounds like a nice report.  What about it?!
    Gareth.

  • Devolped an ALV report for daily cash receipts for selected date range

    hi,   
                 how to devlop an ALV report for daily cash receipts for selected date range.for this report what are the tables and fields we have to use.what is the selectionscreen&what is logic.give me sample report.

    hi,   
                 how to devlop an ALV report for daily cash receipts for selected date range.for this report what are the tables and fields we have to use.what is the selectionscreen&what is logic.give me sample report.

  • Report for showing pending (ageing) quantity according to store location wi

    Report for showing pending (ageing) quantity according to store location wise:   
    Fields on selection screen (input screen) : Plant code From to , Material code From to , Current date, Numbers of days(for display the ageing(pending) balance for a given period,Storage locations from to.
    Field in the output List : Material code , Material descriptions, Balance quantiy,Balance value ,Consumptions date.

    Hi,
    That sounds like a nice report.  What about it?!
    Gareth.

  • ALV report for Purchase Requisitions(PR)

    Hai All!
      i am developing an ALV report for Purchase Requisitions(PR) tht are not approved ( ie IN RELEASE status), so i want to get who has approved PR and who has not approved it... from which table & which field i can get this data...
    plz help me

    Hi Following fields are used to set / reset release of PR
    EBAN-FRGKZ
    EBAN-FRGZU
    EBAN-FRGST.
    You will have to understand combination of these field from MM Fuctional Consultant.
    rgds
    rajesh
    Edited by: RAJESH KUMAR on Aug 6, 2008 12:18 PM

  • Alv report for multiple record insertion

    hi,
    i'm new to abap. i'm using alv report for record display and insertion. how can i insert multiple records from alv to my table??

    well that can be achieved only by running BDC inside alv report to enter the entries.and in that too you can append or edit single entries only
    reward if useful
    regards
    vivek

  • How can i show employees photos in ADF?

    hi,
    i use jdev 10.1.3.2 and ADF.
    with employees info, i want to show employees photos. how can i do this?
    thanks.

    <p>
    Hi,
    </p>
    <p>
    See example no 85 on Steve Muench blog &quot;<strong>Uploading Contents of af:inputFile to a BLOB Column</strong>&quot;.
    </p>
    <p>
    Kuba
    </p>

  • Heading in ALV report is showing up blank

    Hello Friends
    First of all thanks to you all for giving so much of help. I appreciate it.
    I would appreciate if some could please let me know, why my code is not printing the header in my ALV report. It shows up as blank. I have written the Form 'TOP-OF-PAGE'.
    Thanks a lot in advance
    Ram

    This coding will give u the solution ....
    this is an interactive ALV ...
    *& Report  ZMR001_MATERIAL_STOCK_VALUE
    REPORT  zmr001_material_stock_value.
          MODULE MMxxxxxxxx.                                              *
          Objective :..........................................         *
          Program   : Updates Tables (   )    Downloads data (  )       *
                      Outputs List   (   )                              *
          Technical Spec No ...............                             *
          Date Created       07/12/2006                                 *
          Author             Jayakumar.T....                            *
          Location           April Business / Banglore                  *
          LDB                .....                                      *
          External Dependencies                                         *
    Amendment History                                                  *
    Who        Change ID    Reason                                      *
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯                                     *
    XXXXXXXXX  AADDMMYYYY Where XXXX = Developers Name................. *
               AA- Developers Initial ................................  *
          Includes                                                      *
    *INCLUDE   :                                                           *
          Tables                                                        *
    *TABLES   :                                                            *
    TABLES : mchb , mara  , mbew , tvkos , t001w.
          Types                    Begin with TY_                       *
    *TYPES   :                                                             *
    TYPES : BEGIN OF ty_mchb,
            matnr LIKE mchb-matnr,
            charg LIKE mchb-charg,
            clabs LIKE mchb-clabs,
            werks LIKE mchb-werks,
            spart LIKE mara-spart,
            maktx LIKE makt-maktx,
            value LIKE mchb-clabs,
            total LIKE mchb-clabs,
            END OF ty_mchb.
    TYPE-POOLS: slis.
    CONSTANTS:
    c_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    DATA  gt_list_top_of_page TYPE slis_t_listheader.
          Constants                Begin with C_                        *
    *CONSTANTS:                                                            *
          Data                     Begin with W_                        *
    *DATA     :                                                            *
          Infotypes                   ( HR Module Specific)             *
    *INFOTYPES :                                                           *
          Internal tables          Begin with IT_                       *
    *DATA    :                                                             *
    DATA : it_mchb TYPE TABLE OF ty_mchb,
            wa_mchb TYPE ty_mchb ,
            it_final TYPE TABLE OF ty_mchb,
            wa_final TYPE ty_mchb,
            it_temp TYPE TABLE OF ty_mchb,
            wa_temp TYPE ty_mchb,
            it_temp1 TYPE TABLE OF ty_mchb,
            wa_temp1 TYPE ty_mchb
    DATA: it_listheader TYPE slis_t_listheader.
          Field Symbols            Begin with FS_                       *
    *FIELD-SYMBOLS:                                                        *
          Insert                                                        *
    *INSERT   :                                                            *
          Select Options          Begin with SO_                        *
    *SELECT-OPTIONS :                                                      *
          Parameters              Begin with PR_                        *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001 .
    PARAMETERS     : pr_vkorg LIKE tvko-vkorg OBLIGATORY .
    SELECT-OPTIONS : so_werks FOR mchb-werks.
    SELECT-OPTIONS : so_spart FOR mara-spart.
    SELECTION-SCREEN END OF BLOCK b1.
          Initialisation                                                *
    *INITIALISATION   :
    DATA:   wa_variant LIKE disvariant                ,   "Variant
            wa_fieldcat TYPE slis_fieldcat_alv        ,
            it_fieldcat TYPE slis_t_fieldcat_alv      ,
            it_fieldcat1 TYPE slis_t_fieldcat_alv      ,
            wa_layout   TYPE slis_layout_alv          ,
            wa_print    TYPE slis_print_alv           ,
            it_sort     TYPE slis_t_sortinfo_alv      ,
            it_sp_group TYPE slis_t_sp_group_alv      ,
            it_events   TYPE slis_t_event             ,
            it_list_top_of_page TYPE slis_t_listheader,
            w_title1    TYPE lvc_title,
            w_datum LIKE sy-datum.
    DATA slis_ev_top_of_page  TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    DATA w_top_of_page  TYPE slis_formname VALUE 'TOP_OF_PAGE'.   " for top of page
    DATA it_event  TYPE slis_t_event.
    INITIALIZATION.
      PERFORM eventtab_build USING it_event[].
    *set pf-status '002'.
          At selection-screen                                           *
    AT SELECTION-SCREEN.
      SELECT SINGLE * FROM tvkos WHERE vkorg = pr_vkorg AND spart IN so_spart.
      IF sy-subrc NE 0 .
        MESSAGE text-008 TYPE 'E'.
      ENDIF.
      SELECT SINGLE * FROM t001w WHERE vkorg = pr_vkorg AND werks IN so_werks.
      IF sy-subrc NE 0 .
        MESSAGE text-009 TYPE 'E'.
      ENDIF.
          S T A R T   O F   S E L E C T I O N                           *
    START-OF-SELECTION.
      SELECT mc~matnr charg clabs werks spart maktx
      INTO CORRESPONDING
      FIELDS OF TABLE it_mchb FROM mchb AS mc
      INNER JOIN mara AS ma
      ON mamatnr = mcmatnr
      INNER JOIN makt AS mt
      ON mamatnr = mtmatnr
      WHERE werks IN so_werks AND
      spart IN so_spart
      AND spras = 'EN'
    it_temp[] =  it_mchb[].
    SORT it_temp BY matnr.
    DELETE ADJACENT DUPLICATES FROM it_temp COMPARING matnr.
    LOOP AT it_temp INTO wa_temp.
       it_temp1[] = it_mchb[].
       DELETE it_temp1 WHERE matnr NE wa_temp-matnr.
       LOOP AT it_temp1 INTO wa_temp1.
         SUM.
         EXIT.
       ENDLOOP.
       wa_final-matnr = wa_temp1-matnr.
       wa_final-charg = wa_temp1-charg.
       wa_final-maktx = wa_temp1-maktx.
       wa_final-clabs = wa_temp1-clabs.
       wa_final-werks = wa_temp1-werks.
       wa_final-spart = wa_temp1-spart.
       APPEND wa_final TO it_final.
    ENDLOOP.
      SORT it_mchb BY matnr.
      LOOP AT it_mchb INTO wa_mchb.
        ON CHANGE OF wa_mchb-matnr.
          IF wa_final-matnr IS NOT INITIAL.
            SELECT SINGLE * FROM mbew WHERE matnr = wa_final-matnr
            AND bwkey = wa_final-werks.
            IF mbew-vprsv =  'V'.
              wa_final-value = mbew-verpr.
            ELSEIF mbew-vprsv =  'S'.
              wa_final-value = mbew-stprs.
            ENDIF.
            wa_final-total = wa_final-value * wa_final-clabs.
            APPEND wa_final TO it_final.
            CLEAR wa_final.
          ENDIF.
        ENDON.
        wa_final-clabs = wa_mchb-clabs + wa_final-clabs .
        wa_final-matnr = wa_mchb-matnr.
        wa_final-werks = wa_mchb-werks.
        wa_final-charg = wa_mchb-charg.
        wa_final-maktx = wa_mchb-maktx.
      ENDLOOP.
      IF it_final IS INITIAL.
        MESSAGE text-010 TYPE 'I'.
      ELSE.
        PERFORM fieldcat.
        PERFORM display_data.
      ENDIF.
    LOOP AT it_mchb INTO  wa_mchb.
       WRITE : / , wa_mchb-matnr  , wa_mchb-charg , wa_mchb-maktx , wa_mchb-clabs , wa_mchb-werks , wa_mchb-spart .
    ENDLOOP.
    WRITE : / , 'Jaya'.
    LOOP AT it_final INTO  wa_final.
       WRITE : / , wa_final-matnr  , wa_final-charg , wa_final-maktx , wa_final-clabs , wa_final-werks , wa_final-spart .
    ENDLOOP.
    *GET XX.
    *END-OF-SELECTION.
          E N D       O F   S E L E C T I O N                           *
          At line selection                                             *
    *AT LINE-SELECTION.
          User Command Processing                                       *
    *AT USER-COMMAND.
          Top Of Page                                                   *
    *TOP-OF-PAGE.
          End Of Page                                                   *
    *END-OF-PAGE.
    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.
    to get the events
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = rt_events.
      READ TABLE rt_events INTO ls_event WITH KEY name = slis_ev_top_of_page
      IF sy-subrc = 0.
        ls_event-form = slis_ev_top_of_page.
        MODIFY  rt_events FROM  ls_event TRANSPORTING form WHERE
        name = ls_event-form.
      ENDIF.
      READ TABLE rt_events INTO ls_event WITH KEY name = 'USER_COMMAND'.
      IF sy-subrc EQ 0.
        ls_event-form = 'USER_COMMAND'.
        MODIFY rt_events FROM ls_event TRANSPORTING form WHERE name = ls_event-name.
      ENDIF.
    ENDFORM.                    "eventtab_build
    *&      Form  fieldcat
    FORM fieldcat .
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'MATNR'.
      wa_fieldcat-seltext_m   = text-002 .
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'MAKTX'.
      wa_fieldcat-seltext_m   = text-003 .
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'CLABS'.
      wa_fieldcat-seltext_m   = text-004 .
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'VALUE'.
      wa_fieldcat-seltext_m   = text-006 .
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'TOTAL'.
      wa_fieldcat-seltext_m   = text-007 .
      APPEND wa_fieldcat TO it_fieldcat.
    ENDFORM.                    "fieldcat
    *&      Form  display_data
    FORM display_data .
      PERFORM comment_build USING gt_list_top_of_page[].
      wa_layout-info_fieldname = 'LINE_COLOR'. " Line Color
      wa_print-no_coverpage = 'X'.
      wa_print-no_print_listinfos = 'X'.  " Remove the default first page.
    to get thr grid display
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = sy-repid
         i_background_id         = 'ALV_BACKGROUND'
         i_callback_top_of_page  = 'TOP_OF_PAGE'
          i_callback_user_command = 'USER_COMMAND'
         is_layout               = wa_layout
          it_fieldcat             = it_fieldcat
         i_default               = 'X'
          i_save                  = 'A'
          it_events               = it_event[]
         is_print                = wa_print
        TABLES
          t_outtab                = it_final
        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.                    " eventtab_build
    *&      Form  comment_build
    FORM comment_build USING lt_top_of_page TYPE  slis_t_listheader.
      DATA: ls_line TYPE slis_listheader.
      CLEAR ls_line.
      ls_line-typ  = 'H'.
    to get the company text
      DATA w_name(50) TYPE c.
      ls_line-info = text-005 .
      APPEND ls_line TO lt_top_of_page.
      CLEAR ls_line.
      ls_line-typ  = 'S'.
      ls_line-info = ''.
      APPEND ls_line TO lt_top_of_page.
    ENDFORM.                    "comment_build
    *&      Form  top_of_page
         to print at top of page
    FORM top_of_page.
    to pass the comment bulid for the top of page into the alv
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gt_list_top_of_page.
    ENDFORM.                    "top_of_page
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->RS_SELFIELDtext
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&IC1'.
         MESSAGE 'jj' TYPE 'I'.
          READ TABLE it_final INTO wa_final INDEX rs_selfield-tabindex.
          PERFORM build_fieldcatlog.
          PERFORM event_call USING it_event[].
         PERFORM POPULATE_EVENT_EKPO.
          PERFORM data_retrieval.
          PERFORM build_listheader USING it_listheader.
          PERFORM DISPLAY_ALV.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG
          text
    FORM build_fieldcatlog.
    clear it_fieldcat1[].
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'MATNR'.
      wa_fieldcat-seltext_m   = text-002 .
      APPEND wa_fieldcat TO it_fieldcat1.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'MAKTX'.
      wa_fieldcat-seltext_m   = text-003 .
      APPEND wa_fieldcat TO it_fieldcat1.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'CHARG'.
      wa_fieldcat-seltext_m   = text-003 .
      APPEND wa_fieldcat TO it_fieldcat1.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'CLABS'.
      wa_fieldcat-seltext_m   = text-004 .
      APPEND wa_fieldcat TO it_fieldcat1.
    ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
          text
         -->RT_EVENTS  text
    FORM event_call USING rt_events TYPE slis_t_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         i_list_type           = 0
       IMPORTING
         et_events             = rt_events
    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.
    ENDFORM.                    "event_call
    *&      Form  DATA_RETRIEVAL
          text
    FORM data_retrieval.
      it_temp[] = it_mchb[].
      DELETE it_temp WHERE matnr NE wa_final-matnr.
    ENDFORM.                    "DATA_RETRIEVAL
    *&      Form  BUILD_LISTHEADER
          text
         -->I_LISTHEADEtext
    FORM build_listheader USING i_listheader TYPE slis_t_listheader.
      DATA: hline1 TYPE slis_listheader.
      hline1-typ = 'H'.
      hline1-info = 'CHECKING PGM'.
    ENDFORM.                    "BUILD_LISTHEADER
    FORM DISPLAY_ALV.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
      I_CALLBACK_PROGRAM                = sy-REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      = TITLE_EKPO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = It_FIELDCAT1[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         =
      I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = it_EVENTS[]
      TABLES
        T_OUTTAB                          = IT_temp[]
    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 Report for Purchasing Each Vendor

    Hi Anybody,
    I am developing Purchasing Report. But I want display records in ALV Report based Vendor ID and Name.
    Like Standard Report ME2M.
    Ex: 
      Vendor ID : A0002                Name : UMS SEMICONDUCTOR PTE LTD.,
        sNO     po no        item    Price        Qty
         1.       10001          10    12.30           10
         2.       10002          20    30.30           50
         3.       10003          30    40.30           150
      Vendor ID : X0012                Name : ALPHA PTE LTD.,
          sNO     po no        item    Price        Qty
         1.       10004          10    1.30           10
         2.       10005          20    50.30          50
         3.       10006          30    620.30        150
    How to I will do?.  Anybody please tell me.
    Tks
    S.Muthu.
    IT Dept.

    hi..follow this code..
    ===================================================================
    ===================================================================
    report  .
    ========================== Global definitions  ====================
    Data Types
    type-pools: slis.
    types: begin of tp_data,
    lifnr like ekko-lifnr,
           end of tp_data,
           tp_tbl_data type standard table of tp_data.
    Constants
    Data objects (variable declarations and definitions)
    Report data to be shown.
    data: it_data type standard table of tp_data.
    Heading of the report.
    data: t_heading type slis_t_listheader.
    ======================= Selection Screen ==========================
    selection-screen: begin of block b1 with frame title text-t01.
    DATA: w_aux_lifnr like ekko-lifnr.
    SELECT-OPTIONS s_lifnr for w_aux_lifnr
    DEFAULT LIFNR .
    selection-screen: end of block b1.
    ======================== Event Blocks =============================
    at selection-screen.
    start-of-selection.
      perform get_data using it_data.
    end-of-selection.
      perform build_alv using it_data t_heading.
    ======================== Subroutines ==============================
    *&      Form  get_data
          Gets the information to be shown in the report.
    form get_data using t_data type tp_tbl_data.
    SELECT ekko~lifnr
    INTO CORRESPONDING FIELDS OF TABLE t_data
    FROM ekko as ekko
    WHERE ekko~lifnr in s_lifnr
    endform.                    " get_data
    *&      Form  build_alv
          Builds and display the ALV Grid.
    form build_alv using t_data type tp_tbl_data
                         t_heading  type slis_t_listheader.
    ALV required data objects.
    data: w_title   type lvc_title,
          w_repid   type syrepid,
          w_comm    type slis_formname,
          w_status  type slis_formname,
          x_layout  type slis_layout_alv,
          t_event    type slis_t_event,
          t_fieldcat type slis_t_fieldcat_alv,
          t_sort     type slis_t_sortinfo_alv.
    refresh t_fieldcat.
    refresh t_event.
    refresh t_sort.
    clear x_layout.
    clear w_title.
    Field Catalog
      perform set_fieldcat2 using:
    1 'LIFNR' 'LIFNR' 'EKKO' space space  space  space  space  space space space space space space space t_fieldcat .
    Layout
    x_layout-zebra = 'X'. 
    Top of page heading
      perform set_top_page_heading using t_heading t_event.
    Events
      perform set_events using t_event.
    GUI Status
      w_status = ''.
      w_repid = sy-repid.
    Title
    w_title = <<If you want to set a title for
                the ALV, please, uncomment and edit this line>>.
    User commands
      w_comm   = 'USER_COMMAND'.
    Order
    Example
    PERFORM set_order USING '<field>' 'IT_DATA' 'X' space space t_sort.
    Displays the ALV grid
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program       = w_repid
          it_fieldcat              = t_fieldcat
          is_layout                = x_layout
          it_sort                  = t_sort
          i_callback_pf_status_set = w_status
          i_callback_user_command  = w_comm
          i_save                   = 'X'
          it_events                = t_event
          i_grid_title             = w_title
        tables
          t_outtab                 = t_data
        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.                    " build_alv.
    *&      Form  set_top_page_heading
          Creates the report headings.
    form set_top_page_heading using t_heading type slis_t_listheader
                                    t_events  type slis_t_event.
    data: x_heading type slis_listheader,
          x_event   type line of slis_t_event.
    Report title
      clear t_heading[].
      clear x_heading.
      x_heading-typ = 'H'.
      x_heading-info = ''(001).
      append x_heading to t_heading.
    Program name
      clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'Program: '.
      x_heading-info = sy-repid.
      append x_heading to t_heading.
    User who is running the report
      clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'User: '.
      x_heading-info = sy-uname.
      append x_heading to t_heading.
    Date of execution
      clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'Date: '.
      write sy-datum to x_heading-info.
      append x_heading to t_heading.
    Time of execution 
      clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'Time: '.
      write sy-uzeit to x_heading-info.
      append x_heading to t_heading.
    Top of page event
      x_event-name = slis_ev_top_of_page.
      x_event-form = 'TOP_OF_PAGE'.
      append x_event to t_events.
    endform.
    *&      Form  set_events
          Sets the events for ALV.
          The TOP_OF_PAGE event is alredy being registered in
          the set_top_page_heading subroutine.
    form set_events using t_events type slis_t_event.
    data: x_event   type line of slis_t_event.
    Example
    clear x_event.
    x_event-name = .
    x_event-form = .
    append x_event to t_event.
    endform.
    *&      Form  set_order
          Adds an entry to the order table.
    FORM set_order USING p_fieldname p_tabname p_up p_down p_subtot
                         t_sort TYPE slis_t_sortinfo_alv.
      DATA: x_sort TYPE slis_sortinfo_alv.
      CLEAR x_sort.
      x_sort-fieldname = p_fieldname.
      x_sort-tabname   = p_tabname.
      x_sort-up = p_up.
      x_sort-down = p_down.
      x_sort-subtot = p_subtot.
      APPEND x_sort TO t_sort.
    ENDFORM.                    "set_order
    *&      Form  set_fieldcat2
          Adds an entry to the field catalog.
       p_colpos: Column position.
       p_fieldname: Field of internal table which is being described by
    *            this record of the field catalog.
       p_ref_fieldname: (Optional) Table field / data element which
    *                describes the properties of the field.
    *                If this field is not given, it is copied from
    *                the fieldname.
       p_ref_tabname: (Optional) Table which holds the field referenced
    *              by <<p_ref_fieldname>>.
                      If this is not given, the parameter
                      <<p_ref_fieldname>> references a data element.
       p_outputlen: (Optional) Column width.
       p_noout: (Optional) If set to 'X', states that the field is not
    *           showed initially. If so, the field has to be
                included in the report at runtime using the display
                options.
       p_seltext_m: (Optional) Medium label to be used as column header.
       p_seltext_l: (Optional) Long label to be used as column header.
       p_seltext_s: (Optional) Small label to be used as column header.
       p_reptext_ddic: (Optional) Extra small (heading) label to be
    *                used as column header.
       p_ddictxt: (Optional) Set to 'L', 'M', 'S' or 'R' to select
                  whether to use SELTEXT_L, SELTEXT_M, SELTEXT_S,
                  or REPTEXT_DDIC as text for column header.
       p_hotspot: (Optional) If set to 'X', this field will be used
    *             as a hotspot area for cursor, alolowing the user
    *          to click on the field.
       p_showasicon: (Optional) If set to 'X', this field will be shown
                     as an icon and the contents of the field will set
    *             which icon to show.
       p_checkbox: (Optional) If set to 'X', this field will be shown
                   as a checkbox.
       p_edit: (Optional) If set to 'X', this field will be editable.
       p_dosum: (Optional) If set to 'X', this field will be summed
                (aggregation function) according to the grouping set
                by the order functions.
       t_fieldcat: Table which contains the whole fieldcat.
    FORM set_fieldcat2 USING
          p_colpos p_fieldname p_ref_fieldname p_ref_tabname
          p_outputlen p_noout
          p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
          p_hotspot p_showasicon p_checkbox p_edit
          p_dosum
          t_fieldcat TYPE slis_t_fieldcat_alv.
      DATA: wa_fieldcat TYPE slis_fieldcat_alv.
      CLEAR wa_fieldcat.
    General settings
      wa_fieldcat-fieldname = p_fieldname.
      wa_fieldcat-col_pos = p_colpos.
      wa_fieldcat-no_out = p_noout.
      wa_fieldcat-hotspot = p_hotspot.
      wa_fieldcat-checkbox = p_checkbox.
      wa_fieldcat-icon = p_showasicon.
      wa_fieldcat-do_sum = p_dosum.
    Set reference fieldname, tablenam and rollname.
    If p_ref_tabname is not given, the ref_fieldname given
       is a data element.
    If p_ref_tabname is given, the ref_fieldname given is a
       field of a table.
    In case ref_fieldname is not given,
       it is copied from the fieldname.
      IF p_ref_tabname IS INITIAL.
        wa_fieldcat-rollname =   p_ref_fieldname.
      ELSE.
        wa_fieldcat-ref_tabname = p_ref_tabname.
        IF p_ref_fieldname EQ space.
          wa_fieldcat-ref_fieldname =   wa_fieldcat-fieldname.
        ELSE.
          wa_fieldcat-ref_fieldname =   p_ref_fieldname.
        ENDIF.
      ENDIF.
    Set output length.
      IF NOT p_outputlen IS INITIAL.
        wa_fieldcat-outputlen = p_outputlen.
      ENDIF.
    Set text headers.
      IF NOT p_seltext_m IS INITIAL.
        wa_fieldcat-seltext_m = p_seltext_m.
      ENDIF.
      IF NOT p_seltext_l IS INITIAL.
        wa_fieldcat-seltext_l = p_seltext_l.
      ENDIF.
      IF NOT p_seltext_s IS INITIAL.
        wa_fieldcat-seltext_s = p_seltext_s.
      ENDIF.
      IF NOT p_reptext_ddic IS INITIAL.
        wa_fieldcat-reptext_ddic = p_reptext_ddic.
      ENDIF.
      IF NOT p_ddictxt IS INITIAL.
        wa_fieldcat-ddictxt = p_ddictxt.
      ENDIF.
    Set as editable or not.
      IF NOT p_edit IS INITIAL.
        wa_fieldcat-input     = 'X'.
        wa_fieldcat-edit     = 'X'.
      ENDIF.
      APPEND wa_fieldcat TO t_fieldcat.
    ENDFORM.                   "set_fieldcat2
    ======================== Subroutines called by ALV ================
    *&      Form  top_of_page
          Called on top_of_page ALV event.
          Prints the heading.
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
        i_logo             = <<If you want to set a logo, please,
                             uncomment and edit this line>>
          it_list_commentary = t_heading.
    endform.                    " alv_top_of_page
    *&      Form  user_command
          Called on user_command ALV event.
          Executes custom commands.
    form user_command using r_ucomm     like sy-ucomm
                            rs_selfield type slis_selfield.
    Example Code
    Executes a command considering the sy-ucomm.
    CASE r_ucomm.
       WHEN '&IC1'.
         Set your "double click action" response here.
         Example code: Create and display a status message.
         DATA: w_msg TYPE string,
               w_row(4) TYPE n.
         w_row = rs_selfield-tabindex.
         CONCATENATE 'You have clicked row' w_row
                     'field' rs_selfield-fieldname
                     'with value' rs_selfield-value
                     INTO w_msg SEPARATED BY space.
         MESSAGE w_msg TYPE 'S'.
    ENDCASE.
    End of example code.
    endform.                    "user_command

  • ALV report for 5 Grids using Objects and Method

    I have few questions in ALV 5Grids ,could you please correct me in the following program logic...
    Using this program logic i am able to generate the five Grids and able to populate Header details from VBAK into Grid1,If you click in the Grid 1 and it is populating item details in Grid2 from VBAP,parallally populating the customer data in Grid5 from KNA1.
    Now the pending issue is ,
    if you click in the Grid2 then we should populate the shipping details in Grid3 and
    if you click in the Grid3 then we should populate the billing details in Grid4.
    Program Logic;
    REPORT  ZAREPAS20.
    Tables : vbak,vbap,likp,lips,vbrk,vbrp,kna1.
    DATA : OK_CODE              LIKE        SY-UCOMM,
           G_CONTAINER          TYPE SCRFNAME VALUE 'BCALV7_GRID_DEMO_0100_VASU',
           DOCKING              TYPE REF TO CL_GUI_DOCKING_CONTAINER,
           SPLITTER_1           TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
           SPLITTER_2           TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
           splitter_3           TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
           CELL_TOP1            TYPE REF TO CL_GUI_CONTAINER,
           CELL_BOTTOM1         TYPE REF TO CL_GUI_CONTAINER,
           CELL_TOP2            TYPE REF TO CL_GUI_CONTAINER,
           CELL_BOTTOM2         TYPE REF TO CL_GUI_CONTAINER,
           CELL_LEFT            TYPE REF TO CL_GUI_CONTAINER,
           CELL_middle          TYPE REF TO CL_GUI_CONTAINER,
           CELL_RIGHT           TYPE REF TO CL_GUI_CONTAINER,
           GRID1                TYPE REF TO CL_GUI_ALV_GRID,
           GRID2                TYPE REF TO CL_GUI_ALV_GRID,
           GRID3                TYPE REF TO CL_GUI_ALV_GRID,
           GRID4                TYPE REF TO CL_GUI_ALV_GRID,
           GRID5                TYPE REF TO CL_GUI_ALV_GRID.
    DATA : GT_VBAK              TYPE STANDARD TABLE OF VBAK,
           GT_VBAP              TYPE STANDARD TABLE OF VBAP,
           GT_LIKP              TYPE STANDARD TABLE OF likp,
           GT_LIPS              TYPE STANDARD TABLE OF lips,
           GT_VBRK              TYPE STANDARD TABLE OF vbrk,
           GT_VBRP              TYPE STANDARD TABLE OF vbrp,
           GT_KNA1              TYPE STANDARD TABLE OF kna1.
    DATA:begin of itab1 occurs 0,
         vbeln type likp-VBELN,                            
         erzet type likp-ERZET,                             
         lfart type likp-LFART,                             
         posnr type lips-POSNR,
         END OF ITAB1.
    DATA:begin of itab2 occurs 0,
         vbeln like vbrk-vbeln,                            
         posnr like vbrk-fktyp,                            
         fkart like vbrk-fkart,                             
         fklmg like vbrp-fklmg,                             
         end of itab2.
    *selection screen for selecting range of values
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-001.
    select-options: S_vbeln for VBAK-vbeln.     
    selection-screen end of block b1.
          CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING
              e_row
              e_column
              es_row_no
              sender.  " sending control, i.e. ALV grid that raised event
    ENDCLASS.                    "lcl_eventhandler DEFINITION
          CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
    METHOD HANDLE_DOUBLE_CLICK.
    *DEFINE LOCAL DATA.
    DATA : itab_vbak type VBAK,
           itab_vbap type VBAP,
           itab_likp type likp,
           itab_lips type lips,
           itab_vbrk type vbrk,
           itab_vbrp type vbrp,
           itab_kna1 type kna1.
    *DISTINGUISH ACCORDING TO SENDING GRID INSTANCE
    CASE SENDER.
    WHEN GRID1.
       READ TABLE gt_VBAK INTO itab_vbak INDEX e_row-index.
           CHECK ( itab_vbak-vbeln IS NOT INITIAL ).
            CALL METHOD GRID1->set_current_cell_via_id
              EXPORTING
                 is_ROW_ID    =
                 is_COLUMN_ID =
                is_row_no    = es_row_no.
            Triggers PAI of the dynpro with the specified ok-code
            CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DETAILS' ).
    WHEN GRID2.
            READ TABLE gt_VBAP INTO itab_vbap INDEX e_row-index.
            CHECK ( itab_vbap-vbeln IS NOT INITIAL ).
            CALL METHOD GRID2->set_current_cell_via_id
              EXPORTING
                 is_ROW_ID    =
                 is_COLUMN_ID =
                is_row_no    = es_row_no.
            Triggers PAI of the dynpro with the specified ok-code
            CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DETAILS' ).
    WHEN GRID3.
            READ TABLE gt_LIPS INTO itab_LIPS INDEX e_row-index.
            CHECK ( itab_lips-vgbel IS NOT INITIAL ).
            CALL METHOD GRID3->set_current_cell_via_id
              EXPORTING
                 is_ROW_ID    =
                 is_COLUMN_ID =
                is_row_no    = es_row_no.
            Triggers PAI of the dynpro with the specified ok-code
            CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DELIVERY_DETAILS' ).
    WHEN GRID4.
            READ TABLE gt_VBRP INTO itab_VBRP INDEX e_row-index.
            CHECK ( itab_vbrp-vgbel IS NOT INITIAL ).
            CALL METHOD GRID4->set_current_cell_via_id
              EXPORTING
                 is_ROW_ID    =
                 is_COLUMN_ID =
                is_row_no    = es_row_no.
            Triggers PAI of the dynpro with the specified ok-code
            CALL METHOD cl_gui_cfw=>set_new_ok_code( 'BILLING_DETAILS' ).
    WHEN GRID5.
            READ TABLE gt_KNA1 INTO itab_KNA1 INDEX e_row-index.
            CHECK ( itab_kna1-kunnr IS NOT INITIAL ).
          SET PARAMETER ID 'KUN' FIELD itab_KNA1-KUNNR.
           CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
          WHEN OTHERS.
            RETURN.
        ENDCASE.
    endmethod.
    endclass.    "lcl_eventhandler IMPLEMENTATION
    start-of-selection.
    *write :/ 'FEDEX INT''''L' .
    SELECT        * FROM  vbak INTO TABLE gt_VBAK
    where vbeln IN  S_VBELN.
    creating docking container
    create object docking
       exporting
        parent     = cl_gui_container=>screen0
        ratio      = 90
      exceptions
       others      = 6.
      if sy-subrc eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Create splitter container
    CREATE OBJECT splitter_1
        EXPORTING
          parent            = docking
          rows              = 1
          columns           = 3
         NO_AUTODEF_PROGID_DYNNR =
         NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Get cell container
      CALL METHOD splitter_1->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = cell_left.
      CALL METHOD splitter_1->get_container
        EXPORTING
          row       = 1
          column    = 2
        RECEIVING
          container = cell_middle.
      CALL METHOD splitter_1->get_container
        EXPORTING
          row       = 1
          column    = 3
        RECEIVING
          container = cell_right.
    Create 2nd splitter container
      CREATE OBJECT splitter_2
      EXPORTING
          parent            = cell_left
          rows              = 2
          columns           = 1
         NO_AUTODEF_PROGID_DYNNR =
         NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Get cell container
      CALL METHOD splitter_2->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = cell_top1.
      CALL METHOD splitter_2->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = cell_bottom1.
    Create 3rd splitter container
    CREATE OBJECT splitter_3
        EXPORTING
          parent            = cell_middle
          rows              = 2
          columns           = 1
         NO_AUTODEF_PROGID_DYNNR =
         NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Get cell container
      CALL METHOD splitter_3->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = cell_top2.
      CALL METHOD splitter_3->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = cell_bottom2.
    Create ALV grids
      CREATE OBJECT grid1
        EXPORTING
          i_parent          = cell_top1
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT grid2
        EXPORTING
          i_parent          = cell_bottom1
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT grid3
        EXPORTING
          i_parent          = cell_top2
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT grid4
        EXPORTING
          i_parent          = cell_bottom2
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT grid5
        EXPORTING
          i_parent          = cell_right
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Set event handler
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid1.
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid2.
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid3.
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid4.
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid5.
    Display data
      CALL METHOD grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'VBAK'
        CHANGING
          it_outtab        = gt_VBAK
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    REFRESH: gt_vbap.
      CALL METHOD grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'VBAP'
        CHANGING
          it_outtab        = gt_VBAP    " empty !!!
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    REFRESH: gt_LIPS.
      CALL METHOD grid3->set_table_for_first_display
        EXPORTING
          i_structure_name = 'LIPS'
        CHANGING
          it_outtab        = gt_LIPS    " empty !!!
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    REFRESH: gt_VBRP.
      CALL METHOD grid4->set_table_for_first_display
        EXPORTING
          i_structure_name = 'VBRP'
        CHANGING
          it_outtab        = gt_VBRP    " empty !!!
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    REFRESH: gt_KNA1.
      CALL METHOD grid5->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNA1'
        CHANGING
          it_outtab        = gt_KNA1    " empty !!!
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Link the docking container to the target dynpro
      CALL METHOD docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
         CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    NOTE: dynpro does not contain any elements (ok_code -> GD_OKCODE)
      CALL SCREEN '0100'.
    Flow logic of dynpro:
    *PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
    *PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0100.
    end-of-selection.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    SET TITLEBAR 'xxx'.
    Refresh display of detail ALV list
      CALL METHOD grid2->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Refresh display of detail ALV list
      CALL METHOD grid3->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Refresh display of detail ALV list
      CALL METHOD grid4->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Refresh display of detail ALV list
      CALL METHOD grid5->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    CASE SY-UCOMM.
    WHEN 'BACK' OR
         'EXIT'  OR
         'CANCEL'.
         SET SCREEN 0.LEAVE SCREEN.
    USER HAS PUSHED BUTTON "DISPLAY OREDERS"
         WHEN 'ORDER_DETAILS'.
          PERFORM ORDER_SHOW_DETAILS.
          when 'DELIVERY_DETAILS'.
            PERFORM DELIVERY_SHOW_DETAILS.
          WHEN 'BILLING_DETAILS'.
             PERFORM BILLING_SHOW_DETAILS.
         WHEN OTHERS.
    ENDCASE.
    CLEAR : OK_CODE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  ORDER_SHOW_DETAILS
          text
    -->  p1        text
    <--  p2        text
    FORM order_show_details .
    define local data
      DATA:
        ld_row      TYPE i,
        itab_VBAK     TYPE VBAK.
      CALL METHOD grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_VBAK INTO itab_VBAK INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT        * FROM  KNA1 INTO TABLE gt_KNA1
             WHERE  KUNNR  = itab_VBAK-KUNNR.
      SELECT        * FROM  VBAP INTO TABLE gt_VBAP
             WHERE  VBELN  = ITAB_VBAK-VBELN.
    *REFRESH: gt_LIPS.
    ENDFORM.                    " ORDER_SHOW_DETAILS
    *&      Form  DELIVERY_SHOW_DETAILS
          text
    -->  p1        text
    <--  p2        text
    FORM DELIVERY_SHOW_DETAILS .
    define local data
      DATA:
        ld_row      TYPE i,
        itab_VBAP     TYPE VBAP.
      CALL METHOD grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_VBAP INTO itab_VBAP INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT LIKPVBELN LIKPERZET LIKPLFART LIPSVBELN
           INTO CORRESPONDING FIELDS OF TABLE ITAB1
           FROM ( LIKP INNER JOIN LIPS ON LIKPVBELN = LIPSVBELN )
           WHERE LIKP~VBELN IN S_VBELN.
    *REFRESH: gt_LIPS.
    ENDFORM.                    " DELIVERY_SHOW_DETAILS
    *&      Form  BILLING_SHOW_DETAILS
          text
    -->  p1        text
    <--  p2        text
    FORM BILLING_SHOW_DETAILS .
    define local data
      DATA:
        ld_row      TYPE i,
        itab_LIPS     TYPE LIPS.
      CALL METHOD grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_LIPS INTO itab_LIPS INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT VBRKVBELN VBRKFKTYP VBRKFKART VBRPFKLMG
           INTO CORRESPONDING FIELDS OF TABLE ITAB2
           FROM ( VBRK INNER JOIN VBRP ON VBRKVBELN = VBRPVBELN )
           WHERE VBRK~VBELN IN S_VBELN.
    ENDFORM.                    " BILLING_SHOW_DETAILS

    Hi,
    ALV means ABAP List Viewer. Most convenient way to use it is through reuse library (cf.
    transaction se83) available from release 4.6 of SAP R/3.
    ALV is available in two modes: list and grid. List mode is good old list processing with
    standard functionnalities, and grid mode is using a new OCX object displaying grids.
    Classical reports needs more coding to set the horizontal and vertical lines.we need to adjust
    the lines manually.Even interactive also takes lot of code.
    ALV reports reduces the code when compared to classical reports.we use function modules to
    generate the output.
    that r REUSE_ALV_LIST_DISPLAY,REUSE_ALV_GRID_DISPLAY,REUSE_ALV_HIERSEQ_LIST_DISPLAY etc..
    the following threads will give some examples of the functions which you are expecting
    Header
    regarding function module
    hide ALV field
    Simply Display selection parameter values in the ALV OUTPUT
    Drag and drop in a report
    https://www.sdn.sap
    Reprots
    http://www.sapgenie.com/abap/reports.htm
    http://www.allsaplinks.com/material.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you
    use - ABAP Objects calls or simple function modules.

Maybe you are looking for

  • PS report does not equal to asset balance report

    Hi SAP Gurus, We have this problem where PS report S_ALR_87013557 is showing higher amount than the Asset Balances report S_ALR_87011964. Have checked on the transactions and found out that some postings are not yet settled to asset that is why the a

  • Serious and Sudden Problem with Z10 NEED HELP PLEASE

    I have a z10, one of the first that came out in Toronto (if it makes a difference), a couple of hours ago I came across a serious and sudden problem. I was able to swipe left and right between pages of apps, even drop down from the top, but I cannot

  • Connect Mac Book Pro to my TV

    Is there a way I could connect my mac book pro to my LCD TV? I could not find any adapters? I am sure there is a way. I would like to connect using my HDMI slot. Composite or component are fine.

  • GET_BUSINESS_SYSTEM_ERROR  , when Test the OB interface from R3  for proxy?

    Hi friends ,                   In my scenario ABAP Proxy to file. First i have activated the proxy . While i was  trying to <b>Test Interface (F8)</b>  BUTTON .    It is showing the Following Message            <b> 1. My sm59 's TCP/IP Connection tes

  • Architecture: obtain information about the loading of my infocube ?

    Hi, I want to make a Java application which loads information about my infocube like last successull loading, number error records for the last loading, the possibility to display these error records from the PSA ... is it possible with WD ? Any idea