‎2006 Mar 01 11:37 AM
Hi experts,
I gave input in tcode range 'ks02,MM02,LT03'.
i want tcodes changes only which are in Tcode ranges as mentioned above.Remaining tcodes i want to delete.
For this i have used this statement.
DELETE icdhdr WHERE NOT TCODE in r_tcode.
But still i am getting all tcodes which are not in Tcode ranges.
How to remove the unwanted tcodes.
‎2006 Mar 01 12:28 PM
Hi,
the problem may be with the ranges.
r_tcode-sign = 'I'.
r_tcode-option = <b>'EQ'.</b>
r_tcode-low = v_frm.
r_tcode-high = v_to.
append r_tcode.
clear r_tcode.and check the r_tcode values in debug mode...
it should be EQ not BT.
it works very well for me,
just check it
REPORT ZTEST_RANGE .
RANGES : R_TCODE FOR SY-TCODE.
DATA: BEGIN OF ITAB OCCURS 0,
TCODE LIKE SY-TCODE,
END OF ITAB.
R_TCODE-LOW = 'KS02'.
R_TCODE-SIGN = 'I'.
R_TCODE-OPTION = 'EQ'.
APPEND R_TCODE.
R_TCODE-LOW = 'MM02'.
R_TCODE-SIGN = 'I'.
R_TCODE-OPTION = 'EQ'.
APPEND R_TCODE.
R_TCODE-LOW = 'LT03'.
R_TCODE-SIGN = 'I'.
R_TCODE-OPTION = 'EQ'.
APPEND R_TCODE.
"9 reocrds are there
ITAB-TCODE = 'MM01'.
APPEND ITAB.
ITAB-TCODE = 'VA02'.
APPEND ITAB.
ITAB-TCODE = 'VA01'.
APPEND ITAB.
ITAB-TCODE = 'VL01'.
APPEND ITAB.
ITAB-TCODE = 'MM02'.
APPEND ITAB.
ITAB-TCODE = 'MM03'.
APPEND ITAB.
ITAB-TCODE = 'KS02'.
APPEND ITAB.
ITAB-TCODE = 'MM02'.
APPEND ITAB.
ITAB-TCODE = 'LT03'.
APPEND ITAB.
DELETE ITAB WHERE TCODE NOT IN R_TCODE.
break-point.
"now only 4 records are thereVijay
‎2006 Mar 01 11:43 AM
Hi silviya,
1. Use like this :
loop at icdhdr.
if icdhdr-tcode in r_tcode.
else.
delete icdhdr.
endif.
endloop.
regards,
amit m.
‎2006 Mar 01 11:59 AM
Hi Silviya,
I had checked with ur delete statement , its working fine
How did u give the tcode ranges?did u click on the extension button of select options and give the 3 tcodes.
check if u had given spaces before tcodes while giving input.
check my code.
&----
*& Report YCHATEST *
*& *
&----
*& *
*& *
&----
REPORT YCHATEST .
tables : tstc.
data:begin of it_tcode occurs 0,
tcode like tstc-tcode,
end of it_tcode.
selection-screen begin of block b1.
select-options : s_tcode for tstc-tcode.
selection-screen end of block b1.
it_tcode-tcode = 'KS02'.
append it_tcode.
it_tcode-tcode = 'MM02'.
append it_tcode.
it_tcode-tcode = 'LT03'.
append it_tcode.
it_tcode-tcode = 'VA01'.
append it_tcode.
clear it_tcode.
delete it_tcode where not tcode in s_tcode.
write : / 'a'.
i had given Ks02 , mm02 and lt03 in the range and i got those 3 in my internal table at last , it had deleted va01.
‎2006 Mar 01 12:03 PM
Hi ,
Try this ..
delete icdhdr where not ( TCODE in r_tcode).
Please reward if useful.
Regards,
Sriranjani.
‎2006 Mar 01 12:04 PM
Hi,
ranges : r_tcode for sy-tcode.
r_tcode-low = 'KS02'.
r_tcode-sign = 'I'.
r_tcode-option = 'EQ'.
append r_tcode.
r_tcode-low = 'MM02'.
r_tcode-sign = 'I'.
r_tcode-option = 'EQ'.
append r_tcode.
r_tcode-low = 'LT03'.
r_tcode-sign = 'I'.
r_tcode-option = 'EQ'.
append r_tcode.
<b>delete icdhdr where TCODE not in r_tcode.</b>
Regards
vijay
‎2006 Mar 01 12:12 PM
I agree with u all.but problem is..
This is range for TCODE.
ranges : r_tcode for struct-TCODE.
this is Hard coded value for TCODE
Transaction_code = 'KS02,LT03,XK02'
this hard coded value will pass through the following subroutines.
I want to delete Tcodes which are not in Tcode ranges.
*FOR Transcation Code
form ranges.
do.
split Transaction_code at '^' into v_range Transaction_code.
split v_range at ',' into v_frm v_to.
shift v_frm left deleting leading ' '.
shift v_to left deleting leading ' '.
if v_frm eq '' and v_to eq ''.
exit.
endif.
if v_frm ne '' and v_to ne ''.
r_tcode-sign = 'I'.
r_tcode-option = 'BT'.
r_tcode-low = v_frm.
r_tcode-high = v_to.
append r_tcode.
clear r_tcode.
elseif v_to ne '' and v_frm eq '' .
r_tcode-sign = 'I'.
r_tcode-option = 'EQ'.
r_tcode-low = v_to.
append r_tcode.
clear r_tcode.
elseif v_frm ne '' and v_to eq ''.
r_tcode-sign = 'I'.
r_tcode-option = 'EQ'.
r_tcode-low = v_frm.
append r_tcode.
endif.
enddo.
clear : v_range,v_frm,v_to.
‎2006 Mar 01 12:28 PM
Hi,
the problem may be with the ranges.
r_tcode-sign = 'I'.
r_tcode-option = <b>'EQ'.</b>
r_tcode-low = v_frm.
r_tcode-high = v_to.
append r_tcode.
clear r_tcode.and check the r_tcode values in debug mode...
it should be EQ not BT.
it works very well for me,
just check it
REPORT ZTEST_RANGE .
RANGES : R_TCODE FOR SY-TCODE.
DATA: BEGIN OF ITAB OCCURS 0,
TCODE LIKE SY-TCODE,
END OF ITAB.
R_TCODE-LOW = 'KS02'.
R_TCODE-SIGN = 'I'.
R_TCODE-OPTION = 'EQ'.
APPEND R_TCODE.
R_TCODE-LOW = 'MM02'.
R_TCODE-SIGN = 'I'.
R_TCODE-OPTION = 'EQ'.
APPEND R_TCODE.
R_TCODE-LOW = 'LT03'.
R_TCODE-SIGN = 'I'.
R_TCODE-OPTION = 'EQ'.
APPEND R_TCODE.
"9 reocrds are there
ITAB-TCODE = 'MM01'.
APPEND ITAB.
ITAB-TCODE = 'VA02'.
APPEND ITAB.
ITAB-TCODE = 'VA01'.
APPEND ITAB.
ITAB-TCODE = 'VL01'.
APPEND ITAB.
ITAB-TCODE = 'MM02'.
APPEND ITAB.
ITAB-TCODE = 'MM03'.
APPEND ITAB.
ITAB-TCODE = 'KS02'.
APPEND ITAB.
ITAB-TCODE = 'MM02'.
APPEND ITAB.
ITAB-TCODE = 'LT03'.
APPEND ITAB.
DELETE ITAB WHERE TCODE NOT IN R_TCODE.
break-point.
"now only 4 records are thereVijay
‎2006 Mar 01 3:39 PM
Dear Silviya,
have you tried this:
r_tcode-low = 'KS02'.
r_tcode-sign = 'E'. -> excluded from selection
r_tcode-option = 'EQ'.
append r_tcode.
...
append the ranges table like this for every single tcode that you want to be excluded from the selection.
After that, the statement should work like this:
delete icdhdr where tcode in r_tcode.
Hope this helps, regards, Kathrin!