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

Unable to create PR with header text/note using BAPI_PR_CREATE

Former Member
0 Likes
2,192

Hi all,

I have successfully created purchase requisition using BAPI_PR_CREATE. But, the bapi is not creating header text/note for the PR even when I give inputs for the same.

I have given the following inputs.

structure name: PRHEADERTEXT

PRHEADERTEXT-PREQ_NO =

PRHEADERTEXT-PREQ_ITEM = '0010'

PRHEADERTEXT-TEXT_ID = 'B01'

PRHEADERTEXT-TEXT_FORM = 'EN'

PRHEADERTEXT-TEXT_LINE = 'New text'

How can I create PR with header text/note using BAPI_PR_CREATE.

Thanks & Regards,

Rajan

Edited by: Rajan Usman Basha on Jan 6, 2009 11:29 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,366

Hi

is better late than never

structure name: PRHEADERTEXT

just a little correction in the code and...at enjoy the sweet glory

*PRHEADERTEXT-PREQ_NO = "Not necesary for creation of PR

*PRHEADERTEXT-PREQ_ITEM = '0010' "Not necesary for creation of PR

PRHEADERTEXT-TEXT_ID = 'B01'

*PRHEADERTEXT-TEXT_FORM = 'EN' "Not necesary for creation of PR

PRHEADERTEXT-TEXT_LINE = 'New text'

Good luck

6 REPLIES 6
Read only

Former Member
0 Likes
1,366

example

REPORT ZPURCHASEORDER.

data:

header like BAPIMEPOHEADER,

headerx like BAPIMEPOHEADERX,

it_item like standard table of BAPIMEPOITEM,

it_itemx like standard table of BAPIMEPOITEMX,

return like standard table of BAPIRET2,

wa_item like BAPIMEPOITEM,

wa_itemx like BAPIMEPOITEMX,

p_int type i,

p_matnr like mara-matnr,

p_pono like ekko-ebeln.

DATA: BEGIN OF BAPIRETURN OCCURS 0.

INCLUDE STRUCTURE BAPIRET2.

DATA: END OF BAPIRETURN.

constants:

c_x type c value 'X'.

header-comp_code = '3000'.

header-doc_type = 'DP25'.

header-creat_date = sy-datum.

header-item_intvl = '10'.

header-vendor = 'ARAMI-00'.

header-langu = sy-langu.

header-pmnttrms = '0001'.

header-purch_org = '3000'.

header-pur_group = '010'.

header-currency = 'USD'.

headerx-comp_code = c_x.

headerx-doc_type = c_x.

headerx-creat_date = c_x.

headerx-item_intvl = c_x .

headerx-vendor = c_x.

headerx-langu = c_x.

headerx-pmnttrms = c_x .

headerx-purch_org = c_x.

headerx-pur_group = c_x.

*LOOP AT it_final2 INTO wa_final2.

p_int = p_int + 10.

wa_item-po_item = p_int.

p_matnr = 'T-SRM01'.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

input = p_matnr

IMPORTING

output = p_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.

wa_item-material = p_matnr.

wa_item-plant = '3200'.

wa_item-quantity = 100.

wa_item-conf_ctrl = 'Z01'.

wa_item-ACKN_REQD = 'X'.

WA_ITEM-ERS = ''.

APPEND wa_item TO it_item.

wa_itemx-po_item = p_int.

wa_itemx-material = c_x.

wa_itemx-plant = c_x .

wa_itemx-stge_loc = c_x .

wa_itemx-quantity = c_x .

wa_itemx-item_cat = c_x .

wa_itemx-acctasscat = c_x .

wa_itemx-conf_ctrl = 'X'.

wa_itemx-ACKN_REQD = 'X'.

WA_ITEMX-ERS = 'X'.

APPEND wa_itemx TO it_itemx.

*ENDLOOP.

CALL FUNCTION 'BAPI_PO_CREATE1'

EXPORTING

poheader = header

poheaderx = headerx

IMPORTING

exppurchaseorder = p_pono

TABLES

return = return

poitem = it_item

poitemx = it_itemx.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'

IMPORTING

RETURN = BAPIRETURN.

write:/ p_pono.

Read only

0 Likes
1,366

Hi Krupa,

Thanks for the reply. In this example, you are not passing any values for BAPIMEREQHEADTEXT which is a structure for header text or note.

please get me some other example code, where you have given inputs for header text/note.

Once again Thanks,

Rajan

Read only

Former Member
0 Likes
1,367

Hi

is better late than never

structure name: PRHEADERTEXT

just a little correction in the code and...at enjoy the sweet glory

*PRHEADERTEXT-PREQ_NO = "Not necesary for creation of PR

*PRHEADERTEXT-PREQ_ITEM = '0010' "Not necesary for creation of PR

PRHEADERTEXT-TEXT_ID = 'B01'

*PRHEADERTEXT-TEXT_FORM = 'EN' "Not necesary for creation of PR

PRHEADERTEXT-TEXT_LINE = 'New text'

Good luck

Read only

0 Likes
1,366

Hey..

The above code is not working.

You have inserted PRHEADERTEXT-TEXT_ID = 'B01'.

As I know 'B01' belongs to  Item Details -> Texts tab -> Item text

plse suggest.

Thanks.

Hitesh

Read only

Former Member
0 Likes
1,366

Thanks for the replies

Read only

0 Likes
1,366

Hey do your problem get resolved. If yes, How?