Application Development 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: 

CS01

former_member188724
Contributor
0 Kudos

Hi Friends,

I want to copy a BOM material to another plant.

I am using FM CS_BOM_EXPL_MAT_V2, then use the

CSAP_MAT_BOM_READ for source plant,

CSAP_MAT_BOM_CREATE to create bom in target plant.

I am getting sy-subrc as 1 in the FM CSAP_MAT_BOM_CREATE. I am not sure why it is as I am passing the parametzers correctly I suppose.

Step 1 Use FM CS_BOM_EXPL_MAT_V2.

step 2: Loop at STB.

step 3: Inside the loop call FM CSAP_MAT_BOM_READ.

Step 4;

call function 'CALO_INIT_API'

exceptions

log_object_not_found = 1

log_sub_object_not_found = 2

other_error = 3

others = 4.

CALL FUNCTION 'CSAP_MAT_BOM_CREATE'

EXPORTING

material = lv_matnr

PLANT = lv_werks

bom_usage = '3'

VALID_FROM = lv_date

i_stko = i_stko1

IMPORTING

FL_WARNING = api_warning

BOM_NO = v_bom_no

TABLES

T_STPO = i_stpoi

EXCEPTIONS

ERROR = 1

OTHERS = 2 .

I get sy-subrc as 1.

Please correct me if I am wrong in my assumption.

Regards,

K.S

1 ACCEPTED SOLUTION

former_member195402
Active Contributor
0 Kudos

Hi,

there may be many reasons for this.

Didi you check the existence of all BOM componentes in the target plant. If you have checked this, maybe some other STPO_API01 data are not valid in the target plant (look at VENDOR, PURCH_GRP, PURCH_ORG, ...)

Regards,

Klaus

2 REPLIES 2

former_member195402
Active Contributor
0 Kudos

Hi,

there may be many reasons for this.

Didi you check the existence of all BOM componentes in the target plant. If you have checked this, maybe some other STPO_API01 data are not valid in the target plant (look at VENDOR, PURCH_GRP, PURCH_ORG, ...)

Regards,

Klaus

Former Member
0 Kudos

Hi,

Please check the error message after executing the FM 'CSAP_MAT_BOM_CREATE'. For sy-subrc eq 1, there can be lot of errors. So check the standard structure which hold the error messages for the exact error message.

Thanks & Regards,

Harish