03-31-2008 7:20 AM
hi gurus.,
My requirement is i hv to group all sub-partnumbers in one single part number ..
for Example: BHRM2960 (8 chars) is my main Part number
for this Sub-part numbers come like this ..
BHRM2960-010
BHRM2960-020
BHRM2960-030
.. i want to group all the sub-partnumbers under main part number ..
i.e., like this 'BHRM2960*' .. how can i achieve this ..also i have to calculate total of all the sub-part numbers based on header part number through code .. how can i achieve this.. plz help me ..its urgent ..
Thanks in advance
03-31-2008 7:25 AM
for example your internal table contains fields like...........
main, sub, amount, maintot, subtot................
sort itab by main sub.
loop at itab.
to calculate main total...............
at end of main.
sum.
itab-maintot = amount.
endat.
to calculate sub total..............
at end of sub.
sum.
itab-sudtot = amount.
endat.
endloop.
reward if useful..................
03-31-2008 7:28 AM
Hi,
use function module
data : it_stb2 like stpox occurs 0 with header line,
it_spma2x like it_spma2 occurs 0 with header line,
it_matcat like cscmat occurs 0 with header line,
call function 'CS_BOM_EXPL_MAT_V2'
exporting
capid = 'PP01'
datuv = sy-datum
mktls = 'X'
mehrs = 'X'
mmory = '1'
mtnrv = it_spma2-matnr
werks = werks
tables
stb = it_stb2
matcat = it_matcat
exceptions
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
others = 8.
Regards,
V.Balaji
Reward if Usefull...
03-31-2008 7:34 AM
hi Gurus.,
my requirement not yet reached.. first i hv to group all sub-part numbers under their respective Part number Group ...Then i hv to sum up based on Part number .. how can i achieve this... its urgent...
03-31-2008 7:42 AM
ex:
data: begin of itab occurs 0,
main
sub
end of itab.
data: begin of itab1 occurs 0,
main
sub type string,
subtot type i,
end of itab1.
sort itab by main.
loop at itab.
concatenate itab1-sub itab-sub
into itab1-sub
separated by '*'.
itab1-subtot = itab1-subtot + 1.
at end of main.
move: itab-main to itab1-main.
append itab1.
clear itab1.
endat.
endloop.
03-31-2008 7:36 AM
Hi ,
If you are using ,ALV grid or List display function module then then it will be very easy for you to do these type of requirement.
In function module 'REUSE_ALV_GRID/LIST_DISPLAY' , you have to fill some parameters and you can avail the facility of sorting fields , subtotals and grouping etc.
03-31-2008 7:36 AM
Hi,
Look at the transaction 'CS12'. You will get a solution from this.
Thanks and Regards,
Suman
03-31-2008 7:47 AM
Hi,
loop the sub-partner table with condition WHERE number CP 'BHRM2960*'.
LOOP AT it_sub WHERE partn CP 'BHRM2960*'.
....
ENDLOOP.
03-31-2008 7:50 AM