Skip to Content
-1

call transaction from alv tree output display without using oops.

Feb 14, 2017 at 11:14 AM

148

avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

avatar image
Former Member Feb 15, 2017 at 04:51 AM
-1

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.

Share
10 |10000 characters needed characters left characters exceeded
Sandra Rossi Feb 14, 2017 at 07:29 PM
0

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.
Share
10 |10000 characters needed characters left characters exceeded
Chintu adi Feb 15, 2017 at 10:39 AM
0

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!!

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Feb 16, 2017 at 06:03 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded