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

BAPI_PO_CREATE1 Strange Problem. Plz Help.

Former Member
0 Likes
4,644

Hi guys!

I'm using BAPI_PO_CREATE1 to create several PO's from a text file. I finally achieved that my BAPI to work as wished, with conditions, etc.

The problem im having is that it works perfectly for the first time in the loop for the creation of the PO, however on the second time of the loop with exactly the same data just the PO number changed for the next PO doesnt work, i get the error of net price must be > 0.

I have debugged the program and i have checked that the condition for the net price is there and also i passed it on the POITEM table just to make sure it wasnt that, and it didnt work neither.

Plz any help will be very appreciated.

Thx.

16 REPLIES 16
Read only

Former Member
0 Likes
3,344

Do you COMMIT WORK after each call of the BAPI?

Rob

Read only

former_member425121
Participant
0 Likes
3,344

Hi Gilberto

Dou you have (else price BAPIEKPOC-net_price) switched on the 'Take Price' Items Field ?

BAPIEKPOC-po_price = 'X'

Regards

Frank.

Read only

Former Member
0 Likes
3,344

Hi, thanks for your replies!

The answers for your replies are yes, im doing COMMIT WORK after every call of the BAPI and yes i have passed correctly the net_price and its Change toolbar for net_price ('X').

The strange thing is that i used the exactly same record for the PO twice, and only the first time of the loop gets to work.

Hope you can give me any another idea.

Thx

Read only

0 Likes
3,344

What if you leave the PO number blank? Won't the BAPI assign the number?

Rob

Read only

Former Member
0 Likes
3,344

We have some problems like that and SAP proposed that we use the next perform for reset all the buffers

After the bapi use.

PERFORM MEPO_REFRESH(SAPLMEPO).

DATA: MEM_OPTN LIKE CSDATA-XFELD VALUE '0'.

EXPORT MEM_OPTN TO MEMORY ID 'CSIO_MEM_OPTN'.

CALL FUNCTION 'BAPI_PO_CREATE1'

EXPORTING....

regards

Read only

Former Member
0 Likes
3,344

Hi again!

Thanks for all your replies!

I have fixed my problem, it had to do with freeing the memory as Omar said. It works now.

By the way, i have got one last problem with this BAPI. I don't know if anyone of you guys know how to create a condition with a discount. I got the condition type, condition value, however don't understand why it sums the percentage of the discount to the price instead of substracting. I created a PO manually just to check it wasnt a functional mistake but i found that creating it manually it does substract it to the gross price, any ideas?

And thanks for all your help, i really appreciate it.

Read only

0 Likes
3,344

Hi Gilberto,

I have the same issue when the first item in a loop works fine during bapi_po_create1 but for the subsequent items I'm getting error message "Net price must be greater than 0".

What kind of abap statement did you use to free the buffer?

Thanks in advance.

Read only

Former Member
0 Likes
3,344

I've found a solution.

Thanks anyways.

Regards.

Read only

0 Likes
3,344

Gilberto,

I recently posted a message : having problem loading BAPI_PO_CREAT1 Structure - POCOND and one of our sdn member (Patrick Yee - thnks) email me a sample to populate this structure :

FORM populate_pricing .

CLEAR: tbl_pocond,

tbl_pocondx.

  • Pricing Conditions

tbl_pocond-itm_number = tbl_item-ebelp.

tbl_pocond-cond_st_no = '1'.

tbl_pocond-cond_type = 'PB00'.

tbl_pocond-cond_value = tbl_item-netpr.

tbl_pocond-currency = tbl_header-waers.

tbl_pocond-change_id = 'I'.

APPEND tbl_pocond.

tbl_pocondx-itm_number = tbl_item-ebelp.

tbl_pocondx-cond_st_no = '1'.

tbl_pocondx-itm_numberx = 'X'.

tbl_pocondx-cond_st_nox = 'X'.

tbl_pocondx-cond_type = 'X'.

tbl_pocondx-cond_value = 'X'.

tbl_pocondx-currency = 'X'.

tbl_pocondx-change_id = 'X'.

APPEND tbl_pocondx.

ENDFORM. " populate_pricing

I tested my bapi via t-code SE37 using Patrick's example and sucessfully created a PO, but when i called the BAPI from my custom program using the same code sample to load the POCOND structure i got an error message :

"No Condition determined" .

Can you post the code you used in laoding your POCOND Structure? Thanks

- Frank

Patrick Yee

Posts: 303

Registered: 4/20/05

Re: BAPI_PO_CREATE1 - help loading item condition !!

Posted: Oct 26, 2005 10:57 PM Reply E-mail this post

Hi Frank,

I have used the following code in my PO Upload program and it works fine:

FORM populate_pricing .

CLEAR: tbl_pocond,

tbl_pocondx.

  • Pricing Conditions

tbl_pocond-itm_number = tbl_item-ebelp.

tbl_pocond-cond_st_no = '1'.

tbl_pocond-cond_type = 'PB00'.

tbl_pocond-cond_value = tbl_item-netpr.

tbl_pocond-currency = tbl_header-waers.

tbl_pocond-change_id = 'I'.

APPEND tbl_pocond.

tbl_pocondx-itm_number = tbl_item-ebelp.

tbl_pocondx-cond_st_no = '1'.

tbl_pocondx-itm_numberx = 'X'.

tbl_pocondx-cond_st_nox = 'X'.

tbl_pocondx-cond_type = 'X'.

tbl_pocondx-cond_value = 'X'.

tbl_pocondx-currency = 'X'.

tbl_pocondx-change_id = 'X'.

APPEND tbl_pocondx.

ENDFORM. " populate_pricing

Hope this helps.

Cheers,

Pat.

Read only

0 Likes
3,344

Hi Frank.

Right now I don't have access to SAP, im not at work until Monday now. However checking the example given to you I think its pretty much the way I populate my POCOND structure. The only difference is that I used the Condition No. first field if im not wrong, for that i used a consecutive number from 1 to ...

You might check that the condition type you're using its configure functionally by the MM configurator. My advise would be talk to your MM configurator or check the MM configurations so you can see what u might need to pass to the BAPI according to the configuration.

Regards

Read only

0 Likes
3,344

ok Gilberto, looking forward to your code sample on Monday.

Regards,

Frank

Read only

0 Likes
3,344

Gilberto - I resolved the issue. it was a typo, I forgot to insert an 'X' in one of the structure change tool bar.

Regards,

Frank

Read only

0 Likes
3,344

Hi Gilberto,

Could you please let me know how you fixed the problem of getting discount types added instead of gettin subtracted?

And also, I am facing a problem of some of the condition types getting duplicated and some of the condition types getting deleted after executing the BAPI.

Please let me know of any possible reasons for this.

Thanks,

Sruti

Read only

0 Likes
3,344

Hi Gilberto and Sruti Jilla!

I'm facing the same problem with the conditions in the PO Items. May you tell me how did you fix this problem with the BAPI? (my problem is that there's a discount condition that it's not updating the conditions item in the PO.

Kind Regards,

Luis

Read only

Former Member
0 Likes
3,344

Hi Experts,

I have and issue in creating Purchase Order using BAPI_PO_CREATE1. i can successfully create a PO, but the problem is, it will contain 2 'ZBID' condition per item.

The senario is:

the input file has a material with a net price different from Purchase Info Record of that material.

example, material A has a netprice of 500 specified in the input file. but the Purchase info record of this material has a net price of 475.

the BAPI will create a PO having a condition ZBID, but with 2 values in the item details tab.

ZBID - 500

ZBID - 475.

but in the item tab, material A has a specified net price of 475. (this is wrong, input price(500) must be taken into account)

Please advise on how can i get rid of ZBID 475 in the condition. the correct PO must have a condition of ZBID and a net price of 500.

correct output: Material A with a net price of 500, conditions must be ZBID(500) and NAVS(0).

thank you.

Read only

0 Likes
3,344

Hi Richard,

I have the same issue noe .

can u please help me out

how u solved ur issue

thanks

Rakesh S