‎2007 Jan 19 5:34 AM
Hi friends
i tried to use instead of parameter i am using select options
error function module was called incorrectly
how can i rectify to solve this one.
tables :mara,marc,stpo.
parameters: p_werks like t001w-werks obligatory.
select-options : P_matnr for mara-matnr.
constants c_x value 'X'.
data: begin of it_comp occurs 0,
idnrk like stpox-idnrk,
ojtxp like stpox-ojtxp,
menge like stpox-menge,
meins like stpox-meins,
matkl like stpox-matmk,
end of it_comp.
data: w_topmat like cstmat.
data : itab type table of mara with header line.
*
*******************
start-of-selection.
*******************
perform explode_assembly.
*****************
end-of-selection.
*****************
perform write_report.
************
top-of-page.
************
perform print_header.
&----
form print_header.
write: /(18) 'Component'(h00),
(40) 'Description'(h01),
'Mat.Group'(h02),
(18) 'Quantity'(h03).
uline.
endform.
&----
form write_report.
write: / w_topmat-matnr under text-h00 color col_heading,
w_topmat-maktx under text-h01 color col_heading.
loop at it_comp.
write: /
it_comp-idnrk under text-h00,
it_comp-ojtxp under text-h01,
it_comp-matkl under text-h02,
it_comp-menge unit it_comp-meins under text-h03,
it_comp-meins.
endloop.
uline.
endform.
&----
form explode_assembly.
data: it_stb like stpox occurs 0 with header line,
it_stb2 like stpox occurs 0 with header line,
it_stb3 like stpox occurs 0 with header line,
w_msg(255) type c.
select matnr from mara into table itab where matnr between p_matnr-low and p_matnr-high.
loop at p_matnr.
itab-matnr = p_matnr-low.
append itab.
itab-matnr = p_matnr-high.
append itab.
clear itab.
endloop.
Explode highest level:
call function 'CS_BOM_EXPL_MAT_V2'
exporting
auskz = c_x
capid = 'PP01'
cuols = c_x
datuv = sy-datum
knfba = c_x
ksbvo = c_x
mbwls = c_x
mdmps = c_x
BGIXO = c_x
MKMAT = c_x
MMAPS = c_x
FBSTP = c_x
FTREL = c_x
mtnrv = p_matnr
werks = p_werks
importing
topmat = w_topmat
tables
stb = it_stb
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
conversion_error = 8
others = 9.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
into w_msg.
write: / w_msg.
exit.
*else.
endif.
loop at it_stb.
it_comp-matkl = it_stb-matmk.
it_comp-idnrk = it_stb-idnrk.
it_comp-ojtxp = it_stb-ojtxp.
it_comp-menge = it_stb-menge.
it_comp-meins = it_stb-meins.
collect it_comp.
clear it_comp.
endloop.
endloop.
endform.
how can i sove this error .
Regards
ds
‎2007 Jan 19 5:38 AM
hi,
The pasted code has no errrors ... it i executed in my system ... let us know the place where you are getting errors ...
Regards,
Santosh
‎2007 Jan 19 5:38 AM
hi,
The pasted code has no errrors ... it i executed in my system ... let us know the place where you are getting errors ...
Regards,
Santosh
‎2007 Jan 19 5:44 AM
error is fm is allow you specify only fields of particular type under mtnrv
here p_matnr is specity different field type.
i check that one it gives error
Rds
ds
‎2007 Jan 19 5:46 AM
HI,
dont use p_matnr use p_matnr-low since p_matnr is an internal table it gives you error. you should pass a filed of type matnr.
Regards,
Sesh
‎2007 Jan 19 5:50 AM
Hi friend
Thank u
i got the ouput one materials bom,
if i want to get from and to materials bom
what i have to do
Regard
ds
‎2007 Jan 19 5:53 AM
Hi friend
Thank u
i got the ouput one materials bom,
if i want to get from and to materials bom
Regard
ds
‎2007 Jan 19 5:55 AM
HI,
See if there is any function modue which accepts an internal table instead of one single value. If there is no function module like that then you might have to call this FM in a loop but i wont suggest since its not good in performance check for any other function module. This FM has one tables parameter MATCAT try and see if you can use this.
Regards,
Sesh
‎2007 Jan 19 6:01 AM
hi
bcs the requirement is run this report in background only
if i give 1 to 500 materials i ll give gives the materials and bom
and download into excel.where i have to
data : itab like table of mara occurs 0 with header line.
loop at p_matnr.
itab-matnr = p_matnr-low.
append itab.
itab-matnr = p_matnr-high.
append itab.
clear itab.
endloop.
instead of p_matnr-low can i use itab.
regds
ds
‎2007 Jan 19 6:56 AM
Hi frineds
if i want to pass the low and high value to one itab
then i have to pass one by one value into function module
is it possible to get the output 1 up 10 simultaniously
how can i adopt
Regards
Ds
‎2007 Jan 19 5:39 AM
HI,
Use IN instead of BETWEEN and can you give us the exact error.
Regards,
Sesh
‎2007 Jan 19 5:41 AM
Hi ,
In your code do the following changes.
data: it_stb like stpox occurs 0 with header line,
it_stb2 like stpox occurs 0 with header line,
it_stb3 like stpox occurs 0 with header line,
w_msg(255) type c.
select matnr from mara into table itab where matnr between p_matnr-low and p_matnr-high.
You can write the above select in this fashion also .
select matnr from mara into table itab where matnr in p_matnr.
why you require the below code i don't understand .
<b>loop at p_matnr.
itab-matnr = p_matnr-low.
append itab.
itab-matnr = p_matnr-high.
append itab.
clear itab.</b>
<b>endloop.</b>
<b>Use the Function Module CS_BOM_EXPLOSION and you require the configuration instance .</b>
Explode highest level:
call function 'CS_BOM_EXPL_MAT_V2'
exporting
auskz = c_x
capid = 'PP01'
cuols = c_x
datuv = sy-datum
knfba = c_x
ksbvo = c_x
mbwls = c_x
mdmps = c_x
BGIXO = c_x
MKMAT = c_x
MMAPS = c_x
FBSTP = c_x
FTREL = c_x
mtnrv = p_matnr
werks = p_werks
importing
topmat = w_topmat
tables
stb = it_stb
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
conversion_error = 8
others = 9.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
into w_msg.
write: / w_msg.
exit.
*else.
endif.
loop at it_stb.
it_comp-matkl = it_stb-matmk.
it_comp-idnrk = it_stb-idnrk.
it_comp-ojtxp = it_stb-ojtxp.
it_comp-menge = it_stb-menge.
it_comp-meins = it_stb-meins.
collect it_comp.
clear it_comp.
endloop.
endloop.
endform.
Please reward if useful.
‎2007 Jan 19 5:44 AM
Hi,
Error is here in bold use p_matnr-low or high.
call function 'CS_BOM_EXPL_MAT_V2'
exporting
auskz = c_x
capid = 'PP01'
cuols = c_x
datuv = sy-datum
knfba = c_x
ksbvo = c_x
mbwls = c_x
mdmps = c_x
BGIXO = c_x
MKMAT = c_x
MMAPS = c_x
FBSTP = c_x
FTREL = c_x
<b>mtnrv = p_matnr</b>
werks = p_werks
importing
topmat = w_topmat
tables
stb = it_stb
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
conversion_error = 8
others = 9.
Regards,
Sesh
‎2007 Jan 19 5:51 AM
Give this way ...
call function 'CS_BOM_EXPL_MAT_V2'
exporting
auskz = c_x
capid = 'PP01'
cuols = c_x
datuv = sy-datum
knfba = c_x
ksbvo = c_x
mbwls = c_x
mdmps = c_x
BGIXO = c_x
MKMAT = c_x
MMAPS = c_x
FBSTP = c_x
FTREL = c_x
<b>mtnrv = p_matnr-low</b>
werks = p_werks
importing
topmat = w_topmat
tables
stb = it_stb
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
conversion_error = 8
others = 9.
Regards,
Santosh