Using: BAPI_MATERIAL_SAVEDATA

Hi,
i try to use the above FM like this:
REPORT ZGRO_TEST.
DATA: HEADDATA LIKE BAPIMATHEAD.
DATA: RETURN   LIKE BAPIRET2.
DATA: BEGIN OF RETURNM OCCURS 0.
        INCLUDE STRUCTURE BAPIRET2.
DATA: END   OF RETURNM.
DATA: BEGIN OF LTEXT OCCURS 0.
        INCLUDE STRUCTURE BAPI_MLTX.
DATA: END   OF LTEXT.
DATA: MATNR    LIKE MARA-MATNR VALUE '000000000000000592'.
START-OF-SELECTION.
  HEADDATA-MATERIAL   = MATNR.
  LTEXT-APPLOBJECT  = 'MATERIAL'.
  LTEXT-TEXT_NAME   = MATNR.
  LTEXT-TEXT_ID     = 'PRUE'.
  LTEXT-LANGU       = SY-LANGU.
  LTEXT-FORMAT_COL  = '*'.
  LTEXT-TEXT_LINE   = 'first  Inspection Text'.
  APPEND LTEXT.
  LTEXT-TEXT_LINE   = 'second Inspection Text'.
  APPEND LTEXT.
  LTEXT-TEXT_LINE   = 'third  Inspection Text'.
  APPEND LTEXT.
  CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
       EXPORTING
            HEADDATA         = HEADDATA
       IMPORTING
            RETURN           = RETURN
       TABLES
            MATERIALLONGTEXT = LTEXT
            RETURNMESSAGES   = RETURNM.
  BREAK-POINT.
END-OF-SELECTION.
It works (i hope) OK.
But i get some return like this:
<b>RETURN</b>
The material 592 has been created or extended
<b>RETURNM with 4 entries</b>
Trying to create: 592 ____ ____ ____ __________ ____ __ ___ ___
The material cannot be maintained since no maintainable data transferred
Trying to change: 592 ____ ____ ____ __________ ____ __ ___ ___
Material 592 changed
Question:
Can i give the FM any Information for using it
in UPDATE-Mode or is my using in this case correct??
thanks for help
Regards, Dieter

Hello Dieter
The documentation of the parameter MATERIALLONGTEXT says:
Note                                                                               
Different long texts (basic data texts, purchase order texts, internal 
    comments, sales texts, material memos) can be created for a material.  
    This requires the fields APPLOBJECT, TEXT_NAME, TEXT_ID, and LANGU or  
    LANGU_ISO in table parameter MATERIALLONGTEXT to contain entries.      
    Depending on the content of field TEXT_ID, the field TEXT_NAME must have
    the following structure:                                                                               
The material number is transferred first. If it has fewer than 18      
    characters, the remaining characters must be filled with blanks. If it 
    is a material memo (LTXT), the plant key must also be transferred from 
    character 19 onwards; in the case of a sales text (0001), this must be 
    the sales organization and distribution channel. The combinations      
    allowed for the four different fields are indicated in the following table:
Thus, I guess the problem might be the leading '0'. You should try to write the material number just as '592'.
Regards
   Uwe

Similar Messages

  • Error while creating a material using Bapi_material_savedata

    Hi,
    there is an error encountered while creating a material using BAPI_MATERIAL_SAVEDATA..
    The Error description is " Material description is not transfered " even after supplying the Material description and other mandatory field information like industrial sector, material type ,basic view indicator,Base UOM,Base UOM ISO code.
    Please let me know the solution, if you know.

    Hi,
    Please search the SCN for the answers
    https://www.sdn.sap.com/irj/scn/advancedsearch?query=errorinBAPI_MATERIAL_SAVEDATA+&cat=sdn_all

  • Problem in using BAPI_MATERIAL_SAVEDATA

    I want to extend a Material from Plant A to Plant B. I am getting the following error.
    E   MM         360 Key fields for user data PLANTDATA and checkbox structure PLANTDATAX are different
    Please correct in the following code
    data: la_headdata type BAPIMATHEAD,
    la_clientdata type BAPI_MARA,
    la_CLIENTDATAX type BAPI_MARAX,
    la_PLANTDATA type BAPI_marc,    "Plant View
    la_PLANTDATAX type bapi_marcx,  "Plant View
    la_mbew  type  bapi_mbew,    "Accounting View
    la_mbewx  type bapi_mbewx.
    *la_return type BAPIRET2.
    *to return messages
    DATA:BEGIN OF la_RETURN OCCURS 0.
            INCLUDE STRUCTURE BAPIRET2.
    DATA:END OF la_RETURN.
    data: i_materialdescription type table of BAPI_MAKT,
          wa_mat_desc like line of i_materialdescription.
    Header
    la_headdata-MATERIAL = '000001000000004000'.
    la_headdata-IND_SECTOR = 'M'.
    la_headdata-MATL_TYPE = 'ZALB'.
        la_headdata-basic_view      = 'X'.
        la_headdata-purchase_view   = 'X'.
        la_headdata-account_view    = 'X'.
        la_headdata-MRP_VIEW        = 'X'.
        la_headdata-STORAGE_VIEW    = 'X'.
        la_headdata-COST_VIEW       = 'X'.
    Client Data - Basic
    la_clientdata-BASE_UOM = 'EA'.
    la_CLIENTDATAX-BASE_UOM = 'X'.
    la_clientdata-MATL_GROUP = '21001000'.
    la_CLIENTDATAX-MATL_GROUP = 'X'.
    la_clientdata-unit_of_wt     = 'KG'.
    la_clientdatax-unit_of_wt    = 'X'.
    la_clientdata-division       = '10'.
    la_clientdatax-division      = 'X'.
    Material Description
    wa_mat_desc-langu           = 'E'.
    wa_mat_desc-MATL_DESC = '+TLA,FILTER KIT,BUNDLE B'.
    append wa_mat_desc to i_materialdescription.
    clear: wa_mat_desc.
    Plant - Purchasing
    la_PLANTDATA-plant     = '5530'.
    la_PLANTDATAX-plant     = 'X'.
    la_PLANTDATA-pur_group     = '006'.
    la_PLANTDATAX-pur_group    = 'X'.
    Accounting
    la_mbew-val_area = '5530'.
    la_mbewx-val_area = 'X'.
    la_mbew-price_ctrl = 'S'.
    la_mbewx-price_ctrl = 'X'.
    la_mbew-std_price = '0.01'.
    la_mbewx-std_price = 'X'.
    *la_mbew-price_unit = '1.000'.
    *la_mbewx-price_unit = 'X'.
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
    headdata = la_headdata
    CLIENTDATA = la_clientdata
    CLIENTDATAX = la_CLIENTDATAX
    PLANTDATA = la_PLANTDATA
    PLANTDATAX = la_PLANTDATAX
    FORECASTPARAMETERS =
    FORECASTPARAMETERSX =
    PLANNINGDATA =
    PLANNINGDATAX =
    STORAGELOCATIONDATA =
    STORAGELOCATIONDATAX =
    VALUATIONDATA = la_mbew
    VALUATIONDATAX = la_mbewx
    WAREHOUSENUMBERDATA =
    WAREHOUSENUMBERDATAX =
    SALESDATA =
    SALESDATAX =
    STORAGETYPEDATA =
    STORAGETYPEDATAX =
    FLAG_ONLINE = ' '
    FLAG_CAD_CALL = ' '
    IMPORTING
    RETURN = la_return
    TABLES
    MATERIALDESCRIPTION = i_materialdescription
    UNITSOFMEASURE =
    UNITSOFMEASUREX =
    INTERNATIONALARTNOS =
    MATERIALLONGTEXT =
    TAXCLASSIFICATIONS =
    RETURNMESSAGES =
    PRTDATA =
    PRTDATAX =
    EXTENSIONIN =
    EXTENSIONINX =
    read table la_return with key TYPE = 'S'.
      if sy-subrc = 0.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      endif.
      WRITE:/ la_RETURN-TYPE,
        2 la_RETURN-ID,
        22 la_RETURN-NUMBER,
        25 la_RETURN-MESSAGE.

    Hi,
    hope this code gives you an idea
    *& Report ZKAR_MATMAS_BAPI
    *& This program demonstrates how easy it is to create Material master
    *& data using BAPI_MATERIAL_SAVEDATA
    *& The program also generates a report post-execution displaying errors
    *& as well as successful uploads
    REPORT ZKAR_MATMAS_BAPI.
    * TABLES
    * FLAGS *
    DATA: F_STOP. " Flag used to stop processing
    * DATA DECLARATIONS *
    DATA : V_EMPTY TYPE I, " No. of empty records
    V_TOTAL TYPE I. " Total no. of records.
    * STRUCTURES & INTERNAL TABLES
    *BAPI structures
    DATA: BAPI_HEAD LIKE BAPIMATHEAD, " Header Segment with Control Information
    BAPI_MAKT LIKE BAPI_MAKT, " Material Description
    BAPI_MARA1 LIKE BAPI_MARA, " Client Data
    BAPI_MARAX LIKE BAPI_MARAX, " Checkbox Structure for BAPI_MARA
    BAPI_MARC1 LIKE BAPI_MARC, " Plant View
    BAPI_MARCX LIKE BAPI_MARCX, " Checkbox Structure for BAPI_MARC
    BAPI_MBEW1 LIKE BAPI_MBEW, " Accounting View
    BAPI_MBEWX LIKE BAPI_MBEWX, " Checkbox Structure for BAPI_MBEW
    BAPI_RETURN LIKE BAPIRET2. " Return Parameter
    *--- Internal table to hold excel file data
    DATA: IT_INTERN TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
    *--- Internal table to hold Matetrial descriptions
    DATA: BEGIN OF IT_MAKT OCCURS 100.
            INCLUDE STRUCTURE BAPI_MAKT.
    DATA: END OF IT_MAKT.
    *--- Internal to hold the records in the text file
    DATA : BEGIN OF IT_DATA OCCURS 100,
                WERKS(4), " Plant
                MTART(4), " Material type
                MATNR(18), " Material number
                MATKL(9) , " Material group
                MBRSH(1), " Industry sector
                MEINS(3), " Base unit of measure
                GEWEI(3), " Weight Unit
                SPART(2), " Division
                EKGRP(3), " Purchasing group
                VPRSV(1), " Price control indicator
                STPRS(12), " Standard price
                PEINH(3), " Price unit
                SPRAS(2), " Language key
                MAKTX(40), " Material description
                END OF IT_DATA.
    * SELECTION SCREEN. *
    SELECTION-SCREEN BEGIN OF BLOCK SCR1 WITH FRAME TITLE TEXT-111.
    PARAMETER : P_FILE TYPE RLGRAP-FILENAME OBLIGATORY DEFAULT " Input File
    'C:\Material_master.XLS'.
    PARAMETER : P_MAX(4) OBLIGATORY DEFAULT '100'. " no.of recs in a session
    PARAMETERS: P_HEADER TYPE I DEFAULT 0. " Header Lines
    PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY,
    P_BEGROW TYPE I DEFAULT 1 NO-DISPLAY,
    P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY,
    P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY.
    SELECTION-SCREEN END OF BLOCK SCR1.
    * AT SELECTION-SCREEN *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    *--- Validating file
      PERFORM VALIDATE_FILE USING P_FILE.
    * START-OF-SELECTION
    START-OF-SELECTION.
    *--- Perform to convert the Excel data into an internal table
      PERFORM CONVERT_XLS_ITAB.
      IF NOT IT_DATA[] IS INITIAL.
    *--- Perform to delete Header lines
        PERFORM DELETE_HEADER_EMPTY_RECS.
      ENDIF.
    * END OF SELECTION. *
    END-OF-SELECTION.
    *--- Perform to upload Material Master data
      PERFORM UPLOAD_MATMAS.
    * Form : validate_input_file
    * Description : To provide F4 help for file if read from PC
    FORM VALIDATE_FILE USING F_FILE TYPE RLGRAP-FILENAME.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        CHANGING
          FILE_NAME     = F_FILE
        EXCEPTIONS
          MASK_TOO_LONG = 1
          OTHERS        = 2.
      IF SY-SUBRC <> 0.
        MESSAGE S010(ZLKPL_MSGCLASS). " 'Error in getting filename'.
      ENDIF.
    ENDFORM. " validate_input_file
    *& Form CONVER_XLS_ITAB
    * text
    FORM CONVERT_XLS_ITAB.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          FILENAME    = P_FILE
          I_BEGIN_COL = P_BEGCOL
          I_BEGIN_ROW = P_BEGROW
          I_END_COL   = P_ENDCOL
          I_END_ROW   = P_ENDROW
        TABLES
          INTERN      = IT_INTERN.
      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 to move the data into an internal data
      PERFORM MOVE_DATA.
    ENDFORM. " CONVERT_XLS_ITAB
    *& Form MOVE_DATA
    * text
    FORM MOVE_DATA.
      DATA : LV_INDEX TYPE I.
      FIELD-SYMBOLS <FS>.
    *--- Sorting the internal table
      SORT IT_INTERN BY ROW COL.
      CLEAR IT_INTERN.
      LOOP AT IT_INTERN.
        MOVE IT_INTERN-COL TO LV_INDEX.
    *--- Assigning the each record to an internal table row
        ASSIGN COMPONENT LV_INDEX OF STRUCTURE IT_DATA TO <FS>.
    *--- Asigning the field value to a field symbol
        MOVE IT_INTERN-VALUE TO <FS>.
        AT END OF ROW.
          APPEND IT_DATA.
          CLEAR IT_DATA.
        ENDAT.
      ENDLOOP.
    ENDFORM. " MOVE_DATA
    *& Form DELETE_HEADER_EMPTY_RECS
    * To delete the Header and empty records
    FORM DELETE_HEADER_EMPTY_RECS.
      DATA: LV_TABIX LIKE SY-TABIX.
      IF NOT P_HEADER IS INITIAL.
        LOOP AT IT_DATA.
          IF P_HEADER > 0 AND NOT IT_DATA IS INITIAL.
            DELETE IT_DATA FROM 1 TO P_HEADER.
    * P_HEADER = 0.
            EXIT.
          ENDIF.
        ENDLOOP.
      ENDIF.
      CLEAR IT_DATA.
    *--- To delete the empty lines from internal table
      LOOP AT IT_DATA.
        LV_TABIX = SY-TABIX.
        IF IT_DATA IS INITIAL.
          V_EMPTY = V_EMPTY + 1.
          DELETE IT_DATA INDEX LV_TABIX..
        ENDIF.
      ENDLOOP.
      CLEAR IT_DATA.
    *--- Total no of recs in file
      DESCRIBE TABLE IT_DATA LINES V_TOTAL.
      IF V_TOTAL = 0.
        MESSAGE I013(ZLKPL_MSGCLASS). " No records in the file
        F_STOP = 'X'.
        STOP.
      ENDIF.
    ENDFORM. " DELETE_HEADER_EMPTY_RECS
    *& Form UPLOAD_MATMAS
    * to upload Material Master data
    FORM UPLOAD_MATMAS .
      LOOP AT IT_DATA.
    * Header
        UNPACK IT_DATA-MATNR TO IT_DATA-MATNR.
        BAPI_HEAD-MATERIAL = IT_DATA-MATNR.
        BAPI_HEAD-IND_SECTOR = IT_DATA-MBRSH.
        BAPI_HEAD-MATL_TYPE = IT_DATA-MTART.
        BAPI_HEAD-BASIC_VIEW = 'X'.
        BAPI_HEAD-PURCHASE_VIEW = 'X'.
        BAPI_HEAD-ACCOUNT_VIEW = 'X'.
    * Material Description
        REFRESH IT_MAKT.
        IT_MAKT-LANGU = IT_DATA-SPRAS.
        IT_MAKT-MATL_DESC = IT_DATA-MAKTX.
        APPEND IT_MAKT.
    * Client Data - Basic
        BAPI_MARA1-MATL_GROUP = IT_DATA-MATKL.
        BAPI_MARA1-BASE_UOM = IT_DATA-MEINS.
        BAPI_MARA1-UNIT_OF_WT = IT_DATA-GEWEI.
        BAPI_MARA1-DIVISION = IT_DATA-SPART.
        BAPI_MARAX-MATL_GROUP = 'X'.
        BAPI_MARAX-BASE_UOM = 'X'.
        BAPI_MARAX-UNIT_OF_WT = 'X'.
        BAPI_MARAX-DIVISION = 'X'.
    * Plant - Purchasing
        BAPI_MARC1-PLANT = IT_DATA-WERKS.
        BAPI_MARC1-PUR_GROUP = IT_DATA-EKGRP.
        BAPI_MARCX-PLANT = IT_DATA-WERKS.
        BAPI_MARCX-PUR_GROUP = 'X'.
    * Accounting
        BAPI_MBEW1-VAL_AREA = IT_DATA-WERKS.
        BAPI_MBEW1-PRICE_CTRL = IT_DATA-VPRSV.
        BAPI_MBEW1-STD_PRICE = IT_DATA-STPRS.
        BAPI_MBEW1-PRICE_UNIT = IT_DATA-PEINH.
        BAPI_MBEWX-VAL_AREA = IT_DATA-WERKS.
        BAPI_MBEWX-PRICE_CTRL = 'X'.
        BAPI_MBEWX-STD_PRICE = 'X'.
        BAPI_MBEWX-PRICE_UNIT = 'X'.
    *--- BAPI to create material
        CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
        EXPORTING
        HEADDATA = BAPI_HEAD
        CLIENTDATA = BAPI_MARA1
        CLIENTDATAX = BAPI_MARAX
        PLANTDATA = BAPI_MARC1
        PLANTDATAX = BAPI_MARCX
    * FORECASTPARAMETERS =
    * FORECASTPARAMETERSX =
    * PLANNINGDATA =
    * PLANNINGDATAX =
    * STORAGELOCATIONDATA =
    * STORAGELOCATIONDATAX =
    * VALUATIONDATA = BAPI_MBEW1
    * VALUATIONDATAX = BAPI_MBEWX
    * WAREHOUSENUMBERDATA =
    * WAREHOUSENUMBERDATAX =
    * SALESDATA = BAPI_MVKE1
    * SALESDATAX = BAPI_MVKEX
    * STORAGETYPEDATA =
    * STORAGETYPEDATAX =
        IMPORTING
        RETURN = BAPI_RETURN
        TABLES
        MATERIALDESCRIPTION = IT_MAKT
    * UNITSOFMEASURE =
    * UNITSOFMEASUREX =
    * INTERNATIONALARTNOS =
    * MATERIALLONGTEXT =
    * TAXCLASSIFICATIONS =
    * RETURNMESSAGES =
    * PRTDATA =
    * PRTDATAX =
    * EXTENSIONIN =
    * EXTENSIONINX =
        IF BAPI_RETURN-TYPE = 'E'.
          WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,IT_DATA-MATNR.
        ELSEIF BAPI_RETURN-TYPE = 'S'.
          WRITE: 'Successfully created material' ,IT_DATA-MATNR.
        ENDIF.
      ENDLOOP.
    ENDFORM. " UPLOAD_MATMAS
    Regards,
    V.Balaji
    Reward if Usefull...

  • How to add classification view using BAPI_MATERIAL_SAVEDATA

    Hi,
    Please any one let me know how to add classification view using BAPI_MATERIAL_SAVEDATA to the material master.
    Thanks,
    shekar

    We use this bapi on a regular basis as well as classification of materials.  We have success doing this in 2 steps.  First step is to save the material using BAPI_MATERIAL_SAVEDATA, second step is to save classification using BAPI_OBJCL_CHANGE  (this can be used for both create and change)  Also look at Function Group CLBPA .   there are several bapi's in that group dealing with object classification, including the one I mentioned..

  • Issue using BAPI_MATERIAL_SAVEDATA

    hi
    I am using BAPI_MATERIAL_SAVEDATA to create a material master record
    its a ANUB (Non Valued Material)
    i ma facing one prblem that when i am mentioning plant in
    PLANTDATA      LIKE     BAPI_MARC
    i just want to mention its plant and profit center but its asking me
    purchasing group
    mrp type
    plnd del days etc
    but when i m creating a material via MM01 its working fine without inserting all this material is getting created and i have checked in MARC table purchasing group
                             mrp type
                             plnd del days etc are blank
    so please help me on this
    thanxs in advance
    regards
    Rajan

    hi
    its solved
    in header data i nned to select only 2 views
    basic data
    STORAGE_VIEW
    and unbw is a standard one but here we have creted other mat type aunb
    thnxs for your help
    regards
    rajan

  • Create Material Master using BAPI_MATERIAL_SAVEDATA - just the basic view

    Hi,
    I want to create new material master ( just the basic view ) using BAPI_MATERIAL_SAVEDATA.
    No error found in the return parameter, but the material was not created.
    Here is my code :
    DATA : ld_headdata LIKE bapimathead,
           lt_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
           lt_return_comit LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
           lt_return_cl LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
           ld_datum(10),
           ld_uzeit(10).
    DATA: ld_matdesc LIKE bapi_makt OCCURS 0 WITH HEADER LINE,
          ld_clientdata  LIKE bapi_mara.
    Regards,
    Hary
    ld_headdata-material = 'MATERIAL-01'.
    ld_headdata-ind_sector  = 'M'.
    ld_headdata-matl_type = 'ERSA'.
    ld_headdata-basic_view = 'X'.
    ld_matdesc-matl_desc = 'TEST MATERIAL'.
    ld_matdesc-langu = sy-langu.
    APPEND ld_matdesc.
    ld_clientdata-base_uom = 'PC'.
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
      EXPORTING
        headdata                    = ld_headdata
        clientdata                  = ld_clientdata
       clientdatax                 =
      PLANTDATA                   =
      PLANTDATAX                  =
      FORECASTPARAMETERS          =
      FORECASTPARAMETERSX         =
      PLANNINGDATA                =
      PLANNINGDATAX               =
      STORAGELOCATIONDATA         =
      STORAGELOCATIONDATAX        =
      VALUATIONDATA               =
      VALUATIONDATAX              =
      WAREHOUSENUMBERDATA         =
      WAREHOUSENUMBERDATAX        =
      SALESDATA                   =
      SALESDATAX                  =
      STORAGETYPEDATA             =
      STORAGETYPEDATAX            =
      FLAG_ONLINE                 = ' '
      FLAG_CAD_CALL               = ' '
      NO_DEQUEUE                  = ' '
      NO_ROLLBACK_WORK            = ' '
    IMPORTING
       return                      = lt_return
    TABLES
       materialdescription         = ld_matdesc
      UNITSOFMEASURE              =
      UNITSOFMEASUREX             =
      INTERNATIONALARTNOS         =
      MATERIALLONGTEXT            =
      TAXCLASSIFICATIONS          =
      RETURNMESSAGES              =
      PRTDATA                     =
      PRTDATAX                    =
      EXTENSIONIN                 =
      EXTENSIONINX                =
      NFMCHARGEWEIGHTS            =
      NFMCHARGEWEIGHTSX           =
      NFMSTRUCTURALWEIGHTS        =
      NFMSTRUCTURALWEIGHTSX       =
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      WAIT          =
    IMPORTING
       return        = lt_return_comit

    hi
    Hope it will help you.
    <REMOVED BY MODERATOR>
    REPORT z34332_bdc_create_material .
    data: la_headdata type BAPIMATHEAD,
    la_clientdata type BAPI_MARA,
    la_CLIENTDATAX type BAPI_MARAX,
    la_return type BAPIRET2.
    data: i_materialdescription type table of BAPI_MAKT,
    wa_materialdescription like line of i_materialdescription.
    la_headdata-MATERIAL = '000000000000000004'.
    la_headdata-IND_SECTOR = 'M'.
    la_headdata-MATL_TYPE = 'FERT'.
    la_clientdata-BASE_UOM = 'FT3'.
    la_CLIENTDATAX-BASE_UOM = 'X'.
    la_clientdata-MATL_GROUP = '01'.
    la_CLIENTDATAX-MATL_GROUP = 'X'.
    wa_materialdescription = 'TEST'.
    append wa_materialdescription to i_materialdescription.
    clear: wa_materialdescription.
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
    headdata = la_headdata
    CLIENTDATA = la_clientdata
    CLIENTDATAX = la_CLIENTDATAX
    * PLANTDATA =
    * PLANTDATAX =
    * FORECASTPARAMETERS =
    * FORECASTPARAMETERSX =
    * PLANNINGDATA =
    * PLANNINGDATAX =
    * STORAGELOCATIONDATA =
    * STORAGELOCATIONDATAX =
    * VALUATIONDATA =
    * VALUATIONDATAX =
    * WAREHOUSENUMBERDATA =
    * WAREHOUSENUMBERDATAX =
    * SALESDATA =
    * SALESDATAX =
    * STORAGETYPEDATA =
    * STORAGETYPEDATAX =
    * FLAG_ONLINE = ' '
    * FLAG_CAD_CALL = ' '
    IMPORTING
    RETURN = la_return
    TABLES
    MATERIALDESCRIPTION = i_materialdescription
    * UNITSOFMEASURE =
    * UNITSOFMEASUREX =
    * INTERNATIONALARTNOS =
    * MATERIALLONGTEXT =
    * TAXCLASSIFICATIONS =
    * RETURNMESSAGES =
    * PRTDATA =
    * PRTDATAX =
    * EXTENSIONIN =
    * EXTENSIONINX =
    write: la_return-TYPE, ',', la_return-MESSAGE.
    clear: la_headdata, la_return, la_clientdata, la_clientdatax.
    Edited by: Alvaro Tejada Galindo on Feb 19, 2008 3:23 PM

  • Creat inspection setup entries in quality View using BAPI_MATERIAL_SAVEDAT

    Dear all,
    I am using BAPI_MATERIAL_SAVEDATA to extend Material from one plant to another.
    I am able to extend Quality view to another plant
    But unable to create inspection setup entries for the extended view.
    Please help.
    Regards,
    Gaurav sood

    Issue Resolved

  • How to use BAPI_Material_Savedata and BAPI_MATERIAL_EXISTENCECHECK

    Hello All,
    We have a requirment where in I need to make use of the  BAPI_Material_Savedata and BAPI_MATERIAL_EXISTENCECHECK, to check for the material and create material using a IBM integration tool.
    I have connected to SAP using the SAP Connector and now I need to make the BAPI calls to retrive the data as well create data.
    Please help in how to make use of the BAPI's what are all the fileds that I need to fill for the bapi to be created.
    Thanks in advance,
    Suma

    Please go through follwing
    Help on Using   BAPI_MATERIAL_SAVEDATA
    Thanks
    Abhishek
    ********Please reward points if find helpful******

  • How to create material using BAPI_material_savedata.

    hi,
    i try to create the material by using a bapi BAPI_MATERIAL_SAVEDATA , every thing i s going good material is created but only the MFRPN (manufacrurer part number ) is not updated.
    thanks in advance.

    Hi Ritesh,
    Plz check out this link;
    [Creation of BAPI using BAPI_material_savedata|https://wiki.sdn.sap.com/wiki/display/Snippets/Tutorial%2CMM01UploadusingBAPI]
    But plz check the mandatory fields to be passed to the BAPI.
    with regards,
    Mamta
    Edited by: Mamta Kumari on Aug 20, 2009 3:14 PM

  • Using BAPI_MATERIAL_SAVEDATA field SPECPROCTY in marc is not populated

    Hi all,
    I'm using BAPI_MATERIAL_SAVEDATA to create new material and I populate plantdata-SPECPROCTY with 'L1'and I populate plantdatax-SPPROCTYPE with 'X' so that the Special procurement type field in view MRP2 from MM03 will contain the value 'L1'.
    This does not work for some reason. I looked at the config of the created Spec Proc Type L1 and all looks good.
    Could someone help me out!
    Best Regards!
    Curtis

    Hi,
    For creation of MRP2 data there are few other fields which you have to fill. Ensure to pass the data into the following fields.
    wa_plantdata-plant    
    wa_plantdata-mrp_type 
    wa_plantdata-mrp_ctrler
    wa_plantdata-reorder_pt
    wa_plantdata-lotsizekey
    wa_plantdata-round_val
    wa_plantdata-sm_key        = '000'
    wa_plantdata-spproctype
    wa_plantdata-sloc_exprc
    wa_plantdata-serv_level
    I had the same issue. I was able to successfully create the data. Let me know if you need any input. Apart from this you might to use the BAPI " 'MD_MRP_LEVEL_CREATE_DATA" for creation MRP forecast. This is not required at this point of the time but just an FYI.
    Regards,
    Jagath S

  • Create material using bapi_material_savedata

    Hi.
    I'm having prob with creation of material using bapi_material_savedata. When creating new material we use internal numbering so I use first bapi_material_getintnumber'. the number from that bapi is what i used in bapi_material_savedata. However, I getting an error that says 'matnr <from bapi>does not exists', why is this so? do i need to put the commit after the bapi_material_getintnumber and before calling the bapi_material_savedata?
    Please help.
    thnx.

    hi
    good
    go through this example and use accordingly
    REPORT ZBAPIMM01 LINE-SIZE 255 NO STANDARD PAGE HEADING
                     LINE-COUNT 065(001).
    TABLES: T001L, "Storage Locations
            MARA,  "General Material Data
            MAKT,  "Material Descriptions
            MBEW,  "Material Valuation
            MARC.  "Plant Data for Material
    DATA: BAPI_HEAD   LIKE BAPIMATHEAD,
          BAPI_MAKT   LIKE BAPI_MAKT,    "Material Description
          BAPI_MARA1  LIKE BAPI_MARA,    "Client Data
          BAPI_MARAX  LIKE BAPI_MARAX,
          BAPI_MARC1  LIKE BAPI_MARC,    "Plant View
          BAPI_MARCX  LIKE BAPI_MARCX,
          BAPI_MBEW1  LIKE BAPI_MBEW,    "Accounting View
          BAPI_MBEWX  LIKE BAPI_MBEWX,
          BAPI_RETURN LIKE BAPIRET2.
    DATA: BEGIN OF INT_MAKT OCCURS 100.
            INCLUDE STRUCTURE BAPI_MAKT.
    DATA: END OF INT_MAKT.
    DATA: BEGIN OF INT_MAT OCCURS 100,
             WERKS(4),     "Plant
             MTART(4),     "Material type
             MATNR(18),    "Material number
             MATKL(9) ,    "Material group
             MBRSH(1),     "Industry sector
             MEINS(3),     "Base unit of measure
             GEWEI(3),     "Weight Unit
             SPART(2),     "Division
             EKGRP(3),     "Purchasing group
             VPRSV(1),     "Price control indicator
             STPRS(12),    "Standard price
             PEINH(3),     "Price unit
             SPRAS(2),     "Language key
             MAKTX(40),     "Material description
           END OF INT_MAT.
    SELECT-OPTIONS:
                PLANT    FOR  MARC-WERKS OBLIGATORY MEMORY ID PLT,
                MATERIAL FOR  MARA-MATNR MEMORY ID MAT,
                MATLTYPE FOR  MARA-MTART MEMORY ID MTY,
                DIVISION FOR  MARA-SPART MEMORY ID DIV.
    PARAMETERS:  F_FILE LIKE RLGRAP-FILENAME
                 DEFAULT 'C:\DATA\ZMATERIAL.XLS' MEMORY ID F_FILE,
                 GETDATA AS CHECKBOX, "Tick to download materials data to local harddisk
                 UPDDATA AS CHECKBOX. "Tick to update date to Materials Master
    IF GETDATA = 'X'.
       PERFORM DOWNLOAD_DATA.
       PERFORM DOWNLOAD_FILE.
    ENDIF.
    IF UPDDATA = 'X'.
       PERFORM UPLOAD_FILE.
       PERFORM UPDATE_MM.
    ENDIF.
    FORM DOWNLOAD_DATA.
    SELECT * FROM MARC  WHERE LVORM EQ ' '
                          AND WERKS IN PLANT
                          AND MATNR IN MATERIAL.
        CLEAR MARA.
        SELECT SINGLE * FROM MARA WHERE MATNR =  MARC-MATNR.
        CHECK MATLTYPE.
        CHECK DIVISION.
        CLEAR MBEW.
        SELECT SINGLE * FROM MBEW WHERE MATNR =  MARC-MATNR
                                    AND BWKEY =  MARC-WERKS.
        CLEAR MAKT.
        SELECT SINGLE * FROM MAKT WHERE SPRAS =  'EN'
                                    AND MATNR =  MARC-MATNR.
        WRITE:/ MARC-WERKS,    "Plant
                MARA-MTART,    "Material type
                MARA-MATNR,    "Material number
                MARA-MATKL,    "Material group
                MARA-MBRSH,    "Industry sector
                MARA-MEINS,    "Base unit of measure
                MARA-GEWEI,    "Weight Unit
                MARA-SPART,    "Division
                MARC-EKGRP,    "Purchasing group
                MBEW-VPRSV,    "Price control indicator
                MBEW-STPRS,    "Standard price
                MBEW-PEINH,    "Price unit
                MAKT-SPRAS,    "Language key
                MAKT-MAKTX.    "Material description
                INT_MAT-WERKS = MARC-WERKS.    "Plant
                INT_MAT-MTART = MARA-MTART.    "Material type
                INT_MAT-MATNR = MARA-MATNR.    "Material number
                INT_MAT-MATKL = MARA-MATKL.    "Material group
                INT_MAT-MBRSH = MARA-MBRSH.    "Industry sector
                INT_MAT-MEINS = MARA-MEINS.    "Base unit of measure
                INT_MAT-GEWEI = MARA-GEWEI.    "Weight Unit
                INT_MAT-SPART = MARA-SPART.    "Division
                INT_MAT-EKGRP = MARC-EKGRP.    "Purchasing group
                INT_MAT-VPRSV = MBEW-VPRSV.    "Price control indicator
                INT_MAT-STPRS = MBEW-STPRS.    "Standard price
                INT_MAT-PEINH = MBEW-PEINH.    "Price unit
                INT_MAT-SPRAS = MAKT-SPRAS.    "Language key
                INT_MAT-MAKTX = MAKT-MAKTX.    "Material description
                APPEND INT_MAT.
                CLEAR  INT_MAT.
    ENDSELECT.
    ENDFORM.
    FORM DOWNLOAD_FILE.
    call function 'WS_DOWNLOAD'
      EXPORTING
        FILENAME                      = F_FILE
        FILETYPE                      = 'DAT'
      FILETYPE                      = 'WK1'
      tables
        data_tab                      = INT_MAT
      EXCEPTIONS
        FILE_OPEN_ERROR               = 1
        FILE_WRITE_ERROR              = 2
        INVALID_FILESIZE              = 3
        INVALID_TYPE                  = 4
        NO_BATCH                      = 5
        UNKNOWN_ERROR                 = 6
        INVALID_TABLE_WIDTH           = 7
        GUI_REFUSE_FILETRANSFER       = 8
        CUSTOMER_ERROR                = 9
        OTHERS                        = 10.
    IF SY-SUBRC = 0.
       FORMAT COLOR COL_GROUP.
       WRITE:/ 'Data Download Successfully to your local harddisk'.
       SKIP.
    ENDIF.
    ENDFORM.
    FORM UPLOAD_FILE.
    call function 'WS_UPLOAD'
      EXPORTING
        FILENAME                      = F_FILE
        FILETYPE                      = 'DAT'
      FILETYPE                      = 'WK1'
      tables
        data_tab                      = INT_MAT
      EXCEPTIONS
        FILE_OPEN_ERROR               = 1
        FILE_WRITE_ERROR              = 2
        INVALID_FILESIZE              = 3
        INVALID_TYPE                  = 4
        NO_BATCH                      = 5
        UNKNOWN_ERROR                 = 6
        INVALID_TABLE_WIDTH           = 7
        GUI_REFUSE_FILETRANSFER       = 8
        CUSTOMER_ERROR                = 9
        OTHERS                        = 10.
    IF SY-SUBRC = 0.
       FORMAT COLOR COL_GROUP.
       WRITE:/ 'Data Upload Successfully from your local harddisk'.
       SKIP.
    ENDIF.
    ENDFORM.
    FORM UPDATE_MM.
    LOOP AT INT_MAT.
    Header
        BAPI_HEAD-MATERIAL        = INT_MAT-MATNR.
        BAPI_HEAD-IND_SECTOR      = INT_MAT-MBRSH.
        BAPI_HEAD-MATL_TYPE       = INT_MAT-MTART.
        BAPI_HEAD-BASIC_VIEW      = 'X'.
        BAPI_HEAD-PURCHASE_VIEW   = 'X'.
        BAPI_HEAD-ACCOUNT_VIEW    = 'X'.
    Material Description
        REFRESH INT_MAKT.
        INT_MAKT-LANGU           = INT_MAT-SPRAS.
        INT_MAKT-MATL_DESC       = INT_MAT-MAKTX.
        APPEND INT_MAKT.
    Client Data - Basic
        BAPI_MARA1-MATL_GROUP     = INT_MAT-MATKL.
        BAPI_MARA1-BASE_UOM       = INT_MAT-MEINS.
        BAPI_MARA1-UNIT_OF_WT     = INT_MAT-GEWEI.
        BAPI_MARA1-DIVISION       = INT_MAT-SPART.
        BAPI_MARAX-MATL_GROUP = 'X'.
        BAPI_MARAX-BASE_UOM   = 'X'.
        BAPI_MARAX-UNIT_OF_WT = 'X'.
        BAPI_MARAX-DIVISION   = 'X'.
    Plant - Purchasing
        BAPI_MARC1-PLANT      = INT_MAT-WERKS.
        BAPI_MARC1-PUR_GROUP  = INT_MAT-EKGRP.
        BAPI_MARCX-PLANT      = INT_MAT-WERKS.
        BAPI_MARCX-PUR_GROUP  = 'X'.
    Accounting
        BAPI_MBEW1-VAL_AREA   = INT_MAT-WERKS.
        BAPI_MBEW1-PRICE_CTRL = INT_MAT-VPRSV.
        BAPI_MBEW1-STD_PRICE  = INT_MAT-STPRS.
        BAPI_MBEW1-PRICE_UNIT = INT_MAT-PEINH.
        BAPI_MBEWX-VAL_AREA   = INT_MAT-WERKS.
        BAPI_MBEWX-PRICE_CTRL = 'X'.
        BAPI_MBEWX-STD_PRICE  = 'X'.
        BAPI_MBEWX-PRICE_UNIT = 'X'.
        WRITE:/ BAPI_HEAD, BAPI_MARC1.
        call function 'BAPI_MATERIAL_SAVEDATA'
          exporting
            HEADDATA                   = BAPI_HEAD
            CLIENTDATA                 = BAPI_MARA1
            CLIENTDATAX                = BAPI_MARAX
            PLANTDATA                  = BAPI_MARC1
            PLANTDATAX                 = BAPI_MARCX
          FORECASTPARAMETERS         =
          FORECASTPARAMETERSX        =
          PLANNINGDATA               =
          PLANNINGDATAX              =
          STORAGELOCATIONDATA        =
          STORAGELOCATIONDATAX       =
            VALUATIONDATA              = BAPI_MBEW1
            VALUATIONDATAX             = BAPI_MBEWX
          WAREHOUSENUMBERDATA        =
          WAREHOUSENUMBERDATAX       =
          SALESDATA                  = BAPI_MVKE1
          SALESDATAX                 = BAPI_MVKEX
          STORAGETYPEDATA            =
          STORAGETYPEDATAX           =
          IMPORTING
            RETURN                     = BAPI_RETURN
          TABLES
            MATERIALDESCRIPTION        = INT_MAKT
          UNITSOFMEASURE             =
          UNITSOFMEASUREX            =
          INTERNATIONALARTNOS        =
          MATERIALLONGTEXT           =
          TAXCLASSIFICATIONS         =
          RETURNMESSAGES             =
          PRTDATA                    =
          PRTDATAX                   =
          EXTENSIONIN                =
          EXTENSIONINX               =
    IF BAPI_RETURN-TYPE = 'E'.
       WRITE:/ 'Error Message ', BAPI_RETURN.
    ENDIF.
    ENDLOOP.
    ENDFORM.
    *---End of Program
    thanks
    mrutyun^

  • Updating mbew table using bapi_material_savedata

    Hi experts,
    when i am tring to updae valuation type using bapi_material_savedata.
    i am getting the following error
    749Required parameters missing when calling up module T001k_SINGLE_READ.
    pleae help
    thanks  in advance
    Naresh
    Edited by: naresh.k.dasari on Jan 18, 2011 10:20 AM

    Hi Naresh,
    I am facing the same problem when I try to use this BAPI to update profit centre through table MARC.
    What did you have to fill in the HEADDATA structure?
    Did you fill only the HEADDATA and the structure regarding to the data you want to update?
    Thanks in advance.
    Ricardo.

  • Report using BAPI_MATERIAL_SAVEDATA

    Hi All,
    can anyone send me the report where
    BAPI_MATERIAL_SAVEDATA is used to create the material.
    if anyone has then plz share with me.
    Thanks
    Sanjeev

    Hi All,
    can anyone send me the report where
    BAPI_MATERIAL_SAVEDATA is used to create the material.
    if anyone has then plz share with me.
    Thanks
    Sanjeev

  • How to ceate RefPlant:consumption data use BAPI_MATERIAL_SAVEDATA?

    Hi all.
    I need create material master data like via MM01.
    I call BAPI: BAPI_MATERIAL_SAVEDATA to create data.
    I could NOT found the relevant fields in parameters list for ‘RefPlant:consumption’(Reference plant for consumption) in Forecasting View.
    Is there any FM or BAPI to create this parameter?
    I check the logic in program R_TRANSACT_PROD_VERS for tcode C223, it seems that update by openSQL.
    So confused
    Thanks and Regards.
    Ryan Chen.

    Hi,
      Check the  BAPI_MATERIAL_SAVEDATA ,in the BAPI  is there a table parameter EXTENSIONIN ?
    which you can use to pass the values for user defined fields to the BAPI..
    Regards
    Kiran Sure

  • Update user defined fields in MARA using bapi_material_savedata

    Hi,
    I have this problem:
    I am creating materials from a Z table filled by another application (not SAP). I am using the bapi "bapi_material_savedata" to create the materials and it is working fine. But now I need to fill user defined fields in the MARA table from this Z table, and this fields, are not filled after using the bapi.
    I am using the bapi tables "extensionin" and "extensioninx".
    I have modified the BAPI_TE_MARA structure adding the ZZ fields of the MARA and the BAPI_TE_MARAX structure with the same fields but different data elements. So I have this structures/tables:
    BAPI_TE_MARA:
       MATERIAL - MATNR
       ZZDIM1   - ZZCHDIM1
       ZZDIM2   - ZZCHDIM2
       ZZDIM3   - ZZCHDIM3
    BAPI_TE_MARAX:
       MATERIAL - MATNR
       ZZDIM1   - BAPIUPDATE
       ZZDIM2   - BAPIUPDATE
       ZZDIM3   - BAPIUPDATE
    MARA:
    ..(standard fields of the MARA)....
       ZZDIM1   - ZZCHDIM1
       ZZDIM2   - ZZCHDIM2
       ZZDIM3   - ZZCHDIM3
    Here is the code that i'm using to update the extensionin and extensioninx tables:
    DATA x_bapi_te_mara TYPE bapi_te_mara.
      DATA x_bapi_te_marax TYPE bapi_te_marax.
      it_extensionin-structure = 'BAPI_TE_MARA'.
      it_extensioninx-structure = 'BAPI_TE_MARAX'.
    * the internal table it_material contains the data of the
    * ZZ fields
      MOVE-CORRESPONDING it_material TO x_bapi_te_mara.
      x_bapi_te_mara-material = it_material-matnr.
      x_bapi_te_marax-material = it_material-matnr.
      x_bapi_te_marax-zzdim1 = 'X'.
      x_bapi_te_marax-zzdim2 = 'X'.
      x_bapi_te_marax-zzdim3 = 'X'.
      it_extensionin-valuepart1 = x_bapi_te_mara.
      APPEND it_extensionin.
      it_extensioninx-valuepart1 = x_bapi_te_marax.
      APPEND it_extensioninx.
    Also i have an entry in the table T130F that i'm not sure i need.
    Please help me to fill this user defined fields !!
    Regards,
    Jesus

    I'm using both,
    x_bapi_te_mara-material = it_material-matnr.
    x_bapi_te_marax-material = it_material-matnr.
    The first line is from the x_bapi_te_mara structure and the second for the x_bapi_te_maraX.
    Thanks

  • Can I use "BAPI_MATERIAL_SAVEDATA"  Mass Change Material for IS Retail

    Hi,
    I have customize program to do mass material changes for IS Retail. Currenlty we are using BAPI_MATERIAL_MAINTAINDATA_RT to do the changes for each selected article and site, it could be 70k combination.
    since BAPI_MATERIAL_MAINTAINDATA_RT cannot handle more than 1 article per execution can I use standard BAPI_MATERIAL_SAVEDATA ?
    Please advise.
    thank You and Best Regards
    Fernand

    Hello,
    Both BAPI's support only one article per execution. BAPI_MATERIAL_MAINTAINDATA_RT is meant for Retail environment whereas BAPI_MATERIAL_SAVEDATA will not update table such as MAW1.  You may call the BAPI in a loop to update multiple articles.
    Thanks,
    Venu

Maybe you are looking for

  • If I gave a wrong email when I first set up my iPod touch how can I change the email so I can then activate my accout

    I really need help changing my email that I set up my iPod touch with when I first set it up. What happened was the email I put in I don't know the password to to activate the accout so I can get apps is there a way I can change it to a different ema

  • IPhone 3G will not sync to iTunes whatever I do

    iPhone 3G iTunes 10.5. Macbook Pro 15" i5 processor iOS 4.2.1 (which I believe is as far as it will go) Having real trouble syncing the entire contents of my iPhone. I can go through the whole process either via right-clicking on my iPhone in the dev

  • Report RFASLD20

    Hi guys, in FI there is the report RFASLD20  in which an option exists that data will be prepared for XI. Does somebody has ever used this option in connection with XI. I guess its a typicall german thing called "Zusammenfassende Meldung" for the bur

  • Flash Videos Stall Before Playing (image)

    For about a few weeks now, flash videos (specifically Youtube and Liveleak) have been stalling before they play. The video will be black for around 30 seconds before the video actually begins loading. Here's how it looks like: Notice how all videos o

  • Tcode for Query deletion on Infoprovider

    Hi, Do we have any tcode or table where i want to delete all the query and Workbook on an infoprovider. Thanks Puneet