Skip to Content

Regarding alv

send me some sample program to make interactive alv in each column level

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Posted on Feb 27, 2007 at 04:37 AM

    Refer this link

    http://www.sap-img.com/abap/an-interactive-alv-report.htm

    Reward if this helps.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 27, 2007 at 04:44 AM

    Hi,

    Herewith i am sending the sample report for LAV INTERACTIVE.

    REPORT YMS_ALVINTERACTIVE NO STANDARD PAGE HEADING LINE-COUNT 65(3) LINE-SIZE 220

    MESSAGE-ID ZZ.

    TYPE-POOLS: SLIS, ICON.

    ************************************************************************

    • Tables *

    ************************************************************************

    TABLES : VBRK, "Billing Master table

    VBRP. "Billing Item table

    ************************************************************************

    • VARIABLES DECLARATION *

    ************************************************************************

    DATA: STR_DATE LIKE SY-DATUM.

    DATA: X_FIELDCAT_VBRK TYPE SLIS_FIELDCAT_ALV,

    IT_FIELDCAT_VBRK TYPE SLIS_T_FIELDCAT_ALV.

    DATA: X_FIELDCAT_VBRP TYPE SLIS_FIELDCAT_ALV,

    IT_FIELDCAT_VBRP TYPE SLIS_T_FIELDCAT_ALV.

    DATA: L_LAYOUT TYPE SLIS_LAYOUT_ALV.

    DATA: CUR_VBELN(15), CUR_VBELN_VALUE(15).

    DATA: TEMP_VBELN(10).

    DATA: CTAB LIKE SY-TABIX.

    ************************************************************************

    • Internal Tables *

    ************************************************************************

    • Internal table to hold data from VBRK

    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,

    BUTXT LIKE T001-BUTXT,

    CHECK(1) TYPE C,

    END OF IT_VBRK.

    • Internal table to hold data from VBRP

    DATA: BEGIN OF IT_VBRP 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 IT_VBRP.

    DATA: BEGIN OF IT_T001 OCCURS 0,

    BUKRS LIKE T001-BUKRS,

    BUTXT LIKE T001-BUTXT,

    END OF IT_T001.

    ************************************************************************

    • 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,

    S_MATNR FOR VBRP-MATNR.

    SELECTION-SCREEN END OF BLOCK B1.

    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.

    PARAMETERS : LIST RADIOBUTTON GROUP G1,

    GRID RADIOBUTTON GROUP G1 DEFAULT 'X'.

    SELECTION-SCREEN END OF BLOCK B2.

    ************************************************************************

                                    • INITIALIZATION ********************

                                    ************************************************************************

                                    INITIALIZATION.

                                    STR_DATE = SY-DATUM - 200.

                                    S_FKDAT-LOW = STR_DATE.

                                    S_FKDAT-HIGH = SY-DATUM.

                                    S_FKDAT-SIGN = 'I'.

                                    APPEND S_FKDAT.

                                    ************************************************************************

                                    • At Selection-Screen Output *

                                    ************************************************************************

                                    AT SELECTION-SCREEN OUTPUT .

                                    LOOP AT SCREEN.

                                    IF SCREEN-NAME = 'S_FKDAT-HIGH'.

                                    SCREEN-INPUT = 0.

                                    MODIFY SCREEN.

                                    ENDIF.

                                    ENDLOOP.

                                    ************************************************************************

                                    • At Selection-Screen *

                                    ************************************************************************

                                    AT SELECTION-SCREEN.

                                    PERFORM VALIDATION.

                                    ************************************************************************

                                    • Start of Selection *

                                    ************************************************************************

                                    START-OF-SELECTION.

                                    *POPULATION OF DATA INTO INTERNAL TABLE IT_VBRK AND IT_VBRP

                                    PERFORM GET_DATA_VBRK.

                                    PERFORM FIELDCATALOG_CHANGE.

                                    *ALV GRID/LIST DISPLAY

                                    PERFORM FIRST_SCREEN_DISPLAY.

                                    &----


                                    *& Form VALIDATION

                                    &----


                                    • text

                                    ----


                                    FORM VALIDATION.

                                    IF S_VBELN[] IS NOT INITIAL.

                                    SELECT SINGLE VBELN FROM VBRK INTO VBRK-VBELN

                                    WHERE VBELN IN S_VBELN.

                                    IF SY-SUBRC <> 0.

                                    MESSAGE I000 WITH 'PLEASE ENTER CORRECT BILLING DOCUMENT'.

                                    STOP.

                                    ENDIF.

                                    ENDIF.

                                    IF S_FKDAT[] IS INITIAL.

                                    MESSAGE I000 WITH 'PLEASE ENTER ALL THE MANDATORY FIELDS'.

                                    STOP.

                                    ENDIF.

                                    IF S_MATNR[] IS NOT INITIAL.

                                    SELECT SINGLE MATNR FROM MARA INTO VBRP-MATNR

                                    WHERE MATNR IN S_MATNR.

                                    IF SY-SUBRC <> 0.

                                    MESSAGE I000 WITH 'PLEASE ENTER CORRECT MATERIAL NUMBER'.

                                    STOP.

                                    ENDIF.

                                    ENDIF.

                                    ENDFORM. "VALIDATION

                                    &----


                                    *& Form GET_DATA_VBRK

                                    &----


                                    • text

                                    ----


                                    FORM GET_DATA_VBRK.

                                    SELECT VBELN WAERK VKORG FKDAT BUKRS FROM VBRK INTO TABLE IT_VBRK

                                    WHERE VBELN IN S_VBELN AND FKDAT IN S_FKDAT.

                                    SORT IT_VBRK BY VBELN BUKRS.

                                    SELECT BUKRS BUTXT FROM T001 INTO TABLE IT_T001 FOR ALL ENTRIES IN IT_VBRK

                                    WHERE BUKRS = IT_VBRK-BUKRS.

                                    LOOP AT IT_VBRK.

                                    CTAB = SY-TABIX.

                                    LOOP AT IT_T001 WHERE BUKRS = IT_VBRK-BUKRS.

                                    IF SY-SUBRC = 0.

                                    IT_VBRK-BUTXT = IT_T001-BUTXT.

                                    MODIFY IT_VBRK INDEX CTAB.

                                    CLEAR CTAB.

                                    ENDIF.

                                    ENDLOOP.

                                    ENDLOOP.

                                    ENDFORM. "GET_DATA

                                    &----


                                    *& Form FIELDCATALOG_CHANGE

                                    &----


                                    • text

                                    ----


                                    FORM FIELDCATALOG_CHANGE.

                                    *Layout Change

                                    L_LAYOUT-ZEBRA = 'X'.

                                    • L_LAYOUT-BOX_FIELDNAME = 'CHECK'.

                                    *Define seperate Color for the fields

                                    X_FIELDCAT_VBRK-COL_POS = 1.

                                    X_FIELDCAT_VBRK-FIELDNAME = 'CHECK'.

                                    X_FIELDCAT_VBRK-SELTEXT_M = 'chek'.

                                    X_FIELDCAT_VBRK-CHECKBOX = 'X'.

                                    X_FIELDCAT_VBRK-INPUT = 'X'.

                                    X_FIELDCAT_VBRK-EDIT = 'X'.

                                    APPEND X_FIELDCAT_VBRK TO IT_FIELDCAT_VBRK.

                                    CLEAR X_FIELDCAT_VBRK.

                                    X_FIELDCAT_VBRK-COL_POS = 2.

                                    X_FIELDCAT_VBRK-TABNAME = 'IT_VBRK'.

                                    X_FIELDCAT_VBRK-FIELDNAME = 'VBELN'.

                                    X_FIELDCAT_VBRK-EMPHASIZE = 'C301'.

                                    X_FIELDCAT_VBRK-OUTPUTLEN = 15.

                                    APPEND X_FIELDCAT_VBRK TO IT_FIELDCAT_VBRK.

                                    CLEAR X_FIELDCAT_VBRK.

                                    X_FIELDCAT_VBRK-TABNAME = 'IT_VBRK'.

                                    X_FIELDCAT_VBRK-FIELDNAME = 'WAERK'.

                                    X_FIELDCAT_VBRK-EMPHASIZE = 'C201'.

                                    X_FIELDCAT_VBRK-OUTPUTLEN = 15.

                                    APPEND X_FIELDCAT_VBRK TO IT_FIELDCAT_VBRK.

                                    CLEAR X_FIELDCAT_VBRK.

                                    X_FIELDCAT_VBRK-TABNAME = 'IT_VBRK'.

                                    X_FIELDCAT_VBRK-FIELDNAME = 'VKORG'.

                                    X_FIELDCAT_VBRK-EMPHASIZE = 'C300'.

                                    X_FIELDCAT_VBRK-OUTPUTLEN = 15.

                                    APPEND X_FIELDCAT_VBRK TO IT_FIELDCAT_VBRK.

                                    CLEAR X_FIELDCAT_VBRK.

                                    X_FIELDCAT_VBRK-TABNAME = 'IT_VBRK'.

                                    X_FIELDCAT_VBRK-FIELDNAME = 'FKDAT'.

                                    X_FIELDCAT_VBRK-EMPHASIZE = 'C600'.

                                    X_FIELDCAT_VBRK-OUTPUTLEN = 15.

                                    APPEND X_FIELDCAT_VBRK TO IT_FIELDCAT_VBRK.

                                    CLEAR X_FIELDCAT_VBRK.

                                    X_FIELDCAT_VBRK-TABNAME = 'IT_VBRK'.

                                    X_FIELDCAT_VBRK-FIELDNAME = 'BUKRS'.

                                    X_FIELDCAT_VBRK-EMPHASIZE = 'C400'.

                                    X_FIELDCAT_VBRK-OUTPUTLEN = 15.

                                    APPEND X_FIELDCAT_VBRK TO IT_FIELDCAT_VBRK.

                                    CLEAR X_FIELDCAT_VBRK.

                                    X_FIELDCAT_VBRK-TABNAME = 'IT_VBRK'.

                                    X_FIELDCAT_VBRK-FIELDNAME = 'BUTXT'.

                                    X_FIELDCAT_VBRK-EMPHASIZE = 'C500'.

                                    X_FIELDCAT_VBRK-OUTPUTLEN = 15.

                                    APPEND X_FIELDCAT_VBRK TO IT_FIELDCAT_VBRK.

                                    CLEAR X_FIELDCAT_VBRK.

                                    ENDFORM. "FIELDCATALOG_CHANGE

                                    &----


                                    *& Form FIRST_SCREEN_DISPLAY

                                    &----


                                    • text

                                    ----


                                    FORM FIRST_SCREEN_DISPLAY.

                                    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_VBRK

                                    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.

                                    • CHECK RADIO BUTTON SELECTION AND ACCORDINGLY DISPLAY LIST OR GRID ALV

                                    IF LIST = 'X'.

                                    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

                                    EXPORTING

                                    I_CALLBACK_PROGRAM = SY-REPID

                                    I_CALLBACK_PF_STATUS_SET = 'STATUS'

                                    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

                                    IS_LAYOUT = L_LAYOUT

                                    IT_FIELDCAT = IT_FIELDCAT_VBRK

                                    • IT_EVENTS =

                                    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.

                                    CLEAR LIST.

                                    ENDIF.

                                    IF GRID = 'X'.

                                    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

                                    EXPORTING

                                    I_CALLBACK_PROGRAM = SY-REPID

                                    I_CALLBACK_PF_STATUS_SET = 'STATUS'

                                    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

                                    IS_LAYOUT = L_LAYOUT

                                    IT_FIELDCAT = IT_FIELDCAT_VBRK

                                    • IT_EVENTS =

                                    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.

                                    CLEAR GRID.

                                    ENDIF.

                                    ENDFORM. "FIRST_SCREEN_DISPLAY

                                    &----


                                    *& Form STATUS

                                    &----


                                    • text

                                    ----


                                    • -->P_EXTAB text

                                    ----


                                    FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.

                                    SET PF-STATUS 'STATUS' EXCLUDING P_EXTAB.

                                    ENDFORM. "STATUS

                                    &----


                                    *& Form USER_COMMAND

                                    &----


                                    • text

                                    ----


                                    • -->R_UCOMM text

                                    • -->RS_SELFIELD text

                                    ----


                                    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM

                                    RS_SELFIELD TYPE SLIS_SELFIELD.

                                    CASE R_UCOMM.

                                    WHEN 'BACK' OR 'CANC' OR 'EXIT'.

                                    LEAVE TO SCREEN 0.

                                    WHEN '&IC1'.

                                    IF RS_SELFIELD-FIELDNAME = 'VBELN'.

                                    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

                                    EXPORTING

                                    INPUT = RS_SELFIELD-VALUE

                                    IMPORTING

                                    OUTPUT = TEMP_VBELN.

                                    • TEMP_VBELN = RS_SELFIELD-VALUE.

                                    PERFORM GET_DATA_VBRP.

                                    PERFORM GET_SECOND_SCREEN_DISPLAY.

                                    ENDIF.

                                    ENDCASE.

                                    ENDFORM. "USER_COMMAND

                                    &----


                                    *& Form GET_DATA_VBRP

                                    &----


                                    • text

                                    ----


                                    FORM GET_DATA_VBRP.

                                    SELECT VBELN POSNR FKIMG VRKME NETWR MATNR ARKTX FROM VBRP INTO TABLE IT_VBRP

                                    WHERE VBELN = TEMP_VBELN.

                                    IF SY-SUBRC <> 0.

                                    MESSAGE E000 WITH ' NO BILLING DETAILS FOUND'.

                                    EXIT.

                                    ENDIF.

                                    ENDFORM. "GET_DATA_VBRP

                                    &----


                                    *& Form GET_SECOND_SCREEN_DISPLAY

                                    &----


                                    • text

                                    ----


                                    FORM GET_SECOND_SCREEN_DISPLAY.

                                    • FIELDCATALOG CALL

                                    X_FIELDCAT_VBRP-TABNAME = 'IT_VBRP'.

                                    X_FIELDCAT_VBRP-FIELDNAME = 'VRKME'.

                                    X_FIELDCAT_VBRP-EMPHASIZE = 'C500'.

                                    X_FIELDCAT_VBRP-OUTPUTLEN = 10.

                                    APPEND X_FIELDCAT_VBRP TO IT_FIELDCAT_VBRP.

                                    CLEAR X_FIELDCAT_VBRP.

                                    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

                                    EXPORTING

                                    I_PROGRAM_NAME = SY-REPID

                                    I_INTERNAL_TABNAME = 'IT_VBRP'

                                    I_INCLNAME = SY-REPID

                                    CHANGING

                                    CT_FIELDCAT = IT_FIELDCAT_VBRP

                                    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.

                                    • CHECK RADIO BUTTON SELECTION AND ACCORDINGLY DISPLAY LIST OR GRID ALV

                                    IF LIST = 'X'.

                                    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

                                    EXPORTING

                                    I_CALLBACK_PROGRAM = SY-REPID

                                    I_CALLBACK_PF_STATUS_SET = 'STATUS'

                                    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

                                    IS_LAYOUT = L_LAYOUT

                                    IT_FIELDCAT = IT_FIELDCAT_VBRP

                                    I_SCREEN_START_COLUMN = 1

                                    I_SCREEN_START_LINE = 1

                                    I_SCREEN_END_COLUMN = 100

                                    I_SCREEN_END_LINE = 10

                                    • IT_EVENTS =

                                    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.

                                    ENDIF.

                                    IF GRID = 'X'.

                                    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

                                    EXPORTING

                                    I_CALLBACK_PROGRAM = SY-REPID

                                    I_CALLBACK_PF_STATUS_SET = 'STATUS'

                                    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

                                    IS_LAYOUT = L_LAYOUT

                                    IT_FIELDCAT = IT_FIELDCAT_VBRP

                                    I_SCREEN_START_COLUMN = 1

                                    I_SCREEN_START_LINE = 1

                                    I_SCREEN_END_COLUMN = 100

                                    I_SCREEN_END_LINE = 10

                                    • IT_EVENTS =

                                    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.

                                    ENDIF.

                                    ENDFORM. "GET_SECOND_SCREEN_DISPLAY

                                    Thanks,

                                    Shankar

                                    Add a comment
                                    10|10000 characters needed characters exceeded

                                  • author's profile photo Former Member
                                    Former Member
                                    Posted on Feb 27, 2007 at 04:45 AM

                                    hi,

                                    chk this prog:

                                    &----


                                    report zkeerthi_alv5 .

                                    &----


                                    *& tables declaration

                                    &----


                                    tables: vbrk,vbrp.

                                    &----


                                    *& type-pools declaration

                                    &----


                                    type-pools: slis.

                                    &----


                                    *& data declaration

                                    &----


                                    data: g_repid type sy-repid.

                                    data : it_fieldcat type slis_t_fieldcat_alv, "mara

                                    wa_fieldcat type slis_fieldcat_alv,

                                    wa_layout type slis_layout_alv,

                                    wa_event type slis_alv_event,

                                    t_event type slis_t_event.

                                    data: v_vbeln like vbrk-vbeln,

                                    v_matnr like vbrp-matnr.

                                    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 it_vbrp 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 it_vbrp.

                                    &----


                                    *& selection screen

                                    &----


                                    selection-screen begin of block b with frame title text-001.

                                    select-options: s_vbeln for vbrk-vbeln,

                                    s_fkdat for vbrk-fkdat,

                                    s_matnr for vbrp-matnr.

                                    selection-screen end of block b.

                                    **INITIALIZATION.

                                    initialization.

                                    g_repid = sy-repid.

                                    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.

                                    &----


                                    *& 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_VBRK

                                    &----


                                    *& 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

                                    where vbeln = it_vbrk-vbeln.

                                    endform. " GET_DATA_VBRP

                                    ***END-OF-SELECTION.

                                    end-of-selection.

                                    perform event_list.

                                    perform get_field_catalog.

                                    perform list_disp .

                                    form list_disp .

                                    call function 'REUSE_ALV_GRID_DISPLAY'

                                    exporting

                                    • I_INTERFACE_CHECK = ' '

                                    • I_BYPASSING_BUFFER = ' '

                                    • I_BUFFER_ACTIVE = ' '

                                    i_callback_program = g_repid

                                    • I_CALLBACK_PF_STATUS_SET = 'POPUP'

                                    i_callback_user_command = '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 = WA_LAYOUT

                                    it_fieldcat = it_fieldcat

                                    • IT_EXCLUDING =

                                    • IT_SPECIAL_GROUPS =

                                    • IT_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

                                    • IT_ALV_GRAPHICS =

                                    • IT_HYPERLINK =

                                    • IT_ADD_FIELDCAT =

                                    • IT_EXCEPT_QINFO =

                                    • I_HTML_HEIGHT_TOP =

                                    • I_HTML_HEIGHT_END =

                                    • IMPORTING

                                    • E_EXIT_CAUSED_BY_CALLER =

                                    • ES_EXIT_CAUSED_BY_USER =

                                    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.

                                    endform. " LIST_DISP

                                    &----


                                    *& Form GET_FIELD_CATALOG

                                    &----


                                    • text

                                    ----


                                    • --> p1 text

                                    • <-- p2 text

                                    ----


                                    form get_field_catalog .

                                    call function 'REUSE_ALV_FIELDCATALOG_MERGE'

                                    exporting

                                    i_program_name = g_repid

                                    i_internal_tabname = 'IT_VBRK'

                                    • I_STRUCTURE_NAME =

                                    • I_CLIENT_NEVER_DISPLAY = 'X'

                                    i_inclname = g_repid

                                    • I_BYPASSING_BUFFER =

                                    • I_BUFFER_ACTIVE =

                                    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 event_list

                                    &----


                                    • text

                                    ----


                                    • --> p1 text

                                    • <-- p2 text

                                    ----


                                    form event_list .

                                    clear wa_event.

                                    wa_event-name = 'USER_COMMAND'.

                                    wa_event-form = 'USER_COMMAND'.

                                    append wa_event to t_event.

                                    clear wa_event.

                                    endform. " event_list

                                    form user_command using r_ucomm like sy-ucomm

                                    rs_selfield type slis_selfield.

                                    case r_ucomm.

                                    when '&IC1'.

                                    read table it_vbrk index rs_selfield-tabindex.

                                    perform get_data_vbrp.

                                    perform build_fieldcatalog_vbrp .

                                    perform display_alv_vbrp.

                                    endcase.

                                    endform.

                                    &----


                                    *& Form BUILD_FIELDCATALOG_VBRP

                                    &----


                                    • text

                                    ----


                                    • --> p1 text

                                    • <-- p2 text

                                    ----


                                    form build_fieldcatalog_vbrp .

                                    call function 'REUSE_ALV_FIELDCATALOG_MERGE'

                                    exporting

                                    i_program_name = g_repid

                                    i_internal_tabname = 'IT_VBRP'

                                    • I_STRUCTURE_NAME =

                                    • I_CLIENT_NEVER_DISPLAY = 'X'

                                    i_inclname = g_repid

                                    • I_BYPASSING_BUFFER =

                                    • I_BUFFER_ACTIVE =

                                    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. " BUILD_FIELDCATALOG_VBRP

                                    &----


                                    *& Form DISPLAY_ALV_VBRP

                                    &----


                                    • text

                                    ----


                                    • --> p1 text

                                    • <-- p2 text

                                    ----


                                    form display_alv_vbrp .

                                    call function 'REUSE_ALV_GRID_DISPLAY'

                                    exporting

                                    • I_INTERFACE_CHECK = ' '

                                    • I_BYPASSING_BUFFER = ' '

                                    • I_BUFFER_ACTIVE = ' '

                                    i_callback_program = g_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 =

                                    it_fieldcat = it_fieldcat

                                    • IT_EXCLUDING =

                                    • IT_SPECIAL_GROUPS =

                                    • IT_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

                                    • IT_ALV_GRAPHICS =

                                    • IT_HYPERLINK =

                                    • IT_ADD_FIELDCAT =

                                    • IT_EXCEPT_QINFO =

                                    • I_HTML_HEIGHT_TOP =

                                    • I_HTML_HEIGHT_END =

                                    • IMPORTING

                                    • E_EXIT_CAUSED_BY_CALLER =

                                    • ES_EXIT_CAUSED_BY_USER =

                                    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. " DISPLAY_ALV_VBRP

                                    regards,

                                    keerthi

                                    Add a comment
                                    10|10000 characters needed characters exceeded

                                  • Posted on Feb 27, 2007 at 04:50 AM

                                    Hi,

                                    Kindly go through this coding man. It will be useful for u.

                                    REPORT YMS_ALVTEST line-size 180 message-id zz.

                                    tables:ekko.

                                    type-pools : slis.

                                    &----


                                    • Internal table for ALV

                                    ----


                                    data : it_fieldcat type slis_t_fieldcat_alv, "Field catalog

                                    wa_fieldcat type slis_fieldcat_alv, "WA for Field catalog

                                    it_event type slis_t_event, "events

                                    wa_event type slis_alv_event, "WA for events

                                    it_comment type slis_t_listheader, "Header details

                                    wa_comment type slis_listheader, "WA for header details

                                    wa_layout type slis_layout_alv, "Layout

                                    it_sort type slis_t_sortinfo_alv, "Sort table

                                    wa_sort type slis_sortinfo_alv, "WA for sort table

                                    it_keyinfo type slis_keyinfo_alv. "Pass key value

                                    data : v_repid like sy-repid.

                                    v_repid = sy-repid.

                                    data : v_date like sy-datum,

                                    i_variant like disvariant,

                                    i_variant1 like disvariant.

                                    data : w_save(1) type c,

                                    w_default(1) type c,

                                    w_exit(1) type c.

                                      • color management.

                                      data : it_color type table of lvc_s_scol. "Color management.

                                      &----


                                      • Internal table declearation

                                      ----


                                      data:begin of it_ekko occurs 0,

                                      ebeln like ekko-ebeln,

                                      bukrs like ekko-bukrs,

                                      aedat like ekko-aedat,

                                      end of it_ekko.

                                      data : begin of it_ekpo occurs 0,

                                      ebeln like ekpo-ebeln,

                                      ebelp like ekpo-ebelp,

                                      matnr like ekpo-matnr,

                                      menge like ekpo-menge,

                                      meins like ekpo-meins,

                                      netpr like ekpo-netpr,

                                      netwr like ekpo-menge,

                                      chk(1) type c,

                                      end of it_ekpo.

                                      data : begin of it_ekbe occurs 0,

                                      ebeln like ekbe-ebeln,

                                      ebelp like ekbe-ebelp,

                                      belnr like ekbe-belnr,

                                      menge like ekbe-menge,

                                      matnr like ekbe-matnr,

                                      end of it_ekbe.

                                      data : begin of it_final occurs 0,

                                      ebeln like ekpo-ebeln,

                                      ebelp like ekpo-ebelp,

                                      matnr like ekpo-matnr,

                                      menge like ekpo-menge,

                                      meins like ekpo-meins,

                                      netpr like ekpo-netpr,

                                      netwr like ekpo-netwr,

                                      line_color(4) type c, "Used to store row color attributes

                                      end of it_final.

                                      selection-screen begin of block blk with frame title text-001.

                                      select-options:s_ebeln for ekko-ebeln.

                                      parameters : rb1 radiobutton group g1 modif id z1,

                                      rb2 radiobutton group g1 modif id z2,

                                      rb3 radiobutton group g1 modif id z3.

                                      selection-screen end of block blk.

                                      • Variant for ALV display

                                      selection-screen begin of block 0 with frame title text-000.

                                      parameters: p_varnt like disvariant-variant.

                                      selection-screen end of block 0.

                                      at selection-screen output.

                                      perform modify_screen.

                                      at selection-screen on value-request for p_varnt.

                                      perform f4_for_variant.

                                      start-of-selection.

                                      perform get_details.

                                      perform get_alv.

                                      &----


                                      *& Form modify_screen

                                      &----


                                      • text

                                      ----


                                      • --> p1 text

                                      • <-- p2 text

                                      ----


                                      form modify_screen .

                                      • IF RB1 = 'X'.

                                      • LOOP AT SCREEN.

                                      • IF SCREEN-GROUP1 = 'Z1' .

                                      • SCREEN-INVISIBLE = 1.

                                      • SCREEN-ACTIVE = 0.

                                      • ELSE.

                                      • SCREEN-INVISIBLE = 0.

                                      • SCREEN-ACTIVE = 1.

                                      • ENDIF.

                                      • MODIFY SCREEN.

                                      • ENDLOOP.

                                      • ENDIF.

                                      endform. " modify_screen

                                      &----


                                      *& Form GET_DETAILS

                                      &----


                                      • Get the details

                                      ----


                                      form get_details .

                                      data: ld_color(1) type c.

                                      select ebeln

                                      bukrs

                                      aedat

                                      from ekko

                                      into table it_ekko

                                      where ebeln in s_ebeln.

                                      if sy-subrc = 0.

                                      sort it_ekko by ebeln.

                                      else.

                                      message e000 with 'DATA NOT FOUND'.

                                      endif.

                                      if not it_ekko[] is initial.

                                      select ebeln

                                      ebelp

                                      matnr

                                      menge

                                      meins

                                      netpr

                                      netwr

                                      • chk

                                      from ekpo

                                      into table it_ekpo

                                      for all entries in it_ekko

                                      where ebeln = it_ekko-ebeln.

                                      if sy-subrc = 0.

                                      sort it_ekpo by ebeln.

                                      endif.

                                      endif.

                                      loop at it_ekpo.

                                      it_final-ebeln = it_ekpo-ebeln.

                                      it_final-ebelp = it_ekpo-ebelp.

                                      it_final-matnr = it_ekpo-matnr.

                                      it_final-menge = it_ekpo-menge.

                                      it_final-meins = it_ekpo-meins.

                                      it_final-netpr = it_ekpo-netpr.

                                      it_final-netwr = it_ekpo-netwr.

                                      on change of it_final-ebeln.

                                      ld_color = 7.

                                      concatenate 'C' ld_color '10' into it_final-line_color.

                                      endon.

                                      append it_final.

                                      clear it_final.

                                      endloop.

                                      endform. " GET_DETAILS

                                      &----


                                      *& Form GET_ALV

                                      &----


                                      • text

                                      ----


                                      form get_alv .

                                      perform generate_fieldcat.

                                      perform generate_layout.

                                      perform generate_events.

                                      perform generate_sort.

                                      perform alv_grid_display.

                                      endform. " GET_ALV

                                      &----


                                      *& Form GENERATE_FIELDCAT

                                      &----


                                      • Field catalog

                                      ----


                                      form generate_fieldcat .

                                      if rb1 = 'X' or rb2 = 'X'.

                                      wa_fieldcat-fieldname = 'EBELN'.

                                      wa_fieldcat-col_pos = '1'.

                                      wa_fieldcat-just = 'R'.

                                      wa_fieldcat-seltext_l = 'PO Number'.

                                      wa_fieldcat-lowercase = 'X'.

                                      wa_fieldcat-do_sum = 'X'.

                                      append wa_fieldcat to it_fieldcat.

                                      wa_fieldcat-fieldname = 'EBELP'.

                                      wa_fieldcat-col_pos = '2'.

                                      wa_fieldcat-just = 'C'.

                                      wa_fieldcat-seltext_l = 'Item Number'.

                                      wa_fieldcat-lowercase = 'X'.

                                      wa_fieldcat-edit = 'X'.

                                      append wa_fieldcat to it_fieldcat.

                                      wa_fieldcat-fieldname = 'MATNR'.

                                      wa_fieldcat-col_pos = '3'.

                                      wa_fieldcat-just = 'C'.

                                      wa_fieldcat-seltext_l = 'Material Number'.

                                      wa_fieldcat-lowercase = 'X'.

                                      append wa_fieldcat to it_fieldcat.

                                      wa_fieldcat-fieldname = 'MENGE'.

                                      wa_fieldcat-col_pos = '4'.

                                      wa_fieldcat-just = 'C'.

                                      wa_fieldcat-seltext_l = 'PO Quantity'.

                                      wa_fieldcat-lowercase = 'X'.

                                      append wa_fieldcat to it_fieldcat.

                                      wa_fieldcat-fieldname = 'MEINS'.

                                      wa_fieldcat-col_pos = '5'.

                                      wa_fieldcat-just = 'C'.

                                      wa_fieldcat-seltext_l = 'Order unit'.

                                      wa_fieldcat-lowercase = 'X'.

                                      append wa_fieldcat to it_fieldcat.

                                      wa_fieldcat-fieldname = 'NETPR'.

                                      wa_fieldcat-col_pos = '6'.

                                      wa_fieldcat-just = 'C'.

                                      wa_fieldcat-seltext_l = 'Net price'.

                                      wa_fieldcat-lowercase = 'X'.

                                      append wa_fieldcat to it_fieldcat.

                                      wa_fieldcat-fieldname = 'NETWR'.

                                      wa_fieldcat-col_pos = '7'.

                                      wa_fieldcat-just = 'C'.

                                      wa_fieldcat-seltext_l = 'Net order value'.

                                      wa_fieldcat-lowercase = 'X'.

                                      append wa_fieldcat to it_fieldcat.

                                      • wa_fieldcat-fieldname = 'CHK'.

                                      • wa_fieldcat-col_pos = '8'.

                                      • wa_fieldcat-just = 'C'.

                                      • wa_fieldcat-seltext_l = 'Check Box'.

                                      • wa_fieldcat-lowercase = 'X'.

                                      • wa_fieldcat-checkbox = 'X'.

                                      • wa_fieldcat-edit = 'X'.

                                      • append wa_fieldcat to it_fieldcat.

                                      else.

                                      call function 'REUSE_ALV_FIELDCATALOG_MERGE'

                                      exporting

                                      i_program_name = sy-repid

                                      i_internal_tabname = 'IT_EKKO'

                                      • I_STRUCTURE_NAME = I_STRUCTURE_NAME

                                      • I_CLIENT_NEVER_DISPLAY = 'X'

                                      i_inclname = sy-repid

                                      • I_BYPASSING_BUFFER = I_BYPASSING_BUFFER

                                      • I_BUFFER_ACTIVE = I_BUFFER_ACTIVE

                                      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.

                                      call function 'REUSE_ALV_FIELDCATALOG_MERGE'

                                      exporting

                                      i_program_name = sy-repid

                                      i_internal_tabname = 'IT_EKPO'

                                      • I_STRUCTURE_NAME = I_STRUCTURE_NAME

                                      • I_CLIENT_NEVER_DISPLAY = 'X'

                                      i_inclname = sy-repid

                                      • I_BYPASSING_BUFFER = I_BYPASSING_BUFFER

                                      • I_BUFFER_ACTIVE = I_BUFFER_ACTIVE

                                      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.

                                      endif.

                                      endform. " GENERATE_FIELDCAT

                                      *&----


                                      *& Form GENERATE_EVENTS

                                      *&----


                                      • Generate Events

                                      *----


                                      form generate_events .

                                      call function 'REUSE_ALV_EVENTS_GET'

                                      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.

                                      if not it_event[] is initial.

                                      read table it_event into wa_event with key name = 'TOP_OF_PAGE'.

                                      if sy-subrc = 0.

                                      wa_event-form = 'TOP_OF_PAGE'.

                                      modify it_event from wa_event index sy-tabix.

                                      endif.

                                      read table it_event into wa_event with key name = 'USER_COMMAND'.

                                      if sy-subrc = 0.

                                      wa_event-form = 'IT_USER_COMMAND'.

                                      modify it_event from wa_event index sy-tabix.

                                      endif.

                                      endif.

                                      endform. " GENERATE_EVENTS

                                      *&----


                                      *& Form TOP_OF_PAGE

                                      *&----


                                      • TOP_OF_PAGE

                                      *----


                                      form top_of_page.

                                      data : v_concate(50) type c.

                                      data : v_space(10) type c.

                                      *Concatenate 'vikranth' 'rajesh' 'date:' 'khimavath' into wa_comment-info separated by space .

                                      *append wa_comment to it_comment.

                                      *clear wa_comment.

                                      *concatenate 'srikanth' 'khimavath' into wa_comment-info.

                                      *append wa_comment to it_comment.

                                      *clear wa_comment.

                                      *concatenate 'prashanth' 'khimavath' into wa_comment-info.

                                      *append wa_comment to it_comment.

                                      *clear wa_comment.

                                      concatenate 'VIKRANTH' 'rajesh' into v_concate.

                                      wa_comment-typ = 'S'.

                                      wa_comment-key = 'USER :'.

                                      wa_comment-info = v_concate.

                                      append wa_comment to it_comment.

                                      wa_comment-typ = 'S'.

                                      wa_comment-key = 'DATE:'.

                                      wa_comment-info = sy-datum.

                                      append wa_comment to it_comment.

                                      wa_comment-typ = 'S'.

                                      wa_comment-key = 'TIME:'.

                                      wa_comment-info = sy-timlo.

                                      append wa_comment to it_comment.

                                      call function 'REUSE_ALV_COMMENTARY_WRITE'

                                      exporting

                                      it_list_commentary = it_comment.

                                      clear it_comment.

                                      endform. "TOP_OF_PAGE

                                      &----


                                      *& Form ALV_GRID_DISPLAY

                                      &----


                                      • Grid display

                                      ----


                                      form alv_grid_display .

                                      if rb1 = 'X'.

                                      perform grid_display.

                                      elseif rb2 = 'X'.

                                      perform list_display.

                                      else.

                                      perform hierseq_display.

                                      endif.

                                      endform. " ALV_GRID_DISPLAY

                                      &----


                                      *& Form GENERATE_LAYOUT

                                      &----


                                      • LAYOUT

                                      ----


                                      form generate_layout .

                                      wa_layout-colwidth_optimize = 'X'. "OPTIMIZING FIELD WIDTH

                                      wa_layout-zebra = 'X'. "PUTTING ZEBRA COLORS

                                      wa_layout-totals_text = 'Total'.

                                      wa_layout-subtotals_text = 'SUB TOTAL'.

                                      wa_layout-info_fieldname = 'LINE_COLOR'.

                                      endform. " GENERATE_LAYOUT

                                      &----


                                      *& Form GENERATE_SORT

                                      &----


                                      • SORT

                                      ----


                                      form generate_sort .

                                      wa_sort-fieldname = 'EBELN'.

                                      wa_sort-spos = '1'.

                                      wa_sort-up = 'X'.

                                      wa_sort-subtot = 'X'.

                                      append wa_sort to it_sort.

                                      endform. " GENERATE_SORT

                                      &----


                                      *& Form GRID_DISPLAY

                                      &----


                                      • GRID DISPLAY

                                      ----


                                      form grid_display .

                                      call function 'REUSE_ALV_GRID_DISPLAY'

                                      exporting

                                      • I_INTERFACE_CHECK = ' '

                                      • I_BYPASSING_BUFFER = ' '

                                      • I_BUFFER_ACTIVE = ' '

                                      i_callback_program = v_repid

                                      • I_CALLBACK_PF_STATUS_SET = ' '

                                      • I_CALLBACK_USER_COMMAND = 'IT_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 = 'Purchase Order Details'

                                      • I_GRID_SETTINGS = I_GRID_SETTINGS

                                      is_layout = wa_layout

                                      it_fieldcat = it_fieldcat

                                      • IT_EXCLUDING = IT_EXCLUDING

                                      • IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS

                                      it_sort = it_sort

                                      • IT_FILTER = IT_FILTER

                                      • IS_SEL_HIDE = IS_SEL_HIDE

                                      • I_DEFAULT = 'X'

                                      i_save = w_save

                                      is_variant = i_variant

                                      it_events = it_event

                                      • IT_EVENT_EXIT = IT_EVENT_EXIT

                                      • IS_PRINT = IS_PRINT

                                      • IS_REPREP_ID = 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_ALV_GRAPHICS

                                      • IT_HYPERLINK = IT_HYPERLINK

                                      • IT_ADD_FIELDCAT = IT_ADD_FIELDCAT

                                      • IT_EXCEPT_QINFO = IT_EXCEPT_QINFO

                                      • IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER

                                      • IMPORTING

                                      • E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER

                                      • ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER

                                      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. " GRID_DISPLAY

                                      &----


                                      *& Form LIST_DISPLAY

                                      &----


                                      • LIST DISPLAY

                                      ----


                                      form list_display .

                                      call function 'REUSE_ALV_LIST_DISPLAY'

                                      exporting

                                      • I_INTERFACE_CHECK = ' '

                                      • I_BYPASSING_BUFFER = I_BYPASSING_BUFFER

                                      • I_BUFFER_ACTIVE = ' '

                                      i_callback_program = v_repid

                                      • I_CALLBACK_PF_STATUS_SET = ' '

                                      i_callback_user_command = 'IT_USER_COMMAND'

                                      • I_STRUCTURE_NAME = I_STRUCTURE_NAME

                                      is_layout = wa_layout

                                      it_fieldcat = it_fieldcat

                                      • IT_EXCLUDING = IT_EXCLUDING

                                      • IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS

                                      it_sort = it_sort

                                      • IT_FILTER = IT_FILTER

                                      • IS_SEL_HIDE = IS_SEL_HIDE

                                      • I_DEFAULT = 'X'

                                      • I_SAVE = ' '

                                      • IS_VARIANT = IS_VARIANT

                                      it_events = it_event

                                      • IT_EVENT_EXIT = IT_EVENT_EXIT

                                      • IS_PRINT = IS_PRINT

                                      • IS_REPREP_ID = IS_REPREP_ID

                                      • I_SCREEN_START_COLUMN = 0

                                      • I_SCREEN_START_LINE = 0

                                      • I_SCREEN_END_COLUMN = 0

                                      • I_SCREEN_END_LINE = 0

                                      • IR_SALV_LIST_ADAPTER = IR_SALV_LIST_ADAPTER

                                      • IT_EXCEPT_QINFO = IT_EXCEPT_QINFO

                                      • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

                                      • IMPORTING

                                      • E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER

                                      • ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER

                                      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. " LIST_DISPLAY

                                      &----


                                      *& Form HIERSEQ_DISPLAY

                                      &----


                                      • HIERSEQ DISPLAY

                                      ----


                                      form hierseq_display .

                                      it_keyinfo-header01 = 'EBELN'.

                                      it_keyinfo-item01 = 'EBELN'.

                                      call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

                                      exporting

                                      • I_INTERFACE_CHECK = ' '

                                      i_callback_program = v_repid

                                      • I_CALLBACK_PF_STATUS_SET = ' '

                                      • I_CALLBACK_USER_COMMAND = ' '

                                      is_layout = wa_layout

                                      it_fieldcat = it_fieldcat

                                      • IT_EXCLUDING = IT_EXCLUDING

                                      • IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS

                                      it_sort = it_sort

                                      • IT_FILTER = IT_FILTER

                                      • IS_SEL_HIDE = IS_SEL_HIDE

                                      • I_SCREEN_START_COLUMN = 0

                                      • I_SCREEN_START_LINE = 0

                                      • I_SCREEN_END_COLUMN = 0

                                      • I_SCREEN_END_LINE = 0

                                      • I_DEFAULT = 'X'

                                      • I_SAVE = ' '

                                      • IS_VARIANT = IS_VARIANT

                                      it_events = it_event

                                      • IT_EVENT_EXIT = IT_EVENT_EXIT

                                      i_tabname_header = 'IT_EKKO'

                                      i_tabname_item = 'IT_EKPO'

                                      • I_STRUCTURE_NAME_HEADER = I_STRUCTURE_NAME_HEADER

                                      • I_STRUCTURE_NAME_ITEM = I_STRUCTURE_NAME_ITEM

                                      is_keyinfo = it_keyinfo

                                      • IS_PRINT = IS_PRINT

                                      • IS_REPREP_ID = IS_REPREP_ID

                                      • I_BYPASSING_BUFFER = I_BYPASSING_BUFFER

                                      • I_BUFFER_ACTIVE = I_BUFFER_ACTIVE

                                      • IR_SALV_HIERSEQ_ADAPTER = IR_SALV_HIERSEQ_ADAPTER

                                      • IT_EXCEPT_QINFO = IT_EXCEPT_QINFO

                                      • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

                                      • IMPORTING

                                      • E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER

                                      • ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER

                                      tables

                                      t_outtab_header = it_ekko

                                      t_outtab_item = it_ekpo

                                      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. " HIERSEQ_DISPLAY

                                      &----


                                      *& Form IT_USER_COMMAND

                                      &----


                                      • text

                                      ----


                                      form it_user_command using r_ucomm like sy-ucomm

                                      rs_selfield type slis_selfield.

                                      free it_fieldcat.

                                      case r_ucomm.

                                      when '&IC1'.

                                      read table it_final index rs_selfield-tabindex.

                                      perform get_ekbe.

                                      perform get_field_catalog.

                                      perform get_list.

                                      endcase.

                                      endform. "IT_USER_COMMAND

                                      &----


                                      *& Form GET_EKBE

                                      &----


                                      • text

                                      ----


                                      form get_ekbe .

                                      if not it_final[] is initial.

                                      select ebeln

                                      ebelp

                                      belnr

                                      menge

                                      matnr

                                      into table it_ekbe

                                      from ekbe

                                      for all entries in it_final

                                      where ebeln = it_final-ebeln

                                      and ebelp = it_final-ebelp.

                                      endif.

                                      endform. " GET_EKBE

                                      &----


                                      *& Form GET_FIELD_CATALOG

                                      &----


                                      • text

                                      ----


                                      form get_field_catalog .

                                      wa_fieldcat-fieldname = 'EBELN'.

                                      wa_fieldcat-col_pos = '1'.

                                      wa_fieldcat-just = 'R'.

                                      wa_fieldcat-seltext_l = 'PO Number'.

                                      wa_fieldcat-lowercase = 'X'.

                                      wa_fieldcat-do_sum = 'X'.

                                      append wa_fieldcat to it_fieldcat.

                                      wa_fieldcat-fieldname = 'EBELP'.

                                      wa_fieldcat-col_pos = '2'.

                                      wa_fieldcat-just = 'R'.

                                      wa_fieldcat-seltext_l = 'Item Number'.

                                      wa_fieldcat-lowercase = 'X'.

                                      wa_fieldcat-do_sum = 'X'.

                                      append wa_fieldcat to it_fieldcat.

                                      wa_fieldcat-fieldname = 'BELNR'.

                                      wa_fieldcat-col_pos = '3'.

                                      wa_fieldcat-just = 'R'.

                                      wa_fieldcat-seltext_l = 'Material Document'.

                                      wa_fieldcat-lowercase = 'X'.

                                      wa_fieldcat-do_sum = 'X'.

                                      append wa_fieldcat to it_fieldcat.

                                      wa_fieldcat-fieldname = 'MENGE'.

                                      wa_fieldcat-col_pos = '4'.

                                      wa_fieldcat-just = 'R'.

                                      wa_fieldcat-seltext_l = 'Quantity'.

                                      wa_fieldcat-lowercase = 'X'.

                                      wa_fieldcat-do_sum = 'X'.

                                      append wa_fieldcat to it_fieldcat.

                                      wa_fieldcat-fieldname = 'MATNR'.

                                      wa_fieldcat-col_pos = '5'.

                                      wa_fieldcat-just = 'R'.

                                      wa_fieldcat-seltext_l = 'Material Number'.

                                      wa_fieldcat-lowercase = 'X'.

                                      wa_fieldcat-do_sum = 'X'.

                                      append wa_fieldcat to it_fieldcat.

                                      endform. " GET_FIELD_CATALOG

                                      &----


                                      *& Form get_list

                                      &----


                                      • text

                                      ----


                                      form get_list .

                                      if rb1 = 'X'.

                                      call function 'REUSE_ALV_GRID_DISPLAY'

                                      exporting

                                      • I_INTERFACE_CHECK = ' '

                                      • I_BYPASSING_BUFFER = ' '

                                      • I_BUFFER_ACTIVE = ' '

                                      i_callback_program = v_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_STRUCTURE_NAME

                                      • I_BACKGROUND_ID = ' '

                                      i_grid_title = 'SECONDARY LIST'

                                      • I_GRID_SETTINGS = I_GRID_SETTINGS

                                      • IS_LAYOUT = IS_LAYOUT

                                      it_fieldcat = it_fieldcat

                                      • IT_EXCLUDING = IT_EXCLUDING

                                      • IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS

                                      • IT_SORT = IT_SORT

                                      • IT_FILTER = IT_FILTER

                                      • IS_SEL_HIDE = IS_SEL_HIDE

                                      • I_DEFAULT = 'X'

                                      • I_SAVE = ' '

                                      • IS_VARIANT = IS_VARIANT

                                      • IT_EVENTS = IT_EVENTS

                                      • IT_EVENT_EXIT = IT_EVENT_EXIT

                                      • IS_PRINT = IS_PRINT

                                      • IS_REPREP_ID = 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_ALV_GRAPHICS

                                      • IT_HYPERLINK = IT_HYPERLINK

                                      • IT_ADD_FIELDCAT = IT_ADD_FIELDCAT

                                      • IT_EXCEPT_QINFO = IT_EXCEPT_QINFO

                                      • IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER

                                      • IMPORTING

                                      • E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER

                                      • ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER

                                      tables

                                      t_outtab = it_ekbe

                                      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.

                                      endif.

                                      if rb2 = 'X'.

                                      call function 'REUSE_ALV_LIST_DISPLAY'

                                      exporting

                                      • I_INTERFACE_CHECK = ' '

                                      • I_BYPASSING_BUFFER = I_BYPASSING_BUFFER

                                      • I_BUFFER_ACTIVE = ' '

                                      i_callback_program = v_repid

                                      • I_CALLBACK_PF_STATUS_SET = ' '

                                      • I_CALLBACK_USER_COMMAND = ' '

                                      • I_STRUCTURE_NAME = I_STRUCTURE_NAME

                                      • IS_LAYOUT = IS_LAYOUT

                                      it_fieldcat = it_fieldcat

                                      • IT_EXCLUDING = IT_EXCLUDING

                                      • IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS

                                      • IT_SORT = IT_SORT

                                      • IT_FILTER = IT_FILTER

                                      • IS_SEL_HIDE = IS_SEL_HIDE

                                      • I_DEFAULT = 'X'

                                      • I_SAVE = ' '

                                      • IS_VARIANT = IS_VARIANT

                                      • IT_EVENTS = IT_EVENTS

                                      • IT_EVENT_EXIT = IT_EVENT_EXIT

                                      • IS_PRINT = IS_PRINT

                                      • IS_REPREP_ID = IS_REPREP_ID

                                      • I_SCREEN_START_COLUMN = 0

                                      • I_SCREEN_START_LINE = 0

                                      • I_SCREEN_END_COLUMN = 0

                                      • I_SCREEN_END_LINE = 0

                                      • IR_SALV_LIST_ADAPTER = IR_SALV_LIST_ADAPTER

                                      • IT_EXCEPT_QINFO = IT_EXCEPT_QINFO

                                      • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

                                      • IMPORTING

                                      • E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER

                                      • ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER

                                      tables

                                      t_outtab = it_ekbe

                                      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.

                                      endif.

                                      endform. " get_list

                                      &----


                                      *& Form f4_for_variant

                                      &----


                                      • text

                                      ----


                                      form f4_for_variant .

                                      call function 'REUSE_ALV_VARIANT_F4'

                                      exporting

                                      is_variant = i_variant

                                      • I_TABNAME_HEADER = I_TABNAME_HEADER

                                      • I_TABNAME_ITEM = I_TABNAME_ITEM

                                      • IT_DEFAULT_FIELDCAT = IT_DEFAULT_FIELDCAT

                                      i_save = w_save

                                      • I_DISPLAY_VIA_GRID = ' '

                                      importing

                                      e_exit = w_exit

                                      es_variant = i_variant1

                                      exceptions

                                      not_found = 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. " f4_for_variant

                                      Thanks,

                                      Shankar

                                      Add a comment
                                      10|10000 characters needed characters exceeded

                                    • author's profile photo Former Member
                                      Former Member
                                      Posted on Feb 27, 2007 at 04:53 AM

                                      Hi,

                                      REPORT  z_alv_so  MESSAGE-ID znew .
                                      
                                      ************************************************************************
                                      *TABLE DECLARATION*
                                      ************************************************************************
                                      TABLES: vbak ,             "Sales Document: Header Data
                                              vbap ,             "Sales Document: Item Data
                                              makt ,             "Material Descriptions
                                              lips .             "SD document: Delivery: Item data
                                      ************************************************************************
                                      *DECLARATION OF TYPE-POOL*
                                      *THIS TYPE-POOL CONTAINS THE EVENTS,
                                      ************************************************************************
                                      TYPE-POOLS : slis.
                                      ************************************************************************
                                      *DECLARATION OF EVENTS*
                                      ************************************************************************
                                      DATA: i_event TYPE slis_t_event.
                                      DATA: t_event TYPE slis_alv_event.
                                      ************************************************************************
                                      *DECLARATION OF LIST HEADER*
                                      ************************************************************************
                                      DATA: i_listheader TYPE slis_t_listheader.
                                      ************************************************************************
                                      *DECLARATION OF FIELD CATALOG FOR SCREEN 1*
                                      ************************************************************************
                                      DATA: i_fldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
                                      ************************************************************************
                                      *DECLARATION OF FIELD CATALOG FOR SCREEN 2*
                                      ************************************************************************
                                      DATA: i_fldcat2 TYPE slis_t_fieldcat_alv WITH HEADER LINE.
                                      ************************************************************************
                                      *DECLARATION OF FIELD LAYOUT*
                                      ************************************************************************
                                      DATA: i_layout TYPE slis_layout_alv.
                                      ************************************************************************
                                      *SORTING OF OUTPUT*
                                      ************************************************************************
                                      DATA: i_sort TYPE slis_t_sortinfo_alv.
                                      ************************************************************************
                                      *DATA DECLARATION
                                      ************************************************************************
                                      DATA: v_auart TYPE tvak-auart,
                                            v_vkorg TYPE tvko-vkorg,
                                            v_kunnr TYPE kna1-kunnr,
                                            v_matnr TYPE mara-matnr ,
                                            v_spart TYPE tvta-spart .
                                      
                                      TYPES: BEGIN OF it_so ,
                                      
                                             vbeln TYPE vbeln_va ,          "SALES ORDER NO.
                                             auart TYPE auart ,             "SALES DOC. TYPE
                                             vkorg TYPE vkorg ,             "SALES ORG.
                                             spart TYPE spart ,             "DIVISION
                                             kunnr TYPE kunag ,             "SOLD TO PARTY
                                             posnr TYPE posnr_va ,          "SALES DOC. ITEM
                                             matnr TYPE matnr ,             "MATERIAL NO
                                             maktx TYPE maktx ,             "DESCRIPTION
                                             kwmeng TYPE kwmeng ,           "QUANTITY
                                             vrkme TYPE vrkme ,             "SALES UNIT
                                             line_color(4) TYPE c ,
                                      
                                             END OF it_so .
                                      
                                      TYPES: BEGIN OF it_del ,
                                      
                                             vbeln TYPE vbeln_vl ,         "SALES ORDER NO.
                                             posnr TYPE posnr_vl ,         "SALES DOC. ITEM
                                             matnr TYPE matnr ,            "MATERIAL NO
                                             werks TYPE werks_d ,          "PLANT
                                             lgort TYPE lgort_d ,          "STORAGE LOCATION
                                             charg TYPE charg_d ,          "BATCH NO.
                                             lfimg TYPE lfimg ,            "ACTUAL DELIVERY QTY.
                                             vrkme TYPE vrkme ,            "SALES UNIT
                                      
                                             END OF it_del .
                                      
                                      TYPES: BEGIN OF type_vbfa ,
                                      
                                            vbelv TYPE vbeln_von , "Preceding sales and distribution document
                                            posnv TYPE posnr_von , "Preceding item of an SD document
                                            vbeln TYPE vbeln_nach, "Subsequent sales and distribution document
                                            posnn TYPE posnr_nach, "Document category of subsequent document
                                            vbtyp_n TYPE vbtyp_n ,
                                      
                                            END OF type_vbfa .
                                      
                                      DATA: it_so1 TYPE STANDARD TABLE OF it_so ,
                                            it_del1 TYPE STANDARD TABLE OF it_del ,
                                            it_vbfa TYPE STANDARD TABLE OF type_vbfa,
                                            it_del_ful TYPE STANDARD TABLE OF it_del.
                                      
                                      DATA: wa_so TYPE it_so ,
                                            wa_del TYPE it_del ,
                                            wa_vbfa TYPE type_vbfa,
                                            wa_it_del_ful TYPE it_del.
                                      
                                      DATA:  i_title_vbfa TYPE lvc_title VALUE 'SALES ORDER LIST DISPLAYED'.
                                      DATA:  i_title_vbpa TYPE lvc_title VALUE
                                      'DELIVERY DETAILS DISPLAYED AGAINST GIVEN SALES ORDER'.
                                      
                                      
                                      ************************************************************************
                                      *SELECTION SCREEN                                                      *
                                      ************************************************************************
                                      
                                      SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-004 .
                                      SELECT-OPTIONS: s_vbeln FOR vbak-vbeln ,
                                                      s_auart FOR v_auart ,
                                                      s_vkorg FOR v_vkorg ,
                                                      s_spart FOR v_spart ,
                                                      s_kunnr FOR v_kunnr ,
                                                      s_matnr FOR v_matnr .
                                      SELECTION-SCREEN END OF BLOCK blk1 .
                                      
                                      ************************************************************************
                                      *AT SELECTION SCREEN                                                   *
                                      ************************************************************************
                                      AT SELECTION-SCREEN.
                                      
                                        SELECT SINGLE vbeln
                                                       FROM vbak INTO vbak-vbeln
                                                       WHERE vbeln IN s_vbeln.
                                      
                                        IF sy-subrc <> 0.
                                          MESSAGE e202.
                                        ENDIF.
                                      ************************************************************************
                                      *START OF SELECTION                                                    *
                                      ************************************************************************
                                      START-OF-SELECTION .
                                      
                                        PERFORM data_select.
                                        PERFORM t_sort USING i_sort .
                                        PERFORM event_cat USING i_event .
                                        PERFORM fld_cat USING i_fldcat[] .
                                        PERFORM t_layout USING i_layout .
                                        PERFORM fld_cat2 USING i_fldcat2[] .
                                        PERFORM call_alv.
                                      ************************************************************************
                                      * DATA SELECT                                                          *
                                      ************************************************************************
                                      
                                      *&---------------------------------------------------------------------*
                                      *&      Form  DATA_SELECT
                                      *&---------------------------------------------------------------------*
                                      *       text
                                      *----------------------------------------------------------------------*
                                      *  -->  p1        text
                                      *  <--  p2        text
                                      *----------------------------------------------------------------------*
                                      FORM data_select .
                                      
                                        REFRESH: it_vbfa, it_so1, it_del_ful ,it_del1 .
                                        BREAK-POINT.
                                        SELECT
                                              a~vbeln
                                              a~auart
                                              a~vkorg
                                              a~spart
                                              a~kunnr
                                              b~posnr
                                              b~matnr
                                              c~maktx
                                              b~kwmeng
                                              b~vrkme
                                              INTO TABLE it_so1 FROM vbak AS a
                                                    JOIN vbap AS b ON b~vbeln = a~vbeln
                                                    JOIN makt AS c ON c~matnr = b~matnr
                                                    AND c~spras = sy-langu
                                                    WHERE a~vbeln IN s_vbeln .
                                      
                                      ************************************************************************
                                      * COLURING DISPLAY                                                     *
                                      ************************************************************************
                                      
                                        DATA: ld_color(1) TYPE  c .
                                        LOOP AT it_so1 INTO wa_so.
                                      * Populate color variable with colour properties
                                      * Char 1 = C (This is a color property)
                                      * Char 2 = 3 (Color codes: 1 - 7)
                                      * Char 3 = Intensified on/off ( 1 or 0 )
                                      * Char 4 = Inverse display on/off ( 1 or 0 )
                                      *           i.e. wa_ekko-line_color = 'C410'
                                          ld_color = ld_color + 1.
                                      
                                      * Only 7 colours so need to reset color value
                                          IF ld_color = 8.
                                            ld_color = 1.
                                          ENDIF.
                                          CONCATENATE 'C' ld_color '10' INTO wa_so-line_color.
                                      *  wa_ekko-line_color = 'C410'.
                                          MODIFY it_so1 FROM wa_so.
                                        ENDLOOP .
                                      
                                        IF sy-subrc = 0.
                                      
                                          SELECT vbelv
                                                 posnv
                                                 vbeln
                                                 posnn
                                                 vbtyp_n
                                                 INTO TABLE it_vbfa
                                                 FROM vbfa
                                                 FOR ALL ENTRIES IN it_so1
                                                 WHERE vbelv = it_so1-vbeln
                                                 AND   posnn = it_so1-posnr
                                                 AND vbtyp_n ='J' .
                                      
                                          IF sy-subrc = 0.
                                      
                                            SELECT vbeln
                                                   posnr
                                                   matnr
                                                   werks
                                                   lgort
                                                   charg
                                                   lfimg
                                                   vrkme
                                                   FROM lips INTO TABLE it_del_ful
                                                   FOR ALL ENTRIES IN it_vbfa
                                                   WHERE vbeln = it_vbfa-vbeln
                                                   AND   posnr = it_vbfa-posnn.
                                      
                                          ENDIF.
                                      
                                        ENDIF.
                                      
                                      ENDFORM.                    " DATA_SELECT
                                      
                                      ***********************************************************************
                                      **************** EVENT CATALOG ****************************************
                                      ***********************************************************************
                                      
                                      *&---------------------------------------------------------------------*
                                      *&      Form  EVENT_CAT
                                      *&---------------------------------------------------------------------*
                                      *       text
                                      *----------------------------------------------------------------------*
                                      *      -->P_I_EVENT  text
                                      *----------------------------------------------------------------------*
                                      
                                      FORM event_cat  USING    p_i_event TYPE slis_t_event .
                                      
                                        REFRESH p_i_event .
                                      
                                        CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
                                      * EXPORTING
                                      *   I_LIST_TYPE           = 0
                                         IMPORTING
                                            et_events             = p_i_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 p_i_event WITH KEY name = slis_ev_top_of_page INTO t_event.
                                      
                                        IF sy-subrc = 0.
                                      
                                          MOVE 'TOP_OF_PAGE' TO t_event-form.
                                          MODIFY p_i_event FROM t_event INDEX sy-tabix TRANSPORTING form.
                                      
                                        ENDIF.
                                      
                                        CLEAR t_event .
                                      
                                      ENDFORM.                    " EVENT_CAT
                                      
                                      
                                      **********************************************************************
                                      **********FORM FOR EVENT TOP_OF_PAGE**********************************
                                      **********************************************************************
                                      
                                      FORM top_of_page .
                                      
                                        REFRESH i_listheader.
                                        DATA: t_header TYPE slis_listheader.
                                        DATA: v_text(50).
                                      
                                        WRITE sy-datum TO v_text.
                                        CLEAR t_header.
                                        t_header-typ = 'S'.
                                        t_header-key = 'Date'.
                                        t_header-info = v_text.
                                        APPEND t_header TO i_listheader.
                                      
                                        CLEAR t_header.
                                        CLEAR v_text.
                                      
                                      *  WRITE:  'SALES ORDER REPORT  ' TO v_text .
                                      
                                      *  t_header-typ = 'S'.
                                      *  t_header-key = 'TITLE'.
                                      *  t_header-info = v_text.
                                      *  APPEND t_header TO i_listheader.
                                      
                                      
                                        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
                                          EXPORTING
                                            it_list_commentary = i_listheader
                                            I_LOGO             = 'ENJOYSAP_LOGO' .
                                      *   I_END_OF_LIST_GRID       =
                                      
                                      ENDFORM.                    "TOP_OF_PAGE
                                      
                                      ************************************************************************
                                      ********  FIRST ALV GRID DISPLAY ***************************************
                                      ************************************************************************
                                      
                                      *&---------------------------------------------------------------------*
                                      *&      Form  CALL_ALV
                                      *&---------------------------------------------------------------------*
                                      *       text
                                      *----------------------------------------------------------------------*
                                      *  -->  p1        text
                                      *  <--  p2        text
                                      *----------------------------------------------------------------------*
                                      
                                      FORM call_alv .
                                      
                                        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
                                      
                                         EXPORTING
                                           i_callback_program                = sy-repid
                                      *    I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
                                           i_callback_user_command           = 'USER_COMMAND1'
                                           i_callback_top_of_page            = 'TOP_OF_PAGE'
                                      *     I_BACKGROUND_ID                   = 'ALV_BACKGROUND'
                                           i_grid_title                      = i_title_vbfa
                                           is_layout                         = i_layout
                                           it_fieldcat                       = i_fldcat[]
                                           it_sort                           = i_sort
                                           it_events                         = i_event
                                          TABLES
                                           t_outtab                          = it_so1
                                                  .
                                      *  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.                    " CALL_ALV
                                      ***********************************************************************
                                      ************** FIRST FIELDCATALOG *************************************
                                      ***********************************************************************
                                      *&---------------------------------------------------------------------*
                                      *&      Form  FLD_CAT
                                      *&---------------------------------------------------------------------*
                                      *       text
                                      *----------------------------------------------------------------------*
                                      *      -->P_I_FLDCAT[]  text
                                      *----------------------------------------------------------------------*
                                      
                                      FORM fld_cat  USING    p_i_fldcat TYPE slis_t_fieldcat_alv.
                                      
                                        CLEAR i_fldcat.
                                        i_fldcat-fieldname   = 'VBELN'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat-tabname     = 'IT_SO1'."TABLE NAME
                                        i_fldcat-seltext_m   = 'SALES ORDER NO.'.
                                        i_fldcat-col_pos     = 1.        " POSITION OF THE COLUMN.
                                        i_fldcat-outputlen   = 20.       " SET THE OUTPUT LENGTH.
                                        i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat-just(1)     = 'C'.
                                      
                                        APPEND i_fldcat.
                                      
                                        CLEAR i_fldcat.
                                        i_fldcat-fieldname   = 'AUART'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat-tabname     = 'IT_SO1'."TABLE NAME
                                        i_fldcat-seltext_m   = 'SALES DOC. TYPE'.
                                        i_fldcat-col_pos     = 2.        " POSITION OF THE COLUMN.
                                        i_fldcat-outputlen   = 15.       " SET THE OUTPUT LENGTH.
                                        i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat-just(1)     = 'C'.
                                      
                                        APPEND i_fldcat.
                                      
                                        CLEAR i_fldcat.
                                        i_fldcat-fieldname   = 'VKORG'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat-tabname     = 'IT_SO1'.
                                        i_fldcat-seltext_m   = 'SALES ORG.'.
                                        i_fldcat-col_pos     = 3.        " POSITION OF THE COLUMN.
                                        i_fldcat-outputlen   = 12.       " SET THE OUTPUT LENGTH.
                                        i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat-just(1)     = 'C'.
                                        APPEND i_fldcat.
                                      
                                        CLEAR i_fldcat.
                                        i_fldcat-fieldname   = 'SPART'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat-tabname     = 'IT_SO1'.
                                        i_fldcat-seltext_m   = 'DIVISION'.
                                        i_fldcat-col_pos     = 4.        " POSITION OF THE COLUMN.
                                        i_fldcat-outputlen   = 10.       " SET THE OUTPUT LENGTH.
                                        i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat-just(1)     = 'C'.
                                        APPEND i_fldcat.
                                      
                                        CLEAR i_fldcat.
                                        i_fldcat-fieldname   = 'KUNNR'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat-tabname     = 'IT_SO1'.
                                        i_fldcat-seltext_m   = 'SOLD TO PARTY'.
                                        i_fldcat-col_pos     = 5.        " POSITION OF THE COLUMN.
                                        i_fldcat-outputlen   = 15.       " SET THE OUTPUT LENGTH.
                                        i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat-just(1)     = 'C'.
                                        APPEND i_fldcat.
                                      
                                        CLEAR i_fldcat.
                                        i_fldcat-fieldname   = 'POSNR'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat-tabname     = 'IT_SO1'.
                                        i_fldcat-seltext_m   = 'SALES DOC. ITEM'.
                                        i_fldcat-col_pos     = 6.        " POSITION OF THE COLUMN.
                                        i_fldcat-outputlen   = 17.       " SET THE OUTPUT LENGTH.
                                        i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat-just(1)     = 'C'.
                                        APPEND i_fldcat.
                                      
                                        CLEAR i_fldcat.
                                      
                                        i_fldcat-fieldname   = 'MATNR'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat-tabname     = 'IT_SO1'.
                                        i_fldcat-seltext_m   = 'MATERIAL NO.'.
                                        i_fldcat-col_pos     = 7.        " POSITION OF THE COLUMN.
                                        i_fldcat-outputlen   = 20.       " SET THE OUTPUT LENGTH.
                                        i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat-just(1)     = 'C'.
                                        APPEND i_fldcat.
                                      
                                        CLEAR i_fldcat.
                                        i_fldcat-fieldname   = 'MAKTX'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat-tabname     = 'IT_SO1'.
                                        i_fldcat-seltext_m   = 'DESCRIPTION'.
                                        i_fldcat-col_pos     = 8.        " POSITION OF THE COLUMN.
                                        i_fldcat-outputlen   = 20.       " SET THE OUTPUT LENGTH.
                                        i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat-just(1)     = 'C'.
                                        APPEND i_fldcat.
                                      
                                        CLEAR i_fldcat.
                                        i_fldcat-fieldname   = 'KWMENG'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat-tabname     = 'IT_SO1'.
                                        i_fldcat-seltext_m   = 'QUANTITY'.
                                        i_fldcat-col_pos     = 9.        " POSITION OF THE COLUMN.
                                        i_fldcat-outputlen   = 15.       " SET THE OUTPUT LENGTH.
                                        i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat-do_sum    = 'X'.        " For doing "SUM"
                                        i_fldcat-just(1)     = 'C'.
                                        APPEND i_fldcat.
                                      
                                        CLEAR i_fldcat.
                                        i_fldcat-fieldname   = 'VRKME'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat-tabname     = 'IT_SO1'.
                                        i_fldcat-seltext_m   = 'SALES UNIT'.
                                        i_fldcat-col_pos     = 10.       " POSITION OF THE COLUMN.
                                        i_fldcat-outputlen   = 10.       " SET THE OUTPUT LENGTH.
                                        i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat-just(1)     = 'C'.
                                        APPEND i_fldcat.
                                      
                                      ENDFORM.                    " FLD_CAT
                                      
                                      ***********************************************************************
                                      ****************** ALV SORTING  ***************************************
                                      ***********************************************************************
                                      *&---------------------------------------------------------------------*
                                      *&      Form  SORT
                                      *&---------------------------------------------------------------------*
                                      *       text
                                      *----------------------------------------------------------------------*
                                      *      -->P_I_SORT  text
                                      *----------------------------------------------------------------------*
                                      
                                      FORM t_sort  USING    p_i_sort TYPE slis_t_sortinfo_alv .
                                      
                                        DATA: i_sort TYPE slis_sortinfo_alv .
                                        REFRESH p_i_sort .
                                      
                                        CLEAR i_sort.
                                        i_sort-spos = 1.
                                        i_sort-tabname = 'IT_SO1'.
                                        i_sort-fieldname = 'VBELN'.
                                        i_sort-up = 'X'.
                                        i_sort-subtot = 'X'.
                                        i_sort-group = '*'.
                                        APPEND i_sort TO p_i_sort.
                                      
                                      ENDFORM.                    " SORT
                                      
                                      *FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
                                      *  SET PF-STATUS 'ZSTANDARD'.
                                      *ENDFORM. "Set_pf_status
                                      
                                      ***********************************************************************
                                      ***********FORM FOR EVENT USER_COMMAND1********************************
                                      ***********************************************************************
                                      
                                      FORM user_command1 USING r_ucomm LIKE sy-ucomm
                                                               rs_selfield TYPE slis_selfield.
                                      
                                      *CASE R_UCOMM .
                                      *    WHEN '&IC1' .
                                      *
                                      *    IF rs_selfield-FIELDNAME = 'VBELN' .
                                      *
                                      *    ENDIF .
                                      *
                                      * WHEN OTHERS .
                                      *
                                      * ENDCASE .
                                      
                                        CLEAR wa_so.
                                      
                                        REFRESH: it_del1 .
                                      
                                        IF r_ucomm = '&IC1' AND rs_selfield-fieldname = 'VBELN' AND
                                        rs_selfield-value IS NOT INITIAL.
                                      
                                          READ TABLE it_so1 INTO wa_so INDEX rs_selfield-tabindex.
                                      
                                          IF sy-subrc = 0.
                                      
                                            LOOP AT it_vbfa INTO wa_vbfa WHERE vbelv = wa_so-vbeln
                                                                         AND   posnv = wa_so-posnr.
                                              READ TABLE it_del_ful INTO wa_it_del_ful
                                                   WITH KEY vbeln = wa_vbfa-vbelv
                                                            posnr = wa_vbfa-posnn.
                                      
                                              IF sy-subrc = 0.
                                      
                                                CLEAR wa_del.
                                                MOVE wa_it_del_ful TO wa_del.
                                                APPEND wa_del TO it_del1.
                                      
                                              ENDIF.
                                      
                                            ENDLOOP.
                                          ENDIF.
                                        ENDIF.
                                      
                                      *********************************************************************
                                      ********* SECOND ALV GRID DISPLAY ***********************************
                                      *********************************************************************
                                        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
                                      
                                         EXPORTING
                                          i_callback_program                = sy-repid
                                      *   I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
                                          i_callback_user_command           = 'USER_COMMAND2'
                                          i_callback_top_of_page            = 'TOP_OF_PAGE'
                                      *    I_BACKGROUND_ID                   = 'ALV_BACKGROUND'
                                           i_grid_title                      = i_title_vbpa
                                          it_fieldcat                       = i_fldcat2[]
                                          it_sort                           = i_sort
                                          TABLES
                                          t_outtab                          = it_del_ful
                                                  .
                                      *  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 .                    "USER_COMMAND1
                                      ***********************************************************************
                                      ********** FORM FOR EVENT USER_COMMAND 2 ******************************
                                      ***********************************************************************
                                      
                                      FORM user_command2 USING r_ucomm LIKE sy-ucomm
                                                               rs_selfield TYPE slis_selfield.
                                      
                                        CLEAR wa_so.
                                      
                                        REFRESH: it_del1 .
                                      
                                        IF r_ucomm = '&IC1' AND rs_selfield-fieldname = 'VBELN' AND
                                        rs_selfield-value IS NOT INITIAL.
                                      
                                          READ TABLE it_so1 INTO wa_so INDEX rs_selfield-tabindex.
                                      
                                      *    IF SY-SUBRC = 0.
                                      *
                                      *       LOOP AT it_vbfa INTO wa_vbfa WHERE vbelv = WA_SO-vbeln
                                      *                                    AND   posnv = WA_SO-posnr.
                                          READ TABLE it_del_ful INTO wa_it_del_ful
                                               WITH KEY vbeln = rs_selfield-value
                                                        posnr = wa_vbfa-posnn.
                                      
                                          IF rs_selfield-fieldname = 'VBELN'.
                                      
                                            SET PARAMETER ID 'VL' FIELD wa_vbfa-vbeln .
                                            CALL TRANSACTION 'VL03' AND SKIP FIRST SCREEN.
                                      
                                          ENDIF .
                                      
                                      *       ENDLOOP.
                                      *    ENDIF.
                                        ENDIF.
                                      ENDFORM .                    "USER_COMMAND2
                                      
                                      ************************************************************************
                                      ********* SECOND FIELDCATALOG ******************************************
                                      ************************************************************************
                                      
                                      *&---------------------------------------------------------------------*
                                      *&      Form  FLD_CAT2
                                      *&---------------------------------------------------------------------*
                                      *       text
                                      *----------------------------------------------------------------------*
                                      *      -->P_I_FLDCAT2[]  text
                                      *----------------------------------------------------------------------*
                                      
                                      FORM fld_cat2  USING    p_i_fldcat2 TYPE slis_t_fieldcat_alv .
                                      
                                        CLEAR i_fldcat2.
                                        i_fldcat2-fieldname   = 'VBELN'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat2-tabname     = 'IT_DEL_FUL'."TABLE NAME
                                        i_fldcat2-seltext_m   = 'DELIVERY NO.'.
                                        i_fldcat2-col_pos     = 1.        " POSITION OF THE COLUMN.
                                        i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
                                        i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat2-hotspot     = 'X'.
                                        i_fldcat2-just(1)     = 'C'.
                                        APPEND i_fldcat2.
                                      
                                        CLEAR i_fldcat2.
                                        i_fldcat2-fieldname   = 'POSNR'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat2-seltext_m   = 'DELIVERY ITEM'.
                                        i_fldcat2-col_pos     = 2.        " POSITION OF THE COLUMN.
                                        i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
                                        i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat2-just(1)     = 'C'.
                                        APPEND i_fldcat2.
                                      
                                        CLEAR i_fldcat2.
                                        i_fldcat2-fieldname   = 'MATNR'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat2-seltext_m   = 'MATERIAL NO.'.
                                        i_fldcat2-col_pos     = 3.        " POSITION OF THE COLUMN.
                                        i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
                                        i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat2-just(1)     = 'C'.
                                        APPEND i_fldcat2.
                                      
                                        CLEAR i_fldcat2.
                                        i_fldcat2-fieldname   = 'WERKS'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat2-seltext_m   = 'PLANT.'.
                                        i_fldcat2-col_pos     = 4.        " POSITION OF THE COLUMN.
                                        i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
                                        i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat2-just(1)     = 'C'.
                                        APPEND i_fldcat2.
                                      
                                        CLEAR i_fldcat2.
                                        i_fldcat2-fieldname   = 'LGORT'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat2-seltext_m   = 'ST. LOCATION'.
                                        i_fldcat2-col_pos     = 5.        " POSITION OF THE COLUMN.
                                        i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
                                        i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat2-just(1)     = 'C'.
                                        APPEND i_fldcat2.
                                      
                                        CLEAR i_fldcat2.
                                        i_fldcat2-fieldname   = 'CHARG'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat2-seltext_m   = 'BATCH NO.'.
                                        i_fldcat2-col_pos     = 6.        " POSITION OF THE COLUMN.
                                        i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
                                        i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat2-just(1)     = 'C'.
                                        APPEND i_fldcat2.
                                      
                                        CLEAR i_fldcat2.
                                        i_fldcat2-fieldname   = 'LFIMG'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat2-seltext_m   = 'ACT. DEL. QTY.'.
                                        i_fldcat2-col_pos     = 7.        " POSITION OF THE COLUMN.
                                        i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
                                        i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat2-just(1)     = 'C'.
                                        APPEND i_fldcat2.
                                      
                                        CLEAR i_fldcat2.
                                        i_fldcat2-fieldname   = 'VRKME'. "FIELD FOR WHICH CATALOG ID FILLED
                                        i_fldcat2-seltext_m   = 'SALES UNIT.'.
                                        i_fldcat2-col_pos     = 8.        " POSITION OF THE COLUMN.
                                        i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
                                        i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
                                        i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
                                        "SCROLLABLE AND HIDDABLE.
                                        i_fldcat2-just(1)     = 'C'.
                                        APPEND i_fldcat2.
                                      
                                      ENDFORM.                                                    " FLD_CAT2
                                      
                                      ************************************************************************
                                      ***************** ALV LAYOUT *******************************************
                                      ************************************************************************
                                      *&---------------------------------------------------------------------*
                                      *&      Form  LAYOUT
                                      *&---------------------------------------------------------------------*
                                      *       text
                                      *----------------------------------------------------------------------*
                                      *      -->P_I_LAYOUT  text
                                      *----------------------------------------------------------------------*
                                      
                                      FORM t_layout  USING    p_i_layout TYPE slis_layout_alv .
                                      
                                        p_i_layout-zebra  = 'X'.
                                        p_i_layout-totals_text = 'GRAND TOTAL ='.
                                      *  p_i_layout-CONFIRMATION_PROMPT = 'X'.
                                      *  p_i_layout-DEF_STATUS  = ' '.
                                        p_i_layout-info_fieldname = 'LINE_COLOR'.
                                      
                                      ENDFORM.                    " LAYOUT

                                      reward if useful.

                                      Add a comment
                                      10|10000 characters needed characters exceeded

                                    Before answering

                                    You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
                                    You must be Logged in to submit an answer.

                                    Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.