CSAP_MAT_BOM_CREATE

Hi
I am using CSAP_MAT_BOM_CREATE to create BOM i passing the following values
CALL FUNCTION 'CSAP_MAT_BOM_CREATE'
      EXPORTING
        material                 =  lv_matnr
        plant                    = lv_werks
        bom_usage                = lv_stlan
        i_stko                   = wa_stko
   TABLES
        t_stpo                   = it_stpo
   EXCEPTIONS
     error                    = 1
     OTHERS                   = 2.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
To create the BOM.But I am getting error as  'data is in complete' AND i am getting sy-subrc value as 1.
Please give me inputs
Regards
Rasheed
Edited by: Rasheed salman on Mar 31, 2009 10:58 AM

Hi ,
    Please refer the code given in function module documentation . I hope it will help you to slove this problen
regards
Deepak
Edited by: Deepak Kumar on Mar 31, 2009 11:55 AM

Similar Messages

  • Program to update BOM by CSAP_MAT_BOM_CREATE as error KEY_INCOMPLETE coming

    Hi to all,
    Can any one provide me sample program to update BOM via Function Module CSAP_MAT_BOM_CREATE.
    As i already have created the program , but run time error is coming KEY_INCOMPLETE for CSAP_MAT_BOM_CREATE.
    as i have already search the SDN , but cant get any specific answer for that.
    Note: itab_bom_header and itab_bom_item_details are of same line type as
      i_stko and t_stpo  with data.     
    DATA: wa_bom_header  TYPE     zia_str_bom_header,
          wa_itab_bom_item_details TYPE zia_str_bom_item_details.
    IF  itab_bom_header[] IS  NOT INITIAL .
      READ TABLE  itab_bom_header INTO wa_bom_header INDEX 1 .
    ENDIF.
    *---- BOM header data structure
    DATA: BEGIN OF tstko OCCURS 0.
            INCLUDE STRUCTURE stko_api01.
    DATA: END OF tstko.
    DATA: wa_tstko  LIKE LINE OF tstko.
    *---- BOM items table
    DATA: BEGIN OF tstpo OCCURS 0.
            INCLUDE STRUCTURE stpo_api01.
    DATA: END OF tstpo.
    DATA: wa_tstpo LIKE LINE OF tstpo.
    **---- Object dependencies table
    Basis data
    *data: begin of tdep_data occurs 0.
    *include structure csdep_dat.
    *data: end of tdep_data.
    Description
    *data: begin of tdep_descr occurs 0.
    *include structure csdep_desc.
    *data: end of tdep_descr.
    Source
    *data: begin of tdep_source occurs 0.
    *include structure csdep_sorc.
    *data: end of tdep_source.
    Sequence
    *data: begin of tdep_order occurs 0.
    *include structure csdep_ord.
    *data: end of tdep_order.
    Documentation
    *data: begin of tdep_doc occurs 0.
    *include structure csdep_doc.
    *data: end of tdep_doc.
    CALL FUNCTION 'CALO_INIT_API'
    EXPORTING
      FLAG_DB_LOG_ON                 = 'X'
      FLAG_MSG_ON                    = 'X'
      FLAG_API_API_CALL_ON           = ' '
      FLAG_COLLECT_MSG_ON            = ' '
      EXTERNAL_LOG_NO                = 'API'
      DEL_LOG_AFTER_DAYS             = '10'
      DATA_RESET_SIGN                = '!'
    EXCEPTIONS
       LOG_OBJECT_NOT_FOUND           = 1
       LOG_SUB_OBJECT_NOT_FOUND       = 2
       OTHERS                         = 3
    LOOP AT itab_bom_header INTO wa_bom_header.
    wa_tstko-BASE_QUAN =  wa_bom_header-base_qty.
    wa_tstko-BASE_UNIT  =  wa_bom_header-BASE_UOM.
    wa_tstko-BOM_STATUS  = wa_bom_header-BOM_STATUS.
    ENDLOOP.
    LOOP AT  itab_bom_item_details INTO  wa_itab_bom_item_details.
      wa_tstpo-item_categ   = wa_itab_bom_item_details-item_category.
      wa_tstpo-item_no      = wa_itab_bom_item_details-bom_itm_number.
      wa_tstpo-component    = wa_itab_bom_item_details-component.
      wa_tstpo-comp_unit = wa_itab_bom_item_details-uom.
      wa_tstpo-comp_qty = '10'.
      wa_tstpo-valid_from   = wa_itab_bom_item_details-valid_from.
      wa_tstpo-itm_ident    =  wa_itab_bom_item_details-item_id  .
      APPEND wa_tstpo TO tstpo .
    ENDLOOP.
    FM to create BOM
    CALL FUNCTION 'CSAP_MAT_BOM_CREATE'
      EXPORTING
        material               =   wa_bom_header-material
        plant                  =   wa_bom_header-plant
        bom_usage              =   wa_bom_header-bom_usage
        VALID_FROM             =   wa_bom_header-VALID_FROM
      CHANGE_NO                =
      REVISION_LEVEL           =
      i_stko                   =    tstko  " bom header
      FL_NO_CHANGE_DOC         = ' '
      FL_COMMIT_AND_WAIT       = ' '
      FL_CAD                   = ' '
      fl_default_values        = 'X'
    IMPORTING
    fl_warning               =  fl_warning
    bom_no                   =  bom_no
    TABLES
    t_stpo                    =  tstpo   " bom item
      T_DEP_DATA               = tdep_data
      T_DEP_DESCR              = tdep_descr
      T_DEP_ORDER              = tdep_source
      T_DEP_SOURCE             = tdep_order
    T_DEP_DOC                 =  tdep_doc
      T_LTX_LINE               =
      T_STPU                   =
    EXCEPTIONS
    error                    = 1
      OTHERS                   = 2
    IF sy-subrc <> 1.
      WRITE 'error'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    IF fl_warning EQ 'X'.
      WRITE 'done'.
    ENDIF.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      WAIT          =
    IMPORTING
      RETURN        =
    please can any one provide me the solution for that.
    i shall be thankfull to you for this.
    Regards
    Pavneet Rana
    Edited by: pavneet rana on Aug 18, 2011 3:01 PM

    Thanks for reply,
    i have debug my program and found that run time error is coming at GET_MAST function module.
    but  i have already checked that     MATNR and STLNR  is already filled before reaching to that FM.
    GET_MAST
    IF NOT SET IS INITIAL.
          IF     WA-MATNR IS INITIAL
             AND WA-STLNR IS INITIAL.
             RAISE KEY_INCOMPLETE.
          ENDIF.
          IF     WA-MATNR <> SPACE
             AND WA-STLNR <> SPACE.
             RAISE KEY_INVALID.
          ENDIF.
    please can any one provide me the solution for that.
    Regards
    Pavneet Rana

  • Problem in function module 'CSAP_MAT_BOM_CREATE'

    Hi
    I am using CSAP_MAT_BOM_CREATE to create BOM i passing the following values
    CALL FUNCTION 'CSAP_MAT_BOM_CREATE'
    EXPORTING
    material = lv_matnr
    plant = lv_werks
    bom_usage = lv_stlan
    i_stko = wa_stko
    TABLES
    t_stpo = it_stpo
    EXCEPTIONS
    error = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    To create the BOM.But I am getting error as 'data is in complete' AND i am getting sy-subrc value as 1.
    Please give me inputs

    maybe you are not filling all the mandatory fields you need.
    Please, let we know how do you fill your structures, otherwise is almost impossibile help you.
    The message is clear: you are missing some mandatory (for the FM) field.

  • Create BOM , CSAP_MAT_BOM_CREATE

    Hi,
    i have some problems with the call function mentioned above.
    First let me show the code:
    *- Kopfdaten füllen
      wa_tstko-base_quan = '1'.
      wa_tstko-bom_text = text-t11.   "'Stücklistentext'.
      APPEND wa_tstko TO xt_tstko.
    hilfsfeld für Stücklistenposition
      DATA: lh_item1(4) TYPE c VALUE '0000'
          , lh_item(4) TYPE c.
      LOOP AT xt_hstb WHERE box = 'X'.
    *- Positionsdaten füllen
        ADD 10 TO lh_item1.
        SHIFT lh_item1 LEFT DELETING LEADING space.
        CONCATENATE '00' lh_item1 INTO lh_item.
        CLEAR xt_tstpo.
        wa_tstpo-item_no    = lh_item.
        wa_tstpo-item_categ = 'L'.                      "Mußeingabe
        wa_tstpo-component  = xt_hstb-n_matnr.          "Mußeingabe
        wa_tstpo-comp_qty   = xt_hstb-menge.            "Mußeingabe
        wa_tstpo-comp_unit  = xt_hstb-mmein.
        wa_tstpo-item_text1 = xt_hstb-ojtxb.
        APPEND wa_tstpo TO xt_tstpo.
      ENDLOOP.
    CALL FUNCTION 'CALO_INIT_API'.
      CALL FUNCTION 'CSAP_MAT_BOM_CREATE'
        EXPORTING
          material                 = xl_matnr
          plant                    = xp_werks
          bom_usage                = 'L'
         valid_from               = xl_datuv
      CHANGE_NO                =
      REVISION_LEVEL           =
          i_stko                   = xt_tstko
      FL_NO_CHANGE_DOC         = ' '
      FL_COMMIT_AND_WAIT       = ' '
      FL_CAD                   = ' '
      FL_DEFAULT_VALUES        = 'X'
    IMPORTING
      FL_WARNING               =  xh_flg_warning
       bom_no                   = xh_stlnr
       TABLES
         t_stpo                   = xt_tstpo
       EXCEPTIONS
         error                          = 1
         OTHERS                   = 2
    i always get following dump.
    exception: ..... KEY_INCOMPLETE....
    Does anybody have some answers for that problem?
    thx
    Thomas

    Give a example.
    this program can create bom succcess.but add stpu(subitem) ,have some problem.
    REPORT  ZPDM_CREATEBOM                          .
    DATA: i_stko  like STKO_API01.
    data: T_STPO  like table of STPO_API01 WITH HEADER LINE.
    data: T_STPU  like table of STPU_API01 WITH HEADER LINE.
    data: BOM_HEADER like BICSK.
    DATA: return TYPE char100,
          return2 TYPE char100.
    i_stko-BASE_QUAN = 1.
    T_STPO-ITEM_CATEG = 'L'.
    T_STPO-ITEM_NO = '0010'.
    T_STPO-COMPONENT = '52008022702'.
    T_STPO-COMP_QTY = '10'.
    APPEND T_STPO.
    T_STPO-ITEM_CATEG = 'L'.
    T_STPO-ITEM_NO = '0020'.
    T_STPO-COMPONENT = '52008022701'.
    T_STPO-COMP_QTY = '20'.
    APPEND T_STPO.
    T_STPU-POINTER = 20.
    T_STPU-UPOSZ = '0001'.
    T_STPU-EBORT = 'A1'.
    T_STPU-UPMNG = '10'.
    APPEND T_STPU.
    T_STPU-POINTER = 20.
    T_STPU-UPOSZ = '0002'.
    T_STPU-EBORT = 'A2'.
    T_STPU-UPMNG = '10'.
    APPEND T_STPU.*
    CALL FUNCTION 'CSAP_MAT_BOM_CREATE'
      EXPORTING
        material                 = 'FERT005'
       PLANT                    = '1000'
        bom_usage                = '1'
      VALID_FROM               =
       CHANGE_NO                = 'ECO200909096'
      REVISION_LEVEL           =
        i_stko                   = i_stko
      FL_NO_CHANGE_DOC         = ' '
      FL_COMMIT_AND_WAIT       = ' '
      FL_CAD                   = ' '
      FL_DEFAULT_VALUES        = 'X'
    IMPORTING
      FL_WARNING               =
      BOM_NO                   =
    TABLES
       T_STPO                   =   T_STPO
      T_DEP_DATA               =
      T_DEP_DESCR              =
      T_DEP_ORDER              =
      T_DEP_SOURCE             =
      T_DEP_DOC                =
      T_LTX_LINE               =
       T_STPU                   = T_STPU
    EXCEPTIONS
       ERROR                    = 1
       OTHERS                   = 2

  • About FM 'CSAP_MAT_BOM_CREATE'

    Hello Friends!!
    To create a BOM I am using a FM 'CSAP_MAT_BOM_CREATE'. Can u please tell me more about it? i mean is it safe to use it instead of BAPI ?
    Useful answers will be rewarded with points
    Thanks

    Hello,
    instead use BAPI_MATERIAL_BOM_GROUP_CREATE fm which will create a BOM for a material.
    Regards,
    Vasanth

  • CSAP_MAT_BOM_CREATE and Sales Order

    Hi,
    I need to use CSAP_MAT_BOM_CREATE in my application, since BAPI_MATERIAL_BOM_GROUP_CREATE is unavailable in version below 4.6C (if I am right). Do you know whether I can use BOM created with function CSAP_MAT_BOM_CREATE in Sales Order??
    Any usefull information will be warmly appreciated and rewarded properly (even any information about creating Sales Order, because I am completely new in this issue).
    Thanks in advance.
    Br,
    Rafal

    Hi,
    I need to use CSAP_MAT_BOM_CREATE in my application, since BAPI_MATERIAL_BOM_GROUP_CREATE is unavailable in version below 4.6C (if I am right). Do you know whether I can use BOM created with function CSAP_MAT_BOM_CREATE in Sales Order??
    Any usefull information will be warmly appreciated and rewarded properly (even any information about creating Sales Order, because I am completely new in this issue).
    Thanks in advance.
    Br,
    Rafal

  • Regarding CSAP_MAT_BOM_CREATE

    Hi
    I want to use the function CSAP_MAT_BOM_CREATE to create a material list.
    Which parameters I must to fill ?
    Thanks

    Hi,
    use this code ...i have created a FM and done the coding in it you can do the same thing or you can use this code in report aswell.
    below code creates material  bom ...but your passing parametrs will be different..but this code will definetly help you.
    rewards if useful
    DATA : T_STPO TYPE TABLE OF STPO_API01 WITH HEADER LINE.
    DATA : I_STKO LIKE STKO_API01.
    translate material to UPPER CASE.
    DATA : VAR1 TYPE CSAP_MBOM-DATUV.
    WRITE VALID_FROM TO VAR1.
    LOOP AT ET_ITEM.
    IF ET_ITEM-COMPONENT is not initial.
    SHIFT ET_ITEM-QUANTITY LEFT DELETING LEADING SPACE.
    CONDENSE ET_ITEM-QUANTITY.
    CONDENSE ET_ITEM-QUANTITY.
    translate ET_ITEM-COMPONENT to UPPER CASE.
    T_STPO-ITEM_CATEG = 'L'.
    T_STPO-ITEM_NO = ET_ITEM-ITEM.
    T_STPO-COMPONENT = ET_ITEM-COMPONENT.
    T_STPO-COMP_QTY = ET_ITEM-QUANTITY.
    T_STPO-COMP_UNIT = 'EA'.
    APPEND T_STPO.
    ENDIF.
    ENDLOOP.
    CALL FUNCTION 'CSAP_MAT_BOM_CREATE'
      EXPORTING
        MATERIAL                 = MATERIAL
        PLANT                    = PLANT
        BOM_USAGE                = BOM_USAGE
        VALID_FROM               = VAR1
    *   CHANGE_NO                =
    *   REVISION_LEVEL           =
        I_STKO                   = I_STKO
    *   FL_NO_CHANGE_DOC         = ' '
    *   FL_COMMIT_AND_WAIT       = ' '
    *   FL_CAD                   = ' '
    *   FL_DEFAULT_VALUES        = 'X'
    * IMPORTING
    *   FL_WARNING               =
    *   BOM_NO                   =
      TABLES
        T_STPO                   = T_STPO
    *   T_DEP_DATA               =
    *   T_DEP_DESCR              =
    *   T_DEP_ORDER              =
    *   T_DEP_SOURCE             =
    *   T_DEP_DOC                =
    *   T_LTX_LINE               =
    *   T_STPU                   =
    EXCEPTIONS
       ERROR                    = 1
       OTHERS                   = 2
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    IF SY-SUBRC EQ 0.
    COMMIT WORK.
    ENDIF.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
       ID              = SY-MSGID
       LANG            = '-D'
       NO              = SY-MSGNO
       V1              = SY-MSGV1
       V2              = SY-MSGV2
       V3              = SY-MSGV3
       V4              = SY-MSGV4
    IMPORTING
       MSG             = MESSAGE
    * EXCEPTIONS
    *   NOT_FOUND       = 1
    *   OTHERS          = 2
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Edited by: abhijeet udgirkar on Aug 13, 2010 12:25 PM
    Edited by: abhijeet udgirkar on Aug 13, 2010 12:30 PM
    Edited by: abhijeet udgirkar on Aug 13, 2010 12:33 PM
    Edited by: abhijeet udgirkar on Aug 13, 2010 12:37 PM

  • Tracing error from FM 'CSAP_MAT_BOM_CREATE'

    I used this FM name 'CSAP_MAT_BOM_CREATE' to create BOM. Now I want to find out the errors in partular line. I mean that if I have error in line number 5,11,17 and 25 then I want trac them and show them. How can I do that?
    Regards,
    Subhasish

    This question is closed as unanswered.

  • CSAP_MAT_BOM_CREATE  no log

    when i call function 'CSAP_MAT_BOM_CREATE',it always show exception. But it does not like other bapi function ,it does not hase params like 'bapiret2'.
    how can i get more information about the function run time error?
    please help me.
    regard.

    help please

  • CSAP_MAT_BOM_CREATE and JAVA

    Hi,
    Has anybody used CSAP_MAT_BOM_CREATE in his/her Java Application?
    or at least know CSAP_MAT_BOM_CREATE and necessary input to execute this API?
    Looking forward answers.
    BR,
    Rafal

    Hi,
    Thanks a lot. I don't have command field in my menu bar (don't know why). Anyway I've found SE37 in another way by insert transaction into my favourites.
    Do you know sth about using CSAP_MAT_BOM_CREATE directly into Java?
    I've faced many problems and solved them successfully, but I still have really strange one. I can create BOM with <b>one</b> item, but if I try to create BOM with more than one, function throws a terminating error during execution.
    I show the source code below:
    JCO.Function function;
              try {
                   function = this.createFunction("CSAP_MAT_BOM_CREATE");
              } catch (CreateFunctionException e) {
                   return e.toString();
              if (function == null) {
                   return "Error: createBom() - Function==null";
              //System.out.println(function.getImportParameterList().get);
              function.getImportParameterList().setValue("TESTBICYCLE4", "MATERIAL");
              function.getImportParameterList().setValue("1", "BOM_USAGE");
              function.getImportParameterList().setValue("03.01.2007", "VALID_FROM");
              Table tstpo=function.getTableParameterList().getTable("T_STPO");
              tstpo.appendRow();
              tstpo.setValue("0010", "ITEM_NO");
              tstpo.setValue("L", "ITEM_CATEG");
              tstpo.setValue("TESTIRON", "COMPONENT");
              tstpo.setValue("5", "COMP_QTY");
              tstpo.setValue("ST", "COMP_UNIT");
    //if i comment following lines execution is possible, otherwise not
              tstpo.appendRow();
              tstpo.setValue("0020", "ITEM_NO");
              tstpo.setValue("L", "ITEM_CATEG");
              tstpo.setValue("TESTPLASTIC", "COMPONENT");
              tstpo.setValue("15", "COMP_QTY");
              tstpo.setValue("ST", "COMP_UNIT");
    //execution
    executeBapi(function);

  • CSAP_MAT_BOM_CREATE problem via RFC because of 'strg-reset_sign'

    Hi!
    I have the following problem:
    I want to create a bom in SAP via RFC using the function CSAP_MAT_BOM_CREATE. The function fails if a component of the bom starts with 'X'!
    I have debugged the function CSAP_MAT_BOM_CREATE and found that there is a flag strg-reset_sign which contains an 'X' and every value of each component which starts with the same value ('X') is deleted. So all values (for example IDNRK) starting with 'X' are cleared and so I get the message "data incomplete..."
    The code doing this is:
    hlp_tabfld1 = <tabfld1>.
    check not <tabfld1> is initial.
    if strg-reset_sign is initial or
    hlp_tabfld1 ne strg-reset_sign.
    THIS CODE INSIDE THE IF IS NOT EXECUTED IF hlp_tabfld1 CONTAINS AN 'X'. hlp_tabfld1 CONTAINS THE FIRST VALUE OF EACH FIELD OF A BOM-COMPONENT IN A LOOP.
    The flag 'strg-reset_sign' is not set to 'X' when I try it inside the SAPGui with SE37!
    Is this a customizing issue or where does the flag come from???
    Thanks,
    Konrad

    Thanks for reply,
    i have debug my program and found that run time error is coming at GET_MAST function module.
    but  i have already checked that     MATNR and STLNR  is already filled before reaching to that FM.
    GET_MAST
    IF NOT SET IS INITIAL.
          IF     WA-MATNR IS INITIAL
             AND WA-STLNR IS INITIAL.
             RAISE KEY_INCOMPLETE.
          ENDIF.
          IF     WA-MATNR <> SPACE
             AND WA-STLNR <> SPACE.
             RAISE KEY_INVALID.
          ENDIF.
    please can any one provide me the solution for that.
    Regards
    Pavneet Rana

  • Help with CSAP_MAT_BOM_CREATE

    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.

    Hi,
    As Jarek mentined , pls check the material existency and then convert the material in to internal format , moreover pls check the mandatory parameters .
    CALL FUNCTION 'CSAP_MAT_BOM_CREATE'
             EXPORTING
               material           = material "2000000001
               plant              = plant "1001
               bom_usage          = '05'
               valid_from         = valid_from 'Date
               i_stko             = ls_stko     "Structure of header
    *         FL_NO_CHANGE_DOC   = ' '
    *         FL_COMMIT_AND_WAIT = ' '
    *         FL_CAD             = ' '
               fl_default_values  = ' '
             IMPORTING
               fl_warning         = fl_warning
               bom_no             = bom_no
             TABLES
               t_stpo             = lt_stpo[]
    *         T_DEP_DATA         =
    *         T_DEP_DESCR        =
    *         T_DEP_ORDER        =
    *         T_DEP_SOURCE       =
    *         T_DEP_DOC          =
    *         T_LTX_LINE         =
    *         T_STPU             =
             EXCEPTIONS
               error              = 1
               OTHERS             = 2.
           IF sy-subrc <> 0.
    *        MESSAGE ID     SY-MSGID
    *                TYPE   SY-MSGTY
    *                NUMBER SY-MSGNO
    *                WITH   SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    why can't you use the below function module :
    * call function to create bill fo materail by using
    * the previously declared local internal tables
    DATA :  lit_bomgroup  TYPE STANDARD TABLE OF bapi1080_bgr_c,
                       wa_bomgroup   TYPE bapi1080_bgr_c,
                       lv_bom_text   TYPE string,
                       lv_plant      TYPE ztbom_header-werks,
                        lit_variants TYPE STANDARD TABLE OF bapi1080_bom_c,
                        wa_variants  TYPE bapi1080_bom_c,
                        lit_items    TYPE STANDARD TABLE OF bapi1080_itm_c,
                        wa_items     TYPE bapi1080_itm_c,
                        lit_matrel   TYPE STANDARD TABLE OF bapi1080_mbm_c,
                        wa_matrel    TYPE bapi1080_mbm_c,
                        lit_itemas   TYPE STANDARD TABLE OF bapi1080_rel_itm_bom_c,
                        wa_itemas    TYPE bapi1080_rel_itm_bom_c.
                wa_bomgroup-bom_group_identification = 'BAPI_SMP_COL1'.
                 wa_bomgroup-object_type = 'BGR'.
                 wa_bomgroup-object_id   = 'SIMPLE1'.
                 wa_bomgroup-bom_usage   = wa_bom_h-stlan.
                 wa_bomgroup-created_in_plant = wa_bom_h-werks.
                 wa_bomgroup-ltxt_lang      = sy-langu.
                 wa_bomgroup-technical_type = ' '.
                 wa_bomgroup-bom_text       = lv_bom_text.
                 APPEND wa_bomgroup TO lit_bomgroup.
    *-->Check BOM Existency
    *-->Convert Material
            wa_bom_h-datuv = sy-datum.
             wa_bom_h-stlst = '01'.
    *-->Convert UOM
    *--Get Alt BOM based on Material and Plantand pass the next Alt BOM which we have to create
    *-->Variants
                wa_variants-bom_group_identification = 'BAPI_SMP_COL1'.
                 wa_variants-object_type              = 'BOM'.
                 wa_variants-object_id                = 'SIMPLE1'.
                 wa_variants-alternative_bom          = wa_bom_h-stlal.
                 wa_variants-bom_status               = wa_bom_h-stlst.
                 wa_variants-base_qty                 = wa_bom_h-bmeng.
                 wa_variants-base_unit                = wa_bom_h-bmein. " base unit
                 wa_variants-alt_text                 = wa_bom_h-alternate_text.   " alternative text
                 wa_variants-valid_from_date          = wa_bom_h-datuv.
                 wa_variants-function = 'NEW'.
                 APPEND wa_variants TO lit_variants.
    CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
                   EXPORTING
                     input          = wa_bom_h-bmein
                   IMPORTING
                     output         = wa_bom_h-bmein
                   EXCEPTIONS
                     unit_not_found = 1
                     OTHERS         = 2.
    *--> Pass Items
                 SORT lit_items BY object_id valid_from_date.
                 CALL FUNCTION 'BAPI_MATERIAL_BOM_GROUP_CREATE'
                   EXPORTING
                     all_error         = 'X'
                   TABLES
                     bomgroup          = lit_bomgroup
                     variants          = lit_variants
                     items             = lit_items
                     materialrelations = lit_matrel
                     itemassignments   = lit_itemas
                     return            = e_return.
                 CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

  • CSAP_MAT_BOM_CREATE\CSAP_MAT_BOM_MAINTAIN

    SAPiens,
    We are using the above mentioned RFMs to pass material bill of materials data in to SAP from an external system. These RFMs are not providing meaningful errors upon data failure. For example, if we pass a Change Order number which is not existing in SAP, these RFMs simply says, Error, thats all. In our scenario, we have choosen CSAP_MAT_BOM_MAINTAIN since we have to send delta BOM changes (only changes, not the complete BOM).
    Please suggest is there any way to derive meaningful error log by using any other function module in conjunction with CSAP_MAT_BOM_MAINTAIN. OR is there any other RFM which carries only BOM changes and  at the same time give some meaningful errors?
    Thanks so much in Advance
    Aman

    Aman,
    Try BAPI mentioned in attached link. There is a sample code too.
    http://sap.ittoolbox.com/code/archives.asp?d=2270&a=s
    ashish

  • Problem in creating a bapi for bom

    hai all,
    i am trying to create a bapi for bom using csap_mat_bom_create, but it am getting sy-subrc value as 1.
    and displaying error message as the function module name itself.
    is there any solution dor it.

    Hello,
    Try to use that bapi :
    BAPI_MATERIAL_BOM_GROUP_CREATE
    Thierry

  • Error while creating BOM with FM CSAP_MAT_BOM_MAINTAIN

    Hi All,
    While creating the bom with the FM "CSAP_MAT_BOM_MAINTAIN" using change number i am getting the below error message.
    " Processing of this object is not supported with change number."
    Please help me out.
    Regards
    Suresh

    call function 'CSAP_MAT_BOM_MAINTAIN'
      exporting
        material                 = material
        plant                    = plant
        bom_usage                = usage
        alternative              = alternat
        valid_from               = y_date
    *   CHANGE_NO                =                   "<----Have u used this field for creating ?
    *   REVISION_LEVEL           =
        i_stko                   = l_stko
    *   FL_NO_CHANGE_DOC         = ' '
        fl_commit_and_wait       = 'X'
        fl_bom_create            = 'X'
        fl_new_item              = ' '
        fl_complete              = ' '
    * IMPORTING
    *   FL_WARNING               =
    *   O_STKO                   =
    CSAP_MAT_BOM_CREATE would be an ideal one for creation and CSAP_MAT_BOM_MAINTAIN for change
    Regards,
    Mithun Shetty.

Maybe you are looking for

  • How do I download xcode4 from the app store?

    It failed a few times during the download but when I restarted it it started again from where it left off. This was good. However the last time it failed it changed something as when I retry it now it starts from scratch. It took me about 3 days to a

  • Itunes wont download songs from other countries

    i would like to download songs from different countries but says "itunes could not connect to the music store an unknown error occured (-3237)" so if can help me please do.

  • Organize Bookmarks is gone from my Bookmarks section on toolbar. How do I get it back?

    I had to reload my Mac operating system recently. After that I downloaded Firefox 4.0. It doesn't have under the Bookmarks section "Organize Bookmarks" any more in the drop down. How do I get it back?

  • Will Essbase alone can be install/configure in 11.1.2.2 or 11.1.2.1?

    Hi All, We have system 9 project for one of my client, only essbase native mode using for security, we dont have any shared services configured. Only Essbase & EAS installed and security assignment only for essbase without HSS. Now we need to migrate

  • An error occurred installing iOS 6

    While updating from iOS 5 to iOS 6 on my iPhone 4S, my friend interrupted the updating process by mistake, later, when I attempted to update again, I get the message "Unable to Install Update, An error occurred installing iOS 6", asks CLOSE and SETTI