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

Similar Messages

  • Create BOM for material

    Hi All,
    I am using CSAP_MAT_BOM_READ to read the BOM details of one material and using these detals i am creating BOM for other material. I am using CSAP_MAT_BOM_CREATE to create the BOM, But always it is returing
    sy-subrc as 1.
      I am not able to find out what kind of error this is, is this data error or any other error.
    If anyone used this FM before please provide some input on how to use this FM for above requirement.
    Regards,
    Rahul

    instead use BAPI_MATERIAL_BOM_GROUP_CREATE fm which will create a BOM for a material.

  • FM/BAPI to create BOM where alternative can be passed as input

    Hi
    My requirement is to create BOM  of a material where I need to input 'Alternative BOM' also like ijn CS01 t-code.
    I got one FM CSAP_MAT_BOM_CREATE which is creating BOM , but it does not take 'Alternative BOM' as input parameter, rather it creates default alternative BOM. But I need a FM which will take alternative BOM as input.
    Please help.

    Dear Avishek,
    In my understanding the system creates the first alternative BOM 01 for a BOM usage,whenever you
    create through CS01 or by a functional module,no need of any input for this field.
    come back with your queries,if you are facing some problem on this.
    Regards
    Mangalraj.S

  • How to create BOM(Bill Of Material) item data from flat file?

    I have two flat files one is BOM(Bill Of Material) header data and BOM item data. BOM header is already created, now I want to create BOM item data with reference to the header data. Is there any standard direct batch input method in LSMW or Is there any standard BAPI or Is there any standard BDC report program to do the task? CS01 is the TCode to create BOM.

    Hi,
    The DI program works for create step CS01 and not for CS02.
    Perhaps this ( adding items in header by Tx: CS02 ) could be achieved by a Recording step in LSMW.
    Best Regards, Murugesh

  • Error while creating BOM using BAPI 'BAPI_BOM_UPLOAD_SAVE'

    Hi All,
    We are getting an error as 'Data is incomplete' while trying to create BoM using the bapi 'BAPI_BOM_UPLOAD_SAVE', if the item contains Item category as 'T'. But for other item category like 'L' or 'N', the bapi is sucessfull.
    The values that we pass to fill the item category 'T' are operation, item_cat, bom_itm_no, COMPON_QTY, FIXED_QTY as 'X', UNMEAS as 'ST', ITEM_TEXT1 and ITEM_TEXT2.
    Anyone who has faced same problem or has a solution to the problem, kindly provide a solution.
    Regards,
    Vijay

    The error you receive is because of different config for different Item Categories. Find out from the functional team what fields have they kept mandatory for the item category 'T'. You may not be passing one of those fields in the BAPI.
    Try creating a BOM manually for item category 'T' and you may figure our which field you are missing.

  • Can not create BOM

    Hi All,
    While creating BOM through CS01 i am getting the following error in the first screen only -
    ' BOM can only be extended via master recipe'.
    Thnx in advance.

    hi,
    BOM is created through Master receipe . So error message is displayed "BOM can only be extended
    via master recipe". You can change this error message to warning message.
    In process industry (PP-PI),BOM is maintained in Master receipe along with resource . New BOM no.
    is maintained along with new production version with receipe group and counter.
    In the change mode option of master reecipe ( T-code :c202), u will find that current status of
    BOM and accordingly u will assign alternate BOM no. the material.
    In this new BOM will be created for the material.
    I think it will resolve your problem. If any further query pl revert.
    Regards
    Vinod

  • Problem in creating BOM

    Hi,
    While creating a material BOM, I assigned item category as L (Stock Item) for one of the component as this component is a raw material and it is externally procured. But while saving this BOM, I am getting one error message "material type ROH cannot be used with item category L (plant xxxx)". If I change this item category to N (Non stock item) as suggested by Performance Assistant, BOM is getting created without any problem.
    Can anyone please suggest a solution for this problem for not able to create BOM with item category L?
    Thanks in  advance for your help.
    Regards,
    Sudhakar

    Sudhakar,
    In the Material Type defination we maintain whether that material type is valuated by Quantity and Value for a Valuation area(Plant). In your case for ROH material Valuation in not maintained for Plant XXXX.
    Use Customizing transaction OMS4, in the list select ROH material type and then hit Quantity/Value updating folder. Here for the plant XXXX activate check box for Quantity updating and Value updating. Once this is done try adding the same component to BOM with item category "L".
    Regards,
    Prasobh

  • PROBLEM IN CREATING BOM ITEM TEXT FROM TEXT FILE

    Hi All,
    I am developing interface program for creating BOM based on data it text file. in my text file contain three column(material, qty and longtext). These text i need to upload to BOM TCODE CS01). Using SAVE_TEXT I have generated text object. it don't says any error. But while viewing text in CS03, text is not visible. Give me suggestion or give me any other method for updating item text from textfile.
    Thanks in advance.
    Regards.
    Peranandam.

    Hi Carl,
    Actually problem is SAVE_TEXT updates text but I cant able to view in CSO3 transaction. because while creating BOM I forget for updating language key for long text. After updating language key I can able to view text in CS03.
    Now I am facing another problem. If I am executing program directly without going to debug mode, It is not updates text. Logic everything is correct. Give me some suggestions for solving this issue. I am also tried with commit work, Commit_text and wait up n seconds statement.
    Regards,
    Peranandam

  • Need a solution to create BOM which will work for all Component category

    Hi All,
    I want to create BOM.
    I am using LSMW (std batch input program RCSBI010).
    After execution I came to know that it will not work for if Item category (STPO-POSTP) = 'D' (Document).
    Can Anyone tell me Is there any way to create Material BOm which will work for all kinds of component(Item)Category.
    Below are the diffnt types of Item Category:
    ICt Item category text         
    A   Alloy Item                 
    D   Document item              
    I   PM structure element       
    K   Class item                 
    L   Stock item                 
    M   Phantom material           
    N   Non-stock item             
    R   Variable-size item         
    T   Text item                  
    X   Coded, Non-Stock Item

    Dear Amit,
    1.Is the production BOM containing all these item categories?
    2.It seems there are some additonal item categories apart from standard item categories(A Alloy Item ,M Phantom material ,
    X Coded, Non-Stock Item) for which you have to identify for which fields the value will be populated.
    3.In my understanding it's possible through a BDC recording through T.code SHDB and befor this activity discuss the same with
    your ABAP consultant as it involves some text items too.
    check and revert back.
    Regards
    Mangalraj.S

  • BAPI'S or Function Modules for creating BOM

    Hi all,
    Can any one please suggest me what is the exact function module or BAPI for creating BOM..
    If any created the same through bapi's or FM your sample codes are also welcome..
    Thanks and Regards,
    Keny

    BAPI_DOCUMENT_CREATE2 and BAPI_MATERIAL_BOM_GROUP_CREATE
    chk them

  • LSMW Batch Input Recording for Create BOM

    Dear All,
    I want to do LSMW for Creating BOM using Batch Input Recording,
    I know that i have to make 2 time Recording, first for the BOM Header and second for the BOM item
    For the BOM header i have done it, but for the BOM item i got some trouble with the item number (POSNR),
    when i run the LSMW, for the first item (item 0010) was success, but for the item 0020, it can't work and i got error
    message " NO BATCH INPUT FOR SAPLCSDI 0150"
    How is the recording step by step for BOM Item so the Item number can increase well?
    Very need your help,
    Regards,
    Marufat

    Hello Santosh,
    Thanks for the reply,
    I already check in SM35 where i also thought that the main problem is about adding the new item number,
    but when i tried to do repeat recording, i can not find any entry for adding the line item, so the line item after 0010 cannot be input
    Is there any solution?
    Regards,
    Marufat

  • Valuation type while creating BOM

    Hello Experts,
    My requirement is that, I should be able to select valuation type of material in BOM. Please let me know, if there any setting where I can enter valuation type, while creating BOM.
    We have two valuation types for my raw material - Local and Import. When we execute standard cost estimate, system picks up value appearing in material master (without valuation type). This value is average of both the valuation types. So we want that system should pick up valuation type, mentioned in BOM.
    =
    Deepak

    Hello Deepak,
    In go to CS01/CS02 select the line item and go to item overview and in that in the customer fields tab you can maintain the valuation type.
    If customer field not available then with help of the user exit ''PCSD0002'' you add the customer filed in item.
    It's not standard process, you have to do the development
    I hope this information helpful to you,
    Regards
    Umesh Mali

  • Create BOM with item category L

    Hi,
    I am facing an issue while going to create BOM with item category L.
    System shows material type can not be used with item category L for that particular plant.
    Please help...
    Thanks,
    Rampreet Jaiswal
    Edited by: Csaba Szommer on Jan 11, 2012 12:21 PM

    Hi,
    Its also maintained * for header material.
    Guys we have already checked OS14 and OS24 at first. but it is allowed for header and item.
    regards,
    Solomon

  • Error in change number creating BOM in Engineering Type.

    Can anyone guys help me with my problem.
    I'm creating Bom using BAPI_MATERIAL_BOM_GROUP_CREATE.
    Every time I create BOM Using one bom only in engineering and all BOM for materials were created.
    But every time i create rerun the program and have different change number on its components, the error occur,
    "Generation not Supported for Change number"
    Can anyone help me with this?
    Thanks and God Bless.

    In case errors rollback.... I beleive the following logic would resolve your issue.
    constants:c_error_type(1) type c value 'E'.
    call function 'BAPI_MATERIAL_BOM_GROUP_CREATE'
        exporting
          testrun                  = l_testmode
        tables
          bomgroup                 = l_bomgroup
          variants                 = l_variants
          items                    = l_items
          subitems                 = l_subitems
          materialrelations        = l_materialrelations
          itemassignments          = l_itemassignments
          subitemassignments       = l_subitemassignments
          return                   = l_return.
      if l_testmode is initial.
        read table l_return with key type = c_error_type.
        if sy-subrc = 0.
          call function 'BAPI_TRANSACTION_ROLLBACK'.
        else.
          call function 'BAPI_TRANSACTION_COMMIT'.
         endif.
    Thanks
    Anantha

  • Sample code creating BOM for CS01 using BDC recording.

    Hi,
    Can anyone give me sample coding creating BOM for CS01 using BDC recording.
    I want to display the flat file records,under one (Alternative BOM).
    I m already working on it,but i m getting one A.BOM for each records.
    [       Header data          ]    [      Item Data               ]
    SOFTDRINKS   WIND   1       13            1     ml     l
    SOFTDRINKS   WIND   1       11            1     ml     l
    SOFTDRINKS   WIND   1       15        1     ml     l
    SOFTDRINKS   WIND   1       14       1     ml     l
    Code:
    report ZBOM
           no standard page heading line-size 255.
    *include bdcrecx1.
    *DATA: BEGIN OF bdc OCCURS 0,
          matnr(18),
          werks(4),
          stlan(1),
         END OF BDC.
    *DATA: BEGIN OF BDC1 OCCURS 0,
          idnrk(18),
          MENGE(18),
          MEINS(3),
          postp(1),
          posnr(4),
         END OF bdc1.
    DATA: BEGIN OF BDCDATA OCCURS 0,
             matnr(18),
             werks(4),
             stlan(1),
             idnrk(18),
             MENGE(18),
             MEINS(3),
             postp(1),
             posnr(4),
          END OF BDCDATA.
    data  ibdcdata type standard table of bdcdata WITH  header line.
    *start-of-selection.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'C:\Documents and Settings\dilipkumar.b\Desktop\soft.txt'
       FILETYPE                       = 'ASC'
       HAS_FIELD_SEPARATOR            = ','
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                     =
      HEADER                         =
      TABLES
        DATA_TAB                      = BDCDATA
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *perform open_group.
    loop at bdcdata.
    perform bdc_dynpro      using 'SAPLCSDI' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29N-STLAN'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RC29N-MATNR'
                                  'SOFTDRINKS'.
    perform bdc_field       using 'RC29N-WERKS'
                                  'WIND'.
    perform bdc_field       using 'RC29N-STLAN'
                                  '1'.
    perform bdc_field       using 'RC29N-DATUV'
                                  '16.09.2008'.
    perform bdc_dynpro      using 'SAPLCSDI' '0110'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RC29K-BMENG'
                                  '1'.
    perform bdc_field       using 'RC29K-STLST'
                                  '1'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-EXSTL'.
    perform bdc_dynpro      using 'SAPLCSDI' '0111'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-LABOR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLCSDI' '0140'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POSTP(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=FCBU'.
    perform bdc_field       using 'RC29P-IDNRK(001)'
                                  BDCDATA-IDNRK.
    perform bdc_field       using 'RC29P-MENGE(001)'
                                  BDCDATA-MENGE.
    perform bdc_field       using 'RC29P-MEINS(001)'
                                  BDCDATA-MEINS.
    perform bdc_field       using 'RC29P-POSTP(001)'
                                  BDCDATA-POSTP.
    perform bdc_dynpro      using 'SAPLCSDI' '0130'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POSNR'.
    perform bdc_field       using 'RC29P-POSNR'
                                   BDCDATA-POSNR.            "'0010'.
    perform bdc_field       using 'RC29P-IDNRK'
                                  BDCDATA-IDNRK.             "'15'.
    perform bdc_field       using 'RC29P-MENGE'
                                  BDCDATA-MENGE.             "'1'.
    perform bdc_field       using 'RC29P-MEINS'
                                  BDCDATA-MEINS.             "'ml'.
    perform bdc_dynpro      using 'SAPLCSDI' '0131'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POTX1'.
    perform bdc_field       using 'RC29P-SANKA'
                                  'X'.
    *perform bdc_transaction using 'CS01'.
    *perform close_group.
    CALL TRANSACTION 'CS01' USING IBDCDATA MODE 'A' UPDATE 'S'.
    REFRESH IBDCDATA.
    clear ibdcdata.
    endloop.
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR iBDCDATA.
      iBDCDATA-PROGRAM  = PROGRAM.
      iBDCDATA-DYNPRO   = DYNPRO.
      iBDCDATA-DYNBEGIN = 'X'.
      APPEND ibDCDATA .
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
    IF FVAL <> NODATA.
        CLEAR iBDCDATA.
        iBDCDATA-FNAM = FNAM.
        iBDCDATA-FVAL = FVAL.
        APPEND iBDCDATA .
    ENDIF.
    ENDFORM.

    Hi,
          I tried with the sample code but i m not getting the required result.
        Can anyone give some other soln.
    Code:
    REPORT  ZBOM2
    no standard page heading line-size 255.
    *include bdcrecx1.
    TYPES: BEGIN OF TY_FLAT,      " structure for flat file
            STRING(200),
           END OF TY_FLAT.
    TYPES: BEGIN OF TY_HEAD,     " structure for header file
            IND(2) TYPE N,
            MATNR(18),
            WERKS(4),
            STLAN(1),
           END OF TY_HEAD.
    TYPES : BEGIN OF TY_ITEM,    "structure for item file
              IND(2) TYPE N,
              POSTP(1),
              IDNRK(18),
              MENGE(13),
              meins(3),
            END OF TY_ITEM.
    TYPES :BEGIN OF TY_FLAT1,   " structure for final file
             MATNR(18),
             WERKS(4),
             STLAN(1),
             posnr(4),
             POSTP(1),
             IDNRK(18),
             MENGE(13),
             meins(3),
           END OF TY_FLAT1.
    INTERNAL TABLE DECLERATIONS:
    DATA : T_FLAT TYPE STANDARD TABLE OF TY_FLAT,
           T_FLAT1 TYPE STANDARD TABLE OF TY_FLAT1,
           T_HEAD TYPE STANDARD TABLE OF TY_HEAD,
           T_ITEM TYPE STANDARD TABLE OF TY_ITEM,
           T_BDCDATA TYPE STANDARD TABLE OF BDCDATA with header line ,
           T_BDCMSG TYPE STANDARD TABLE OF BDCMSGCOLL.
    WORK AREA DECLERATIONS:
    DATA : ST_FLAT TYPE TY_FLAT,
           ST_FLAT1 TYPE TY_FLAT1,
           ST_HEAD TYPE TY_HEAD,
           ST_ITEM TYPE TY_ITEM,
           ST_BDCDATA TYPE BDCDATA,
           ST_BDCMSG TYPE BDCMSGCOLL.
    VARIABLES:
    DATA : FNAM TYPE LOCALFILE,           "rlgrap-filename,
           FTYP TYPE RLGRAP-FILETYPE,
           LF_FNAM TYPE STRING.
    DATA : V_IND(2) TYPE N,                " value 1,
           V_FLD(20),
           V_NO(2) TYPE N.
    *start-of-selection.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'C:\Documents and Settings\dilipkumar.b\Desktop\soft.txt'
       FILETYPE                       = 'ASC'
       HAS_FIELD_SEPARATOR            = ','
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                     =
      HEADER                         =
      TABLES
        DATA_TAB                      = T_FLAT
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT T_FLAT INTO ST_FLAT.
    SPLIT ST_FLAT AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
    INTO ST_FLAT1-MATNR ST_FLAT1-WERKS
    ST_FLAT1-STLAN ST_FLAT1-POSTP
    ST_FLAT1-IDNRK ST_FLAT1-MENGE ST_FLAT1-MEINS.
    APPEND ST_FLAT1 TO T_FLAT1.
    CLEAR ST_FLAT1.
    ENDLOOP.
    SORT T_FLAT1 BY MATNR WERKS STLAN POSTP IDNRK MENGE MEINS.
    LOOP AT T_FLAT1 INTO ST_FLAT1.
    MOVE :
    ST_FLAT1-MATNR TO ST_HEAD-MATNR,
    ST_FLAT1-WERKS TO ST_HEAD-WERKS,
    ST_FLAT1-STLAN TO ST_HEAD-STLAN,
    ST_FLAT1-POSTP TO ST_ITEM-POSTP,
    ST_FLAT1-IDNRK TO ST_ITEM-IDNRK,
    ST_FLAT1-MENGE TO ST_ITEM-MENGE,
    ST_FLAT1-MENGE TO ST_ITEM-MEINS.
    AT new STLAN.
      ADD 1 TO V_IND.
    ENDAT.
    MOVE V_IND TO ST_HEAD-IND.
    MOVE V_IND TO ST_ITEM-IND.
    APPEND ST_HEAD TO T_HEAD.
    APPEND ST_ITEM TO T_ITEM.
    CLEAR ST_HEAD.
    CLEAR ST_ITEM.
    ENDLOOP.
    CLEAR V_IND.
    *perform open_group.
    SORT T_ITEM BY IND.
    SORT T_HEAD BY IND.
    DELETE ADJACENT DUPLICATES FROM T_HEAD.
    LOOP AT T_HEAD INTO ST_HEAD.
    perform bdc_dynpro      using 'SAPLCSDI' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29N-STLAN'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RC29N-MATNR'
                                  ST_HEAD-MATNR.
    perform bdc_field       using 'RC29N-WERKS'
                                  ST_HEAD-WERKS.
    perform bdc_field       using 'RC29N-STLAN'
                                  ST_HEAD-STLAN.
    perform bdc_field       using 'RC29N-DATUV'
                                  '16.09.2008'.
    perform bdc_dynpro      using 'SAPLCSDI' '0110'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RC29K-BMENG'
                                  '1'.
    perform bdc_field       using 'RC29K-STLST'
                                  '1'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-EXSTL'.
    perform bdc_dynpro      using 'SAPLCSDI' '0111'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-LABOR'.
    LOOP AT T_ITEM INTO ST_ITEM WHERE IND = ST_HEAD-IND.
    ADD 1 TO V_NO.
    perform bdc_dynpro      using 'SAPLCSDI' '0140'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-MENGE(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=FCBU'.
    perform bdc_dynpro      using 'SAPLCSDI' '0140'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POSNR(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=FCBU'.
    perform bdc_field       using 'RC29P-IDNRK(01)'
                                  ST_ITEM-IDNRK.
    perform bdc_field       using 'RC29P-MENGE(01)'
                                  ST_ITEM-MENGE.
    perform bdc_field       using 'RC29P-MEINS(01)'
                                  ST_ITEM-MEINS.
    perform bdc_field       using 'RC29P-POSTP(01)'
                                  ST_ITEM-POSTP.
    CONCATENATE 'RC29K-IDNRK(' V_NO ')' INTO V_FLD.
    CONDENSE V_FLD.
    PERFORM BDC_FIELD USING V_FLD
    ST_ITEM-IDNRK.
    CONCATENATE 'RC29K-MENGE(' V_NO ')' INTO V_FLD.
    CONDENSE V_FLD.
    PERFORM BDC_FIELD USING V_FLD
    ST_ITEM-MENGE.
    CONCATENATE 'RC29K-MEINS(' V_NO ')' INTO V_FLD.
    CONDENSE V_FLD.
    PERFORM BDC_FIELD USING V_FLD
    ST_ITEM-MEINS.
    CONCATENATE 'RC29K-POSTP(' V_NO ')' INTO V_FLD.
    CONDENSE V_FLD.
    PERFORM BDC_FIELD USING V_FLD
    ST_ITEM-POSTP.
    V_NO = 1.
    ENDLOOP.
    CLEAR V_NO.
    *perform bdc_dynpro      using 'SAPLCSDI' '0130'.
    *perform bdc_field       using 'BDC_OKCODE'
                                 '/00'.
    *perform bdc_field       using 'BDC_CURSOR'
                                 'RC29P-POSNR'.
    *perform bdc_field       using 'RC29P-POSNR'
                                  POSNR.
    *perform bdc_field       using 'RC29P-IDNRK'
                                 bdcdata-IDNRK.
    *perform bdc_field       using 'RC29P-MENGE'
                                 bdcdata-MENGE.
    *perform bdc_field       using 'RC29P-MEINS'
                                 bdcdata-MEINS.
    perform bdc_dynpro      using 'SAPLCSDI' '0131'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POTX1'.
    perform bdc_field       using 'RC29P-SANKA'
                                     'X'.
    perform bdc_dynpro      using 'SAPLCSDI' '0133'.
    perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-matkl'.
    perform bdc_field       using 'RC29P-SANKA'
                                     'zv01'.
    perform bdc_dynpro      using 'SAPLCSDI' '0140'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29N-POSNR(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=FCBU'.
    *perform bdc_transaction using 'CS01'.
    perform close_group.
    CALL TRANSACTION 'CS01' USING t_bdcdata MODE 'A' UPDATE 'S'.
    REFRESH t_bdcdata.
    clear t_bdcdata.
    endloop.
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR st_bdcdata.
      st_bdcdata-PROGRAM  = PROGRAM.
      st_bdcdata-DYNPRO   = DYNPRO.
      st_bdcdata-DYNBEGIN = 'X'.
      APPEND st_bdcdata to t_bdcdata .
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
    IF FVAL <> NODATA.
        CLEAR st_bdcdata.
        st_bdcdata-FNAM = FNAM.
        st_bdcdata-FVAL = FVAL.
        APPEND st_bdcdata to t_bdcdata.
    ENDIF.
    ENDFORM.

Maybe you are looking for

  • Recent Failure with Shuffle ... Solution

    So I tried everything I could to get my Shuffle to work. It stopped working all of a sudden 2 days ago and I have since uninstalled all my software and tried to update the thing multiple times using the new updater and the old updater. The solution t

  • Continue motion tracking

    I did motion tracking and have a target layer attached to the motion tracking and it the target is masked. It is working great. I corrected some of the keyframes in the motion tracking and really fine tuned it. Now, I would like to continue the same

  • Dynamic SQL for creating report in portal

    Has anyone had to create report in Portal using dynamic sql. That is you build up the query commands depending on the parameters entered by the user. E.g the columns displayed will be what the users has selected in the parameter form. Urgent reply pl

  • Where do I find the demo songs?

    Where in Garageband do I find the several Gigabytes of demo songs I installed? I wanted to listen to any royalty free built in songs and see if they would work for an advertising project, (1-3 min. commercials). I can find the Chinese Text Editor, bu

  • Does Numbers support Excel functions CELL, SUBSTITUTE, and REDIRECT?

    Been trying to find the list of Excel-compatible functions but did not succeed. I would like to use Numbers to edit my Excel files in iPad. I often generate reports by pulling data out from a seperate sheet using Excel functions like CELL, SUBSTITUTE