BAPI_PR_CREATE
Hi gurus,
Please, anyone can explain me how to use and fill the BAPI_PR_CREATE for create a purchase requisition.
Regards in advance for the help
Enzo.
Hi,
You should be able to find the documentaion in the FM of the BAPI, se37. Where the parameters would be defined.
Regards
Harish
Similar Messages
-
Error on creation of PR using BAPI_PR_CREATE
Hello All,
while creating a PR using BAPI_PR_CREATE getting an error simultaneously a PR is creating
The error is Enter a G/L Account. Even when I am providing with the G/L Account number.
There is one input field as SERIAL_NO in tables PRACCOUNT and PRACCOUNTX. If I give SERIAL_NO as 00 in tables PRACCOUNT and PRACCOUNTX, then it gives the same error but and no PR is created but if i give 01 it gives the same error but and now PR is created simultaneouly .
Using the same details if I execute BAPI_REQUISITION_CREATE and SERIAL_NO as 00, the PR is successfully created.
Please let me know if anybody worked on it.
Thanks & Regards,
Ruchi TiwariHi,
you just need to populate the following fields:
praccount-preq_item = '10'. <--- this depends on how many items you have in your PR.
praccount-serial_no = '1'. <--- this one is required, in case you split the qty of the item by G/L or Cost Center.
dont forget to populate the ff. fields in the Purchase Requisition Change Parameter - Account Assignment table.
praccountx-preq_item = '10'.
praccountx-serial_no = '1'.
Thanks & regards,
ShreeMohan -
Capture an error while creating a purchase requisition (BAPI_PR_CREATE)
Hi All,
I am using FM BAPI_PR_CREATE to create purchase requesition, Now my problem is that i have various items for single material now i wan to capture the error if any item has ?
Please let me know how to do so?
Thanks & Regards,
Ruchi TiwariHi,
To get the error messages after the BAPI_PR_CREATE is called,
loop at the return table which will contain the system messages and call the following FM
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = LS_MESSAGES-MSGID
LANG = '-D'
NO = LS_MESSAGES-MSGNR
V1 = LS_MESSAGES-MSGV1
V2 = LS_MESSAGES-MSGV2
V3 = LS_MESSAGES-MSGV3
V4 = LS_MESSAGES-MSGV4
IMPORTING
MSG = LV_MESSAGE
EXCEPTIONS
NOT_FOUND = 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. -
Error Message: Enter Plant, ME 083 in BAPI_PR_CREATE in Batch Log of batch
Hi Experts,
Am creating the Purc Requisations of EBAN table, by using BAPI_PR_CREATE from my " Z " prog.
They are creating fine, but, in JOB LOG(when scheduled as BATCH JOB), am getting an error as
" ENTER PLANT" of ID is ME # is 083.
I tried all combinations, like populated a value into Procuring plant, Supplying plant, in the folllowing structures of BAPI,(passing follwoing tables)
pritem = it_bapimereqitemimp
pritemx = it_bapimereqitemx
pritemexp = it_bapimereqitem
PRITEMSOURCE = it_BAPIMEREQSOURCE
still getiitng the same error!!!
I debugged, but, culd not able figure it out??
let me know that, Why its so?
How to fix it?
Any SAP NOTE?
thanqHi,
I have the same issue.
Did you ever figure this out ? -
GL account error for BAPI_PR_CREATE
Hi Experts,
I am getting error while using function moule BAPI_PR_CREATE for creating PR.
Enter G/L Account
No instance of object type PurchaseRequisition has been created. External reference: # 1
here I have provided data like PREQ_ITEM, SERIAL_NO, CREAT_DATE, QUANTITY, GL_ACCOUNT and COSTCENTER for PRACCOUNT table.
Please can you suggest solution for this.
Thanks & Regards,
BBCHi,
I have maintained indicators for PRITEMX then I got error maintain services or limits.
here I am passing values for SERVICELIMIT table like DOC_ITEM, OVERALL_LIMIT & EXP_VALUE.
here I have doubt , have to maintain indicators for PRACCOUNTX & SERVICELIMITX ?
please suggest me.
Regards,
BBC -
BAPI_PR_CREATE (Enter G/L account) error
Hi
I am using <b>BAPI_PR_CREATE</b> to create Open PR , I passed all the fields and entered G/L account . But i am getting error as <b>'Enter G/L account'</b>. If I am not entering G/L account it is giving <b>error two times </b> as 'Enter G/L account'. What more I need pass to the BAPI .please helpI've tried regarding Helmut's advise and it works.
10 points (if i was a thread owner) -
Error whil creating Service Line item in ME51N using BAPI_PR_CREATE
Hi Experts,
Am able to create PR number using BAPI_PR_CREATE, but when am trying to create Service line item am getting acc assignment error please check my code and solve my issue. ..its very adj please help me .
DATA : t_bapimereqitemimp TYPE TABLE OF bapimereqitemimp ,
t_bapimereqaccount TYPE TABLE OF bapimereqaccount,
t_bapimereqaccountx TYPE TABLE OF bapimereqaccountx,
t_pritemx TYPE TABLE OF bapimereqitemx,
wa_bapimereqitemimp TYPE bapimereqitemimp,
pr_number TYPE bapimereqheader-preq_no,
wa_prheader TYPE bapimereqheader,
wa_prheaderx TYPE bapimereqheaderx,
wa_pritemx TYPE bapimereqitemx,
wa_bapimereqaccountx TYPE bapimereqaccountx,
wa_bapimereqaccount TYPE bapimereqaccount,
t_return TYPE TABLE OF bapiret2,
wa_return TYPE bapiret2.
DATA : t_bapi_srv_limit_data TYPE TABLE OF bapi_srv_limit_data,
wa_bapi_srv_limit_data TYPE bapi_srv_limit_data.
DATA servicelimitx TYPE TABLE OF bapi_srv_limit_datax.
DATA w_servicelimitx TYPE bapi_srv_limit_datax.
DATA : t_servicelines TYPE TABLE OF bapi_srv_service_line,
w_servicelines TYPE bapi_srv_service_line,
t_servicelinesx TYPE TABLE OF bapi_srv_service_linex,
w_servicelinesx TYPE bapi_srv_service_linex,
t_bapi_srv_acc_data TYPE TABLE OF bapi_srv_acc_data,
w_bapi_srv_acc_data TYPE bapi_srv_acc_data,
t_bapi_srv_acc_datax TYPE TABLE OF bapi_srv_acc_datax,
w_bapi_srv_acc_datax TYPE bapi_srv_acc_datax.
DATA : t_bapimereqitem TYPE TABLE OF bapimereqitem,
w_bapimereqitem TYPE bapimereqitem.
DATA : t_bapimereqitemx TYPE TABLE OF bapimereqitemx,
w_bapimereqitemx TYPE bapimereqitemx.
wa_prheader-pr_type = 'RV'."lv_doc_type.
wa_prheaderx-pr_type = 'X'.
wa_bapimereqitemimp-preq_item = '1'."wa_eban-item.
wa_bapimereqitemimp-pur_group = '100'."wa_eban-ekgrp.
wa_bapimereqitemimp-preq_name = 'E.R. TITTO'."wa_eban-afnam.
wa_bapimereqitemimp-short_text = 'AC Fitting'."wa_eban-txz01.
wa_bapimereqitemimp-material = ' '."wa_eban-matnr.
wa_bapimereqitemimp-plant = '1000'."wa_eban-werks.
wa_bapimereqitemimp-store_loc = 'ST00'."wa_eban-lgort.
wa_bapimereqitemimp-matl_group = 'Z13'."wa_eban-matkl.
wa_bapimereqitemimp-quantity = '1'."wa_eban-menge.
wa_bapimereqitemimp-unit = 'AU'."wa_eban-meins.
wa_bapimereqitemimp-deliv_date = '20140604'."wa_eban-lfdat.
wa_bapimereqitemimp-preq_price = '100'."wa_eban-preis.
wa_bapimereqitemimp-item_cat = 'D'."wa_eban-pstyp.
wa_bapimereqitemimp-acctasscat = 'K'."wa_eban-knttp.
wa_bapimereqitemimp-fixed_vend = ' '."wa_eban-flief.
wa_bapimereqitemimp-purch_org = '1000'."wa_eban-ekorg.
wa_bapimereqitemimp-currency = 'INR'."wa_eban-waers.
wa_bapimereqitemimp-pckg_no = '00000001'.
wa_bapimereqaccount-preq_item = '1'."wa_eban-item.
*wa_bapimereqaccount-serial_no = '01'.
wa_bapimereqaccount-gl_account = '0000002244'."wa_eban-sakto.
wa_bapimereqaccount-costcenter = 'OPSD'."wa_eban-kostl.
APPEND wa_bapimereqitemimp TO t_bapimereqitemimp.
APPEND wa_bapimereqaccount TO t_bapimereqaccount.
wa_pritemx-preq_item = '1'."wa_eban-item.
wa_pritemx-pur_group = 'X'.
wa_pritemx-preq_name = 'X'.
wa_pritemx-short_text = 'X'.
wa_pritemx-material = 'X'.
wa_pritemx-plant = 'X'.
wa_pritemx-store_loc = 'X'.
wa_pritemx-matl_group = 'X'.
wa_pritemx-quantity = 'X'.
wa_pritemx-unit = 'X'.
wa_pritemx-deliv_date = 'X'.
wa_pritemx-preq_price = 'X'.
wa_pritemx-item_cat = 'X'.
wa_pritemx-acctasscat = 'X'.
wa_pritemx-fixed_vend = 'X'.
wa_pritemx-purch_org = 'X'.
wa_pritemx-currency = 'X'.
wa_pritemx-pckg_no = 'X'.
wa_bapimereqaccountx-preq_item = '1'."wa_eban-item.
*wa_bapimereqaccountx-serial_no = '01'.
wa_bapimereqaccountx-preq_itemx = 'X'.
wa_bapimereqaccountx-serial_nox = 'X'.
wa_bapimereqaccountx-gl_account = 'X'.
wa_bapimereqaccountx-costcenter = 'X'.
APPEND wa_pritemx TO t_pritemx.
APPEND wa_bapimereqaccountx TO t_bapimereqaccountx.
**Service item limit
*wa_bapi_srv_limit_data-doc_item = '10'.
wa_bapi_srv_limit_data-overall_limit = '1000'.
wa_bapi_srv_limit_data-exp_value = '800'.
APPEND wa_bapi_srv_limit_data TO t_bapi_srv_limit_data.
*w_servicelimitx-doc_item = '10'.
w_servicelimitx-overall_limit = 'X'.
w_servicelimitx-exp_value = 'X'.
APPEND w_servicelimitx TO servicelimitx.
w_bapimereqitem-preq_item = '10'.
***w_bapimereqitem-preq_name = 'E.R. TITTO'.
***w_bapimereqitem-plant = '1000'.
***w_bapimereqitem-store_loc = 'ST00'.
***w_bapimereqitem-matl_group = 'Z03'.
***w_bapimereqitem-quantity = '1'.
***w_bapimereqitem-unit = 'AU'.
w_bapimereqitem-item_cat = 'D'.
w_bapimereqitem-deliv_time = '20140604'.
w_bapimereqitem-acctasscat = 'K'.
**w_bapimereqitem-consumpt = 'U'.
APPEND w_bapimereqitem TO t_bapimereqitem.
**w_bapi_srv_acc_data-doc_item = '1'.
**w_bapi_srv_acc_data-outline = '0000000001'.
*w_bapi_srv_acc_data-srv_line = '20'.
w_bapi_srv_acc_data-serial_no = '10'.
w_bapi_srv_acc_data-serial_no_item = 'D'.
*w_bapi_srv_acc_data-quantity = '1'.
*APPEND w_bapi_srv_acc_data TO t_bapi_srv_acc_data.
**w_bapi_srv_acc_datax-doc_item = '1'.
**w_bapi_srv_acc_datax-outline = '0000000001'.
*w_bapi_srv_acc_datax-srv_line = '20'.
**w_bapi_srv_acc_datax-serial_no = '01'.
**w_bapi_srv_acc_datax-serial_no_item = '01'.
*w_bapi_srv_acc_datax-quantity = '1'.
*APPEND w_bapi_srv_acc_datax TO t_bapi_srv_acc_datax.
w_servicelines-service = '00000001'.
APPEND w_servicelines TO t_servicelines.
w_servicelinesx-service = 'X'.
APPEND w_servicelinesx TO t_servicelinesx.
CALL FUNCTION 'BAPI_PR_CREATE'
EXPORTING
prheader = wa_prheader
prheaderx = wa_prheaderx
IMPORTING
number = pr_number
TABLES
return = t_return
pritem = t_bapimereqitemimp
pritemx = t_pritemx
pritemexp = t_bapimereqitem
praccount = t_bapimereqaccount
praccountx = t_bapimereqaccountx
servicelimit = t_bapi_srv_limit_data
servicelimitx = servicelimitx
servicelines = t_servicelines
servicelinesx = t_servicelinesx
serviceaccount = t_bapi_srv_acc_data
serviceaccountx = t_bapi_srv_acc_datax.Hi,
Check this Thread , Thread1 . It might help you to resolve the issue.
Thanks
KH -
BAPI_PR_CREATE for Service line items only
Hi All,
We are unable to create the Purchase Requistion Order using the BAPI_PR_CREATE for Service line items.
The Error Message 436(06) " In case of account assignment, please enter acc. assignment data for item" is always received with respect to Account Assignment.
We are currently using ECC 6.0 EHP 4. SAP instance to create the Purchase requisition order.
We already did this analysis and came to this include previously for the Error Message 436(06) and could find thatt the accounting tables are not filled.
Also, the accounting items table is refreshed and deleted in 3 places in the code.
We did put debug on that u2026 but during debug, the control does not go to these places.
I suppose there is some other major functionality related to Service PR is missing in the BAPI_PR_CREATE.
Also we are unable to find the detailed documentation.
Thanks and Regards,
Shivakumar K.Hi Shivakumar,
Hi Shivakumar,
in most of the cases this error - 06 436 - happens due to wrongly filled BAPI structures.
Please check the entries in the x-structures in first line, for example:
PRACCOUNT structure
PREQ_ITEM 00010
SERIAL_NO 01
GL_ACCOUNT 2222222
COSTCENTER SAP-DUMMY
PRACCOUNTX structure
PREQ_ITEM 00010
SERIAL_NO 01 <<<<
GL_ACCOUNT X
COSTCENTER X
SERVICEACCOUNT structure
Line 1:
DOC_ITEM 00010
OUTLINE 0000000001
SRV_LINE 0000000010
SERIAL_NO 01
SERIAL_NO_ITEM 01
SERVICEACCOUNTX structure
Line 1:
DOC_ITEM 00010
OUTLINE 0000000001
SRV_LINE 0000000010
SERIAL_NO 01 <<<<
SERIAL_NO_ITEM X <<<
Regards,
Edit -
Filling up Line item text in BAPI_PR_CREATE
Hello Guys,
I want to use the FM BAPI_PR_CREATE and fill up its item text for line item level. How do you properly fillup the table <i><b>PRITEMTEXT</b></i>? What should be the appropriate TEXT_ID, TEXT_FORM should I use?
I urgently need your professional advice regarding this matter.
Thank you very much,
JeffreyPass the following values:
TDOBJECT(TExt object) EBAN
TDNAME(Text name ) <Concatenation of Purchase req number and Item number of purchase requisition>
TDID(Text ID) B01
TDSPRAS(language) EN
REgards,
Ravi
P.s: Please reward helpful posts. -
Problem filling item text in BAPI_PR_CREATE
Hello guys,
I am using the bapi BAPI_PR_CREATE. I am having problems on filling up the text in the item level. I used the textID 'B04' the text will supposed to be in the 'material PO text' text field but it instead was placed in the 'item text' field.
How do I go about it?
Need you expert advice on this.
Thanks,
JeffreyHello Ravikumar,
Yes I did. Under the text tab of the current line item, i clicked on the <b>Material PO text</b> and choose <i>SAPscript editor</i> on the drop down list and went to the text editor. I choose goto-->header and there I found its corresponding text id which is <b>B04</b>. I wonder why it is still placed in the <b>item text</b> field (which is text id - 'B01')?
Another thing. What's the use of <b>TEXT_FORM</b> in table <b>PRITEMTEXT</b>?
Hope you could help me on this.
I really need to solve this.
Thanks,
Jeffrey -
BAPI_PR_CREATE - Error 'Enter G/L account'
hi,
when i tried to create purchase requisition with bapi BAPI_PR_CREATE for VISA/BGC, i m getting error as 'Enter G/L account' even after passing that value. I tried with BAPI_REQUISITION_CREATE, here i can create requisition but i cant enter HEADER TEXT so im using BAPI_PR_CREATE. please help me in solving the error with BAPI_PR_CREATE.Hi,
could you explain how you solved your issue?
Thanks
Fabio -
BAPI_PR_CREATE Extension Issue
Hi
I am using BAPI_PR_CREATE to upload Purchase Requisition Create data for ME51n Transaction. Here there is screen Enhancement has been added to ME51n.
When Iam uploading data through BAPI_PR_CREATE the below error message is been shown in RETURN structure:
No instance of object type PurchaseRequisition has been created. External reference:
Error transferring ExtensionIn data for enhancement CI_EBANDB.
In enhancement implemented code is as below for ME51n :
data: gt_items TYPE mmpur_requisition_items.
data:wa_header TYPE mereq_header.
CALL METHOD im_header->get_data
RECEIVING
re_data = wa_header.
*****Get Item Detail
CALL METHOD im_header->get_items
EXPORTING
im_auth_check = MMPUR_NO
im_release_op = MMPUR_NO
RECEIVING
re_items = gt_items.
When I checked this enhancement iam not able to find BAPI Extension data.Probably:
Ls_acctx-SERIAL_NO = gc_x.
should be
Ls_acctx-SERIAL_NO = '01'.
And uncomment PREQ_ITEM.
Regards,
Jarek -
Bapi_pr_create not working for package number for service and limits
Hi Experts,
I am copying the existing service and limits values from the existing package number to new package number using BAPI_PR_CREATE. I am getting Some error (In case of account assignment, please enter acc. assignment data for item).
Please let me know any one get the solution for this problem. If anyone know some thing about this problem Please throw some light, so that I will check it out further.
Thanks for you help in Advance.
Regards,
Nagaraju.Hello,
I got almost the same problem.
Im trying to copy existing PR's too, all works well until it comes to services. Functions return says to enter account data etc.
How should i copy service records?
Best regards
P.S. Old function "BAPI_REQUISITION_CREATE" doesnt work because of Unicode system. -
Error bapi_pr_create
Hello Experts,
I am trying to create a service purchase requisition with bapi_pr_create while creating i am getting an error "In case of account assignment please enter account assignment data for item"
account data i am passing is
PRACCOUNT structure
SERIAL_NO 01
GL_ACCOUNT 400000
COSTCENTER 6_1200
PRACCOUNTX structure
SERIAL_NO 01
GL_ACCOUNT X
COSTCENTER X
SERVICEACCOUNT structure
Line 1:
SERIAL_NO 01
SERIAL_NO_ITEM 01
SERVICEACCOUNTX structure
Line 1:
SERIAL_NO 01
SERIAL_NO_ITEM X
Can any one suggest me where i am going wrong
BR,
praveenHello Manohar,
Thanks for your response.
I am able to create purchase requisition through me51n but if pass the same data into the FM bapi_pr_create it is showing the error like "In case of account assignment, please enter acc. assignment data for item". in debugging i found that my accounting info is not getting filled.
METHOD get_exkn.
LOOP AT me->my_state->acct_items INTO l_acct_item.
CHECK l_acct_item->is_funds_mgt_wrapper( ) EQ mmpur_no.
l_exkn = l_acct_item->if_accounting_model_mm~get_exkn( ).
INSERT l_exkn INTO TABLE ex_exkn.
ENDLOOP.
Could you please guide me where its going wrong.
BR,
Praveen -
Enter GL account error in BAPI_PR_CREATE
Hi Experts,
I a using babi BAPI_PR_CREATE to create a PR with two line items. but I am getting error 'Enter GL account'.
Please check below program and let me know if anything wrong in it.
data: lv_prnum type BAPIEBANC-PREQ_NO.
data: lv_prnumber type BAPIMEREQHEADER-PREQ_NO.
data: it_req_item type table of BAPIEBANC,
wa_req_item type BAPIEBANC.
data: it_req_item_new type table of BAPIEBAN,
wa_req_item_new type BAPIEBAN.
data: it_acc_assig type table of BAPIEBKN,
wa_acc_assig type BAPIEBKN.
data: it_req_ser type table of BAPIESLLC,
wa_req_ser type BAPIESLLC.
data: it_ser_val type table of BAPIESKLC,
wa_ser_val type BAPIESKLC.
data: it_return type table of BAPIRETURN,
lv_return type BAPIRET2.
data: lv_msg type char50.
data: it_change_return type table of BAPIRET2,
wa_change_return type BAPIRET2.
data: it_pritem type table of BAPIMEREQITEMIMP,
wa_pritem type BAPIMEREQITEMIMP.
data: it_pritemx type table of BAPIMEREQITEMX,
wa_pritemx type BAPIMEREQITEMX.
data: it_pritemexp type table of BAPIMEREQITEM,
wa_pritemexp type BAPIMEREQITEM.
data: it_praccount type table of BAPIMEREQACCOUNT,
wa_praccount type BAPIMEREQACCOUNT.
data: it_praccountx type table of BAPIMEREQACCOUNTX,
wa_praccountx type BAPIMEREQACCOUNTX.
data: it_ret type table of BAPIRET2,
wa_ret type BAPIRET2.
data: it_prheader type table of BAPIMEREQHEADER,
wa_prheader type BAPIMEREQHEADER.
data: it_prheaderx type table of BAPIMEREQHEADERX,
wa_prheaderx type BAPIMEREQHEADERX.
data: it_ser_acc type table of BAPI_SRV_ACC_DATA,
wa_ser_acc type BAPI_SRV_ACC_DATA.
data: it_ser_accx type table of BAPI_SRV_ACC_DATAX,
wa_ser_accx type BAPI_SRV_ACC_DATAX.
*first item - material
wa_pritem-PREQ_ITEM = '00010'.
wa_pritem-PUR_GROUP = 'ITD'.
wa_pritem-preq_name = 'abcd'.
wa_pritem-SHORT_TEXT = 'ABC'.
wa_pritem-MATERIAL = 'NCAD100001'.
wa_pritem-PLANT = '1100'.
wa_pritem-TRACKINGNO = 'XXX'.
wa_pritem-MATL_GROUP = 'Z111'.
wa_pritem-QUANTITY = 1.
*wa_pritem-UNIT = 'AU'.
wa_pritem-PREQ_DATE = '20140430'.
wa_pritem-DELIV_DATE = '20140505'.
wa_pritem-PRICE_UNIT = 1.
*wa_pritem-ITEM_CAT = ' '.
wa_pritem-ACCTASSCAT = 'N'.
*wa_pritem-des_vendor = '0050000793'.
*wa_pritem-fixed_vend = '0050000793'.
wa_pritem-PURCH_ORG = '1000'.
append wa_pritem to it_pritem.
*2nd item - service
clear wa_pritem.
wa_pritem-PREQ_ITEM = '00020'.
wa_pritem-PUR_GROUP = 'ITD'.
wa_pritem-preq_name = 'abc'.
wa_pritem-SHORT_TEXT = 'ABC'.
*wa_pritem-MATERIAL = 'NCAD100002'.
wa_pritem-PLANT = '1100'.
wa_pritem-TRACKINGNO = 'XXX'.
wa_pritem-MATL_GROUP = 'S0010'.
wa_pritem-QUANTITY = 1.
*wa_pritem-UNIT = 'AU'.
wa_pritem-PREQ_DATE = '20140430'.
wa_pritem-DELIV_DATE = '20140505'.
wa_pritem-PRICE_UNIT = 1.
wa_pritem-ITEM_CAT = '9'.
wa_pritem-ACCTASSCAT = 'N'.
*wa_pritem-des_vendor = '0050000793'.
*wa_pritem-fixed_vend = '0050000793'.
wa_pritem-PURCH_ORG = '1000'.
wa_pritem-pckg_no = '0000000001'.
append wa_pritem to it_pritem.
*fields for 1st item - material
wa_pritemx-PREQ_ITEM = '00010'.
wa_pritemx-PREQ_ITEMX = 'X'.
wa_pritemx-PUR_GROUP = 'X'.
wa_pritemx-preq_name = 'X'.
wa_pritemx-SHORT_TEXT = 'X'.
wa_pritemx-MATERIAL = 'X'.
wa_pritemx-PLANT = 'X'.
wa_pritemx-TRACKINGNO = 'X'.
wa_pritemx-MATL_GROUP = 'X'.
wa_pritemx-QUANTITY = 'X'.
*wa_pritem-UNIT = 'AU'.
wa_pritemx-PREQ_DATE = 'X'.
wa_pritemx-DELIV_DATE = 'X'.
wa_pritemx-PRICE_UNIT = 'X'.
*wa_pritem-ITEM_CAT = ' '.
wa_pritemx-ACCTASSCAT = 'X'.
*wa_pritemx-des_vendor = 'X'.
*wa_pritemx-fixed_vend = 'X'.
wa_pritemx-PURCH_ORG = 'X'.
append wa_pritemx to it_pritemx.
*fields for 2nd item - service
clear wa_pritemx.
wa_pritemx-PREQ_ITEM = '00020'.
wa_pritemx-PREQ_ITEMX = 'X'.
wa_pritemx-PUR_GROUP = 'X'.
wa_pritemx-preq_name = 'X'.
wa_pritemx-SHORT_TEXT = 'X'.
wa_pritemx-MATERIAL = 'X'.
wa_pritemx-PLANT = 'X'.
wa_pritemx-TRACKINGNO = 'X'.
wa_pritemx-MATL_GROUP = 'X'.
wa_pritemx-QUANTITY = 'X'.
*wa_pritem-UNIT = 'X'.
wa_pritemx-PREQ_DATE = 'X'.
wa_pritemx-DELIV_DATE = 'X'.
wa_pritemx-PRICE_UNIT = 'X'.
wa_pritem-ITEM_CAT = 'X'.
wa_pritemx-ACCTASSCAT = 'X'.
*wa_pritemx-des_vendor = 'X'.
*wa_pritemx-fixed_vend = 'X'.
wa_pritemx-PURCH_ORG = 'X'.
wa_pritem-pckg_no = 'X'.
append wa_pritemx to it_pritemx.
*Account assignment data for 1st item - material
wa_praccount-PREQ_ITEM = '00010'.
wa_praccount-SERIAL_NO = '01'.
wa_praccount-QUANTITY = 1.
wa_praccount-DISTR_PERC = '1.00'.
wa_praccount-NET_VALUE = 1.
wa_praccount-GL_ACCOUNT = '0040100801'.
wa_praccount-UNLOAD_PT = 'ABC'.
wa_praccount-CO_AREA = '1000'.
wa_praccount-NETWORK = '000004011841'.
append wa_praccount to it_praccount.
*Account assignment data for 2nd item - service
clear wa_praccount.
wa_praccount-PREQ_ITEM = '00020'.
wa_praccount-SERIAL_NO = '02'.
*wa_praccount-QUANTITY = 1.
*wa_praccount-DISTR_PERC = '1.00'.
*wa_praccount-NET_VALUE = 1.
wa_praccount-GL_ACCOUNT = '0040100801'.
wa_praccount-UNLOAD_PT = 'ABC'.
wa_praccount-CO_AREA = '1000'.
wa_praccount-NETWORK = '000004011841'.
append wa_praccount to it_praccount.
*Account assignment fields for 1st item - material
wa_praccountx-PREQ_ITEM = '00010'.
wa_praccountx-SERIAL_NO = '01'.
wa_praccountx-PREQ_ITEMX = 'X'.
wa_praccountx-SERIAL_NOX = 'X'.
wa_praccountx-QUANTITY = 'X'.
wa_praccountx-DISTR_PERC = 'X'.
wa_praccountx-NET_VALUE = 'X'.
wa_praccountx-GL_ACCOUNT = 'X'.
wa_praccountx-UNLOAD_PT = 'X'.
wa_praccountx-CO_AREA = 'X'.
wa_praccountx-NETWORK = 'X'.
append wa_praccountx to it_praccountx.
*Account assignment fields for 2nd item - service
clear wa_praccountx.
wa_praccountx-PREQ_ITEM = '00020'.
wa_praccountx-SERIAL_NO = '02'.
wa_praccountx-PREQ_ITEMX = 'X'.
wa_praccountx-SERIAL_NOX = 'X'.
*wa_praccountx-QUANTITY = 'X'.
*wa_praccountx-DISTR_PERC = 'X'.
*wa_praccountx-NET_VALUE = 'X'.
wa_praccountx-GL_ACCOUNT = 'X'.
wa_praccountx-UNLOAD_PT = 'X'.
wa_praccountx-CO_AREA = 'X'.
wa_praccountx-NETWORK = 'X'.
append wa_praccountx to it_praccountx.
*2nd item Service details
wa_ser_acc-doc_item = '00020'.
wa_ser_acc-outline = '0000000001'.
wa_ser_acc-srv_line = '0000000010'.
wa_ser_acc-serial_no = '02'.
wa_ser_acc-serial_no_item = '02'.
wa_ser_acc-quantity = 10.
append wa_ser_acc to it_ser_acc.
*2nd item Service fields
wa_ser_accx-doc_item = '00020'.
wa_ser_accx-outline = '0000000001'.
wa_ser_accx-srv_line = '0000000010'.
wa_ser_accx-serial_no = '02'.
wa_ser_accx-serial_no_item = 'X'.
wa_ser_accx-quantity = 'X'.
append wa_ser_accx to it_ser_accx.
*Header details
wa_prheader-pr_type = 'PURE'.
wa_prheaderx-pr_type = 'X'.
CALL FUNCTION 'BAPI_PR_CREATE'
EXPORTING
PRHEADER = wa_prheader
PRHEADERX = wa_prheaderx
* TESTRUN =
IMPORTING
NUMBER = lv_prnumber
* PRHEADEREXP =
TABLES
RETURN = it_ret
PRITEM = it_pritem
PRITEMX = it_pritemx
* PRITEMEXP = it_pritemexp
* PRITEMSOURCE =
PRACCOUNT = it_praccount
* PRACCOUNTPROITSEGMENT =
PRACCOUNTX = it_praccountx
* PRADDRDELIVERY =
* PRITEMTEXT =
* PRHEADERTEXT =
* EXTENSIONIN =
* EXTENSIONOUT =
* PRVERSION =
* PRVERSIONX =
* ALLVERSIONS =
* PRCOMPONENTS =
* PRCOMPONENTSX =
* SERVICEOUTLINE =
* SERVICEOUTLINEX =
* SERVICELINES =
* SERVICELINESX =
* SERVICELIMIT =
* SERVICELIMITX =
* SERVICECONTRACTLIMITS =
* SERVICECONTRACTLIMITSX =
SERVICEACCOUNT = it_ser_acc
SERVICEACCOUNTX = it_ser_accx
* SERVICELONGTEXTS =
* SERIALNUMBER =
* SERIALNUMBERX =
IF sy-subrc eq 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = lv_return.
endif.Hi ,
read the BAPI documentation where they have provided example for PR creation with and without account assignment with example.
check that.
regards, -
Found error in BAPI_PR_CREATE
Dear All,
I am facing problem while i am using BAPI_PR_CREATE to add purchase req. automatically.Can anybody help me
error is ME 083 Enter Document Type
BAPI 001 No instance of object type PurchaseRequisition has been created. External reference: # 1.
My Code is
TABLES:eban.
DATA: BEGIN OF itab OCCURS 0,
NO(5),
bnfpo LIKE eban-bnfpo,
bsart LIKE eban-bsart,
matnr LIKE eban-matnr,
lgort LIKE eban-lgort,
menge LIKE eban-menge,
bednr LIKE eban-bednr,
lfdat LIKE eban-lfdat,
TX(132),
END OF itab.
DATA :
prheader LIKE TABLE OF bapimereqheader WITH HEADER LINE,
prheader1 LIKE TABLE OF bapimereqheader WITH HEADER LINE,
prheaderx LIKE TABLE OF bapimereqheaderx WITH HEADER LINE,
PRITEMEXP LIKE TABLE OF BAPIMEREQITEM WITH HEADER LINE,
WA_PRITEMEXP LIKE BAPIMEREQITEM ,
return LIKE TABLE OF bapiret2 WITH HEADER LINE,
WA_return LIKE bapiret2 ,
pritem LIKE TABLE OF bapimereqitemimp WITH HEADER LINE,
pritemx LIKE TABLE OF bapimereqitemx WITH HEADER LINE,
PRITEMTEXT LIKE TABLE OF BAPIMEREQITEMTEXT WITH HEADER LINE,
pw_pr_number TYPE bapimereqheader-preq_no.
DATA auxfilename LIKE rlgrap-filename.
prheader-PR_TYPE = 'ZRAW'.
prheader-GENERAL_RELEASE = 'X'.
APPEND prheader.
CLEAR prheader.
prheaderx-PR_TYPE = 'X'.
prheaderx-GENERAL_RELEASE = 'X'.
*prheaderx-CREATE_IND = ''.
*prheaderx-CTRL_IND = 'X'.
*prheaderx-ITEM_INTVL = 'X'.
*prheaderx-LAST_ITEM = 'X'.
*prheaderx-MEMORY = 'X'.
APPEND prheaderx.
CLEAR prheaderx.
pritem-preq_item = 00010.
pritem-material = 'R8101140006-0000'.
pritem-plant = 2210.
pritem-store_loc = 2001.
pritem-pur_group = 104.
pritem-quantity = 101.
pritem-trackingno = 'HR'.
pritem-deliv_date = '20140930'.
APPEND pritem.
CLEAR pritem.
pritemx-PREQ_ITEM = 00010.
pritemx-preq_itemX = 'X'.
pritemx-material = 'X'.
pritemx-plant = 'X'.
pritemx-store_loc = 'X'.
pritem-pur_group = 'X'.
pritemx-quantity = 'X'.
pritemx-trackingno = 'X'.
pritemx-deliv_date = 'X'.
*pritemx-SHORT_TEXT = 'X'.
APPEND pritemx.
CLEAR pritemx.
CALL FUNCTION 'BAPI_PR_CREATE' "#EC *
EXPORTING
prheader = prheader
prheaderx = prheaderx
* TESTRUN = TESTRUN
IMPORTING
number = pw_pr_number
TABLES
return = return
pritem = pritem
pritemx = pritemx
* pritemexp = pritemexp
* pritemsource = t_itemsource
* pritemtext = t_itext
EXCEPTIONS
OTHERS = 1.
****** Check whether any error exist. If not commit the changes else rollback the changes.
READ TABLE return
* TRANSPORTING NO FIELDS dar013009
INTO wa_return . "dar013009
* WITH KEY type = c_msgty_e.
IF sy-subrc = 0.
* pw_flag = c_error.
* pw_msg = wa_return-message. "dar013009
ELSE.
* pw_flag = c_success.
ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
REFRESH PRITEM.
REFRESH prheader.
REFRESH prheaderx.
REFRESH PRITEMX.
REFRESH PRITEMTEXT.
data : str type string.
CONCATENATE 'purchase req no is : ' pw_pr_number into str SEPARATED BY space.
message str type 'S'.i add this code and use same in Bapi_pr_create
pritemexp-DOC_TYPE = 'ZRAW'.
APPEND pritemexp.
CLEAR pritemexp.
i am checking in debug mode actually before call of bapi_pr_create it is showing doc_type value in table pritemexp = 'ZRAW'
but after call of bapi_pr_create it is making blank doc_type and throwing error.
Maybe you are looking for
-
Ok, this has been a real nightmare. I am an extensive user of BB since OS4. Wanted to try the new Z10, so I got myself a spanking new one. With my prior experience in switching devices, it would be a cinch. Transfer device over via blackberry desktop
-
How to track changes to config tables?
Hi, I would like to track the changes that have been done to the config tables and would like to know the name of the transport request which might have done this? My SAP is on ECC 5.0 Can some one please help? Thanks Vijay
-
About abstract method read() in class InputStream (third message)
The subclass FilterInputStream is not abstract and extend InputStream: have you ever seen the implementation of that method in the source code available in SDK? It only calls that abstract method!!! I think it is not a very simple problem and anyway
-
Can I turn off screen rotation?
I would like to know if I can turn off screen rotation espicially in music. Thanks, Dave
-
Creating a formula and the editor does not pop up
Trying to create a simple formula. Have entered cells in by typing but it will just show the formula and not what the forumla has been designated to do