Skip to Content
-3

Going BACK to ALV from Another ALV

Hi All,

I have called report inside another report.

From the 2 report If clicked on BACK button it suppose to be display previous reprot ALV output. But its not working.

1 st report ALV is called. If user clicked on that ALV then 2 ALV will called.

From the 2nd ALV BACK button how to naviagte to the previous screen. i.e 1st report output.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Jun 15, 2017 at 11:55 AM

    Depends on how you call the 2nd alv

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 16, 2017 at 04:23 AM

    Hi aarti,

    simply use interactive alv function to full fill your requirement.

    this report go to another screen based on based list when user click.

    regards,

    Umayaraja.B

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 16, 2017 at 05:50 AM

    Check out the following code

    SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S31 { font-style: italic; color: #808080; } .L0S32 { color: #3399FF; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; } .L0S70 { color: #808080; }

    *&---------------------------------------------------------------------*
    *& Report ZALV_MULTI
    *&
    *&---------------------------------------------------------------------*

    REPORT zalv_multi.

    TABLES : vbap .
    TYPE-POOLS : slis .

    TYPES : BEGIN OF ty_vbap,
    vbeln TYPE vbap-vbeln,
    posnr TYPE vbap-posnr,
    matnr TYPE vbap-matnr,
    arktx TYPE vbap-arktx,
    END OF ty_vbap.

    DATA : it_vbap TYPE TABLE OF ty_vbap,
    wa_vbap TYPE ty_vbap .

    TYPES : BEGIN OF ty_mara,
    matnr TYPE mara-matnr,
    mtart TYPE mara-mtart,
    matkl TYPE mara-matkl,
    bismt TYPE mara-bismt,
    END OF ty_mara.

    DATA : it_mara TYPE TABLE OF ty_mara ,
    wa_mara TYPE ty_mara .


    *declaration for fieldcatalog
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
    wa_fieldcat TYPE slis_fieldcat_alv,
    it_fieldcat TYPE slis_t_fieldcat_alv.


    SELECT-OPTIONS : v_vbeln FOR vbap-vbeln .

    START-OF-SELECTION .


    SELECT vbeln
    posnr
    matnr
    arktx FROM vbap INTO TABLE it_vbap
    WHERE vbeln IN v_vbeln.

    wa_fieldcat-tabname = 'IT_VBAP'.
    wa_fieldcat-fieldname = 'VBELN'.
    wa_fieldcat-seltext_m = 'SO No.'.
    APPEND wa_fieldcat TO i_fieldcat.
    CLEAR wa_fieldcat.

    wa_fieldcat-tabname = 'IT_VBAP'.
    wa_fieldcat-fieldname = 'POSNR'.
    wa_fieldcat-seltext_m = 'ITEM No.'.
    APPEND wa_fieldcat TO i_fieldcat.
    CLEAR wa_fieldcat.

    wa_fieldcat-tabname = 'IT_VBAP'.
    wa_fieldcat-fieldname = 'MATNR'.
    wa_fieldcat-seltext_m = 'MATERIAL'.
    APPEND wa_fieldcat TO i_fieldcat.
    CLEAR wa_fieldcat.

    wa_fieldcat-tabname = 'IT_VBAP'.
    wa_fieldcat-fieldname = 'ARKTX'.
    wa_fieldcat-seltext_m = 'DESC.'.
    APPEND wa_fieldcat TO i_fieldcat.
    CLEAR wa_fieldcat.


    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    * I_INTERFACE_CHECK = ' '
    * I_BYPASSING_BUFFER = ' '
    * I_BUFFER_ACTIVE = ' '
    i_callback_program = sy-repid
    * I_CALLBACK_PF_STATUS_SET = ' '
    i_callback_user_command = 'USER_COMD'
    * 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 = I_GRID_TITLE
    * I_GRID_SETTINGS = I_GRID_SETTINGS
    * IS_LAYOUT = IS_LAYOUT
    it_fieldcat = i_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_vbap
    * EXCEPTIONS
    * PROGRAM_ERROR = 1
    .



    *&---------------------------------------------------------------------*
    *& Form USER_COMD
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    * -->R_UCOMM text
    * -->RS_SELFIELD text
    *----------------------------------------------------------------------*
    FORM user_comd USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.

    DATA : lv_matnr TYPE mara-matnr .
    CASE r_ucomm.
    WHEN '&IC1'.
    BREAK-POINT.

    CLEAR lv_matnr .
    lv_matnr = rs_selfield-value .


    SELECT matnr
    mtart
    matkl
    bismt FROM mara INTO TABLE it_mara WHERE matnr = lv_matnr.

    IF sy-subrc = 0 .

    wa_fieldcat-tabname = 'IT_MARA'.
    wa_fieldcat-fieldname = 'MATNR'.
    wa_fieldcat-seltext_m = 'MATERIAL No.'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.

    wa_fieldcat-tabname = 'IT_MARA'.
    wa_fieldcat-fieldname = 'MTART'.
    wa_fieldcat-seltext_m = 'MAT TYPE'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.

    wa_fieldcat-tabname = 'IT_MARA'.
    wa_fieldcat-fieldname = 'MATKL'.
    wa_fieldcat-seltext_m = 'MAT KL'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.

    wa_fieldcat-tabname = 'IT_MARA'.
    wa_fieldcat-fieldname = 'BISMT'.
    wa_fieldcat-seltext_m = 'OLD MAT'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    * I_CALLBACK_USER_COMMAND = ' '
    IT_FIELDCAT = IT_FIELDCAT
    * 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_MARA
    * EXCEPTIONS
    * PROGRAM_ERROR = 1
    .
    ENDIF.
    ENDCASE.
    ENDFORM. "user_command

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 16, 2017 at 05:51 AM

    Check out the following code

    SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S31 { font-style: italic; color: #808080; } .L0S32 { color: #3399FF; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; } .L0S70 { color: #808080; }

    *&---------------------------------------------------------------------*
    *& Report ZALV_MULTI
    *&
    *&---------------------------------------------------------------------*

    REPORT zalv_multi.

    TABLES : vbap .
    TYPE-POOLS : slis .

    TYPES : BEGIN OF ty_vbap,
    vbeln TYPE vbap-vbeln,
    posnr TYPE vbap-posnr,
    matnr TYPE vbap-matnr,
    arktx TYPE vbap-arktx,
    END OF ty_vbap.

    DATA : it_vbap TYPE TABLE OF ty_vbap,
    wa_vbap TYPE ty_vbap .

    TYPES : BEGIN OF ty_mara,
    matnr TYPE mara-matnr,
    mtart TYPE mara-mtart,
    matkl TYPE mara-matkl,
    bismt TYPE mara-bismt,
    END OF ty_mara.

    DATA : it_mara TYPE TABLE OF ty_mara ,
    wa_mara TYPE ty_mara .


    *declaration for fieldcatalog
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
    wa_fieldcat TYPE slis_fieldcat_alv,
    it_fieldcat TYPE slis_t_fieldcat_alv.


    SELECT-OPTIONS : v_vbeln FOR vbap-vbeln .

    START-OF-SELECTION .


    SELECT vbeln
    posnr
    matnr
    arktx FROM vbap INTO TABLE it_vbap
    WHERE vbeln IN v_vbeln.

    wa_fieldcat-tabname = 'IT_VBAP'.
    wa_fieldcat-fieldname = 'VBELN'.
    wa_fieldcat-seltext_m = 'SO No.'.
    APPEND wa_fieldcat TO i_fieldcat.
    CLEAR wa_fieldcat.

    wa_fieldcat-tabname = 'IT_VBAP'.
    wa_fieldcat-fieldname = 'POSNR'.
    wa_fieldcat-seltext_m = 'ITEM No.'.
    APPEND wa_fieldcat TO i_fieldcat.
    CLEAR wa_fieldcat.

    wa_fieldcat-tabname = 'IT_VBAP'.
    wa_fieldcat-fieldname = 'MATNR'.
    wa_fieldcat-seltext_m = 'MATERIAL'.
    APPEND wa_fieldcat TO i_fieldcat.
    CLEAR wa_fieldcat.

    wa_fieldcat-tabname = 'IT_VBAP'.
    wa_fieldcat-fieldname = 'ARKTX'.
    wa_fieldcat-seltext_m = 'DESC.'.
    APPEND wa_fieldcat TO i_fieldcat.
    CLEAR wa_fieldcat.


    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    * I_INTERFACE_CHECK = ' '
    * I_BYPASSING_BUFFER = ' '
    * I_BUFFER_ACTIVE = ' '
    i_callback_program = sy-repid
    * I_CALLBACK_PF_STATUS_SET = ' '
    i_callback_user_command = 'USER_COMD'
    * 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 = I_GRID_TITLE
    * I_GRID_SETTINGS = I_GRID_SETTINGS
    * IS_LAYOUT = IS_LAYOUT
    it_fieldcat = i_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_vbap
    * EXCEPTIONS
    * PROGRAM_ERROR = 1
    .



    *&---------------------------------------------------------------------*
    *& Form USER_COMD
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    * -->R_UCOMM text
    * -->RS_SELFIELD text
    *----------------------------------------------------------------------*
    FORM user_comd USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.

    DATA : lv_matnr TYPE mara-matnr .
    CASE r_ucomm.
    WHEN '&IC1'.
    BREAK-POINT.

    CLEAR lv_matnr .
    lv_matnr = rs_selfield-value .


    SELECT matnr
    mtart
    matkl
    bismt FROM mara INTO TABLE it_mara WHERE matnr = lv_matnr.

    IF sy-subrc = 0 .

    wa_fieldcat-tabname = 'IT_MARA'.
    wa_fieldcat-fieldname = 'MATNR'.
    wa_fieldcat-seltext_m = 'MATERIAL No.'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.

    wa_fieldcat-tabname = 'IT_MARA'.
    wa_fieldcat-fieldname = 'MTART'.
    wa_fieldcat-seltext_m = 'MAT TYPE'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.

    wa_fieldcat-tabname = 'IT_MARA'.
    wa_fieldcat-fieldname = 'MATKL'.
    wa_fieldcat-seltext_m = 'MAT KL'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.

    wa_fieldcat-tabname = 'IT_MARA'.
    wa_fieldcat-fieldname = 'BISMT'.
    wa_fieldcat-seltext_m = 'OLD MAT'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    * I_CALLBACK_USER_COMMAND = ' '
    IT_FIELDCAT = IT_FIELDCAT
    * 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_MARA
    * EXCEPTIONS
    * PROGRAM_ERROR = 1
    .
    ENDIF.
    ENDCASE.
    ENDFORM. "user_command

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 16, 2017 at 02:14 PM

    If you are using OO ALV, it should be handled through On User Command of second ALV and PF status. If its an SALV you should implement on_user_command FOR EVENT added_function OF cl_salv_events.

    Add comment
    10|10000 characters needed characters exceeded