‎2010 Apr 07 10:46 AM
Hi Everyone,
I have a requitement where i need to display a classic report based on the records checked in the first report.
The first classic report has list of material details with checkbox.when the user selects a particular record,and clicks the button,the selected record should be displayed in the second classic report.
i tried framing the logic based on some inputs from SDN,but the problem is the check box value is not getting captured because of which i get all the records from the first report.
iam using at user comamnd event,as this has to occur at button click.
iam also posting my at user command code.
kindly have a look and guide me where iam going wrong.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'EXECUTE'.
SET PF-STATUS 'EXECUTE'.
WRITE:/1(60) sy-uline.
WRITE:/1 sy-vline,
2 'MATERIAL NUMBER',
15 sy-vline,
16 'MATERIAL DESCRIPTION',
60 sy-vline.
WRITE:/1(60) sy-uline.
DO .
READ LINE sy-index.
IF sy-subrc NE 0.
EXIT.
ENDIF.
LOOP AT it_makt .
if sy-lisel+1(1) = 'X'.
it_final-matnr = it_makt-matnr.
it_final-maktx = it_makt-maktx.
APPEND it_final.
else .
if sy-index > 1 and sy-lisel = space.
exit.
endif.
endif.
ENDLOOP.
LOOP at it_final.
WRITE:/1 sy-vline,
2 it_final-matnr,
17 sy-vline,
18 it_final-maktx,
60 sy-vline.
ENDLOOP.
ENDDO.
ENDCASE.
WRITE:/1(60) sy-uline.
thanks in advance.
‎2010 Apr 07 10:50 AM
Hi
If u r using ALV,then u need to set edt_cll_cb = 'X' in grid settings.
Regrards,
Raghu.
‎2010 Apr 07 10:51 AM
‎2010 Apr 07 11:16 AM
Try Below Code
pline type i value 0,
pline = 3. " considering first two rows as header
loop at it_makt.
pline = pline + 1.
write : / it_makt-pflag as checkbox input on,
at 3 sy-vline,
at 2 it_makt-matnr,
at 18 sy-vline,
at 20 it_makt-maktx,
at 53 sy-vline,
endloop.
at user-command.
case sy-ucomm.
when '&EXIT'.
leave program.
when '&EXE'.
refresh it_final.
do pline times.
read line sy-index.
if sy-lisel(1) = 'X'.
clear it_final.
it_final-matnr = sy-lisel+4(10). change offset accordingly
it_final-matkx = sy-lisel+19(30). change offset accordingly
append it_final.
endif.
enddo.
loop at it_final.
write : at 3 sy-vline,
at 2 it_final-matnr,
at 18 sy-vline,
at 20 it_final-maktx,
at 53 sy-vline,
endloop.Regards
Vinod
Edited by: Vinod Kumar on Apr 7, 2010 3:47 PM
‎2010 Apr 09 6:01 AM
Hi Vinod,
I did the same way as suggested by you.
But i need to do a validation on the material number selected by the user.
the user cannot select the same material again.
I also implemented the code for that,but somehow the material number in second internal table is not checkd with the first internakl table.
can u plz tell me where iam going wrong?
the below is the code i implemented for validation of material number.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN '&EXIT'.
LEAVE PROGRAM.
WHEN 'EXECUTE'.
REFRESH it_final.
do pline times.
read line sy-index.
if sy-lisel(1) = 'X'.
IF NOT it_final IS INITIAL.
LOOP AT it_final.
IF sy-lisel+1(100) EQ it_makt-matnr.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Error message for duplicate records'
txt1 = it_final-matnr
txt2 = 'Record already exists '.
TXT3 = ' '
TXT4 = ' '
write : / it_final-matnr,
AT 20 sy-vline,
AT 25 it_final-maktx,
AT 50 sy-vline.
ELSE.
it_final-matnr = sy-lisel+1(100).
it_final-maktx = sy-lisel+19(100).
append it_final.
write : / it_final-matnr,
AT 20 sy-vline,
AT 25 it_final-maktx,
AT 50 sy-vline.
ENDIF.
ENDLOOP.
IF flag = 0.
it_final-matnr = sy-lisel+1(100).
it_final-maktx = sy-lisel+19(100).
append it_final.
write : / it_final-matnr,
AT 20 sy-vline,
AT 25 it_final-maktx,
AT 50 sy-vline.
ELSE.
it_final-matnr = sy-lisel+4(10).
it_final-maktx = sy-lisel+19(30).
append it_final.
write : / it_final-matnr,
AT 25 it_final-maktx,
AT 50 sy-vline.
ENDIF.
ENDIF.
enddo.
Thanks in advance.
‎2010 Apr 09 9:37 PM
Have a look at abap examples (transaction abapdocu). Expecially the one in menu user dialogs, lists, user actions, changing field formats: there's a select field, the user clicks a button which finds the line, and when he comes back, the checkbox is grayed out
‎2011 May 30 10:40 AM