on 05-03-2007 10:24 AM
Hi guys,
Well I have a probem with the use of BAPI_SALESDOCUMENT_CHANGE for the creation of new items into an existing sales document.
The problem is not the creation of the new item, I use the correspoding flags 'U' for the order_header_in structure and 'I' for the table item_in. I am creating the new item but I can't put the cumulative order quantity (good old kwmeng field) in the new item.
I am trying to fill the 'target_qty' field in table item_in though I have tried other fields after many unsuccessfull attemps. This is frustrating I am starting to write once and again REDRUM in my physical notepad (dunno why I'm doing so yet).
Please can anybody help me with this?
BTW this is my first post in this forum.
Thanks in advance.
Hi Vincent,
yes the required field for KWMENG is the field "target_qty" . I think the problem may be that you are not updating the fields ( with 'X') that you are trying to change/insert at item level in the table parameter ITEM_INX.
Reward points if this is helpful by marking the question as answered and rating the helpfulness of this response
Ayan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, I'm updating the fields and marking the fields to update.
More info.
If I only fill the fields:
itm_number (posnr)
material (matnr)
target_qty (zmeng)
The bapi ends free of errors but i dont get KWMENG (cumulative order quantity) informed in the sales document (position has been created but this field is empty).
BUT if I try to inform more fields, trying to give the BAPI enough info to get the field, if I inform target_qu (zieme) I do get an error like that the sales unit that I'm providing is not expected. Weird, the sales unit is right for sure.
I have been debugging it all this time and it seems that in the end SAP calls functions SD_SALES_DOCU_MAINTAIN and SD_SALES_ITEM_MAINTAIN. In these function modules there is no field for KWMENG but for ZMENG instead (just like in BAPI_SALESDOCUMENT_CHANGE.
Because of this I supose that the KWMENG field will be calculated using the info I can provide.
Right now I'm testing this.
Thanks anyhow :).
C'mon fresh points in exchange for help.
Well the only other solution I can think of is to try supplying the schedule line information as well
Ex code:
schedulech_lines-itm_number = it_vbap_old-posnr.
schedulech_lines-sched_line = '0001'.
schedulech_linesx-itm_number = it_vbap_old-posnr.
schedulech_lines-req_qty = it_vbap-kwmeng.
schedulech_linesx-sched_line = '0001'.
schedulech_linesx-req_qty = 'X'.
schedulech_linesx-updateflag = 'U'.
APPEND : schedulech_lines, schedulech_linesx
No, it doesn't work.
I tried to fill another stucture also but same result. I am short of new ideas except filling as many fields as possible.
Well I'll keep trying and you, please , keep answering.
Just some more data. The fact is that I want to create new items inside a sales document just before it is saved (using exits). Is there any other way without using this BAPI?
Thanks another time.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.