Application Development 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: 

error in BAPI_PO_CREATE1

Former Member
0 Kudos
149

Hi all,

Can anyone tell me how to use FM BAPI_PO_CREATE1.I am getting this error.

"Type conflict when calling a function module (field length)"

This is my code.

REPORT Z8CKG_BAPI_PO_CREATE1_T1.

  • PO HEADER DETAILS.

TYPES: BEGIN OF T_PO_HEADER.

INCLUDE STRUCTURE BAPIMEPOHEADER.

TYPES: END OF T_PO_HEADER.

TYPES: BEGIN OF T_PO_HEADERX.

INCLUDE STRUCTURE BAPIMEPOHEADERX.

TYPES: END OF T_PO_HEADERX.

  • PO ITEMS DETAILS.

TYPES: BEGIN OF T_PO_ITEMS.

INCLUDE STRUCTURE BAPIMEPOITEM.

TYPES: END OF T_PO_ITEMS.

TYPES: BEGIN OF T_PO_ITEMX.

INCLUDE STRUCTURE BAPIMEPOITEMX.

TYPES: END OF T_PO_ITEMX.

DATA: I_PO_HEADER TYPE STANDARD TABLE OF T_PO_HEADER,

I_PO_HEADERX TYPE STANDARD TABLE OF T_PO_HEADER,

I_PO_ITEMS TYPE STANDARD TABLE OF T_PO_ITEMS,

I_PO_ITEMX TYPE STANDARD TABLE OF T_PO_ITEMS.

DATA: WA_PO_HEADER TYPE T_PO_HEADER,

WA_PO_HEADERX TYPE T_PO_HEADER,

WA_PO_ITEMS TYPE T_PO_ITEMS,

WA_PO_ITEMX TYPE T_PO_ITEMS.

DATA: PUR_ORDER LIKE BAPIMEPOHEADER-PO_NUMBER,

C_X(1) TYPE C VALUE 'X'.

  • START OF SELECTION.

START-OF-SELECTION.

  • HEADER DETAILS.

WA_PO_HEADER-COMP_CODE = '0001'.

WA_PO_HEADER-DOC_TYPE = 'NB'.

WA_PO_HEADER-CREAT_DATE = SY-DATUM.

WA_PO_HEADER-CREATED_BY = 'DEVELOPER'.

WA_PO_HEADER-VENDOR = 'V1'.

WA_PO_HEADER-PURCH_ORG = '001'.

WA_PO_HEADER-CURRENCY = 'INR'.

WA_PO_HEADER-SALES_PERS = 'CHINMAY GHOSH'.

WA_PO_HEADER-TELEPHONE = '090019909'.

  • HEADERX DETAILS.

WA_PO_HEADERX-COMP_CODE = C_X.

WA_PO_HEADERX-DOC_TYPE = C_X.

WA_PO_HEADERX-CREAT_DATE = C_X.

WA_PO_HEADERX-CREATED_BY = C_X.

WA_PO_HEADERX-VENDOR = C_X.

WA_PO_HEADERX-PURCH_ORG = C_X.

WA_PO_HEADERX-CURRENCY = C_X.

WA_PO_HEADERX-SALES_PERS = C_X.

WA_PO_HEADERX-TELEPHONE = C_X.

  • ITEM DETAILS.

WA_PO_ITEMS-PO_ITEM = '10'.

WA_PO_ITEMS-MATERIAL = 'RM1'.

WA_PO_ITEMS-SHORT_TEXT = 'RAW MATERIAL1'.

WA_PO_ITEMS-PLANT = '0001'.

WA_PO_ITEMS-QUANTITY = '100'.

  • ITEMX DETAILS.

WA_PO_ITEMX-PO_ITEM = '10'.

WA_PO_ITEMX-MATERIAL = C_X.

WA_PO_ITEMX-SHORT_TEXT = C_X.

WA_PO_ITEMX-PLANT = C_X.

*WA_PO_ITEMX-QUANTITY = 'X'.

APPEND WA_PO_ITEMS TO I_PO_ITEMS.

APPEND WA_PO_ITEMX TO I_PO_ITEMX.

  • ITEM DETAILS.

WA_PO_ITEMS-PO_ITEM = '20'.

WA_PO_ITEMS-MATERIAL = 'RM2'.

WA_PO_ITEMS-SHORT_TEXT = 'RAW MATERIAL2'.

WA_PO_ITEMS-PLANT = '0001'.

WA_PO_ITEMS-QUANTITY = '150'.

  • ITEMX DETAILS.

WA_PO_ITEMX-PO_ITEM = '10'.

WA_PO_ITEMX-MATERIAL = C_X.

WA_PO_ITEMX-SHORT_TEXT = C_X.

WA_PO_ITEMX-PLANT = C_X.

*WA_PO_ITEMX-QUANTITY = C_X.

APPEND WA_PO_ITEMS TO I_PO_ITEMS.

APPEND WA_PO_ITEMX TO I_PO_ITEMX.

  • ITEM DETAILS.

WA_PO_ITEMS-PO_ITEM = '30'.

WA_PO_ITEMS-MATERIAL = 'RM3'.

WA_PO_ITEMS-SHORT_TEXT = 'RAW MATERIAL3'.

WA_PO_ITEMS-PLANT = '0001'.

WA_PO_ITEMS-QUANTITY = '200'.

  • ITEMX DETAILS.

WA_PO_ITEMX-PO_ITEM = '10'.

WA_PO_ITEMX-MATERIAL = C_X.

WA_PO_ITEMX-SHORT_TEXT = C_X.

WA_PO_ITEMX-PLANT = C_X.

*WA_PO_ITEMX-QUANTITY = C_X.

APPEND WA_PO_ITEMS TO I_PO_ITEMS.

APPEND WA_PO_ITEMX TO I_PO_ITEMX.

CALL FUNCTION 'BAPI_PO_CREATE1'

EXPORTING

poheader = WA_PO_HEADER

POHEADERX = WA_PO_HEADERX

  • POADDRVENDOR =

  • TESTRUN =

  • MEMORY_UNCOMPLETE =

  • MEMORY_COMPLETE =

  • POEXPIMPHEADER =

  • POEXPIMPHEADERX =

  • VERSIONS =

  • NO_MESSAGING =

  • NO_MESSAGE_REQ =

  • NO_AUTHORITY =

  • NO_PRICE_FROM_PO =

IMPORTING

EXPPURCHASEORDER = PUR_ORDER

  • EXPHEADER =

  • EXPPOEXPIMPHEADER =

TABLES

  • RETURN =

POITEM = I_PO_ITEMS

POITEMX = I_PO_ITEMX

  • POADDRDELIVERY =

  • POSCHEDULE =

  • POSCHEDULEX =

  • POACCOUNT =

  • POACCOUNTPROFITSEGMENT =

  • POACCOUNTX =

  • POCONDHEADER =

  • POCONDHEADERX =

  • POCOND =

  • POCONDX =

  • POLIMITS =

  • POCONTRACTLIMITS =

  • POSERVICES =

  • POSRVACCESSVALUES =

  • POSERVICESTEXT =

  • EXTENSIONIN =

  • EXTENSIONOUT =

  • POEXPIMPITEM =

  • POEXPIMPITEMX =

  • POTEXTHEADER =

  • POTEXTITEM =

  • ALLVERSIONS =

  • POPARTNER =

.

WRITE:/5 PUR_ORDER.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
80

Hi Chinmay

Please make below changes:

[code]DATA: WA_PO_HEADER TYPE T_PO_HEADER,

<b>WA_PO_HEADERX TYPE T_PO_HEADERX,</b>

WA_PO_ITEMS TYPE T_PO_ITEMS,

<b>WA_PO_ITEMX TYPE T_PO_ITEMSX.[/</b>code]

Regards

Eswar

8 REPLIES 8

Former Member
0 Kudos
80

hi Chinmay,

you need to change the following declerations:

DATA: WA_PO_HEADER TYPE T_PO_HEADER,

WA_PO_HEADERX TYPE T_PO_HEADER,

<b>and re-write as mentioned below:</b>

DATA: WA_PO_HEADER TYPE BAPIMEPOHEADER,
           WA_PO_HEADERX TYPE BAPIMEPOHEADERX.

Hope this helps.

Sajan Joseph.

Message was edited by:

Sajan Joseph

Former Member
0 Kudos
81

Hi Chinmay

Please make below changes:

[code]DATA: WA_PO_HEADER TYPE T_PO_HEADER,

<b>WA_PO_HEADERX TYPE T_PO_HEADERX,</b>

WA_PO_ITEMS TYPE T_PO_ITEMS,

<b>WA_PO_ITEMX TYPE T_PO_ITEMSX.[/</b>code]

Regards

Eswar

0 Kudos
80

ok i have corrected that still it is giving me error.

Exception condition "FAILURE" raised.

Tell me what are the required parameters to be passed so as to create PO.

0 Kudos
80

This is the source code where error is happening.

METHOD get.

IF my_manager is initial.

CALL METHOD get_manager.

ENDIF.

CALL METHOD my_manager->search EXPORTING im_id = im_id

IMPORTING ex_handle = ex_handle

EXCEPTIONS failure = 01.

IF sy-subrc ne 0.

RAISE failure.

ENDIF.

ENDMETHOD.

0 Kudos
80

Thats because you didnt reward points for the answers! <b>JUST KIDDING</b>.

There are no more mandatory fields, other than the POHEADER field, which you have already passed.

The error can be due to incorrect data passed.

Sajan Joseph.

0 Kudos
80

Don't worry once my problem is solved i will be giving points.No, i have passed correct data still it is showing me that errror.

former_member404244
Active Contributor
0 Kudos
80

Hi,

u can directly declare the internal table and workarea like this

DATA: I_PO_HEADER TYPE STANDARD TABLE OF BAPIMEPOHEADER,

I_PO_HEADERX TYPE STANDARD TABLE OF BAPIMEPOHEADERX,

I_PO_ITEMS TYPE STANDARD TABLE OF BAPIMEPOITEM,

I_PO_ITEMX TYPE STANDARD TABLE OF BAPIMEPOITEM.

DATA: WA_PO_HEADER TYPE BAPIMEPOHEADER,

WA_PO_HEADERX TYPE BAPIMEPOHEADERX,

WA_PO_ITEMS TYPE BAPIMEPOITEM,

WA_PO_ITEMX TYPE BAPIMEPOITEM.

Regards,

Nagaraj

Former Member
0 Kudos
80

Thanks for all ur valuable replies......