2008 Jun 08 6:32 PM
Hi all.
I have written code for interactive report using pfn.when i am clicking on check box for individual entries i am getting the correct result but when i am selecting multiple checkbox i am not getting required result.
Eg.suppose basic list has 10 and 20 values.on clicking checkbox for 10 and 20 separately i m getting the result but when i selecting 10 and 20 at same time 20 valuse are repeated.
please help me.
REPORT ZINTERACT.
tables:mara,mvke.
data:itab like mara occurs 0 with header line.
data:jtab like mvke occurs 0 with header line.
select-options: matnr for mara-matnr.
data:chk.
initialization.
matnr-low = '1'.
matnr-high = '500'.
matnr-sign = 'I'.
matnr-option = 'BT'.
append matnr.
start-of-selection.
select matnr mtart matkl from mara into corresponding fields of table
itab where matnr in matnr.
loop at itab.
write: / chk as checkbox , itab-matnr , itab-mtart , itab-matkl.
hide:itab-matnr.
endloop.
AT PF05.
CHECK SY-LSIND = 1.
select matnr vkorg vtweg from mvke into corresponding fields of table
jtab where matnr = itab-matnr.
WINDOW STARTING AT 10 5 ENDING AT 80 15.
DO.
CLEAR CHK.
READ LINE SY-INDEX FIELD VALUE CHK.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
CHECK CHK = 'X'.
loop at jtab.
write: / jtab-vkorg , jtab-vtweg.
endloop.
ENDDO.
clear itab-matnr.
2008 Jun 09 9:49 AM
Hi,
Try the logic like,you can read multiple values from list
DO.
READ LINE SY-INDEX FIELD VALUE CHK itab-matnr.
IF sy-subrc = 0 and chk = 'X'.
select matnr vkorg vtweg from mvke into corresponding fields of table
jtab where matnr = itab-matnr.
ELSEIF SY-SUBRC NE 0.
EXIT.
ENDIF.
enddo.