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

Error in bapi BAPI_PR_CREATE while uploading

Former Member
0 Kudos
1,825

HI Gurus,

I have program for uploading PR with BAPI. BAPI_PR_CREATE.

while uploading without account assignment category it is working fine.

while enter account assignment category v need to enter sales order no and item no. that is mandatory field for account assignment category..

if using program its showing error.

No instance of object type Purchase Requisition has been created. External reference: # 1

Enter sales order

Sd document XXXXXXX is not in the database or has been archived.

but I tried to create manually it is working fine.

I tried to upload with bapi directly with out z program.

tht time also it showing error

No instance of object type Purchase Requisition has been created. External reference: # 1

Enter sales order

If any one give solution

it is very helpful for me.

9 REPLIES 9
Read only

JL23
Active Contributor
0 Kudos
1,051

Are you sure you used the same number sales order and sales order item number that is in the data base.

Often people forget the leading zeros.

Read only

Former Member
0 Kudos
1,051

Hi Jürgen,

Thanks for ur rly..

ya am using same sales order and item which is ther in data base.

actually the sales order no is 500000062. if i give leading zero also like 0500000062 in direct bapi it is taking withou zero only.

for item if i give 20 system automatically taking 00020 like that.

I given account assignment category in PRTEM ACCTASSCAT.

that value is taking

I given the sales order no and item in

PRACCOUNT SD_DOC

ITM_NUMBER

only these values are not taking .

bcos of that am not able to upload PR.

Read only

Former Member
0 Kudos
1,051

Hi friends,

Now its working in std BAPI . we have to maintain the serial no for sales document and Item in bapi..

after passing it is working in std BAPI.

field name is SERIAL_NO TYPE BAPIMEREQACCOUNT-SERIAL_NO ,

It is not working thro my program.

but that serial no value system generating automatically in ME51N.that is disable field.

v cant take from excel.

how can v pass the value.

if any one can fidn the solution for that.

Read only

Former Member
0 Kudos
1,051

HI friends,

I given as a hardcore as ' 01'

s_praccount-preq_item = wa1_dummy-preq_item.

s_praccount-serial_no = '01'.

s_praccount-sd_doc = wa1_dummy-sd_doc.

s_praccount-itm_number = wa1_dummy-itm_number.

s_praccountx-serial_no = '01'.

s_praccountx-sd_doc = 'X'.

s_praccountx-itm_number = 'X'.

I given like this, bcos v cant pass the value thro xcel.

now it s working fine .

my problem is if i given data in same xcel for multiple recard , it s not taking,

if give item 10,20,again 10

the 10 and 20 item should create one requisition no.

the another item 10 should create new requisition No.

but in my case

first item displaying 2 times thn the second item is displaying as 3 item.

last data is not getting .

if i given item no continue sly like 10,20, 30 it is working fine.

I have only one header pr_type

In item preq_item based on this field it should work.

if preq_item = 10 new requisition no should create.

how to resolve this.

guide me any one.

Edited by: Prasath on Jan 20, 2012 8:36 AM

Read only

JL23
Active Contributor
0 Kudos
1,051

if give item 10,20,again 10

what does that mean?

an item number always belongs to a document number.

the the second 10 belong to a different document?

if not, why is a second 10 at a place where a 30 should be?

Read only

Former Member
0 Kudos
1,051

Hi

Thnaks for the Reply,

in normal scenario it ll upload base on header.

if header change it ll generate automatically requisition no. So in program v used AT END OF pr_type.

so if pr_type is diff it will work.

in my case only one header it will not change. v hav only one pr type.

it should generate based on Item.

If item 10 it should generate new requisition No.

my flat file is ,

pr type - material - pur org - plant - storage loc - qty - traking no - .... pr item

xxx abc pqr 1000 xyz 100 11111 10

xxx abc pqr 1000 xyz 200 11111 20

xxx abc pqr 1000 xyz 300 11111 30

xxx abc pqr 1000 xyz 400 11111 10

xxx abc pqr 1000 xyz 500 11111 20

here header is same.. if pr item 10 it should generate new requisition No, means it should commit before value 10.

so before commit v hav to give the logic if item 10 it should generate for before value.

hope u got my requirement.

Read only

JL23
Active Contributor
0 Kudos
1,051

this is in general nonsense from my point of view

items without header doesnot make sense.

what is the difference between those 2 (I see only the quantity which is different):

xxx abc pqr 1000 xyz 100 11111 10

xxx abc pqr 1000 xyz 400 11111 10

I do not say that it cannot be achieved, but doing it based on "AT END OF pr_type" does not make much sense in this scenario.

if the 10 is your only indicator that shall trigger a new document, then you have to do your decision on the item number (if item = 10, then do ....)

and not on any other field.

Read only

Former Member
0 Kudos
1,051

HI,

Thanks for u rly,

ya . the 10 is your only indicator that shall trigger a new document.

i tried like this

if item = 10,

but it is committing whn the item is 10. need to commit if 10 it should generate before the value.

hav to call the BAPI towice if item 10 . before updating the bapi structure and after updating the structure.

anyhow it is solved.

Read only

Former Member
0 Kudos
1,051

we hav to call the bapi_pr_create.

before updating the bapi structure once.

then after updating structure also.