Probelm in creation of material using BAPI

Hi All,
Is it possible to create a material without passing a material number to the BAPI
(BAPIMATHEAD-MATERIAL)?
I am encountaring a problem that 'Enter the Material Number'.
I dont want to enter material number.  The system should generate an internal material number.
How can i solve this issue...
will be rewarded with points....
Thanks in advance
Kishore

Hi,
first you need to check if your materialtype is customized for internal number
and then you can work with an btch-program
or MM17
regards
Nicole
Edited by: Nicole Lorenz on Mar 20, 2008 3:01 AM

Similar Messages

  • Creation of material using BAPI in LSMW without using material no.

    Hi SAP Gurus,
    I have a requirement of creating materials using the BAPI in LSMW.
    I tried to create a material using the BAPI (Business Object - BUS1001006 , and method - SAVEDATA) which should be created internally, but it is asking the material number to be given externally and my configuration is setup to create the material number internally.
    Even I looked into the material type which is associated with the number range and everything looks good.
    Is there any solution to create the material by using BAPI in LSMW without passing the material no. externally ?
    Appreciate your help.
    Kalikonda.

    Hi,
    it looks like it's not possible to call this BAPI wihtout material number. Here is a quote from BAPI documentation.
    When creating material master data, you must transfer the material
    number, the material type, and the industry sector to the method. You
    must also enter a material description and its language.
    Cheers

  • Creation of Material using BDC Session method & global class

    Hi
    Creation of Material using BDC Session method & global class by using oops.
    can anyone plz help me out

    Hi,
    it looks like it's not possible to call this BAPI wihtout material number. Here is a quote from BAPI documentation.
    When creating material master data, you must transfer the material
    number, the material type, and the industry sector to the method. You
    must also enter a material description and its language.
    Cheers

  • Create material using bapi ' bapi_material_savedata'

    Hi Experts,
    i was tring to create material using bapi ' bapi_material_savedata' but the material is not updating in the table.
    please find the code and suggest me if any modification
    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 = int_matnum-MATERIAL.
    *LOOP AT int_matnum.
    la_headdata-MATERIAL = int_matnum-MATERIAL.
    write : int_matnum-material.
    *ENDLOOP.
    la_headdata-MATERIAL = '100000518'."int_matnum-MATERIAL.
    la_headdata-IND_SECTOR = p_indsr.
    la_headdata-MATL_TYPE = p_matype.
    la_clientdata-BASE_UOM = 'FT3'.
    la_clientdata-pur_valkey = ' '.
    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 =
    Please Help me
    Regards,
    Naresh

    Hi all,
    Now it is asking me for the other fields,
    E ,
    The field MARA-XCHPF/BAPI_MARA-BATCH_MGMT is defined as a required field; it does not contain an entry
    i have passed this val as
    la_clientdata-batch_mgmt = 'X'.
    even though i am getting the same error.
    can you help me to solve the issue.
    Tthanks
    Naresh
    Edited by: naresh.k.dasari on Jan 4, 2011 10:36 AM

  • Creating Material Using BAPI

    Hi Friends,
    I want to create a material using BAPI, can anyone give me some sample program or can any one give me links which earlier posted this problem.
    Points for sure for sample program.
    thanks and regards
    Vijaya

    hi
    good
    go through this REPORT z_bapi_salesorder_create.
    Parameters
    Sales document type
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text FOR FIELD p_auart.
    PARAMETERS: p_auart TYPE auart OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Sales organization
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text1 FOR FIELD p_vkorg.
    PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Distribution channel
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text2 FOR FIELD p_vtweg.
    PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Division.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text3 FOR FIELD p_spart.
    PARAMETERS: p_spart TYPE spart OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SKIP 1.
    Sold-to
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text4 FOR FIELD p_sold.
    PARAMETERS: p_sold  TYPE kunnr OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Ship-to
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text5 FOR FIELD p_ship.
    PARAMETERS: p_ship  TYPE kunnr OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SKIP 1.
    Material
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text6 FOR FIELD p_matnr.
    PARAMETERS: p_matnr TYPE matnr   OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Quantity.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text7 FOR FIELD p_menge.
    PARAMETERS: p_menge TYPE kwmeng  OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Plant
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text9 FOR FIELD p_plant.
    PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Data declarations.
    DATA: v_vbeln            LIKE vbak-vbeln.
    DATA: header             LIKE bapisdhead1.
    DATA: headerx            LIKE bapisdhead1x.
    DATA: item               LIKE bapisditem  OCCURS 0 WITH HEADER LINE.
    DATA: itemx              LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
    DATA: partner            LIKE bapipartnr  OCCURS 0 WITH HEADER LINE.
    DATA: return             LIKE bapiret2    OCCURS 0 WITH HEADER LINE.
    DATA: lt_schedules_inx   TYPE STANDARD TABLE OF bapischdlx
                             WITH HEADER LINE.
    DATA: lt_schedules_in    TYPE STANDARD TABLE OF bapischdl
                             WITH HEADER LINE.
    Initialization.
    INITIALIZATION.
    v_text   = 'Order type'.
    v_text1  = 'Sales Org'.
    v_text2  = 'Distribution channel'.
    v_text3  = 'Division'.
    v_text4  = 'Sold-to'.
    v_text5  = 'Ship-to'.
    v_text6  = 'Material'.
    v_text7  = 'Quantity'.
    v_text9  = 'Plant'.
    Start-of-selection.
    START-OF-SELECTION.
    Header data
    Sales document type
      header-doc_type = p_auart.
      headerx-doc_type = 'X'.
    Sales organization
      header-sales_org = p_vkorg.
      headerx-sales_org = 'X'.
    Distribution channel
      header-distr_chan  = p_vtweg.
      headerx-distr_chan = 'X'.
    Division
      header-division = p_spart.
      headerx-division = 'X'.
      headerx-updateflag = 'I'.
    Partner data
    Sold to
      partner-partn_role = 'AG'.
      partner-partn_numb = p_sold.
      APPEND partner.
    Ship to
      partner-partn_role = 'WE'.
      partner-partn_numb = p_ship.
      APPEND partner.
    ITEM DATA
      itemx-updateflag = 'I'.
    Line item number.
      item-itm_number = '000010'.
      itemx-itm_number = 'X'.
    Material
      item-material = p_matnr.
      itemx-material = 'X'.
    Plant
      item-plant    = p_plant.
      itemx-plant   = 'X'.
    Quantity
      item-target_qty = p_menge.
      itemx-target_qty = 'X'.
      APPEND item.
      APPEND itemx.
      Fill schedule lines
      lt_schedules_in-itm_number = '000010'.
      lt_schedules_in-sched_line = '0001'.
      lt_schedules_in-req_qty    = p_menge.
      APPEND lt_schedules_in.
      Fill schedule line flags
      lt_schedules_inx-itm_number  = '000010'.
      lt_schedules_inx-sched_line  = '0001'.
      lt_schedules_inx-updateflag  = 'X'.
      lt_schedules_inx-req_qty     = 'X'.
      APPEND lt_schedules_inx.
    Call the BAPI to create the sales order.
      CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
           EXPORTING
                sales_header_in     = header
                sales_header_inx    = headerx
           IMPORTING
                salesdocument_ex    = v_vbeln
           TABLES
                return              = return
                sales_items_in      = item
                sales_items_inx     = itemx
                sales_schedules_in  = lt_schedules_in
                sales_schedules_inx = lt_schedules_inx
                sales_partners      = partner.
    Check the return table.
      LOOP AT return WHERE type = 'E' OR type = 'A'.
        EXIT.
      ENDLOOP.
      IF sy-subrc = 0.
        WRITE: / 'Error in creating document'.
      ELSE.
    Commit the work.
        COMMIT WORK AND WAIT.
        WRITE: / 'Document ', v_vbeln, ' created'.
      ENDIF.
    thanks
    mrutyun^

  • Posting an accounting document with material using BAPI (ver 4.6c)

    Hello!
    Can anyone help me out with this one please?
    I need to post an accounting document using BAPI.  Since the customer's SAP is 4.6c, the BAPI I found closest is BAPI_ACC_GL_POSTING_POST.
    The posting has 2 specific requirements:
    1.  For the Vendor item, the tax needs to be calculated; and
    2.  For the G/L items, the corresponding material/quantity needs to be entered
    So, my questions are:
    1.  How do you enable the "Calculate Tax" option, which is the Calculate Tax checkbox in F-02?
    2.  How do you enter the material and quantity for the G/L items?
    Thanks a lot!

    Hi,
    Before posting your document please check first whether this is reversal or not.
    please use BAPI_ACC_DOCUMENT_REV_CHECK to check reversal document
    Have a Nice Day,
    Regards,
    Sujeet

  • How to create material using BAPI  Methods?

    hi,
    how to create material master dat using BAPI?
    could u guide me
    i will be waiting for reply.
    REGARDS
    ESWAR.

    Hi eswar,
    Try this code to create gods mmovement...
    DATA: GOODSMVT_HEADER LIKE BAPI2017_GM_HEAD_01,
          " Material Document Header Data
          GOODSMVT_CODE LIKE BAPI2017_GM_CODE,
          " Assign code to transaction for BAPI goods movement
          MATERIALDOCUMENT LIKE BAPI2017_GM_HEAD_RET-MAT_DOC,
          " Number of Material Document
          GOODSMVT_ITEM LIKE BAPI2017_GM_ITEM_CREATE OCCURS 0 WITH HEADER
          LINE,
          " Create Material Document Item
          RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE
          " Return table for messages
    *Fill values in header
    GOODSMVT_HEADER-PSTNG_DATE = '20030825'.
    GOODSMVT_HEADER-DOC_DATE = '20030802'.
    *Fill GOODSMVT_CODE
    GOODSMVT_CODE-GM_CODE = '05' .
    *Fill Item Table
    GOODSMVT_ITEM-MATERIAL = '100-100'.
    GOODSMVT_ITEM-PLANT = '1000'.
    GOODSMVT_ITEM-STGE_LOC = '0001'.
    GOODSMVT_ITEM-MOVE_TYPE = '501'.
    GOODSMVT_ITEM-ENTRY_QNT = '50'.
    GOODSMVT_ITEM-ITEM_TEXT = 'Test Sanket'.
    *GOODSMVT_ITEM-COSTCENTER = '1000'.
    APPEND GOODSMVT_ITEM.
    *Create Good's movement
    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
      EXPORTING
        GOODSMVT_HEADER  = GOODSMVT_HEADER
        GOODSMVT_CODE    = GOODSMVT_CODE
      IMPORTING
        MATERIALDOCUMENT = MATERIALDOCUMENT
      TABLES
        GOODSMVT_ITEM    = GOODSMVT_ITEM
        RETURN           = RETURN.
    *Commit BAPI
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        WAIT = 'X'.
    *Display Goods movement number
    FORMAT COLOR 6 INVERSE ON.
    READ TABLE RETURN WITH KEY TYPE = 'E'.
    IF SY-SUBRC = 0.
      WRITE: /,'ERROR! Goods movement not created'.
    ELSE.
      WRITE: /,'Goods movent number',MATERIALDOCUMENT COLOR 5,
               'posted for material',GOODSMVT_ITEM-MATERIAL.
    ENDIF.
    FORMAT COLOR OFF INVERSE OFF.
    try this on report program and create a goods movement.
    Sanket.

  • Sales order for variant material using BAPI "BAPI_SALESORDER_CREATEFROMDAT2

    Hi,
    I am using BAPI "BAPI_SALESORDER_CREATEFROMDAT2" for creating salesorder for variant configuration material. I am able to create a salesorder when have only one variant material, However when i have more than one variant material getting errors. Can some one tell me how to fill the material data in the config tables provided in the BAPI.
    Thanks.

    Hai Vinit
    Check the following Code & also Check the following Standard Programs
    L2032U12
    LCRMAU01
    LCRMAU11
    LZOC1U01
    MWWMJF32
    RBUS2032
    Structures for order header
    DATA: l_order_header_in    LIKE bapisdhd1,
          l_order_header_inx   LIKE bapisdhd1x,
    Tables for order items
          li_order_items_in    TYPE STANDARD TABLE OF bapisditm,
          li_order_items_inx   TYPE STANDARD TABLE OF bapisditmx,
    Order partners
          li_order_partners    TYPE STANDARD TABLE OF bapiparnr,
    *Schedule lines
          li_ORDER_SCHEDULES_IN  TYPE STANDARD TABLE OF BAPISCHDL,
          li_ORDER_SCHEDULES_INX  TYPE STANDARD TABLE OF BAPISCHDLX,
    *-condition type
          li_ORDER_CONDITIONS_IN   TYPE  STANDARD TABLE OF BAPICOND,
          li_ORDER_CONDITIONS_INX   TYPE  STANDARD TABLE OF BAPICONDX,
    Return table from bapi call
          li_return TYPE STANDARD TABLE OF bapiret2,
    Sales document number
          l_vbeln LIKE bapivbeln-vbeln,
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
    EXPORTING
    order_header_in  = l_order_header_in
    order_header_inx = l_order_header_inx
               testrun          = 'X'
    IMPORTING
    salesdocument    = l_vbeln
    TABLES
    return           = li_return
    order_items_in   = li_order_items_in
    order_items_inx  = li_order_items_inx
    order_partners   = li_order_partners
    ORDER_SCHEDULES_IN = li_ORDER_SCHEDULES_IN
    ORDER_SCHEDULES_INX = li_ORDER_SCHEDULES_INX
    ORDER_CONDITIONS_IN = li_ORDER_CONDITIONS_IN
    ORDER_CONDITIONS_INX = li_ORDER_CONDITIONS_INX.
    Thanks & Regards
    Sreenivasulu P

  • Creation of PO using BAPI from SRM

    Hi all,
          When PR is transfered to SRM from ERP,When i try to create PO in ERP using BAPI,i am getting a error message.SRM also uses the same BAPI to
    replicate PO In ERP,but then we dont get any error message. According to my understanding in both cases , EPROFILE has values,and it will call the fm
    BBP_EPROFILE_LOCAL_PROCESS.Can any one plz clarify this.
    Thanks,
    Tess

    Hi,
    I have use the BAPI as per given note ref.  I am taking the PO price from Info record for this I am not giving the item price in the BAPI items,  but I want that  the header discount should from the user input,  but when I ma giving the header discount codnition  system is giving error   PO header fault,   but along with this  If i given the items value to in the net price then it is creating the PO,  so is it possible to get the items value from the info record and header codnition discount value from user input, we dont want to maintain discount at info record.
    regards,
    zafar

  • Creation with Reference using BAPIs

    We're looking into creating an order with reference to a quotation or a return order with reference to an order or invoice.
    According to OSS note 370988 you can only achieve this using a workaround. We're in the process of testing it, so we were wondering whether anybody else out there already has experience with it.
    Specifically:
    - are there any issues in the document flow (based on our testing so far no) ?
    - are there issues with regards to pricing ?
    - do the final documents look as if created using VA01 ?
    Are there other approaches ? E.g. how does the SAP web shop do it ?
    Thanks
    Adrian

    HI Adrian Zehnder,
    1) If you want create order with reference to quotation like ex quotation document type is ymea then create quotation using standard bapi 2) By using bapi get the details of the quotation and pass that data to BAPI_SALESORDER_CREATEFROMDAT2 fill the fields ref_doc, ref_doc_it, and ref_doc_ca  3) There i s no issue with pricing everything will copy.4) It will like created in va01.Post if you need more help in this.
    Regards,
    Madhu.

  • Updating a child of a BOM material using bapi sales order change

    Hi, Appreciate your thoughts on the following issue..
    We have a batch program which uses a bapi sales order change and updates the plant at the line items of the sales order. when this plant is assigned.. if any of the line item is a BOM item, it explodes and the data from the parent ( like payment terms, fixed val date ) should get copied to the child items same as the parent. This is happening fine if manual mode using va01 and va02 but when plant is updated using bapi the childs are not getting the data from the parent ( which comes through config )...
    Appreciate your inputs and any additional information to be passed to the bapi for the BOM materials to get the same config data as parent to the child when exploded...
    Thanks and will reward helpful answers..

    Hi, Appreciate your thoughts on the following issue..
    We have a batch program which uses a bapi sales order change and updates the plant at the line items of the sales order. when this plant is assigned.. if any of the line item is a BOM item, it explodes and the data from the parent ( like payment terms, fixed val date ) should get copied to the child items same as the parent. This is happening fine if manual mode using va01 and va02 but when plant is updated using bapi the childs are not getting the data from the parent ( which comes through config )...
    Appreciate your inputs and any additional information to be passed to the bapi for the BOM materials to get the same config data as parent to the child when exploded...
    Thanks and will reward helpful answers..

  • Deleting material using BAPI

    Hi Guys,
    I'm trying to delete a material, using BAPI_MATERIAL_SAVEDATA. The inputs i gave are the material number(Under Headdata Structure) and the Deletion Flag field as "X" (under ClientData structure). I'm also commiting the transaction..
    But my material in SAP doesn't show a deletion flag to be set.
    The doubt i have is, am i missing someother important field to do this??
    Pls help me on this guys
    Thanks
    Varun

    The field MANUF_PROF was mandatory

  • Creation of material with BAPI

    hi SAP folks,
    Iam a beginner in ABAP.need some clarifications on BAPI
    1. what is BAPI?how is that used for creation of materials.
    2. In what way that is different from BDCs.
    3. Which is mostly preferred and why?
    4. How are BAPIs called from Zprograms.
    5.  Required complete tutorials on BAPI.
    Thanks in advance
    BALA

    See the example code for BAPI :
    *& Report  Z8_BAPI
    REPORT  Z8_BAPI.
                   STRUCTURE  DECLARATIONS                             *
    TABLES: BAPIMATHEAD,  "Headerdata
            BAPI_MARA,    "Clientdata
            BAPI_MARAX,   "Clientdatax
            BAPI_MARC,    "Plantdata
            BAPI_MARCX,   "Plantdatax
            BAPI_MAKT,    "Material description
            BAPIRET2.     "Return messages
    DATA:V_FILE TYPE STRING.
    DATA:
      BEGIN OF LSMW_MATERIAL_MASTER,
        MATNR(018) TYPE C,  "Material number
        MTART(004) TYPE C,  "Material type
        MBRSH(001) TYPE C,  "Industry sector
        WERKS(004) TYPE C,  "Plant
        MAKTX(040) TYPE C,  "Material description
        DISMM(002) TYPE C,  "Extra Field Added In the Program as itsrequired
        MEINS(003) TYPE C,  "Base unit of measure
        MATKL(009) TYPE C,  "Material group
        SPART(002) TYPE C,  "Division
        LABOR(003) TYPE C,  "Lab/office
        PRDHA(018) TYPE C,  "Product hierarchy
        MSTAE(002) TYPE C,  "X-plant matl status
        MTPOS_MARA(004) TYPE C,  "Gen item cat group
        BRGEW(017) TYPE C,  "Gross weight
        GEWEI(003) TYPE C,  "Weight unit
        NTGEW(017) TYPE C,  "Net weight
        GROES(032) TYPE C,  "Size/Dimensions
        MAGRV(004) TYPE C,  "Matl grp pack matls
        BISMT(018) TYPE C,  "Old material number
        WRKST(048) TYPE C,  "Basic material
        PROFL(003) TYPE C,  "DG indicator profile
        KZUMW(001) TYPE C,  "Environmentally rlvt
        BSTME(003) TYPE C,  "Order unit
        VABME(001) TYPE C,
        EKGRP(003) TYPE C,  "Purchasing group
        XCHPF(001) TYPE C,  "Batch management
        EKWSL(004) TYPE C,  "Purchasing key value
        WEBAZ(003) TYPE C,  "GR processing time
        MFRPN(040) TYPE C,  "Manufacturer part number
        MFRNR(010) TYPE C,  "Manufacturer number
        VPRSV(001) TYPE C,  "Price control indicator
        STPRS(015) TYPE C,  "Standard price
        BWPRH(014) TYPE C,  "Commercial price1
        BKLAS(004) TYPE C,  "Valuation class
      END OF LSMW_MATERIAL_MASTER.
                   INTERNAL TABLE DECLARATIONS                         *
    *to store the input data
    DATA:
      BEGIN OF it_matmaster OCCURS 0.
            INCLUDE STRUCTURE LSMW_MATERIAL_MASTER.
    DATA:
      END OF it_matmaster.
    *for material description
    DATA:BEGIN OF IT_MATERIALDESC OCCURS 0.
         INCLUDE STRUCTURE BAPI_MAKT .
    DATA:END OF IT_MATERIALDESC.
    *to return messages
    DATA:BEGIN OF IT_RETURN OCCURS 0.
         INCLUDE STRUCTURE BAPIRET2.
    DATA:END OF IT_RETURN.
    SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002.
    PARAMETERS:P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B1 .
    AT SELECTION SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          PROGRAM_NAME  = SYST-CPROG
          DYNPRO_NUMBER = SYST-DYNNR
          FIELD_NAME    = 'P_FILE'
        IMPORTING
          FILE_NAME     = P_FILE.
                   TO UPLOAD THE DATA                                  *
    START-OF-SELECTION.
    V_FILE = P_FILE.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = V_FILE
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      tables
        data_tab                      =  IT_MATMASTER
    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.
                   DATA POPULATIONS                                    *
    LOOP AT  IT_MATMASTER.
      BAPIMATHEAD-MATERIAL = IT_MATMASTER-MATNR.
      BAPIMATHEAD-IND_SECTOR = IT_MATMASTER-Mbrsh.
      BAPIMATHEAD-MATL_TYPE = IT_MATMASTER-Mtart.
      BAPIMATHEAD-BASIC_VIEW = 'X'.
      BAPIMATHEAD-PURCHASE_VIEW = 'X'.
      BAPIMATHEAD-ACCOUNT_VIEW = 'X'.
      BAPI_MARA-MATL_GROUP = IT_MATMASTER-MATKL.
      BAPI_MARA-OLD_MAT_NO = IT_MATMASTER-BISMT.
      BAPI_MARA-BASE_UOM = IT_MATMASTER-MEINS.
      BAPI_MARA-BASIC_MATL = IT_MATMASTER-WRKST.
      BAPI_MARA-MFR_NO = IT_MATMASTER-MFRNR.
      BAPI_MARAX-MATL_GROUP = 'X'.
      BAPI_MARAX-OLD_MAT_NO = 'X'.
      BAPI_MARAX-BASE_UOM = 'X'.
      BAPI_MARAX-BASIC_MATL = 'X'.
      BAPI_MARAX-MFR_NO = 'X'.
      BAPI_MARC-PLANT = IT_MATMASTER-WERKS.
      BAPI_MARC-PUR_GROUP = IT_MATMASTER-EKGRP.
      BAPI_MARCX-PLANT = IT_MATMASTER-WERKS.
      BAPI_MARCX-PUR_GROUP = 'X'.
      IT_MATERIALDESC-LANGU = 'EN'.
      IT_MATERIALDESC-MATL_DESC = IT_MATMASTER-MAKTX.
      append IT_materialdesc.
      CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
        EXPORTING
          headdata                   = BAPIMATHEAD
          CLIENTDATA                 = BAPI_MARA
          CLIENTDATAX                = BAPI_MARAx
         PLANTDATA                  = BAPI_MARc
         PLANTDATAX                 = BAPI_MARcx
        FORECASTPARAMETERS         =
        FORECASTPARAMETERSX        =
        PLANNINGDATA               =
        PLANNINGDATAX              =
        STORAGELOCATIONDATA        =
        STORAGELOCATIONDATAX       =
        VALUATIONDATA              =
        VALUATIONDATAX             =
        WAREHOUSENUMBERDATA        =
        WAREHOUSENUMBERDATAX       =
        SALESDATA                  =
        SALESDATAX                 =
        STORAGETYPEDATA            =
        STORAGETYPEDATAX           =
        FLAG_ONLINE                = ' '
        FLAG_CAD_CALL              = ' '
       IMPORTING
         RETURN                     = IT_RETURN
       TABLES
         MATERIALDESCRIPTION        = IT_MATERIALDESC
        UNITSOFMEASURE             =
        UNITSOFMEASUREX            =
        INTERNATIONALARTNOS        =
        MATERIALLONGTEXT           =
        TAXCLASSIFICATIONS         =
        RETURNMESSAGES             =
        PRTDATA                    =
        PRTDATAX                   =
        EXTENSIONIN                =
        EXTENSIONINX               =
    WRITE:/    IT_RETURN-TYPE,
            2   IT_RETURN-ID,
            22  IT_RETURN-NUMBER,
            25  IT_RETURN-MESSAGE.
               IT_RETURN-LOG_NO,
               IT_RETURN-LOG_MSG_NO,
               IT_RETURN-MESSAGE_V1,
               IT_RETURN-MESSAGE_V2,
               IT_RETURN-MESSAGE_V3,
               IT_RETURN-MESSAGE_V4,
               IT_RETURN-PARAMETER,
               IT_RETURN-ROW,
               IT_RETURN-FIELD,
               IT_RETURN-SYSTEM.
    ENDLOOP.

  • To create a Material using BAPI with out passing the material number

    Hello Experts,
    I am using BAPI_MATERIAL_SAVEDATA to create a material of some Ztype. I am successfully creating a material if I am passing Material Number as input. I want the material number to generated internally.
    When I am doing material creation with same input data with out material number using BDC, it is working fine. It is generating the material number.
    But, not with the BAPI.
    Do, I need to specify this some where in the BAPI to generate the Material number internally? Please let me know.
    Please help me in this regard.
    Thanks & Regards,
    Naresh.

    Hi,
    Read the BAPI documentation regarding Internal Number range for materials.
    When you create material master data, the following fields must always
    contain a value in the structure:
    o   MATERIAL
        Only external number assignment is supported for the material number
        (MATERIAL). If you want the material number to be assigned
        internally, the method BAPI_MATERIAL_GETINTNUMBER must first be
        called. This method determines an internal number for the material
        to be created. You must enter this internal number in field
        HEADDATA-MATERIAL.
    Regards
    Vinod

  • To change material using BAPI

    Hi All,
    We are using BAPI_MATERIAL_SAVEDATA to change a material. But end user is not having the authorization to modify using this bapi. because this BAPI is used for both creation and for changing so it is checking creation object Authorization and  it is failing.
    Kindly suggest me some other BAPI to Change the material to avoid the above problem.

    try these..
    /SAPMP/BAPI_MATERIAL_SAVEDATA  Mill Products: Create and Change Material Master
    BAPI_MATERIAL_MAINTAINDATA_RT  Create and change material master data (retail)
    BAPI_MATERIAL_EDIT             Change Material

Maybe you are looking for

  • External Hard Drive not connecting

    I had a WD passport external hard drive which I had hooked up to Time Machine. It has been working fine for over a year now. Just today I noticed the desktop Time Machine icon was not showing up as usual. I went to Time Machine and it says it cannot

  • Syncing question

    I have some songs on my ipod that I would like to keep on my iPod.  I'd like to add some songs to my iPod by syncing it with iTunes on my computer.  My question is, will I lose the songs that are on my iPod, if I sync it with my computer. Also, vice/

  • How can I get to see the complete list of tool selections

    How can I get to see the complete tool selections on the panel?

  • How to work on images in java ?

    i want to generate image through test. means i wanto conert text in to image how can we do that. 2nd how can i generate BARCODE's is there any way to generate barcodes if we supply values ?

  • Does the new iPhoto share better?

    The most important thing I would like to know about the new iPhoto: 1. Can two family members access the same photos across our home LAN? When I try with the older iPhoto, I have a completely different set of photos than what my wife sees on her comp