11-12-2007 4:39 PM
Hello Gurus,
Internal table contains sales org, distr channel, rounding profile. Please help me how I can check in which sales org (1231 to 1236) and distribution channel (10, 20 and 30) combinations I have the rounding profile ZBU2.
Regards,
Balu
11-12-2007 4:47 PM
hi Balu,
LOOP AT itab WHERE salesorg BT ( '1231' AND '1236 )
AND ( distrchan EQ '10' OR
distrchan EQ '20' OR
distrchan EQ '30' )
AND roundprof EQ 'ZBU2'
ENDLOOP.
this might be rough, but I think you get the logic
ec
11-12-2007 4:46 PM
You can do it like this:
Loop at itab where rounding_profile = 'ZBU2'.
* access itab-sales_org and itab-dist_channel for the combination
endloop.
Regards,
Naimesh Patel
11-12-2007 4:47 PM
hi Balu,
LOOP AT itab WHERE salesorg BT ( '1231' AND '1236 )
AND ( distrchan EQ '10' OR
distrchan EQ '20' OR
distrchan EQ '30' )
AND roundprof EQ 'ZBU2'
ENDLOOP.
this might be rough, but I think you get the logic
ec
11-12-2007 4:49 PM
You can use below syntax.
tables : vbak.
ranges : r_vkorg for vbak-vkorg,
r_vtweg for vbak-vtweg.
r_vkorg-low = '1231'.
r_vkrog-sign = 'I'.
r_vkorg-option = 'EQ'
append r_vkorg.
r_vkorg-low = '1232'.
r_vkrog-sign = 'I'.
r_vkorg-option = 'EQ'
append r_vkorg.
r_vkorg-low = '1233'.
r_vkrog-sign = 'I'.
r_vkorg-option = 'EQ'
append r_vkorg.
r_vkorg-low = '1234'.
r_vkrog-sign = 'I'.
r_vkorg-option = 'EQ'
append r_vkorg.
r_vkorg-low = '1235'.
r_vkrog-sign = 'I'.
r_vkorg-option = 'EQ'
append r_vkorg.
r_vkorg-low = '1236'.
r_vkrog-sign = 'I'.
r_vkorg-option = 'EQ'
append r_vkorg.
same thing should apply to r_vtweg.
loop at itab where vkorg in r_vkorg
and vtweg in r_vtweg.
endloop.
Thanks
Seshu
11-12-2007 4:50 PM
Hi
RANGES: R_VKORG FOR VBAK-VKORG,
R_VTWEG FOR VBAK-VTWEG.
R_VKORG(3) = 'IBT'.
R_VKORG-LOW = '1231'
R_VKORG-HIGH = '1236'.
APPEND R_VKORG.
R_VTWEG(3) = 'IEQ'.
R_VTWEG-LOW = '10'.
APPEND R_VTWEG.
R_VTWEG-LOW = '20'.
APPEND R_VTWEG.
R_VTWEG-LOW = '30'.
APPEND R_VTWEG.
LOOP AT ITAB WHERE VKORG IN R_VKORG
AND VTWEG IN R_VTWEG
AND PROFILE = 'ZBU2'
Max
11-12-2007 4:58 PM
Hello Gurus,
I think I was not clear. I already have an internal table with fields sales org, dchannel and rounding profile. Sales org field can contain 1231 to 1236 but not necessarily all. Dchannel field can contain 10, 20 and 30 but necessarily all three. Rounding profile field can contain ZBU2 or any other values or blank.
Now from this internal table, I need to fill another table field with Yes(Y) if the rounding profile is ZBU2 for all the existing combinations of sales org and dchannels in the first table. I need to flll with No (N) if the rounding profile is not equal to ZBU2 in all the existing combinations of sales org and dchannels in the first table.
I need to know how I can write this loop.
Regards,
Balu
11-12-2007 5:02 PM
Then you have to write read command within loop.
loop at itab.
read table itab1 with key vkorg = itab-vkrog binary search.
if sy-subrc eq 0.
here write your logic.
endif.
endloop.
you can check for VTWEG and other fields too
Thanks
Seshu
11-12-2007 5:05 PM
Hi
( from Max's example...)
RANGES: R_VKORG FOR VBAK-VKORG,
R_VTWEG FOR VBAK-VTWEG.
R_VKORG(3) = 'IBT'.
R_VKORG-LOW = '1231'
R_VKORG-HIGH = '1236'.
APPEND R_VKORG.
R_VTWEG(3) = 'IEQ'.
R_VTWEG-LOW = '10'.
APPEND R_VTWEG.
R_VTWEG-LOW = '20'.
APPEND R_VTWEG.
R_VTWEG-LOW = '30'.
APPEND R_VTWEG.
LOOP AT ITAB WHERE VKORG IN R_VKORG
AND VTWEG IN R_VTWEG.
IF ITAB-PROFILE = 'ZBU2'.
Populate your Yes Table
ELSE.
Populate your No table
ENDIF...
11-12-2007 7:44 PM
Thank you for all the replies.
I used ferry's logic. Points assigned to Ferry, Seshu and Eric.
Thanks,
Balu
11-12-2007 5:05 PM
Hi,
Please try this.
LOOP AT ITAB WHERE VKORG BT ( '1231' AND '1236 )
AND ( VTWEG EQ '10' OR
VTWEG EQ '20' OR
VTWEG EQ '30' )
AND PROFILE EQ 'ZBU2'.
ITAB-FLAG = 'Y'.
MODIFY ITAB.
ENDLOOP.
LOOP AT ITAB WHERE FLAG EQ SPACE.
ITAB-FLAG = 'N'.
MODIFY ITAB.
ENDLOOP.
Regards,
Ferry Lianto