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

Problems with BAPI_SALESORDER_CREATEFROMDAT2

Former Member
0 Likes
2,083

Hi All..

I'm having a problem with the Bapi BAPI_SALESORDER_CREATEFROMDAT2. The problem is that I have Header conditions and also conditions for the positions. Where can I put the values for this conditions.. I'm moving them to the order_conditions_in structure, but when I run it the ones that belongs to the header shows me the following message: "ZPRE condition as a header condition is not allowed2".

Is this procedure right? or I have to put the header's condition anywhere else?...

Thank you so much for your comments!!!...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,013

You are passing them to the correct structure, but are you sending ITM_NUMBER as '000000'?

12 REPLIES 12
Read only

Former Member
0 Likes
2,014

You are passing them to the correct structure, but are you sending ITM_NUMBER as '000000'?

Read only

0 Likes
2,013

Yes... This is a piece of my code:

  • This first piece is the one that the condicion is for

  • any position

es_bapicond-itm_number = cont_pos.

es_bapicond-cond_type = 'ZPRE'.

es_bapicond-cond_value = ti_datos_pedidos-zpre.

es_bapicond-currency = ti_datos_pedidos-zpre_m.

APPEND es_bapicond.

  • This second piece is for header conditions

es_bapicond-itm_number = '000000'.

es_bapicond-cond_type = 'ZVAR'.

es_bapicond-cond_value = ti_datos_pedidos-zvar.

APPEND es_bapicond.

I think I'm passing them in the right way.. :S

Thanks in advance

Read only

0 Likes
2,013

Hi Maria,

It may be an obvious one, but are you sure that the condition is a header condition? Item level conditions are also displayed at the header in summarised form.

The field V_T685A-KKOPF should be set to 'X' for it to allow header level conditions.

Sorry if this is a too obvious...

Also, you don't put a currency for ZVAR, is this intended?

Brad

Read only

0 Likes
2,013

Hi Brad...

I'm sure the condition is not a header condition, the error that the return structure shows tells me it and also the SD Functional also told me. I don't know what's happening here :S.. The currency of ZVAR as Initial is intended... Sorry for asking so much, but I'm a begginner.. :S

Read only

0 Likes
2,013

Is this what you meant to say?

<i>I'm sure the condition is not a header condition</i>

If you are sure that ZVAR is not a header condition then how can you add it to the header of the sales order?

ZVAR must be marked as a header condition to add it to the header level.

Brad

Read only

0 Likes
2,013

Sorry.. I think we're not understanding each other... What I'm trying to say is.. I have 2 conditions, ZPRE and ZVAR. ZPRE is a position condition and ZVAR is a header condition. I'm having problems when I'm trying to indicate thar ZPRE is a position one. With ZVAR I'm not having problems. Hope this can help to explain.

Thanks a lot.

Maria

Read only

0 Likes
2,013

ok, now I understand, seems I'm not reading so well today.

So, another obvious question, have you debugged the code and confirmed the value of cont_pos when it gets added into the internal table? Maybe its getting initialised at some point???

Brad

Read only

0 Likes
2,013

Jajaja.. don't worry.. it's ok.. thanks for your time.

Yes I've debugged the code and the values for the header has the itm_number = '000000' and the position ones has a number different from '000000'.

Another question is.. Exists the posibility of just pass the positions conditions and later using another FM pass the header ones?...

Thanks again!

Maria

Read only

0 Likes
2,013

Thank you so much!

I've solved the problem.. The conditions where ok, was a problem with the items and a field that hadn't the right values...

Thank yoy so much for your time and suggestions!

Read only

Former Member
0 Likes
2,013

Hello Maria,

Is ZPRE a manual condition. In SD certain condition types are derived from the pricing procedure and some can be added manually. You need check ZPRE which category it belongs

regards,

Samir.

Read only

0 Likes
2,013

Hi Samir...

Yes, ZPRE is a manual condition. I don't know why this isn't working.. the others conditions works perfectly.. that's why I asked earlier if the header and position conditions where in the same structure.

Thanks a lot for your help...

Read only

Former Member
0 Likes
2,013

Inform field ITM_NUMBER for BAPISDITM and bapicond. It works!!!

By Cramp

Message was edited by:

Luiz Mourã