Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

in bom explosion i got the error msg while using select options

Former Member
0 Likes
1,429

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,333

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

12 REPLIES 12
Read only

Former Member
0 Likes
1,334

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

Read only

0 Likes
1,333

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

Read only

0 Likes
1,333

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

Read only

0 Likes
1,333

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

Read only

0 Likes
1,333

Hi friend

Thank u

i got the ouput one materials bom,

if i want to get from and to materials bom

Regard

ds

Read only

0 Likes
1,333

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

Read only

0 Likes
1,333

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

Read only

0 Likes
1,333

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

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,333

HI,

Use IN instead of BETWEEN and can you give us the exact error.

Regards,

Sesh

Read only

Former Member
0 Likes
1,333

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.

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,333

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

Read only

Former Member
0 Likes
1,333

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