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

Interactive reports using ABAP query

Former Member
0 Likes
1,059

I have developed an ABAP query which prints the sales documents in ALV list display.

In that list display I would do develop a functionality is , when ever i double click on the sales doc number it will directly go to the VA03 transaction for the corresponding VBELN.

Can anybody explain how to do this?

7 REPLIES 7
Read only

Former Member
0 Likes
876

Hi,

which alv function you are using?

Read only

0 Likes
876

In ABAP query we have the output displat option as SAP List Viewer

Read only

Former Member
0 Likes
876

hi uoy can relate this code and tyr with your need

METHODS: DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID

METHOD DOUBLE_CLICK.

MESSAGE S400(00) WITH 'documentS' E_ROW.

DATA : WA_DISPLAY LIKE LINE OF T_DISPLAY.

IF E_COLUMN = 'BELNR'.

READ TABLE T_DISPLAY INDEX E_ROW INTO WA_DISPLAY.

IF SY-SUBRC = 0.

SET PARAMETER ID 'BLN' FIELD WA_DISPLAY-BELNR.

SET PARAMETER ID 'BUK' FIELD WA_DISPLAY-BUKRS.

SET PARAMETER ID 'GJR' FIELD WA_DISPLAY-GJAHR.

CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.

ENDIF.

ENDIF.

endmethod.

Regards

rajendra

Read only

0 Likes
876

In SAP query how can I add the code,as the program was generated automatically.

Can you please guide where exactly the code is to be added ( are any configuration is needed) so that i can proceed further.

Read only

0 Likes
876

This message was moderated.

Read only

Former Member
0 Likes
876

hi

Follow the link

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40bec8da-4cd8-2910-27a9-81f5ce10...

Revert back to me if your query dosent solved

Regards

Sachin

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
876

Hi,

When you double-click on any cell of alv, use this code to fetch the data of the line that you currently clicked, its working:-

When you double click on the ALV line, you will have sy-ucomm = '&IC1'.

So when you define a i_callback_user_command for the FM reuse_alv_list_display,

     i_callback_user_command           = 'COMMAND' " for User-Command

and create it as:-


FORM command USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
  DATA : ok_code TYPE sy-ucomm.
  ok_code = ucomm.
  CASE ok_code.
    WHEN '&IC1'. "for double click on alv line
      " your code
  ENDCASE.
ENDFORM.

As you have used selfield TYPE slis_selfield, the field selfield will hold all the values.

To know on which row you have clicked and to retain that line, use code:-

Suppose you are currently displaying data from internal table itab and corresponding to it you have work area wa.


read table itab into wa index selfield-tabindex. "index value of line you clicked
" now you have the contents of line that you double clicked currently

Now to know the field name that you clicked, use:-


selfield-fieldname " will fetch you the name of field that you clicked

Now using the work-area and the name of field that you clicked, you can easily make out the details of the field i.e., field name and field value and you can code as per your requirement.

Refer:-


CASE selfield-fieldname.
  WHEN 'VBELN'.
    SET PARAMETER ID 'AUN' FIELD <wa-vbeln>. "value for work area for vbeln
    CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDCASE.

Hope this helps you.

Regards,

Tarun