09-04-2008 8:43 AM
hi all am using this code
&----
*& Form USER_COMMAND
&----
USERCOMMANDS FOR THE ALV PROGRAM.
----
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA : l_purchase TYPE banfn.
CASE r_ucomm.
WHEN 'DCPR'.
IF rs_selfield-fieldname = 'BANFN'.
l_purchase = rs_selfield-value.
SET PARAMETER ID 'BAN' FIELD l_purchase.
CALL TRANSACTION 'ME53N'.
ENDIF.
ENDCASE.
CLEAR r_ucomm.
ENDFORM.
But here only if user is clicking on the Banfn Field then only i will get the value for the field BANFN but my requirement is irrespective of user clicks anywhere in the ALV Grid output, i need to capture the value for the Field BANFN .IS there any way to capture the value of a particular field if that line is selected the same way like we do in simple interactive reports .? i need help in this
09-04-2008 8:53 AM
Hi
U shoudl extract the record of the output table of the selected line:
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA : l_purchase TYPE banfn,
wa LIKE <your output table>.
READ TABLE <your output table> into wa INDEX rs_selfield-tabindex.
IF SY-SUBRC <> 0. EXIT. ENDIF.
CASE r_ucomm.
WHEN 'DCPR'.
l_purchase = wa-BANFN.
SET PARAMETER ID 'BAN' FIELD l_purchase.
CALL TRANSACTION 'ME53N' AND SKIP FIRST SCRENN.
WHEN OTHERS.
ENDCASE.
ENDFORM.
Max
09-04-2008 8:53 AM
Hi
U shoudl extract the record of the output table of the selected line:
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA : l_purchase TYPE banfn,
wa LIKE <your output table>.
READ TABLE <your output table> into wa INDEX rs_selfield-tabindex.
IF SY-SUBRC <> 0. EXIT. ENDIF.
CASE r_ucomm.
WHEN 'DCPR'.
l_purchase = wa-BANFN.
SET PARAMETER ID 'BAN' FIELD l_purchase.
CALL TRANSACTION 'ME53N' AND SKIP FIRST SCRENN.
WHEN OTHERS.
ENDCASE.
ENDFORM.
Max
09-04-2008 9:11 AM
Hi Max Thaknks it Solved the problem
i have also provided you points for giving back quick response to my question.
09-04-2008 9:10 AM
Check the value of rs_selfield-TABINDEX
it returns the rown number on which click event took place.
use read table index rs_selfield-TABINDEX to obtain the value.