Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV tree output

Former Member
0 Likes
951

Hello.

I use these functions to create an output tree:

'RS_TREE_CONSTRUCT', 'RS_TREE_LIST_DISPLAY'

Is there any way to add a button to the output so when they click it, the program closes?

Greets

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
817

In RS_TREE_LIST_DISPLAY fill the CALLBACK_PROGRAM, CALLBACK_USER_COMMAND and CALLBACK_GUI_STATUS parameters.

Parameters for USER_COMMAND are

FORM user_command tables   node STRUCTURE seucomm    
                  using    command                   
                  changing exit                      
                           list_refresh.

There are no parameter for CALLBACK_GUI_STATUS. (Just do a SET PF-STATUS)

You already receive a parameter F15 back from RS_TREE_LIST_DISPLAY if user press the EXIT key (Yellow arrow)

Regards

4 REPLIES 4
Read only

RaymondGiuseppi
Active Contributor
0 Likes
818

In RS_TREE_LIST_DISPLAY fill the CALLBACK_PROGRAM, CALLBACK_USER_COMMAND and CALLBACK_GUI_STATUS parameters.

Parameters for USER_COMMAND are

FORM user_command tables   node STRUCTURE seucomm    
                  using    command                   
                  changing exit                      
                           list_refresh.

There are no parameter for CALLBACK_GUI_STATUS. (Just do a SET PF-STATUS)

You already receive a parameter F15 back from RS_TREE_LIST_DISPLAY if user press the EXIT key (Yellow arrow)

Regards

Read only

0 Likes
817

Can u please explain this a bit more..

THX

Read only

0 Likes
817

- Option 1

Use the F15 parameter, and if checked after call tree display, exit program (in your caller program)

CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
...
IF F15 = 'X'.
  LEAVE PRORAM.
ENDIF.

If F15 is checked, user pressed EXIT, else user pressed BACK.

- Option 2

Creat two forms in your caller program, USER_COMMAND and SET_PF_STATUS

In the form PF-STATUS, execute a SET PF-STATUS you have to create on your caller program. (double-clic on the status name or use SE41)

FORM set_pf_status.
  SET PF-STATUS 'XXX'.
ENDFORM.

In the form USER_COMMAND check the function used and exit program if the desired key is pressed.

FORM user_command TABLES   node STRUCTURE seucomm
                  USING    command
                  CHANGING exit
                           list_refresh.
  CASE command.
    WHEN 'BACK'.
      exit = 'X'.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
  ENDCASE.
ENDFORM.

When calling RS_TREE_LIST_DISPLAY pass the caller program name (do not use sy-repid, move it to a variable) and the name of the forms

w_pgmid = sy-repid.
CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
     EXPORTING
          callback_program      = w_pgmid
          callback_user_command = 'USER_COMMAND'
          callback_gui_status   = 'SET_PF_STATUS'.
(...)

Regards

Read only

Former Member
0 Likes
817

Hi Dear,

All ready there is button in standard SAP.

Click on Cancel button (F12) or

Exit button (Shift+f3).

REWARD IF USEFUL