‎2009 Feb 09 12:28 PM
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?
‎2009 Feb 09 12:30 PM
‎2009 Feb 09 12:32 PM
In ABAP query we have the output displat option as SAP List Viewer
‎2009 Feb 09 12:35 PM
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
‎2009 Feb 09 12:39 PM
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.
‎2009 Apr 28 6:44 AM
‎2009 Feb 09 12:54 PM
hi
Follow the link
Revert back to me if your query dosent solved
Regards
Sachin
‎2009 Apr 28 7:28 AM
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-Commandand 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