‎2007 Jun 08 5:32 AM
Hi,
May I know how can I do this in more efficient way?
let say i have :
sales order pos seq
00010 10 1
00010 10 2
00010 10 3
00020 10 1 -> this line to be removed because seq = 1, and there is no following seq for this sales order+pos.
00040 10 1
Will reward points if the answer helps. Thanks
‎2007 Jun 08 5:55 AM
Try this..
DATA: v_int TYPE i.
DATA: v_tabix TYPE SYTABIX.
SORT ITAB BY vbeln pos seq.
LOOP AT ITAB INTO WA.
V_TABIX = SY-TABIX.
CLEAR: v_int, wa_tmp. [WA_TMP IS WORKAREA FOE INTERNAL TABLE ]
LOOP AT ITAB INTO wa_tmp WHERE vbeln = wa-vbeln AND pos = wa-pos.
V_INT = V_INT + 1.
ENDLOOP.
IF V_INT = 1 AND WA_TMP-SEQ = 1.
DELETE ITAB INDEX V_INDEX.
ENDIF.
ENDLOOP.
If helpful reward some points.
with regards,
suresh
‎2007 Jun 08 5:37 AM
Hi,
Try this..
DATA: v_int TYPE i.
DATA: v_tabix TYPE SYTABIX.
SORT ITAB BY vbeln pos seq.
* process the internal table.
LOOP AT ITAB IN WA.
* row number
V_TABIX = SY-TABIX.
* Clear
CLEAR: v_int, wa_tmp.
* Get the count.
LOOP AT ITAB INTO wa_tmp WHERE vbeln = wa-vbeln AND pos = wa-pos.
V_INT = V_INT + 1.
ENDLOOP.
* Check the count and WA_TMP = 1.
IF V_INT = 1 AND WA_TMP-SEQ = 1.
* Delete that record.
DELETE ITAB INDEX V_INDEX.
ENDIF.
ENDLOOP.
Thanks,
Naren
‎2007 Jun 08 5:38 AM
Hi,
loop at itab.
l_tabix = sy-tabix.
if itab-seq = 1.
read itab with key sales order, pos seq =2
if sy-subrc NE 0.
delete itab index l_tabix
endif.
endif.
endloop.
Reward points if useful.
Regards,
Atish
‎2007 Jun 08 5:40 AM
Hi
You can try this way.
Loop at itab.
at new sorder.
read itab index sy-tabix.
lf_sorder = itab-sorder.
lf_seq_flg = 'X'.
endat.
if lf_sorder NE itab-sorder.
clear lf_seq_flg.
lf_del_index = sy-tabix - 1.
delete itab index lf_del_index.
endif.
endloop.
Regards
Raj
‎2007 Jun 08 5:54 AM
Hi
Do Like This............
it2[] = it1[].
loop at it2.
n = it2-seq.
read table it1 with key sales_order = it2-sales_order
pos = it2-pos
seq = it2-seq.
if sy-subrc = 0.
n = n + 1.
read table it2 with key sales_order = it2-sales_order
pos = it2-pos
seq = n.
if sy-subrc = 0.
move this to your final table.(entry existing)
move-corresponding it1 to it_final.
else.
endif
endif.
clear n.
endloop.
Reward All Helpfull answers........
‎2007 Jun 08 5:55 AM
Try this..
DATA: v_int TYPE i.
DATA: v_tabix TYPE SYTABIX.
SORT ITAB BY vbeln pos seq.
LOOP AT ITAB INTO WA.
V_TABIX = SY-TABIX.
CLEAR: v_int, wa_tmp. [WA_TMP IS WORKAREA FOE INTERNAL TABLE ]
LOOP AT ITAB INTO wa_tmp WHERE vbeln = wa-vbeln AND pos = wa-pos.
V_INT = V_INT + 1.
ENDLOOP.
IF V_INT = 1 AND WA_TMP-SEQ = 1.
DELETE ITAB INDEX V_INDEX.
ENDIF.
ENDLOOP.
If helpful reward some points.
with regards,
suresh