Upload an excelfile to a table using BAPI method

Hi,
I would like to upload an excel file having three coulumns of data to a table using BAPI  methods.
Anybody with a solution?
Thanks in advance.

Hi,
You will find many posts regarding upload data from excel file. e.g. take a look at below thread.
Link: UPLOAD DATA FROM EXCEL FILE
change the given sample code in above thread with BAPI table name and pass this table to your BAPI FM. 
Hope this will solve your problem.
Regards
Ahsan

Similar Messages

  • Upload the data for sales order using BAPI

    hi experts,
    how to upload the data for sales order using BAPI.
    what is the FM?
    it would be much helpful if i have the sample code as i am very new to BAPI.
    thanks and Regards
    Shyam

    Hi  Shyam
    Its very useful for u
    BAPISDORDER_GETDETAILEDLIST
    BAPI_ACC_SALES_ORDER_CHECK
    BAPI_ACC_SALES_ORDER_POST
    BAPI_ACC_SALES_QUOTA_CHECK
    BAPI_ACC_SALES_QUOTA_POST
    Reward all the helpful answers..
    With Regards
    Navin Khedikar

  • Help Required:How Upload Excel file Into Oracle Table Using PLSQL Procedure

    Please Help , Urgent Help Needed.
    Requirement is to Upload Excel file Into Oracle Table Using PLSQL Procedure/Package.
    Case's are :
    1. Excel File is On Users/ Client PC.
    2. Application is on Remote Server(Oracle Forms D2k).
    3. User Is Using Application Using Terminal Server LogIn.
    4. So If User Will Use to GET_FILE_NAME() function of D2K to Get Excel File , D2k Will Try to pick File from That Remote Server(Bcs User Logind from Terminal Server Option).
    5. Cannot Use Util_File Package Or Oracle Directory to Place That File on Server.
    6. we are Using Oracle 8.7
    So Need Some PL/SQL Package or Fuction/ Procedure to Upload Excel file on User's Pc to Oracle Table.
    Please Guide me wd some Code. or with Some Pl/SQL Package, or With SOme Hint. Or any Link ....
    Jus help to Sort This Issue ........
    you can also write me on :
    [email protected], [email protected]

    TEXT_IO is a PL/SQL package available only in Forms (you'll want to post in the Forms forum for more information). It is not available in a stored procedure in the database (where the equivalent package is UTL_FILE).
    If the Terminal Server machine and the database machine do not have access to the file system on the client machine, no application running on either machine will have access to the file. Barring exceptional setups (like the FTP server on the client machine), your applications are not going to have more access to the client machine than the operating system does.
    If you map the client drives from the Terminal Server box, there is the potential for your Forms application to access those files. If you want the files to be accessible to a stored procedure in the database, you'll need to move the files somewhere the database can access them.
    Justin

  • To transfer the data Cross the systems why we are not using BAPI Method?

    Hello All,
    To transfer the data Cross the systems why we are not using BAPI Method? why we are using only ALE/IDoc's?

    Hi Naveen,
       Listing down those I know -
       1. Master data is expected to be changed/created less frequestly.
       2. Transactional data is expected to be chnaged/created more frequestly.
       3. Transactions to create/change/display master data do no have message control integration, since you are not supposed to print/fax/mail master data to your partners.
       4. Distribution of master data in generally supposed to happen within Enterprise boundry and typically you will have one central server maintaining master data which will be distributed to multiple downstream operation system (Some thing where MDM fits). So ideally when distributing master data using ALE you will be sending it to multiple systems.
       5. Distributing transactional data PO/SO etc is same as sending fax/print which fits with the requirement of message control.
    Hope this helps,
    Regards,
    Sanjeev

  • LSMW help with DIRs by using BAPi method

    Hi experts,
    I am learning LSMW and I have been given exercise which I have to finish. The question is:
    Create a LSMW object for creation of DIRs by using BAPI method (UPLOAD_DOCUMENT)???
    Can anyone tell me how should I go forward and what DIRs stands for... ??
    I really appreciate your help..
    Regards,
       -Ashok Hansraj

    Hello Ashok,
    If you need a step - by - step approach for loading data using LSMW with various import techniques (like batch input, BAPI, IDOCS etc) you have to go thru this LSMW manual.
    And the files with DIR information, you should receive those fields from your business. Because you should know the structure of the data in those files in order to maintain source and target structures.
    Ask your business people over the format of the file you will be provided. In mean you can go thru this manual on this link.
    http://www.sapgenie.com/saptech/lsmw.htm
    Thanks,
    Naren

  • Storage location Data is not saving in table MARD using BAPI method.

    Hi Experts,
    TABLES: T001L, "Storage Locations
            MARA,  "General Material Data
            MAKT,  "Material Descriptions
            MBEW,  "Material Valuation
            MARC,  "Plant Data for Material
            MARD.  "Storage Location Data for Mate
    DATA: BAPI_HEAD   LIKE BAPIMATHEAD,  "MATERIAL
          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_MARD1  LIKE BAPI_MARD,    "Storage location
          BAPI_MARDX  LIKE BAPI_MARDX,
          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
             LGORT(4),     "Storage location
             MTART(4),     "Material type
             MATNR(18),    "Material number
             MAKTX(40),     "Material description
             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
             BKLAS(4),     "VALUATION CLASS
             VERPR TYPE VERPR_BAPI,    "MOVING PRICE
             BWTTY(1),     "Valuation Catogory
             MLAST(1),     "Price determination
             MLMAA(1),     "Material Ledger
             EKLAS(4),     "Valuation Class for sales order stock
             QKLAS(4),     "Valuation Class for Project Stock
             ZKPRS TYPE DZKPRS, "Future price
             ZKDAT TYPE DZKDAT, "Valid From Date
             BWPRS TYPE BWPRS,  "Tax price 1
             BWPS1 TYPE BWPS1,  "Tax price 2
             VJBWS TYPE VJBWS,  "Tax price 3
             ABWKZ TYPE ABWKZ,  "Devaluatin indicator
             BWPRH TYPE BWPRH,  "Commercial price 1
             BWPH1 TYPE BWPH1,  "Commercial price 2
             VJBWH TYPE VJBWH,  "Commercial Price 3
             XLIFO(1),          "LIFO/FIFO revelant
             MYPOL(4),          "Pool no for LIFO
             MMSTA(2),          "Plant specific material status
             AUSME TYPE AUSME,  "Unit of issue
             QMATA(6),          "Material Authorization group
             RBNRM(9),          "Catalog Profile
             WEBAZ TYPE WEBAZ,  "Goods reciept processing time in days
             PRFRQ TYPE PRFRQ,  "Recurring Insepction
             SSQSS(8),          "QM Control key
             QZGTP(4),          "Certificate Type
             QSSYS(4),          "Required QM system for vendor
           END OF INT_MAT.
    DATA: V_MATNR TYPE MARA-MATNR.
    SELECT-OPTIONS:
                PLANT    FOR  MARC-WERKS OBLIGATORY MEMORY ID PLT,
                S_LGORT  FOR  MARD-LGORT MEMORY ID STL,
                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.
        CLEAR MARD.
        SELECT SINGLE * FROM MARD WHERE WERKS IN PLANT
                                  AND   LGORT IN S_LGORT.
        WRITE:/ MARC-WERKS,    "Plant
                MARD-LGORT,    "Storage location
                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
                MBEW-BKLAS,    "VALUE CLASS
                MAKT-SPRAS,    "Language key
                MBEW-BKLAS,    "Valuation Class
                MBEW-VERPR,    "Moving price
                MAKT-MAKTX,    "Material description
                MBEW-BWTTY,    "Valutaion Catogorey
                MBEW-MLAST,    "Price Determination
                MBEW-MLMAA,    "Material Ledger
                MBEW-EKLAS,    "Valuation class for Sales order stock
                MBEW-QKLAS,    "Valutaion Class for Project Stock
                MBEW-ZKPRS,    "Future Price
                MBEW-ZKDAT,    "Valid From Date
                MBEW-BWPRS,    "Tax price 1
                MBEW-BWPS1,    "Tax price 2
                MBEW-VJBWS,    "Tax price 3
                MBEW-ABWKZ,    "Devaluatin indicator
                MBEW-BWPRH,    "Commercial price 1
                MBEW-BWPH1,    "Commercial price 2
                MBEW-VJBWH,    "Commercial Price 3
                MBEW-XLIFO,    "LIFO/FIFO revelant
                MBEW-MYPOL,    "Pool no for LIFO
                MARC-MMSTA,    "Plant specific material status
                MARC-AUSME,    "Unit of issue
                MARC-QMATA,    "Material Authorization group
                MARA-RBNRM,    "Catalog Profile
                MARC-WEBAZ,    "Goods reciept processing time in days
                MARC-PRFRQ,    "Recurring Insepction
                MARC-SSQSS,    "QM Control key
                MARC-QZGTP,    "Certificate Type
                MARC-QSSYS.    "Required QM system for vendor
                INT_MAT-WERKS = MARC-WERKS.    "Plant
                INT_MAT-LGORT = MARD-LGORT.    "Storage Location
                INT_MAT-MTART = MARA-MTART.    "Material type
                INT_MAT-MATNR = MARA-MATNR.    "Material number
                INT_MAT-MAKTX = MAKT-MAKTX.    "Material description
                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-BKLAS = MBEW-BKLAS.    "VALVATION CLASS
                INT_MAT-VERPR = MBEW-VERPR.    "MOVING price
                INT_MAT-BWTTY = MBEW-BWTTY.    "Valutaion Catogorey
                INT_MAT-MLAST = MBEW-MLAST.    "Price Determination
                INT_MAT-MLMAA = MBEW-MLMAA.    "Material Ledger
                INT_MAT-EKLAS = MBEW-EKLAS.    "Valuation class forS.O Stock
                INT_MAT-QKLAS = MBEW-QKLAS.    "Valutaion Class for Project
                INT_MAT-ZKPRS = MBEW-ZKPRS.    "Future Price
                INT_MAT-ZKDAT = MBEW-ZKDAT.    "Valid From Date
                INT_MAT-BWPRS = MBEW-BWPRS.    "Tax price 1
                INT_MAT-BWPS1 = MBEW-BWPS1.    "Tax price 2
                INT_MAT-VJBWS = MBEW-VJBWS.    "Tax price 3
                INT_MAT-ABWKZ = MBEW-ABWKZ.    "Devaluatin indicator
                INT_MAT-BWPRH = MBEW-BWPRH.    "Commercial price 1
                INT_MAT-BWPH1 = MBEW-BWPH1.    "Commercial price 2
                INT_MAT-VJBWH = MBEW-VJBWH.    "Commercial Price 3
                INT_MAT-XLIFO = MBEW-XLIFO.    "LIFO/FIFO revelant
                INT_MAT-MYPOL = MBEW-MYPOL.    "Pool no for LIFO
                INT_MAT-MMSTA = MARC-MMSTA.    "Plant specific material
                INT_MAT-AUSME = MARC-AUSME.    "Unit of issue
                INT_MAT-QMATA = MARC-QMATA.    "Material Authorization group
                INT_MAT-RBNRM = MARA-RBNRM.    "Catalog Profile
                INT_MAT-WEBAZ = MARC-WEBAZ.    "Goods reciept processing
                INT_MAT-PRFRQ = MARC-PRFRQ.    "Recurring Insepction
                INT_MAT-SSQSS = MARC-SSQSS.    "QM Control key
                INT_MAT-QZGTP = MARC-QZGTP.    "Certificate Type
                INT_MAT-QSSYS = MARC-QSSYS.    "Required QM system for
                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.
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
      EXPORTING
        INPUT              = INT_MAT-MATNR
    IMPORTING
       OUTPUT             = INT_MAT-MATNR
    EXCEPTIONS
      LENGTH_ERROR       = 1
      OTHERS             = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    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_MARC1-PUR_STATUS = INT_MAT-MMSTA.
        BAPI_MARC1-ISSUE_UNIT = INT_MAT-AUSME.
        BAPI_MARC1-QM_AUTHGRP = INT_MAT-QMATA.
        BAPI_MARC1-GR_PR_TIME = INT_MAT-WEBAZ.
        BAPI_MARC1-INSP_INT   = INT_MAT-PRFRQ.
        BAPI_MARC1-CTRL_KEY   = INT_MAT-SSQSS.
        BAPI_MARC1-CERT_TYPE  = INT_MAT-QZGTP.
        BAPI_MARC1-QM_RGMTS   = INT_MAT-QSSYS.
        BAPI_MARCX-PLANT      = INT_MAT-WERKS.
        BAPI_MARCX-PUR_GROUP  = 'X'.
        BAPI_MARCX-PUR_STATUS = 'X'.
        BAPI_MARCX-ISSUE_UNIT = 'X'.
        BAPI_MARCX-QM_AUTHGRP = 'X'.
        BAPI_MARCX-GR_PR_TIME = 'X'.
        BAPI_MARCX-INSP_INT   = 'X'.
        BAPI_MARCX-CTRL_KEY   = 'X'.
        BAPI_MARCX-CERT_TYPE  = 'X'.
        BAPI_MARCX-QM_RGMTS   = 'X'.
    Accounting 1
        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_MBEW1-MOVING_PR     = INT_MAT-VERPR.
        BAPI_MBEW1-VAL_CLASS     = INT_MAT-BKLAS.
        BAPI_MBEW1-VAL_CAT       = INT_MAT-BWTTY.
        BAPI_MBEW1-ML_SETTLE     = INT_MAT-MLAST.
        BAPI_MBEW1-ML_ACTIVE     = INT_MAT-MLMAA.
        BAPI_MBEW1-VM_SO_STK     = INT_MAT-EKLAS.
        BAPI_MBEW1-VM_P_STOCK    = INT_MAT-QKLAS.
        BAPI_MBEW1-FUTURE_PR     = INT_MAT-ZKPRS.
        BAPI_MBEW1-VALID_FROM    = INT_MAT-ZKDAT.
    *ACCOUNTING 2
       BAPI_MBEW1-TAXPRICE_1    = INT_MAT-BWPRS.
       BAPI_MBEW1-TAXPRICE_2    = INT_MAT-BWPS1.
       BAPI_MBEW1-TAXPRICE_3    = INT_MAT-VJBWS.
       BAPI_MBEW1-DEVAL_IND     = INT_MAT-ABWKZ.
       BAPI_MBEW1-COMMPRICE1    = INT_MAT-BWPRH.
       BAPI_MBEW1-COMMPRICE2    = INT_MAT-BWPH1.
       BAPI_MBEW1-COMMPRICE3    = INT_MAT-VJBWH.
       BAPI_MBEW1-LIFO_FIFO     = INT_MAT-XLIFO.
       BAPI_MBEW1-POOLNUMBER    = INT_MAT-MYPOL.
        BAPI_MBEWX-VAL_AREA   = INT_MAT-WERKS.
        BAPI_MBEWX-PRICE_CTRL = 'X'.
        BAPI_MBEWX-STD_PRICE  = 'X'.
        BAPI_MBEWX-PRICE_UNIT = 'X'.
        BAPI_MBEWX-MOVING_PR =  'X'.
        BAPI_MBEWX-VAL_CLASS =  'X'.
        BAPI_MBEWX-VAL_CAT       = 'x'.
        BAPI_MBEWX-ML_SETTLE     = 'X'.
        BAPI_MBEWX-ML_ACTIVE     = 'X'.
        BAPI_MBEWX-VM_SO_STK     = 'X'.
        BAPI_MBEWX-VM_P_STOCK    = 'X'.
        BAPI_MBEWX-FUTURE_PR     = 'X'.
        BAPI_MBEWX-VALID_FROM    = 'X'.
       BAPI_MBEWX-TAXPRICE_1    = 'X'.
       BAPI_MBEWX-TAXPRICE_2    = 'X'.
       BAPI_MBEWX-TAXPRICE_3    = 'X'.
       BAPI_MBEWX-DEVAL_IND     = 'X'.
       BAPI_MBEWX-COMMPRICE1    = 'X'.
       BAPI_MBEWX-COMMPRICE2    = 'X'.
       BAPI_MBEWX-COMMPRICE3    = 'X'.
       BAPI_MBEWX-LIFO_FIFO     = 'X'.
       BAPI_MBEWX-POOLNUMBER    = 'X'.
    *Storage Locations
        BAPI_MARD1-PLANT      = INT_MAT-WERKS.
        BAPI_MARD1-STGE_LOC   = INT_MAT-LGORT.
        BAPI_MARDX-PLANT      = INT_MAT-WERKS.
        BAPI_MARDX-STGE_LOC   = INT_MAT-LGORT.
       WRITE:/ BAPI_HEAD-MATERIAL, BAPI_MARC1-PLANT ,BAPI_MARD1-STGE_LOC.
        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              =
    <b>      STORAGELOCATIONDATA        =  BAPI_MARD1
           STORAGELOCATIONDATAX       =  BAPI_MARDX</b>
            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-MESSAGE.
    ENDIF.
    ENDLOOP.
    ENDFORM.
    <b>i am using this bapi method to copy materials from one plant to another plant using storage location so here what happenig is everyting is going correct but only the storage location data is not saving in table mard so any body faced this kind of problem please tell me.... and one more dbt
    bapi_marcx-pur_status = 'x' what is 'X' here??? is that mandatory field or required field ???
    points wil be rewarded.
    reagrds,
    sunil k airam.

    In the HEADDATA structure, STORAGE_VIEW should also be set as 'X' , in order to update storage location data
    for example
    BAPI_HEAD-STORAGE_VIEW = 'X'.
    Also, PUR_STATUS corresponds to field MARA-MSTAE whose domain has value table T141, therefore values in the field are checked against T141
    Edited by: Harris Veziris on May 12, 2008 12:37 PM

  • Sales order details uploading using BAPI method in LSMW

    Hi Guys,
    Sales order details uploading using BAPI in LSMW, could you please suggest me, is any standard method or programs is available for this.
    I have some queries about this.
    1) One header line having multiple line items, in this case  we able to upload use the  LSMW method,
        if possible please tell me the steps.
      2) Do we need to do any config changes while uploading data?     
      3) Flat file should be which format.
      4) Steps to process each step wise if possible.
    Please help me
    Thanks,
    Gourisanakar.

    Hi Gouri Sankar,
    would you be able to upload the sales orders with multiple line items using BAPI LSMW?
    if so could you plz suggest?
    Thanks in advance.
    Suresh/

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

  • LSMW using BAPI method for ME21N

    Hi to all,
    I am using LSMW BAPI method for the transaction ME21N Iam able to post a PO document successfully, But in my flat file I have a header and followed by item in the same line, while I was posting with same header for different line items its posting different PO's for different  line items but suppose it has to post one document with multiple items.
    My flat file fields are like this : (where as ABCD my header and rest are line items) I am using only one structure 'podata' in LSMW and I am not using any identifier.
    header--Line items
    A B C D S P Q W E X
    A B C D 1 D 3  F K L
    Business Object -     BUS2012     
    Method                -    CREATEFROMDATA1
    Message Type    -    PORDCR1
    Basic Type         -     PORDCR101
    As per my requirement if I have multiple line items for the same header then only one PO should be posted.
    Could you suggest me, How can I achieve this.
    Thanks,
    Lahari

    Hi Jurgen,
    Thanks for your reply.
    As poer your suggestion, I passed my flat file data into a single file and in the begin of transaction, I divided the data into 2 structures as Header & Item.
    Still I am unable to achieve the desired results, can you please elaborate more on how SAP internally joins the structures again.
    To be more clear my flat file data look like this :
    217836     NB     1826162667     0127     00   1     LEAN SIX SIGMA PRIMER     MRO     Z     4.00     EA     60.00     1     EA     
    217836     NB     1826162667     0127     00     2     LEAN SIX SIGMA PRIMER     MRO     Z     4.00     EA     860.00     1     EA     
    217836     NB     1826162668     0127     00     1     LEAN SIX SIGMA PRIMER     MRO     Z     4.00     EA     160.00     1     EA
    217836     NB     1826162668     0127     00     2     LEAN SIX SIGMA PRIMER     MRO     Z     4.00     EA     560.00     1     EA     
    The bold ones being header and the remaining Items, the underlined field is PO number.
    In normal process this file is considered to have 4 records, and tries to create 4 PO's.But my requirement is to create only 2 PO's with 2 items each.
    Thanks.
    Lahari

  • Upload multiple excel files into tables using APEX

    Hi folks,
    I'm wondering if anyone has ever uploaded multiple .csv files simultaniously and store the data into the database using APEX XE before.
    I can browse for a single file, and execute that okay and a good example of doing that can be found at http://advait.wordpress.com/2008/05/21/uploading-excel-sheet-using-oracle-application-express-apex/
    This works fine when the user browses to a specific file on their network and then uploads the data from that one file.
    However I need the ability to 'grab' every file in a specific directory one after the other to process rather than having to specify which one to load everytime, and wondered if anyone has come across this before.
    Many thanks
    Graham.

    Just for completeness ...
    Got this to work, but it's a pl/sql issue as opposed to an APEX issue.
    Anyway, if anyone needs to have the ability to read multiple files then a quick easy way to do it (as lomg as they know the file names that will be read), is to create a directory on the database which points to the actual harddrive on your PC, then create a table (called an external table) and read from that external table as if it was an actual database table ...
    1 - Log on as sys and grant CREATE ANY DIRECTORY to whatever user you are logging in as (assuming you are not using sys to create apps)
    2 - Create a directory e.g....CREATE OR REPLACE DIRECTORY GB_TEST AS 'c:\gbtest';
    3 - Create an external table as ...
    CREATE TABLE gb_test
    (file_name varchar2(10),
    rec_date date
    rec_name VARCHAR2(20),
    rec_age number,
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY GB_TEST
    ACCESS PARAMETERS
    RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    LOCATION ('data1.csv','data2.csv','data3.csv','data4.csv')
    PARALLEL 5
    REJECT LIMIT 20000;
    That's it then ...
    select * from gb_test
    where file_name = 'xxx'
    will return all the data where the file_name = 'xxx'
    very easy to use.

  • Can we  update The extended VBPA database table using BAPI

    Hi,
      We have a table VBPA appended with two fields start date and end date. Our scenario is to when modifying the sales order using the bapi BAPI_SALESORDER_CHANGE we need to update the two fields star_date and end_date of VBPA table for the corresponding Ship to or Sold to partner for the Given Sales Order.
    Thanks,
    Venkat.

    Hi,
    YES You can, You should be updating this to fields using a BAPI - "BAPI_SALESORDER_CHANGE" and use table user this BAPI "EXTENSIONIN" to update this fields. Refer to BAPI documentation for more reference. Please check below code which was done for VBAK (2 date fields).
    Regards,
    Tim
    DATA:
        ZBAPISDH1     TYPE BAPISDH1,
        ZBAPISDH1X    TYPE BAPISDH1X,
        ZEXTENSIONIN  TYPE  TABLE OF BAPIPAREX WITH HEADER LINE,
        BAPE_VBAK      TYPE  BAPE_VBAK,
        BAPE_VBAKX     TYPE  BAPE_VBAKX.
      ZBAPISDH1X-UPDATEFLAG  = 'U'.
      BAPE_VBAK-VBELN     = P_VBELN.
      BAPE_VBAK-ZZSD_FROM = P_START.
      BAPE_VBAK-ZZSD_TO   = P_END.
      BAPE_VBAKX-VBELN     = P_VBELN.
      BAPE_VBAKX-ZZSD_FROM = CO_X.
      BAPE_VBAKX-ZZSD_TO   = CO_X.
      ZEXTENSIONIN-STRUCTURE  = 'BAPE_VBAK'.
      ZEXTENSIONIN-VALUEPART1 = BAPE_VBAK.
      APPEND ZEXTENSIONIN.
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'.

  • Mobile number is not uploading for BP master data creation using BAPI ?

    Hi,
    I am creating Business Partner Master data in ISU/CCS using the BAPI "BAPI_ISUPARTNER_CREATEFROMDATA". Uploading data from Excel.
    Successfully uploading and creating new Business Partners apart from Mobile number, nick name,middle name, and name of birth fields.
    There are 2 issues i am facing:
    1. There is no field name is called Mobile number (data element AD_MBNMBR1) in structures of that BAPI.
    2. Nick, middle and birth names fields are there, but they are under the Expand(+ symbol) in FPP2 (FPP1) Tcode. That's why these fields are not uploading.
    How to upload them?
    Please help me out.
    Thanks
    Sarayu Parvathaneni.

    Hello Roopesh,
    Ususally, to make the BAPI update the database, you have to run BAPI
    BAPI_TRANSACTION_COMMIT after BAPI_PRDSRVAPS_SAVEMULTI2 is executed.
    In se37-> You may insert
    BAPI_PRDSRVAPS_SAVEMULTI2
    BAPI_TRANSACTION_COMMIT
    in the Menu-->function module >test>test sequences.
    Also as Mani said, if the update is successful the return parameter will be '0'.
    Regards,
    Ademola

  • Uploading CSV file to DB table using APEX

    HI,
    Can anyone guide me how to upload a .csv file to a DB table.
    THANKS IN ADVANCE

    user12550902 wrote:
    as i got some information from the otn..i got a pl/sql code which is used in the process.
    i used it in browse item .selecting file in the client disk and submitting it.when i press the button submit ,it calls a process.It is complex to parse a CSV file manually - as your code is doing. Using an external table (and having Oracle parse it for you), is a lot simpler.
    My guess is that your parsing code fails to deal with all the data formatting cases for that CSV file - and thus the run-time error and failure.
    I suggest that the very first thing you consider is modularisation. How can one test the parsing code in your source? It is totally embedded in the code. A very unflexible approach in all aspects - from code design to maintenance, troubleshooting and debugging. It also does not allow the CSV parsing code to be re-used.
    It comes down to a very fundamental software engineering principle - modularise your code. Always.
    Here's an example of creating a CSV parser - using a custom SQL data type to store the "tokens" from the CSV file, and a function to return it.
    SQL> create or replace type TStrings is table of varchar2(4000);
      2  /                                                         
    Type created.
    SQL>
    SQL> create or replace function tokenise( line varchar2, separatorChars varchar2 default ',', enclosedBy varchar2 default null ) return TStrings is
      2          strList         TStrings;                                                                                                            
      3          str             varchar2(4000);                                                                                                      
      4          i               integer;                                                                                                             
      5          l               integer;                                                                                                             
      6          enclose1        integer;                                                                                                             
      7          enclose2        integer;                                                                                                             
      8          encloseStr      varchar2(4000);                                                                                                      
      9          replaceStr      varchar2(4000);                                                                                                      
    10                                                                                                                                               
    11          procedure AddString( cLine varchar2 ) is                                                                                             
    12          begin                                                                                                                                
    13                  strList.Extend(1);                                                                                                           
    14                  strList( strList.Count ) := REPLACE( cLine, CHR(0), separatorChars );                                                        
    15          end;                                                                                                                                 
    16                                                                                                                                               
    17  begin                                                                                                                                        
    18          strList := new TStrings();                                                                                                           
    19                                                                                                                                               
    20          str := line;                                                                                                                         
    21          loop                                                                                                                                 
    22                  if enclosedBy is not null then                                                                                               
    23                          -- find the enclosed text, if any                                                                                    
    24                          enclose1 := INSTR( str, enclosedBy, 1 );                                                                             
    25                          enclose2 := INSTR( str, enclosedBy, 2 );                                                                             
    26                                                                                                                                               
    27                          if (enclose1 > 0) and (enclose2 > 0) and (enclose2 > enclose1) then                                                  
    28                                  -- extract the enclosed string                                                                               
    29                                  encloseStr := SUBSTR( str, enclose1, enclose2-enclose1+1 );                                                  
    30                                  -- replace the separator char's with zero char's                                                             
    31                                  replaceStr := REPLACE( encloseStr, separatorChars, CHR(0) );                                                 
    32                                  -- and remove the enclosed quotes                                                                            
    33                                  replaceStr := REPLACE( replaceStr, enclosedBy );                                                             
    34                                  -- change the enclosed string in the big string to the replacement string                                    
    35                                  str := REPLACE( str, encloseStr, replaceStr );                                                               
    36                          end if;                                                                                                              
    37                  end if;                                                                                                                      
    38                                                                                                                                               
    39                  l := LENGTH( str );                                                                                                          
    40                  i := INSTR( str, separatorChars );                                                                                           
    41                                                                                                                                               
    42                  if i = 0 then                                                                                                                
    43                          AddString( str );                                                                                                    
    44                  else                                                                                                                         
    45                          AddString( SUBSTR( str, 1, i-1 ) );                                                                                  
    46                          str := SUBSTR( str, i+1 );                                                                                           
    47                  end if;                                                                                                                      
    48                                                                                                                                               
    49                  -- if the separator was on the last char of the line, there is                                                               
    50                  -- a trailing null column which we need to add manually                                                                      
    51                  if i = l then                                                                                                                
    52                          AddString( null );                                                                                                   
    53                  end if;                                                                                                                      
    54                                                                                                                                               
    55                  exit when str is NULL;                                                                                                       
    56                  exit when i = 0;                                                                                                             
    57          end loop;                                                                                                                            
    58                                                                                                                                               
    59          return( strList );                                                                                                                   
    60  end;                                                                                                                                         
    61  /
    Function created.
    SQL> show errors
    No errors.
    SQL>
    SQL> col TOKEN format a30
    SQL>
    SQL> -- default commas as separator, with a trailing null column
    SQL> select rownum as TOKEN_ID, column_value as TOKEN from TABLE( tokenise('id,surname,date,1234,') );
      TOKEN_ID TOKEN
             1 id
             2 surname
             3 date
             4 1234
             5
    SQL>
    SQL> -- default commas as separator, with enclosed text, nulls, etc
    SQL> select rownum as TOKEN_ID, column_value as TOKEN  from TABLE( tokenise('id,surname,"What do you want, universe?",date,1234,,another column',',','"') );
      TOKEN_ID TOKEN
             1 id
             2 surname
             3 What do you want, universe?
             4 date
             5 1234
             6
             7 another column
    7 rows selected.
    SQL>
    {code}
    This approach enables you to write a single and comprehensive parser, test it using SQL and PL/SQL, use it in PL/SQL and SQL, and re-use the code where and when needed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to upload the data to 'abzu' transaction using bapi

    Hi Experts ,
    I need to upload the data to the (asset write up ) transaction 'abzu' and please help me inthis regard
    i found some bapi's like below
    BAPI_FIXEDASSET_CHANGE Changes an Asset
    BAPI_FIXEDASSET_CREATE Creates an Asset
    BAPI_FIXEDASSET_CREATE1 Creates an Asset
    BAPI_FIXEDASSET_GETDETAIL Display Detailed Information on a Fixed Asset
    BAPI_FIXEDASSET_GETLIST Information on Selected Assets
    BAPI_FIXEDASSET_OVRTAKE_CREATE BAPI for Legacy Data Transfer
    BAPI_FIXEDASSET_TEST BAPI for Legacy Data Transfer
    i tried with this bapies but unable to do the transfer the data ,
    please help me ,
    which is the exactly suitable bapi for uploading the data to 'abzu' transaction
    i apriciate you advanced ,
    please give me the exactly solution for this ,
    Regards.,

    Hi Experts ,
    I need to upload the data to the (asset write up ) transaction 'abzu' and please help me inthis regard
    i found some bapi's like below
    BAPI_FIXEDASSET_CHANGE Changes an Asset
    BAPI_FIXEDASSET_CREATE Creates an Asset
    BAPI_FIXEDASSET_CREATE1 Creates an Asset
    BAPI_FIXEDASSET_GETDETAIL Display Detailed Information on a Fixed Asset
    BAPI_FIXEDASSET_GETLIST Information on Selected Assets
    BAPI_FIXEDASSET_OVRTAKE_CREATE BAPI for Legacy Data Transfer
    BAPI_FIXEDASSET_TEST BAPI for Legacy Data Transfer
    i tried with this bapies but unable to do the transfer the data ,
    please help me ,
    which is the exactly suitable bapi for uploading the data to 'abzu' transaction
    i apriciate you advanced ,
    please give me the exactly solution for this ,
    Regards.,

  • Update the Oracle Table using BAPI

    Hi All,
        I would like to update Oracle Data Base with my custom BAPI using the Business Logic Transaction.
    Could any one please give me some logic how to do it?.
    Thanks
    R M

    RM,
    Please follow the steps below:
    1) Create and Configure the Data Server for the database you want to access/update (basically
        you are creating a database connection here).
    2) Save and test the connection by clicking the 'Status' button
    3) Create new query template with template type as 'SQL Query' and select the server you have
        configured in step#1
    4) Select the mode as 'Command' and type-in your Insert/Update statements in the 'Fixed Query'
        tab. For example: insert into yourtable values ('[Param.1]','[Param.2]')
    5) Test the query by passing parameters from the 'Parameters' tab. You are supposed to get a
        'Command Execution Successful'  message if the data is successfully posted to the database.
    6) Create a 'SQL Query' action block in your Business logic transaction to access the above query
        and map your Param.1, Param.2 etc. to your BAPI result (on the Link Editor).
    Hope this helps.
    John

Maybe you are looking for