Dynamically Using BAPI_MATERIAL_SAVEDATA

Greetings all,
I am trying to utilize BAPI_MATERIAL_SAVEDATA. This BAPI updates the material master. However I have a problem. I have an input file that holds the material number, the actual fieldname being updated, and the applicable data for that field (weird setup yes I know). The way this BAPI is setup,  it seems like the importing parameter structures are all for specific material master tables (MARA, MARD, MARC, etc.).  Within each of these importing parameters there are all the fields of each table, however they are named something different than the field itself, however the data element is the same (this can be seen by looking at the types of the import parameters).
My question is this: is it possible to take the input file specified above, and successfully use this BAPI? I will be updating both custom fields and standard SAP fields on the material master. However, these fields will NOT always be in MARA, so I must somehow tell the program 'depending on what field is coming in on each record of the input file, move the data to the appropriate import parameter structure on the BAPI (if it is a standard field, otherwise use the extension area of course under the TABLES section of the BAPI).
I would think a case statement checking for if the field exists in each table down the list on the BAPI import parameters since they correspond to the material master tables. However, I think there has got to be a better way to do this.
Im sure this isnt enough info for an answer but it is a start. Any ideas! Please Help!

Hi
Hope it will help you.
Pls reward if help.
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.
Pls reward if help.

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

  • How to include Forward button dynamically using code?

    hello,
    i am creating my notification message dynamically using clob type document type attribute , and its working fine. But how i include the Forword Button in my message body.
    please advice

    i am allready doing that only, in that what will be the name of the button.
    can i put like this.
    htp.p( '<input type="button" name="forward">');
    then what about the event, shall i have to write the code for forward also.
    please advice.

  • Dynamic USING clause in execute immediate

    Hi All,
    Is it possible to build a dynamic using clause in execute immediate command.
    EXECUTE IMMEDIATE <dynamic query> USING <dynamic clause>;
    Rgrds,
    Nitin.

    Hi,
    The problem is I have a query in which in some scenarios I want just one column in where clause, in other scenario I need 2 columns in the where clause.
    So I would have to write 2 different queries.
    execute immediate 'SELECT 1 FROM DUAL WHERE 1 = :bind1' into a using 1;
    execute immediate 'SELECT 1 FROM DUAL WHERE 1 = :bind1 AND 2 = :bind2' into a using 1, 2;
    Is there any way I can achieve this in a single query like:
    dynamic_using_str varchar2(100);
    dynamic_using_str := '1';
    execute immediate 'SELECT 1 FROM DUAL WHERE 1 = :bind1' into a using dynamic_using_str;
    dynamic_using_str := '1, 2';
    execute immediate 'SELECT 1 FROM DUAL WHERE 1 = :bind1 AND 2 = :bind2' into a using dynamic_using_str;
    ~Nitin.
    Edited by: user13060845 on Apr 30, 2010 12:29 PM

  • Want to send information in Header dynamically using HTTP adapter using post method

    Hi ,
    I have a requirement to send below information in http Adapter header dynamically using post method. which will be authenticated by third party system.
    Authorization : WSSE realm="SDP", profile="UsernameToken", type="AppKey" X-WSSE : UsernameToken Username="XXXX", PasswordDigest="Qd0QnQn0eaAHpOiuk/0QhV+Bzdc=", Nonce="eUZZZXpSczFycXJCNVhCWU1mS3ZScldOYg==", Created="2013-09-05T02:12:21Z"
    I have followed below link to create UDF
    http://scn.sap.com/thread/3241568
    As if now my third party system is not available while sending request I am getting 504 gateway error. is there any approach I can validate my request is working fine?
    Regards,

    Hi Abhay,
    Correct me if I'm wrong but I think WSSE requires a SOAP Envelope. If that is the case, there are two approaches: the first one is to use SOAP Axis and the second one is just to build SOAP Envelope via Java mapping.
    You also need to test it successfully externally, capture the request and replicate it in XI.
    Hope this helps,
    Mark

  • 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******

  • Dynamic Use of web dynpro component

    Hi,
    How can I dynamically use the web dynpro component for display in one component with out using Wdb Dynpro Interface component?
    I want to give user a dash board which is configurable by the user.
    Thanks and regards,
    Pradip

    >
    Pradip R[https://cw.sdn.sap.com/cw/docs/DOC-37733
    > Hi Bhaskar,
    > My components are not in used componenty. In runtime user will search the component in server and shall embedd in my application. So component usage is also dynamic.
    > Any suggestion?
    > Regards,
    > Pradip
    Hi,
    see the link here
    [https://cw.sdn.sap.com/cw/docs/DOC-37733|https://cw.sdn.sap.com/cw/docs/DOC-37733].
    as advised, you create a usage group for dynamic components, add component usages to the group based on your conditions.

  • Can a transaction be called in background dynamically using ABAP program??

    Hi Experts,
    Can a transaction be called in background dynamically using ABAP program without BDC???
    Regards,
    Mansi.

    u can create job dynamically through programming..Try this sample code..
    data: jobname like tbtcjob-jobname value
                                 ' TRANSFER TRANSLATION'.
    data: jobcount like tbtcjob-jobcount,
          host like msxxlist-host.
    data: begin of starttime.
            include structure tbtcstrt.
    data: end of starttime.
    data: starttimeimmediate like btch0000-char1.
    Job open
      call function 'JOB_OPEN'
           exporting
                delanfrep        = ' '
                jobgroup         = ' '
                jobname          = jobname
                sdlstrtdt        = sy-datum
                sdlstrttm        = sy-uzeit
           importing
                jobcount         = jobcount
           exceptions
                cant_create_job  = 01
                invalid_job_data = 02
                jobname_missing  = 03.
      if sy-subrc ne 0.
                                           "error processing
      endif.
    Insert process into job
    SUBMIT zreport and return               << Here it is a static call but u can make it dynamic
                    with p_param1 = 'value'
                    with p_param2 = 'value'
                    user sy-uname
                    via job jobname
                    number jobcount.
      if sy-subrc > 0.
                                           "error processing
      endif.
    Close job
      starttime-sdlstrtdt = sy-datum + 1.
      starttime-sdlstrttm = '220000'.
      call function 'JOB_CLOSE'
           exporting
                event_id             = starttime-eventid
                event_param          = starttime-eventparm
                event_periodic       = starttime-periodic
                jobcount             = jobcount
                jobname              = jobname
                laststrtdt           = starttime-laststrtdt
                laststrttm           = starttime-laststrttm
                prddays              = 1
                prdhours             = 0
                prdmins              = 0
                prdmonths            = 0
                prdweeks             = 0
                sdlstrtdt            = starttime-sdlstrtdt
                sdlstrttm            = starttime-sdlstrttm
                strtimmed            = starttimeimmediate
                targetsystem         = host
           exceptions
                cant_start_immediate = 01
                invalid_startdate    = 02
                jobname_missing      = 03
                job_close_failed     = 04
                job_nosteps          = 05
                job_notex            = 06
                lock_failed          = 07
                others               = 99.
      if sy-subrc eq 0.
                                           "error processing
      endif.
    Regards,
    JOy.

  • Problem in creating program dynamically using FM 'rss_template_instantiate'

    hi everyone,
    i need to create the program dynamically using FM 'RSS_TEMPLATE_INSTANTIATE'.
    if we create the program using this function module can we see the generated code.
    very urgent!!!!!
    thanks in advance.
    regards,
    bharat.

    hi everyone,
    i need to create the program dynamically using FM 'RSS_TEMPLATE_INSTANTIATE'.
    if we create the program using this function module can we see the generated code.
    very urgent!!!!!
    thanks in advance.
    regards,
    bharat.

  • Possible to generate graphics dynamically using ABAP?

    Hello friends,
    It is possible to generate graphics dynamically using ABAP as programming language? In the same line like SVG (Scalable Vector Graphics) or ChartDirector?
    Output of this abap program should be a picture.
    Daniel

    Hi Daniel,
    Have a look at URL
    http://help.sap.com/saphelp_nw04/helpdata/en/0c/5c55a8d0a611d2963100a0c9308b1f/content.htm
    Also have a look at SGRB Package/deveoplment class.
    Thanks
    Lakshman
    Message was edited by: Lakshman Tandra

Maybe you are looking for