Skip to Content
0
Jul 01, 2014 at 04:33 PM

Help with CSAP_MAT_BOM_CREATE

1416 Views

I'm desperately trying to create a simple BOM using 'CSAP_MAT_BOM_CREATE' but I'm just getting nowhere! The only thing this FM is creating is a headache. I'm hoping someone can help me!!!

At the moment, I am using:

  • call function 'CSAP_MAT_BOM_CREATE'
    exporting
    material = MATNR of BOM I want to create
    plant = Destination plant
    bom_usage = '5'
    valid_from = DATUV
    * change_no = aennr
    i_stko = ls_stko
    * fl_commit_and_wait = 'X'
    * importing
    * fl_warning = lv_warning
    * bom_no = lv_bom_no
    tables
    t_stpo = lt_stpo
    * t_stpu = lt_stpu
    exceptions
    error = 1.

...But it's always returning 1 :-(

When I'm debugging I'm always getting upto: "PERFORM mc29s_fuellen_01 USING mtl_matnr mtl_werks ini_bwkey." (LCSDIFAS - Line 88). Here's where it seems to fail. Inside this it's always trying to do a "call function 'MATERIAL_READ'" on the MATNR I want to create, but obviously it doesn't exist yet, so it always fails. It therefore sets FLG_API_ERROR = 'X' and fails everytime.

I've looked through all 157 search results on this forum, seemingly all of Google, and the documentation hasn't helped at all either :-(

Can someone please provide me with either some suggestions, or some example code (Using the actual values you're populating parameters with instead of other variable names so I can see what's going on)?

Many thanks.