cancel
Showing results for 
Search instead for 
Did you mean: 

Upload PO data into SRM system from flat file

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sharad,

Please go through the following thread:

Kindly let us know what errors you are facing so that we will be able to analyse the problem better.

Thanks,

Pradeep

Former Member
0 Kudos

Hi Pradeep,

Thanks for u r replay ....I have tried using this but i am not sure what parameter need to pass .

Could u plz give the what all parameter need to pass so it will be create PO .

thanks

sharad

Former Member
0 Kudos

Hi Sharad,

To find out which all parameters have to be passed, please see the documentation of this BAPI which is available in SE37. A very neat explanation has been provided in the BAPI documentation.

Eg:

Required fields

The following fields are absolutely necessary for the system to be able

save the purchase order.

o Transaction type

o Logical FI system

o Company code in FI system

o Organizational data

Thanks,

Pradeep

Former Member
0 Kudos

Hi ,

Thanks I have gone through these doc and i have done the same but still it not creating the PO

Former Member
0 Kudos

Hi ,

Then tell us what are the errors you are getting?.. Without looking into it how can we tell you what the problem is?

Thanks,

Pradeep

Former Member
0 Kudos

This is error i am getting.

TYPE E

ID COM_PRODUCT_SETTINGS

NUMBER 001

MESSAGE Product ID is longer than the Customizing s

LOG_NO

LOG_MSG_NO 000000

MESSAGE_V1 200930000000000000

MESSAGE_V2 18

MESSAGE_V3

MESSAGE_V4

PARAMETER

ROW 0

FIELD

SYSTEM PS5CLNT100

Former Member
0 Kudos

Hi,

I feel this error is related to the data that you are passing to the BAPI parameters. Check the value you are passing in I_PO_ITEMS-PRODUCT_ID. Is it longer than the allowed value of 40 characters??

Thanks,

Pradeep

Former Member
0 Kudos

Please make sure you pass the product id of size 18, (prefixed with 0 to make it of size 18 if needed).

Regards, Kathirvel

Answers (2)

Answers (2)

Former Member
0 Kudos

HI

I am getting error for partner function

Former Member
0 Kudos

Hi Sharad,

I think purchase group given in flat file is not existing in config. Please check

Former Member
0 Kudos

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

Former Member
0 Kudos

How can I know the list of fields required/optional for the PO upload (Header, item, AAC) etc?

Former Member
0 Kudos

HI gurus

I am getting this error while creationg PO using the bapi

Enter exactly one partner of type Supplier

First maintain the purchasing data for the vendor

Supplier 0020000000 not intended for purch. org.

Partner of type Supplier is not authorized for this document; check entry,

But when i Try to create direct PO form Web its working for same vendor.

Plz reply Regard

sharad