Application Development 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: 

call transaction from alv tree output display without using oops.

arijitbarman
Participant
0 Kudos
680

alv-tree-report-output-screen.jpg

Hi Abapers,

I have developed an alv tree report. I have not used any containers or any call screen. Now my requirement is to call transaction from the alv tree report output display. When user clicks on the po number in the screen then this po number should open in tcode me23n in display mode or when pr number is clicked pr should open in me53n in display mode. i have written this below code for this requirement. I am calling it after 'RS_TREE_CONSTRUCT' and 'RS_TREE_LIST_DISPLAY'. Its not working though. Please someone help me to correct this. I am also attaching a screenshot of my report output screen. PO number & PR number is concatenated with line item number. So total 15 chars.

*Fm for constructing the tree
CALL FUNCTION 'RS_TREE_CONSTRUCT'
TABLES
NODETAB = LT_NODE
EXCEPTIONS
TREE_FAILURE = 1
ID_NOT_FOUND = 2
WRONG_RELATIONSHIP = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
EXPORTING
CALLBACK_PROGRAM = SY-REPID.

*&--------------------------------------------------------------------*
*& Form USER_COMMAND
*&--------------------------------------------------------------------*

FORM USER_COMMAND USING F_UCOMM LIKE SY-UCOMM I_SELFIELD TYPE SLIS_SELFIELD.

READ TABLE LT_FINAL INDEX I_SELFIELD-TABINDEX INTO LW_FINAL.
IF SY-SUBRC = 0.
CASE F_UCOMM.
WHEN '&IC1'.
CASE I_SELFIELD-SEL_TAB_FIELD.
WHEN 'lt_final-PO_EBELN'.
CHECK NOT LW_FINAL-PO_EBELN IS INITIAL.
SET PARAMETER ID 'BES' FIELD LW_FINAL-PO_EBELN.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
WHEN 'lt_final-PR_BANFN'.
CHECK NOT LW_FINAL-PR_BANFN IS INITIAL.
SET PARAMETER ID 'BAN' FIELD LW_FINAL-PR_BANFN.
CALL TRANSACTION 'ME53N' AND SKIP FIRST SCREEN.
ENDCASE.
ENDCASE.
ENDIF.

ENDFORM. "USER_COMMAND

Note: I can share total tree report code if someone needs it.

4 REPLIES 4

Sandra_Rossi
Active Contributor
0 Kudos
243

I think that you forgot to tell us that you had set a break point at the beginning of USER_COMMAND and the debugger didn't stop there. And maybe some other details?

For RS_TREE_LIST_DISPLAY, the subroutine should have this interface (provided in the documentation of the function module):

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

arijitbarman
Participant
0 Kudos
243

Hi Sandra,

I had kept breakpoint on FORM USER_COMMAND but it is not getting triggered. Can you please provide me the code for drill down in alv tree output.

Chintu6august
Contributor
0 Kudos
243

Hello,

i can see that you haven't passed user_command routine to the FM.

  CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
    EXPORTING
      callback_program      = sy-repid
      callback_user_command = 'USER_COMMAND' 
      callback_gui_status   = 'SET_PF'.  

you need to write your user_command form interface should be something like this.

FORM user_command TABLES p_nodes STRUCTURE seucomm

USING p_command TYPE c

CHANGING p_exit TYPE c

p_list_refresh TYPE c.

your call transaction logic using node-level and node-text.

ENDFORM.

thank you!!

arijitbarman
Participant
0 Kudos
243

Hi Chintu,

Thanks alot for your reply. When i am passing user command in RS_TREE_LIST_DISPLAY my tree is not expanding. My pr and po number are in level5 and text1 & text2 respectively. Can you please guide me what should be my logic code to call me53n for pr and me23n for po from alv tree output display.