Upload PO data into SRM system from flat file

Hi all,
I need to create conversion program to upload Open Purchase order data from flat file to System.
I am trying to create po using bapi BAPI_POEC_CREATE. but getting error .
should any one give the details of parameter need to  pass the bapi .
Thanks in advance
Sharad

Sharad,
Not the very best piece of code, but should be helpful.
REPORT  zkb_po_create.
DATA: ls_po_header   TYPE bapi_po_header_c.
DATA: ls_e_po_header TYPE bapi_po_header_d.
DATA: ls_po_items    TYPE bapi_po_item_c.
DATA: ls_po_accass   TYPE bapi_acc_c.
DATA: ls_po_partner  TYPE bapi_bup_c.
DATA: ls_po_orgdata  TYPE bapi_org_c.
DATA: ls_return      TYPE bapiret2.
DATA: lt_po_items   TYPE TABLE OF bapi_po_item_c.
DATA: lt_po_accass  TYPE TABLE OF bapi_acc_c.
DATA: lt_po_partner TYPE TABLE OF bapi_bup_c.
DATA: lt_po_orgdata TYPE TABLE OF bapi_org_c.
DATA: lt_return     TYPE TABLE OF bapiret2.
* Header Details
ls_po_header-businessprocess = 1.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input  = ls_po_header-businessprocess
  IMPORTING
    output = ls_po_header-businessprocess.
ls_po_header-process_type = 'EC'.
ls_po_header-doc_date = sy-datum.
ls_po_header-description = 'Test for BAPI_POEC_CREATE'.
ls_po_header-logsys_fi = 'Backend'.
ls_po_header-co_code = '1000'.
ls_po_header-currency = 'GBP'.
* Item Details
ls_po_items-item_guid    = 2.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input  = ls_po_items-item_guid
  IMPORTING
    output = ls_po_items-item_guid.
ls_po_items-parent        = ls_po_header-businessprocess.
ls_po_items-product_guid  = '4678E74FFFC380AD000000000A8E035B'.
ls_po_items-product_id    = '400030'.
ls_po_items-product_type  = '01'.
ls_po_items-category_guid = '4627B461073F40FC000000000A8E035B'.
ls_po_items-category_id   = '1.04.0500'.
ls_po_items-quantity      = 10.
ls_po_items-deliv_date   = sy-datum + 10.
ls_po_items-price = '25'.
APPEND ls_po_items TO lt_po_items.
* Account Assignment
ls_po_accass-guid = 3.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input  = ls_po_accass-guid
  IMPORTING
    output = ls_po_accass-guid.
ls_po_accass-parent_guid = ls_po_items-item_guid.
ls_po_accass-distr_perc  = 100.
ls_po_accass-g_l_acct    = '<gl acc>'.
ls_po_accass-cost_ctr    = '<cost centre>'.
ls_po_accass-co_area     = '<Ctrl area>'.
APPEND ls_po_accass TO lt_po_accass.
* Partner Functions
ls_po_partner-partner_fct  = '00000019'.
ls_po_partner-partner      = 'Vendor'.
ls_po_partner-parent_guid  = ls_po_items-item_guid.
APPEND ls_po_partner TO lt_po_partner.
ls_po_partner-partner_fct  = '00000016'.
ls_po_partner-partner      = 'Requester'.
ls_po_partner-parent_guid  = ls_po_items-item_guid.
APPEND ls_po_partner TO lt_po_partner.
ls_po_partner-partner_fct  = '00000020'.
ls_po_partner-partner      = 'Receipient'.
ls_po_partner-parent_guid  = ls_po_items-item_guid.
APPEND ls_po_partner TO lt_po_partner.
ls_po_partner-partner_fct  = '00000075'.
ls_po_partner-partner      = 'Location'.
ls_po_partner-parent_guid  = ls_po_items-item_guid.
APPEND ls_po_partner TO lt_po_partner.
ls_po_orgdata-proc_org_ot = 'O'.
ls_po_orgdata-proc_org_id = 'Pur Org'.
ls_po_orgdata-proc_group_ot = 'O'.
ls_po_orgdata-proc_group_id = 'Pur Group'.
ls_po_orgdata-parent_guid = ls_po_items-item_guid.
APPEND ls_po_orgdata TO lt_po_orgdata.
CALL FUNCTION 'BAPI_POEC_CREATE'
  EXPORTING
    i_po_header  = ls_po_header
  IMPORTING
    e_po_header  = ls_e_po_header
  TABLES
    i_po_items   = lt_po_items
    i_po_accass  = lt_po_accass
    i_po_partner = lt_po_partner
    i_po_orgdata = lt_po_orgdata
    return       = lt_return.
READ TABLE lt_return INTO ls_return WITH KEY type = 'E'.
IF sy-subrc NE 0.
  COMMIT WORK AND WAIT.
  WRITE:/ ls_e_po_header-doc_number, ': created successfully'.
ELSE.
  WRITE:/ 'The below errors occurs during PO creation.'.
  LOOP AT lt_return INTO ls_return.
    WRITE:/ ls_return-message.
  ENDLOOP.
ENDIF.
Regards, Kathirvel

Similar Messages

  • Uploading Meter data into the system

    Can some one please describe the process of uploading the meter data into CC&B.
    What is the content of the flat file that i upload.can i upload a meter read XML file directly into the staging tables.....kindly explain the steps..I have not been able to upload any daat into the system using staging control and staging upload page.
    Also i found out that there are batch process MUP1 and MUP2 which need be rum in order to upload the meter data into the system from the meter read staging table.Is this correct.
    With regards to the meter upload staging table, i referred to the MR staging table : CI_MR_STAGE_UP
    there is some data available with the installation as demo data.
    For column MR_UP_STATUS_FLAG, there are values such as E, P, C...I unsersatnd there meaning.
    1) For Pending P status, i submitted the batch processes MUP1 and then MUP2, expecting that teh status might change to Complete, c.......at the same time i ran MRUP-PRG ........well i was going to write nothing happened , but i saw that after some time all teh rows with ataus P and C are not present any more..........
    2)How do i rectify the data with E status.........
    Please helpp me uploading more data to the CI_MR_STAGE_UP Meter read staging table.

    Hi,
    thanks for the reply..
    can u please tell me what is the content of the flat file that i upload.can i upload a meter read XML file directly into the staging tables.....kindly explain the steps..I have not been able to upload any daat into the system using staging control and staging upload page.
    if u can give a flat file sample content for the meter read.
    Also is it advisable to insert data into upload staging table through SQL drectly.
    And can u pls tell me the difference between XAI upload staging table and other upload staging table such as for MR, FA etc.

  • How to batch upload some data into SAP system?

    Hi All:
    I'm a SAP key user in our company, I want to know how to batch upload master data into SAP system? What t-code we can use for batch input?
    Thanks in advance!

    Hi,
    I think at least there are four methods for batch input which you can use in SAP system:
    Standard mass change t-code: for example, MM17 for mass change of material master data, you can find the mass change t-code under the relevant function module;
    T-code SCAT, you can use to record and generate the simple batch input template, it's easy to use for key user;
    T-code LSMW, it's another transaction to generate batch input template, it's often used at the beginning of SAP rollout;
    ABAP program, of course, ABAP is a universal tool for everything, you can use ABAP to generate a batch input program to upload data into SAP system as well.
    So you had better contact your SAP support department, help you to upload data!
    Good luck
    Tao

  • How can i retrieved data into the infocube from archived files

    hi,
    i have archived cube data and i have to load data into the cube from archived files.
    so now i want to find archived files and how to load data into the cube.
    thanks

    Hi.....
    Reloading archived data should be an exception rather than the general case, since data should be
    archived only if it is not needed in the database anymore. When the archived data target is serving also as a
    datamart to populate other data targets, Its recommend that you load the data to a copy of the original
    (archived) data target, and combine the two resulting data targets with a MultiProvider.
    In order to reload the data to a data target, you have to use the export DataSource of the archived data
    target. Therefore, you create an update rule based on the respective InfoSource (technical name 8<data
    target name>). You then trigger the upload either by using ‘Update ODS data in data target’ or by
    replicating the DataSources of the MYSELF source system and subsequently scheduling an InfoPackage
    for the respective InfoSource
    If you want to read the data for reporting or
    control purposes, you have to write a report, which reads data from the archive files sequentially.
    Alternatively, you can also use the Archiving Information System (AS). This tool enables you to define an
    InfoStructure, and create reports based on these InfoStructures. The InfoStructures define an index for
    the archive file data. At the moment, the archiving process in the BW system does not fill the
    InfoStructures during the archiving session automatically. This has to be performed manually when
    needed.
    Another way of displaying data from the archive file is by using the ‘Extractor checker’ (TCODE RSA3).
    Enter the name of the export DataSource of the respective data target (name of the data target preceded
    by ‘8’), and choose the archive files that are to be read. The extractor checker reads the selected archive
    files sequentially. Selection conditions can be entered for filtering but have to be entered in in internal
    format
    It will remain same in the change log table.
    Check this link :
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b32837f2-0c01-0010-68a3-c45f8443f01d
    Hope this helps you...........
    Regards,
    Debjani............

  • Insert data into oracle table from XML file

    I need to insert data into oracle table from XML file
    If anybody handled this type of scenario, Please let me know how to insert data into oracle table from XML file
    Thanks in advance

    The XML DB forum provides the best support for XML topics related to Oracle.
    Here's the FAQ on that forum:
    XML DB FAQ
    where there are plenty of examples of shredding XML into Oracle tables and such like. ;)

  • Function module to get data into internal table from Excel file sheets

    Hi,
    I have to upload customers from excel file.
    we are donloading customer data excel file sheets.
    Customer data in 1 sheet, tax data the other sheet of same excel file, Customer master-Credit data in other sheet of same excel file.
    so i have 3-4 sheet in one excel file.
    now my requirement is to get the data from excel file into internal table.
    is there any function module.
    Thanks & Regards

    I am sending you the idea with an example how you can upload data from an EXCEL file into an internal table. I am not sure if you can take data from different sheet in the same EXCEL file. I think that this is not possible (try it )
    Upload the data into an internal table, like the way that I am describing in the above:
      DATA: L_MAX_COL_NB TYPE I.
      DATA: l_file_name LIKE RLGRAP-FILENAME.
    Just to be sure that is the correct type for the FM.
      l_file_name = P_FILE_NAME.
      L_MAX_COL_NB = 58.  "Maximum nb of colums that the FM can read.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                FILENAME                = l_file_name
                I_BEGIN_COL             = 1
                I_BEGIN_ROW             = 2
                I_END_COL               = L_MAX_COL_NB
                I_END_ROW               = 9999
           TABLES
                INTERN                  = PT_EXCEL
           EXCEPTIONS
                INCONSISTENT_PARAMETERS = 1
                UPLOAD_OLE              = 2
                OTHERS                  = 3.
      IF SY-SUBRC <> 0.
      ENDIF.
    Now you should upload the data into your own itab. The Function Module will return to you all the an itab
    from all fields and columns. Define the structure of the uploading file into SE11 - Data Dictionary. Then read the fieldcatalog of this structure. In the code that I am sending to you, I am insearting an empty line into the internal table and then I am assigning this line into a corresponding field-symbol. Then I am able to change the working area - so and the line of the itab. Propably you could you the statement APPEND INITIAL LINE TO (your_table_name) ASSIGNING <your_field_symbol>, but the example was written in an old SAP version.
      FIELD-SYMBOLS:
                     <F_REC> LIKE WA_UPLOAD_FILE,      "working are of the uploading file
                     <F_FIELD> TYPE ANY.
      DATA: COLUMN_INT TYPE I,
            C_FIELDNAME(30) TYPE C.
      PERFORM GET_FIELDCATOLG TABLES FIELDCAT
                               USING 'ZECO_CHARALAMBOUS_FILE'.
      LOOP AT PT_EXCEL.
        AT NEW ROW.
          ASSIGN WA_UPLOAD_FILE TO <F_REC>.
        ENDAT.
        COLUMN_INT = PT_EXCEL-COL.
        READ TABLE FIELDCAT INTO WA_FIELDCAT INDEX COLUMN_INT.
        CONCATENATE '<F_REC>-' WA_FIELDCAT-FIELDNAME INTO C_FIELDNAME.
        ASSIGN (C_FIELDNAME) TO <F_FIELD>.
        <F_FIELD> = PT_EXCEL-VALUE.
        AT END OF ROW.
          APPEND WA_UPLOAD_FILE TO GT_UPLOAD_FILE.
          CLEAR WA_UPLOAD_FILE.
        ENDAT.
      ENDLOOP.
    With Regards
    George
    Edited by: giorgos michaelaris on Mar 4, 2010 3:44 PM

  • Right Tool to upload Contract data into SRM 5.0 system ?

    Hi,
        Could you tell me, the right tool to upload Contract data from SAP 4.5 into SRM 5.0 system using transaction code BBP_CTR_MAIN. ?
    What would be the problem, if i go with LSMW?
    Thanks in Advance,
    Bobby

    Hi Friends,
        Could any one suggest me which tool (BDC/ LSMW/ BAPI) is suited to upload Contract data from SAP 4.5 into SRM 5.0 using transaction code BBP_CTR_MAIN.I am confusing with Arshad's reply on this.
    Thanks in advance,
    Bobby

  • Can we load data in variable screen from flat file?

    Hello all,
    One of my user once asked me she needs to run a report for some employees, i said you can just type that in employee varaible input box.
    She said I need to run the report and I need it for 120 employees, she has the employee numbers in excel sheet.
    What is the best way of doing this if any ?
    Thanks

    This can be done from a flat file, which has list of all values.
    If you are using Bex 3.5, then we have an icon in variable screen bottom right to upload values, where we can specify the path of the file.
    Naveen.a

  • Getting error while loading  Data into ASO cube by flat file.

    Hi All,
    i am getting this error Essbase error 1270040: Data load buffer[1] does not exist while loading data into ASO cube.
    does anyone have solution.
    Regards,
    VM

    Are you using ODI to load the data or maxl? If you are using an ODI interface, are you using a load rule also which version of essbase and ODI are you using
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How to get raw data into BI system from maxdb database

    Hi Friends
    I have a scenario where i need to get the raw data from a maxdb database into my BI system.The data is stored in the sapdata folder of maxDB.
    Can you please throw somelight on it?
    Thanks in advance.....................................................

    Hi Rajat
    Please check SAP note 520647.
    It explain the steps for DB Multiconnect using DBCON
    Hope this helps
    Ravinder

  • Loading data into infocube in bi 7.0 from flat file.

    Hello  All,
    I need the complete procedure for loading data into the infocube from flat file in bi 7.0 i.e.using transformation,DTP etc.
    Please help me with some gud documents.

    Hi Pratighya,
    Step by step procedure for loading data from flat file.
    1. Create the infoobjects you might need in BI
    2. Create your target infoprovider
    3. . Create a source system
    4. Create a datasource
    5. Create and configure an Infopackage that will bring your records to the PSA
    6. Create a transformation from the datasource to the Infoprovider
    7. Create a Data Transfer Process (DTP) from the datasource to the Infoprovider
    8. Schedule the infopackage
    9. Once succesful, run the DTP
    10. This will fill your target.
    Hope this helps
    Regards
    Karthik

  • How can we upload the Time data into SAP system

    Dear all,
    ingeneral which method we can use to read the Time data and how can we upload that data into SAP system. Please any one can answer this asap.

    In the recent project that I have done.. the time data is uploaded from the external time recording machine.. in the form a file...
    The other way is through CATS... which in turn will populate the time entries as per hte work schedules... and will explicitly have to populate the deviations to the work scheudle by going through transactions..
    Please reward the points if it is helpful...
    Regards,
    Suvan,
    Yash Technologies Pvt Ltd, Hyderabad.
    Message was edited by:
            Suvan

  • Using bapi how to upload the data into sap database?

    hi dear all,
                  im facing problem with bapi ? let me edcuate on bapi ..
    i will be  waiting for reply.
    my e-id :[email protected]
    thanks&regards
    shiva.

    Hi
    A BAPI is a method of a SAP Business Object. BAPI enables SAP and third party applications to interact and integrate
    with each other at the Business Object / Process level.
    Check this link to know more about BAPI.
    http://www.sapgenie.com/abap/bapi/example.htm
    http://sappoint.com/abap/
    Batch Data Communication (BDC) is the oldest batch interfacing technique that SAP provided since the early versions of R/3. BDC is not a
    typical integration tool, in the sense that, it can be only be used for uploading data into R/3 and so it is not bi-directional.
    BDC works on the principle of simulating user input for transactional screen, via an ABAP program. Typically the input comes in the form
    of a flat file. The ABAP program reads this file and formats the input data screen by screen into an internal table (BDCDATA). The
    transaction is then started using this internal table as the input and executed in the background.
    In ‘Call Transaction’, the transactions are triggered at the time of processing itself and so the ABAP program must do the error handling.
    It can also be used for real-time interfaces and custom error handling & logging features. .
    To know more about BDC,
    check the link.
    http://sappoint.com/abap/
    Main differences are...
    In case of bdc data transfer takes place from flat file into sap system ie the file existing in sap system to sap sytem
    where is bapi's r remotly enabled function modules which are assigned to some business objects n used to transfer the data between different business partners who are using different systems other than sap.
    not only that...
    when you plan to upgrade your system version then bdc willnot support those upgradations where as bapi's will support.
    http://www.sap-img.com/abap/ale-bapi.htm
    SAP BAPI
    BAPI STEPS
    Hope this helps.
    ashish

  • Data loading from flat file into bw

    Hi Experts,
    When we load data from flat file into BW the <b>sequence of fields in flat file</b> should be matched with the <b>transfer structure</b> or <b>communication structure</b>?
    wid thanX,
    arijit

    Arijit,
    The sequence of fields in a flat file must be the same as this one in the transfer structure.
    The comm and tran structures are the same after the first creation of datasource from flat file source system. After that someone could change the sequence in the CS -- if the mapping of fields in transfer rules remains unchanged, then the load is to be succesful.
    In case of changing the sequence in TS you'll get either error or wrong load (values to be loaded into some infobjects will go to another ones.)
    Best regards,
    Eugene

  • How to  upload data from flat file to datastore object in BI 7.0

    Dear friends,
    Please tell me
    step by step process for upload data from flat file to datastore object in BI 7.0
    <removed by moderator>
    please help me
    Thanks,
    D.prabhu
    Edited by: Siegfried Szameitat on Aug 17, 2011 11:40 AM

    Create transformation on thr data source and keep the DSO as the target and load.
    Ravi Thothadri

Maybe you are looking for