Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Back button not working after write statement in alv grid display

Hello All,

I have written a program and after its output display in alv_grid, I have mentioned a button in alv toolbar button. The functionality of this custom button is to display some text using write statement. Everything is working fine but after displaying write statement, back button is not working and even all the standard tool bar of alv is coming on next screen. I want that tool bar to be disable also.

Note1 : I have copy standard pf status using SE41.

Program Name :  SAPLSLVC_FULLSCREEN

Status               :  STANDARD_FULLSCREEN

Note2 : Button which is marked with red circle is custom button in ALV output.


Please see the screenshots.

Sample Code:

TYPE-POOLS: slis.

DATA: it_vbak TYPE TABLE OF vbak WITH HEADER LINE.

DATA : gt_fieldcat TYPE TABLE OF slis_fieldcat_alv,

            gs_fieldcat LIKE LINE OF gt_fieldcat.

DATA l_program LIKE sy-repid.

l_program = 'ZRK_TEST'. " Your program name

PARAMETER : vbeln  TYPE vbak-vbeln,

            log AS CHECKBOX DEFAULT 'X'.

SELECT *

FROM vbak

INTO CORRESPONDING FIELDS OF TABLE it_vbak

WHERE vbeln = vbeln.

*** Catalog

gs_fieldcat-fieldname = 'VBELN'.

gs_fieldcat-seltext_l = 'Document Number'.

gs_fieldcat-col_pos   = '1'.

gs_fieldcat-just      = 'C'.

gs_fieldcat-outputlen = '20'.

APPEND gs_fieldcat TO gt_fieldcat.

CLEAR gs_fieldcat.

gs_fieldcat-fieldname = 'ERNAM'.

gs_fieldcat-seltext_l = 'Created By'.

gs_fieldcat-col_pos   = '2'.

gs_fieldcat-just      = 'C'.

gs_fieldcat-outputlen = '20'.

APPEND gs_fieldcat TO gt_fieldcat.

CLEAR gs_fieldcat.

gs_fieldcat-fieldname = 'ERDAT'.

gs_fieldcat-seltext_l = 'Created DATE'.

gs_fieldcat-col_pos   = '3'.

gs_fieldcat-just      = 'C'.

gs_fieldcat-outputlen = '12'.

APPEND gs_fieldcat TO gt_fieldcat.

CLEAR gs_fieldcat.

*** ALV

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

  EXPORTING

     *   I_INTERFACE_CHECK                 = ' '

     *   I_BYPASSING_BUFFER                =

     *   I_BUFFER_ACTIVE                   = ' '

       i_callback_program                     =  l_program

       i_callback_pf_status_set             = 'PF_STATUS'

       i_callback_user_command          = 'ALV_COMMAND'

       it_fieldcat                       = gt_fieldcat

   TABLES

       t_outtab                          = it_vbak.

FORM pf_status USING p_extab TYPE slis_t_extab.

*- Pf status

  DATA: BEGIN OF lt_func OCCURS 0,

        fcode LIKE rsmpe-func,

      END OF lt_func.

  IF log IS INITIAL.

    lt_func-fcode = 'LOG'.

    APPEND lt_func.

  ENDIF.

  SET PF-STATUS 'MAIN' EXCLUDING lt_func.

ENDFORM.

FORM alv_command USING    l_ucomm LIKE sy-ucomm

                          ls_selfield TYPE slis_selfield.

  CASE l_ucomm.

      LEAVE TO LIST-PROCESSING.

    WHEN 'LOG'.

        WRITE 'Hello'.

  ENDCASE.

ENDFORM.                    " alv_command

Thanks in Advance :-)

ALV_Output.jpg (106129 B)
Former Member
replied

Hi Sonu,

The thing is that when you use ALV the toolbar is asociated to a program, when you use the WRITE you didn't change of program name, so the toolbar is the same as the ALV output.

Why don't you put all the logic of the WRITE part in another program in wich either you pass parameter and make the logic in the new program or you can pass all the values vía EXPORT TO MEMORY.

SUBMIT zlog_program WITH p_vbeln = vbeln AND RETURN.

Now you'll be calling a new program passing a value the selection parameter is omitted and you'll only see the WRITE statements, when you hit back  you will go to the ALV.

Regards

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question