Problem in Alv Line selesction
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.
IF rs_selfield-fieldname = 'BANFN'.
l_purchase = rs_selfield-value.
SET PARAMETER ID 'BAN' FIELD l_purchase.
CALL TRANSACTION 'ME53N'.
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
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.