Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem creating Service POs with BAPI_PO_CREATE1

Former Member
0 Likes
3,736

Hi.

I'm trying to create service POs with data that i read from an excel file, to do this I'm using the bapi: <b>BAPI_PO_CREATE1</b> I'm passing the following parameters:

IMPORT:

- poheader

- poheaderx

TABLES:

- return

- poitem

- poitemx

- poaccount

- poaccountx

- poservices

- posrvaccessvalues

- poservices text

- extensionin

When I execute the bapi, I'm getting the following messages into table return:

<i>W - Error transferring ExtensionIn data for enhancement CI_EKKODB

E - No instance of object type PurchaseOrder has been created. External reference:

E - PO header data still faulty

E - Purchase order date is in the past

I - Change WBS Element could not be effected

E - You cannot maintain service specs. due to incomplete transfer structure</i>

Can anybody, please say me what am i doing wrong? How this bapi works?

Regards.

Gregory.

Hi.

I'm trying to create service POs with data that i read from an excel file, to do this I'm using the bapi: <b>BAPI_PO_CREATE1</b> I'm passing the following parameters:

IMPORT:

- poheader

- poheaderx

TABLES:

- return

- poitem

- poitemx

- poaccount

- poaccountx

- poservices

- posrvaccessvalues

- poservices text

- extensionin

When I execute the bapi, I'm getting the following messages into table return:

<i>W - Error transferring ExtensionIn data for enhancement CI_EKKODB

E - No instance of object type PurchaseOrder has been created. External reference:

E - PO header data still faulty

E - Purchase order date is in the past

I - Change WBS Element could not be effected

E - You cannot maintain service specs. due to incomplete transfer structure</i>

Can anybody, please say me what am i doing wrong? How this bapi works?

Regards.

Gregory.

12 REPLIES 12
Read only

Former Member
0 Likes
2,684

Hello,

Chekc this sample report which is used to create the Service PO.

http://www.erpgenie.com/phpBB2/viewtopic.php?p=15525&sid=ea0812d14d0cbffb804e18d34040d521

If useful reward.

Vasanth

Read only

0 Likes
2,684

Hi Vasanth.

Thx for ur answer. I'm doing something like the code in the page (it has only particular differences).

Regards.

Gregory.

Read only

0 Likes
2,684

Hi all.

Please if somebody knows about this, I need help Urgent.

Regards.

Gregory.

Read only

0 Likes
2,684

Hi all.

I wanna know whats the relationship betwen poitem, poaccount, poservices and posrvaccessvalues. I mean the fields that relate those tables.

Please i need help on this, its urgent.

Regards.

Gregory.

Read only

0 Likes
2,684

Hi,

Vasanth

i try this code which u give the link but it shows the error check the poitem.

can you help me

Read only

Former Member
0 Likes
2,684

Gregory Mayorga ,

W - Error transferring ExtensionIn data for enhancement CI_EKKODB

You have extension in standard PO, check whether you are passing all required data.

E - No instance of object type PurchaseOrder has been created. External reference:

E - PO header data still faulty

You still miss some parameters / passed information is wrong like PO date

E - Purchase order date is in the past

PO date is past, I believe that you are using old saved data

I - Change WBS Element could not be effected

E - You cannot maintain service specs. due to incomplete transfer structure

Let me try to get you some sample data..

reward if helpful

Read only

0 Likes
2,684

Hey.

Thx for ur answer Nallasamy.

In my previous post i ask for the relationship between the tables because now i'm getting the error: <b>In case of account assignment, please enter acc. assignment data for item</b>.

I guess that the relationship was as follows (but still getting the error):

BT poitem and poaccount: field po_item

BT poitem and poservices: field pckg_no

BT poservices and po_srv_accessvalues: fields pckg_no, line_no

BT po_account and po_srv_accessvalues: field serial_no.

Now i have 1 item and 4 WBS and for each WBS a few services, i make the tables relations as i say above but still having the error.

What am i doing wrong?

Regards.

Gregory.

Read only

0 Likes
2,684

Check the following parameters..ensure they are passed correctly.

Parameter: POACCOUNT

PO_ITEM = 00001

SERIAL_NO = 01

QUANTITY = 15.000

GL_ACCOUNT = 0000400000

COSTCENTER = 0000001000

CO_AREA = 1000

Parameter: POACCOUNTX

PO_ITEM = 00001

SERIAL_NO = 01

QUANTITY = X

GL_ACCOUNT = X

COSTCENTER = X

CO_AREA = X

Check the same line item by creating PO using ME21N, if that goes through..then the issue is how you pass the data. If it gives the same error message, then its a config issue.

Read only

0 Likes
2,684

Hi Nallasamy.

I've already read this example.

My problem is with the relationship, between poaccount, poservices and posrvaccessvalues.

Regards.

Gregory.

Read only

0 Likes
2,684

Hello My friend

Check this code:

Code listing for: LZMMIUP001F01

Description: Include LZMMIUP001F01

-


----


***INCLUDE LZMMIUP001F01 .

----


&----


*& Form fill_item

&----


  • text

----


  • -->P_WA text

----


FORM fill_item TABLES: poitem STRUCTURE bapimepoitem "Item Data

poitemx STRUCTURE bapimepoitemx "Item Data (Change Parameter

USING wa STRUCTURE zlo_mmcnv009

package.

  • item number

poitem-po_item = wa-itemnum.

poitemx-po_itemx = 'X'.

poitemx-po_item = wa-itemnum.

IF package <> ''.

poitem-pckg_no = package.

poitemx-pckg_no = 'X'.

ENDIF.

*Account Assignment Category

IF wa-category <> ''.

poitem-acctasscat = wa-category.

poitemx-acctasscat = 'X'.

ENDIF.

*Item Category in Purchasing Document

IF wa-itemcat <> ''.

poitem-item_cat = wa-itemcat.

poitemx-item_cat = 'X'.

ENDIF.

*Short Text

IF wa-sortxt <> ''.

poitem-short_text = wa-sortxt.

poitemx-short_text = 'X'.

ENDIF.

*Material Number

IF wa-material <> ''.

poitem-material = wa-material.

poitemx-material = 'X'.

ENDIF.

  • Unit of Measure

IF wa-undmesure <> ''.

poitem-po_unit = wa-undmesure.

poitemx-po_unit = 'X'.

ENDIF.

*Purchase Order Quantity

IF wa-quantity <> ''.

poitem-quantity = wa-quantity.

poitemx-quantity = 'X'.

ENDIF.

*Net Price in Purchasing Document

IF wa-netprice <> ''.

poitem-net_price = wa-netprice.

poitemx-net_price = 'X'.

ENDIF.

*Plant

IF wa-plant <> ''.

poitem-plant = wa-plant.

poitemx-plant = 'X'.

ENDIF.

*Material Group

IF wa-matgrp <> ''.

poitem-matl_group = wa-matgrp.

poitemx-matl_group = 'X'.

ENDIF.

*Free Item

IF wa-free <> ''.

poitem-free_item = wa-free.

poitemx-free_item = 'X'.

ENDIF.

APPEND poitem.

APPEND poitemx.

ENDFORM. " fill_item

&----


*& Form fill_header

&----


  • text

----


  • -->P_WA text

----


FORM fill_header USING wa STRUCTURE zlo_mmcnv009

poheader STRUCTURE bapimepoheader "Header Data

poheaderx STRUCTURE bapimepoheaderx. "Header Data (Change Toolbar)

DATA: dia(2), mes(2), ano(4),

vendor(10) TYPE n.

dia = wa-docdate(2).

mes = wa-docdate+2(2).

ano = wa-docdate+4(4).

CONCATENATE ano mes dia INTO wa-docdate.

dia = wa-datestart(2).

mes = wa-datestart+2(2).

ano = wa-datestart+4(4).

CONCATENATE ano mes dia INTO wa-datestart.

dia = wa-datend(2).

mes = wa-datend+2(2).

ano = wa-datend+4(4).

CONCATENATE ano mes dia INTO wa-datend.

  • Document Type

IF wa-doctyp <> ''.

poheader-doc_type = wa-doctyp.

poheaderx-doc_type = 'X'.

ENDIF.

  • vendor number

IF wa-vendor <> ''.

IF NOT ( wa-vendor CA sy-abcde ).

vendor = wa-vendor.

poheader-vendor = vendor.

poheaderx-vendor = 'X'.

ELSE.

poheader-vendor = wa-vendor.

poheaderx-vendor = 'X'.

ENDIF.

ENDIF.

  • Document Date

IF wa-docdate <> ''.

poheader-doc_date = wa-docdate.

poheaderx-doc_date = 'X'.

ENDIF.

  • purchasing organization

IF wa-organiz <> ''.

poheader-purch_org = wa-organiz.

poheaderx-purch_org = 'X'.

ENDIF.

  • Purchasing Group

IF wa-purgroup <> ''.

poheader-pur_group = wa-purgroup.

poheaderx-pur_group = 'X'.

ENDIF.

  • Start of Validity Period

IF wa-datestart <> ''.

poheader-vper_start = wa-datestart.

poheaderx-vper_start = 'X'.

ENDIF.

  • End of Validity Period

IF wa-datend <> ''.

poheader-vper_end = wa-datend.

poheaderx-vper_end = 'X'.

ENDIF.

  • Company Code

IF wa-compcode <> ''.

poheader-comp_code = wa-compcode.

poheaderx-comp_code = 'X'.

ENDIF.

  • Status of Purchasing Document

IF wa-status <> ''.

poheader-status = wa-status.

poheaderx-status = 'X'.

ENDIF.

ENDFORM. " fill_header

&----


*& Form fill_account

&----


  • text

----


  • -->P_WA text

----


FORM fill_account TABLES poaccount STRUCTURE bapimepoaccount

poaccountx STRUCTURE bapimepoaccountx

USING wa STRUCTURE zlo_mmcnv009.

DATA: account(10) TYPE n.

poaccount-po_item = wa-itemnum.

poaccountx-po_item = wa-itemnum.

*Cost Centre

poaccount-costcenter = wa-coscenter.

poaccountx-costcenter = 'X'.

*Order Number

poaccount-orderid = wa-ordernumb.

poaccountx-orderid = 'X'.

*"G/L Account Number

IF wa-accnumb <> ''.

account = wa-accnumb.

poaccount-gl_account = account."wa-accnumb.

poaccountx-gl_account = 'X'.

ENDIF.

IF NOT ( wa-coscenter = '' AND

wa-ordernumb = '' AND

wa-accnumb = '' ).

APPEND poaccount.

APPEND poaccountx.

ENDIF.

ENDFORM. " fill_account

&----


*& Form fill_schedule

&----


  • text

----


  • -->P_WA text

----


FORM fill_schedule TABLES poschedule STRUCTURE bapimeposchedule

poschedulex STRUCTURE bapimeposchedulx

USING wa STRUCTURE zlo_mmcnv009.

DATA: dia(2), mes(2), ano(4).

dia = wa-delivdate(2).

mes = wa-delivdate+2(2).

ano = wa-delivdate+4(4).

CONCATENATE ano mes dia INTO wa-delivdate.

*Delivery Date

poschedule-po_item = wa-itemnum.

poschedulex-po_item = wa-itemnum.

poschedule-delivery_date = wa-delivdate.

poschedulex-delivery_date = 'X'.

IF NOT wa-delivdate = ''.

APPEND poschedule.

APPEND poschedulex.

ENDIF.

ENDFORM. " fill_schedule

&----


*& Form fill_header_contract

&----


  • text

----


  • -->P_WA text

  • -->P_HEADER text

  • -->P_HEADERX text

----


FORM fill_header_contract USING wa STRUCTURE zlo_mmcnv009

coheader STRUCTURE bapimeoutheader

coheaderx STRUCTURE bapimeoutheaderx.

DATA: dia(2), mes(2), ano(4).

dia = wa-datestart(2).

mes = wa-datestart+2(2).

ano = wa-datestart+4(4).

CONCATENATE ano mes dia INTO wa-datestart.

dia = wa-datend(2).

mes = wa-datend+2(2).

ano = wa-datend+4(4).

CONCATENATE ano mes dia INTO wa-datend.

  • Purchasing Document Date

coheader-doc_date = sy-datum.

coheaderx-doc_date = 'X'.

*Item Number Interval

coheader-item_intvl = '10'.

coheaderx-item_intvl = 'X'.

  • Currency Key

coheader-currency = 'BHD'.

coheaderx-currency = 'X'.

  • languaje

coheader-langu = 'EN'.

coheaderx-langu = 'X'.

  • Document Type

IF wa-doctyp <> ''.

coheader-doc_type = wa-doctyp.

coheaderx-doc_type = 'X'.

ENDIF.

  • vendor number

IF wa-vendor <> ''.

coheader-vendor = wa-vendor.

coheaderx-vendor = 'X'.

ENDIF.

  • purchasing organization

IF wa-organiz <> ''.

coheader-purch_org = wa-organiz.

coheaderx-purch_org = 'X'.

ENDIF.

  • Purchasing Group

IF wa-purgroup <> ''.

coheader-pur_group = wa-purgroup.

coheaderx-pur_group = 'X'.

ENDIF.

  • Start of Validity Period

IF wa-datestart <> ''.

coheader-vper_start = wa-datestart.

coheaderx-vper_start = 'X'.

ENDIF.

  • End of Validity Period

IF wa-datend <> ''.

coheader-vper_end = wa-datend.

coheaderx-vper_end = 'X'.

ENDIF.

ENDFORM. " fill_header_contract

&----


*& Form fill_item_contract

&----


  • text

----


  • -->P_WA text

  • -->P_COITEM text

  • -->P_COITEMX text

----


FORM fill_item_contract TABLES: coitem STRUCTURE bapimeoutitem

coitemx STRUCTURE bapimeoutitemx

USING wa STRUCTURE zlo_mmcnv009.

  • item number

coitem-item_no = wa-itemnum.

coitemx-item_no = wa-itemnum.

coitemx-item_nox = 'X'.

*Material Number

IF wa-material <> ''.

coitem-material = wa-material.

coitemx-material = 'X'.

ENDIF.

*Target Quantity

IF wa-quantity <> ''.

coitem-target_qty = wa-quantity.

coitemx-target_qty = 'X'.

ENDIF.

*Net Price in Purchasing Document

IF wa-netprice <> ''.

coitem-net_price = wa-netprice.

coitemx-net_price = 'X'.

ENDIF.

APPEND coitem.

APPEND coitemx.

ENDFORM. " fill_item_contract

&----


*& Form fill_service

&----


  • text

----


  • -->P_POSERVICES text

  • -->P_T_ITEM text

  • -->P_ITEMNUM text

----


FORM fill_service TABLES poservices STRUCTURE bapiesllc

t_item STRUCTURE zlo_mmcnv009

poservices_2 STRUCTURE bapiesklc

USING itemnum packno.

DATA: line(10) TYPE n,

service(18) TYPE n,

packno2(10) TYPE n.

poservices-pckg_no = packno.

packno2 = packno.

packno = packno + 1.

poservices-line_no = '0000000001'.

poservices-outl_ind = 'X'.

poservices-subpckg_no = packno.

APPEND poservices.

line = '0000000002'.

LOOP AT t_item WHERE itemnum = itemnum.

IF t_item-activity <> ''.

IF NOT ( t_item-activity CA sy-abcde ).

service = t_item-activity.

poservices-service = service.

ELSE.

poservices-service = t_item-activity.

ENDIF.

ELSE.

poservices-service = t_item-activity.

ENDIF.

poservices-pckg_no = packno.

poservices-line_no = line. "itemnum.

poservices-ext_line = t_item-line.

poservices-quantity = t_item-quantity1.

poservices-base_uom = t_item-undmed.

poservices-gr_price = t_item-price.

poservices-short_text = t_item-shortxt.

poservices-subpckg_no = '0000000000'.

poservices-outl_ind = ''.

APPEND poservices.

poservices_2-pckg_no = packno.

poservices_2-line_no = line.

  • poservices_2-SERNO_LINE =

  • poservices_2-SERIAL_NO =

poservices_2-quantity = t_item-quantity1.

poservices_2-net_value = t_item-price.

APPEND poservices_2.

line = line + 1.

ENDLOOP.

ENDFORM. " fill_service

&----


*& Form fill_pocond

&----


  • text

----


  • -->P_POCOND text

  • -->P_POCONDX text

  • -->P_WA text

----


FORM fill_pocond TABLES pocond STRUCTURE bapimepocond

pocondx STRUCTURE bapimepocondx

USING wa STRUCTURE zlo_mmcnv009.

*Net Price in Purchasing Document

IF wa-netprice <> ''.

pocond-itm_number = wa-itemnum.

pocondx-itm_number = wa-itemnum.

pocond-cond_value = wa-netprice.

pocondx-cond_value = 'X'.

pocond-currency = 'BHD'.

pocondx-currency = 'X'.

pocond-cond_type = 'PBXX'.

pocondx-cond_type = 'X'.

*COND_TYPE

APPEND pocond.

APPEND pocondx.

ENDIF.

ENDFORM. " fill_pocond

Read only

0 Likes
2,684

Hi guys. Thx for ur answers.

Medhan the error about extensionin was sollved, the cause was a wrong population of the structure.

Gabriel. My problem is that i dont know how to relate poaccount, poservices and posrvaccessvalues tables.

By the example code i understand that the relationship between poitem and poaccount is 1:1. If there is true: how can i create a PO with 2 items, one item has several services that input several costcenters and the other has several services that input several WBS's?

Is necessary to pass the orderid to the poaccount table?

The following example is what i want to create using the bapi:

ITEM 1

SRV 1 inputs Costenter 1

SRV 2 inputs Costenter 1

SRV 3 inputs Costenter 2

SRV 4 inputs Costenter 2

SRV 5 inputs Costenter 3

ITEM 2

SRV 1 inputs WBS 1

SRV 2 inputs WBS 2

SRV 3 inputs WBS 2

SRV 4 inputs WBS 3

What tables must i fill and pass to the bapi?

Regards.

Gregory.

Read only

Former Member
0 Likes
2,684

Hi

Check your EKKO extension structure CI_EKKODB and check whether the fields in that structure are populated with right values.

You may have to check the user exit, probably in the user exit 'EXIT_SAPMM06E_006', they may be passing values to the extension structure.

Let me know, if you need further information

Regards

MD