Changing PSTYV in sales order with BAPI_SALESORDER_CREATEFROMDAT2
hi all,
I'm having this trouble...
we are creating a Sales Order from PI calling directly the BAPI_SALESORDER_CREATEFROMDAT2...
but, theres a field than I have to change... the PSTYV must be TANN when the VBAP-NETWR is 0.
I've used the MV45AFZZ program for the exit... but no in the move_field_to_vbap ('cause it doesn't work form me), I used this one:
FORM USEREXIT_SAVE_DOCUMENT_PREPARE.
data: l_tabix type i VALUE 0.
if xvbak-AUART = 'ZCO'.
loop at xvbap.
add 1 to l_tabix.
if xvbap-netwr EQ 0.
xvbap-PSTYV = 'TANN'.
modify xvbap index l_tabix TRANSPORTING pstyv .
endif.
endloop.
endif.
ENDFORM.
and with this, when the sales order is created, my PSTYV field if NETWR = 0, now is TANN.... but this is NOT the solution 'cause I can't make an Invoice... I have an incompletion LOG....
but, if I change the field manually appears a message: New pricing carried out ( Message no. V1209 ).
and with this... I fix the problem.... but, you can see than I need it automatically....
so I think, than with my exit, I'm only changing the PSTYV value, but no all the changes than this need...
thanks in advance...
Regards..
Apart from that and also
ORDER_ITEMS_IN-ITEM_CATEG = " Value here
ORDER_ITEMS_INX-ITEM_CATEG = " Value here
a®
Similar Messages
-
Query in creating Sales Order with BAPI_SALESORDER_CREATEFROMDAT2?
Hi,
I am trying to create a Sales Order with the BAPI and have a contract as a reference. Do I need to explicity mention the line item details in case I need the data from Contract to be copied here. If not how do I acheive this functionality.
P.S: I am able to create the Sales Order with the reference and I can see the Sales Order in the contracts workflow but not the line items in the Sales Order.
Any suggestions?
Regards,
KarthikHello, Karthik,
By reading the documentation of BAPI
BAPI_SALESORDER_CREATEFROMDAT2
the mandatory data to be supplied to the BAPI, in order to succesfuly create the the Sales Order are:
"1. ORDER_HEADER_IN :
DOC_TYPE Sales document type
SALES_ORG Sales organization
DISTR_CHAN Distribution channel
DIVISION Division
2. ORDER_PARTNERS..:
PARTN_ROLE Partner role, SP sold-to party
PARTN_NUMB Customer number
3. ORDER_ITEMS_IN..: MATERIAL Material number"
The OSS note 93091 basically re-states the same thing.
After studying this BAPI's source code, the conclusion seems to be the one the documentation points to: <b>the BAPI can only be used to create a sales order by supplying (manually) all the necessary data.</b>
BTW: How did you manage to create the empty Sales Order with reference, you mentioned in your mail? Just by providing a reference document number? <b>And nothing more?</b>
Bye,
Bogdan -
Creating sales order with BAPI_SALESORDER_CREATEFROMDAT2
Hi,
I´m creating sale orders with the function BAPI_SALESORDER_CREATEFROMDAT2. If you create sales order manually over the transaction, the system will find the right delivery date for you, if you are typing a date too early, for example.
The same I need to do the BAPI. But if I´m running the BAPI without a date, it is creating a sales order without a BAPI.
How can I get the date, SAP finds out automatically, when creating sales orders over the transaction?
Thank you!Really no advices to that?
-
Create sales order with BAPI_SALESORDER_CREATEFROMDAT2 example
Hi, does anyone have a working example of how to create a sales order using BAPI_SALESORDER_CREATEFROMDAT2?
Thankshi Robert,
Check this code...try to map.
one order with total sum of effort
clear: l_order_header,
l_salesdocument,
l_order_partners,
l_order_items,
l_order_schdl.
refresh: it_order_items,
it_order_partners,
it_order_schdl,
it_return.
???????? get from material ...
Order header
l_order_header-doc_type = 'ZQBV'.
l_order_header-distr_chan = '10'.
l_order_header-division = '00'.
if g_qals-werk eq '1100'.
l_order_header-sales_org = '1000'.
else.
if g_qals-werk eq '3100'.
l_order_header-sales_org = '3000'.
else.
message i001(00) with text-005.
endif.
endif.
l_order_header-purch_no_c = g_qals-prueflos. " <= lot
Partner data
l_order_partners-partn_role = 'AG'.
l_order_partners-partn_numb = g_qals-kunnr.
append l_order_partners to it_order_partners.
Order items => only one
l_order_items-itm_number = 10.
l_order_items-material = g_qals-matnr.
l_order_items-target_qty = 1.
append l_order_items to it_order_items.
Schedules for quantity
l_order_schdl-itm_number = 10.
l_order_schdl-req_qty = 1. " <= only 1 !
append l_order_schdl to it_order_schdl.
Conditions for value
l_order_conditions-itm_number = 10.
l_order_conditions-cond_type = 'PR00'.
l_order_conditions-cond_value = g_effort_sum.
l_order_conditions-currency = g_effort_unit.
append l_order_conditions to it_order_conditions.
BAPI to create sales order
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN =
ORDER_HEADER_IN = l_order_header
ORDER_HEADER_INX =
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
SALESDOCUMENT = l_salesdocument
TABLES
RETURN = it_return
ORDER_ITEMS_IN = it_order_items
ORDER_ITEMS_INX =
ORDER_PARTNERS = it_order_partners
ORDER_SCHEDULES_IN = it_order_schdl
ORDER_SCHEDULES_INX =
ORDER_CONDITIONS_IN = it_order_conditions
ORDER_CONDITIONS_INX =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
ORDER_CCARD =
ORDER_TEXT =
ORDER_KEYS =
EXTENSIONIN =
PARTNERADDRESSES =
if not l_salesdocument is initial.
order successfully created
message i001(00) with text-001 l_salesdocument.
endif.
endif.
for more info check the below link also
Problem with BAPI_SALESORDER_CREATEFROMDAT2
Regards,
Naveen -
Changing quantities in sales order with reference to quotation
Hi,
Quotation has been created for Product -- A, 10 quantities.
Sales order created with reference to quotation, system copies 10 quantity in sales order.
How do you restrict in sales order end user should not change quantities, system should not allow for changes by end user. If end user changes Qty system should give an "Error message", so that sales can not be saved.
Could you suggest solution ASAP.
Thanks in Advance.
Regards,
vamsi.Normally You will have a warning message set for this. under class V1. if you want the error to be hard error then you would have to hard code it in a user exit under mv45afzz "userexit_save_document_prepare" where u can check if the quantities in the quote and sales order are different and create a hard error.
the other option which I am not sure if it is possible is to propose the eror in message class v4 which you can control thru customisation under SPRO>SD>message settings
reward points if it helps
regards
Biju -
Updating Sales order with BAPI_SALESORDER_CREATEFROMDAT2
Hi All ,
I am not able to Update two Zfields in vbap using FM BAPI_SALESORDER_CREATEFROMDAT2, In create mode I am able to save values into those fields .
I have checked the fields in structures
ZZVBAP (append structure of VBAP)
ZZBAPE_VBAP (append structure of BAPE_VBAP)
ZZBAPE_VBAPX (append structure of BAPE_VBAPX)
ZZVBAPKOZ (append structure of VBAPKOZ)
ZZVBAPKOZX
what could be the other reason for these zfields not saving in update mode .
Thanks
Vinay KollaYou can use implicit enhancement to include new fields to be added in BAPI. Because in BAPI, field by field mapping is there. just find FM "sd_salesdocument_create" and then find where ITEM details are to be filled.
If you still have problem, reply back,,, because I just worked in thsi BAPI for same scenario. -
ERP - SD Sales orders with billing plan (material number change appear)
Sales and Distribution.
Regarding sales orders with billing plan.
We create the sales order and create billing plan at header or item level.
We issue down payment request(s) upon receipt of sales order.
Often during the life time of the sales order one or more of the material numbers are changed after the down payment request(s) has been issued and paid by the client.
Our issue is that prior to changing the material number in the sales order we have to reverse the payment(s), reverse the down payment request(s) and after the material number change re-issue the down payment request(s) and register the payment again.
We wish to find a solution avoiding all the reversals.
If you have a similar situation please inform how to handle material number change in the sales orders with billing plan.
Best regards
LiseDear Consultor SD ,
There is no setting to create the invoice based on schedule line.
What you can possibly do is create multiple deliveries based on the schedule line and
then invoice the individual deliveries.
If you want system to split the deliveries based on schedule line, then you will have to include Schedule line also
in the COMBINATION REQUIREMENT in VTLA.
Thanks & Regards,
Hegal K Charles -
Change status for sales order in crmd_order
Hi,
I am creating a report which has to change for all sales order with status "Open" to status "Processed". Is there any function or bapi to do this ?? Supposing, there is no function, which tables do i have to change ???
thanks in advance!!!
MariaMmmm it doesn't work... I have tried this:
CALL FUNCTION 'CRM_STATUS_CHANGE_EXTERN_OW'
EXPORTING
CHECK_ONLY = ' '
OBJNR = i_crmd_orderadm_h-guid
USER_STATUS = 'I1003'
SET_INACT = ' '
IV_REF_KIND =
IV_OBJECT_TYPE =
IV_NO_1O_MAINTAIN =
IMPORTING
STONR =
EXCEPTIONS
OBJECT_NOT_FOUND = 1
STATUS_INCONSISTENT = 2
STATUS_NOT_ALLOWED = 3
OTHERS = 4.
If sy-subrc = 0.
endif.
But noting has change in tag Status in tx. CRMD_ORDER.. still have in "system status": In process and in "User status": Order Rep Processed.
Thanks in advance !!! -
Restrict manual change in sales order with respect to quotation
Hi All,
The user use to create sales order with respect to quotation. The user can able to change pricing as well as some header and item fields. How can I restrict user for manual change in sales order expect some specific fields.
Thanks.Hi Sunil,
It is possible through configuration better you can post in sd forums.
For the condition type settings , ensure that the manual entries is 'D'. it wont allow any changes in the order.
Regards,
Madhu.
Edited by: madhurao123 on Aug 1, 2011 1:08 PM -
All changes in sales orders with in a week
Hi gurus,
I want to display a report to display all the changes in sales orders with in a week,
Can anybody help me .If anybody already developed this report can you send to me.
regards,
D..Query table CDHDR and CDPOS with the following fields:
CDHDR-TCODE = VA01 or VA02
CDHDR-UDATE = <specified date range>
Now select from CDPOS where
CDPOS-OBJECTCLAS = CDHDR-OBJECTCLAS
CDPOS-OBJECTID = CDHDR-OBJECTID
CDPOS-CHANGENR = CDHDR-CHANGENR
The rest of the details for the change can be found from the other fields in CDPOS. like tablename, fieldname, old value, new value etc.
Hope this helps.
Sudha -
Change price in Sales Order created with reference with Quote
Hi Experts,
Need to change price (eg..1000USD to 1100USD) in sales order (va02). Here Sales Order is created (va01)with reference with Quote(va21) where price in maintained (as 1000USD). so price in Sales Order is copied from Quote. Now, If I want to do the change in Sales Order (from 1000USD to 1100USD) kindly suggest me what are all the possible ways. Can I do the changes within the existing documents rather than creating new docs. due to the change.
Note: User is creating new Quote with 1100USD and creating subsequent new Sales Order with new Quote.
Thanks
ViswanathanHi,
In va02 you double-click on the material that has been entered, then in the new screen goto the condition tab, here u will find the $1000 that you have entered, and then change it to $1100.
Swapnil -
Changing Price Conditions in Sales Order with SD_SALESDOCUMENT_CHANGE
Hello there!
I need to change the value of a price condition in a sale order ;I'm using the f.m. SD_SALESDOCUMENT_CHANGE.
It doesnt' work as I want, 'cause it creates an other price conditions instead of just changing the price value of the actual one.
Waiting for your tips,
thanks.
This is how my code looks like:
PARAMETER: p_vbeln LIKE vbak-vbeln.
data: st_order_header_inx TYPE bapisdhd1x,
st_conditions LIKE bapicond,
st_conditionsx LIKE bapicondx,
tb_conditions TYPE TABLE OF bapicond,
tb_conditionsx TYPE TABLE OF bapicondx,
tb_return TYPE TABLE OF bapiret2.
st_order_header_inx-updateflag = 'U'.
st_conditions-itm_number = '0010'.
st_conditions-cond_type = 'PR00'.
st_conditions-cond_updat = 'X'.
st_conditions-cond_value = '100'. "Value I want to enter
APPEND st_conditions TO tb_conditions.
st_conditionsx-itm_number = '0010'.
st_conditionsx-cond_type = 'PR00'.
st_conditionsx-updateflag = 'U'.
st_conditionsx-cond_value = 'X'.
APPEND ls_conditionsx TO tb_conditionsx.
CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'
EXPORTING
salesdocument = p_vbeln
order_header_inx = st_order_header_inx
TABLES
return = tb_return
conditions_in = tb_conditions
conditions_inx = tb_conditionsx .Get the conditions records first from the Sales Order with BAPI BAPISDORDER_GETDETAILEDLIST
CALL FUNCTION 'BAPISDORDER_GETDETAILEDLIST'
EXPORTING
i_bapi_view = lw_bapi_view
TABLES
sales_documents = lt_order
order_conditions_out = lt_conditions_out.
Then populate the conditions internal table with the data that you get from the previous code
move-corresponding lw_conditions_out to lw_order_conditions_in.
lw_order_conditions_in-cond_value = '100' " the value that you want to modify
APPEND lw_order_conditions_in TO lt_order_conditions_in.
CLEAR lw_order_conditions_inx.
lw_order_conditions_inx-itm_number = lv_kposn.
lw_order_conditions_inx-cond_st_no = lw_conditions_out-cond_st_no.
lw_order_conditions_inx-cond_count = lw_conditions_out-cond_count.
lw_order_conditions_inx-cond_type = lw_conditions_out-cond_type.
lw_order_conditions_inx-updateflag = 'U'.
lw_order_conditions_inx-cond_value = lc_x.
APPEND lw_order_conditions_inx TO lt_order_conditions_inx.
You didn't populate the fields cond_st_no and -cond_count. Then just call BAPI SD_SALESDOCUMENT_CHANGE to change the Sales order.
Hope that helps.
Erwin -
BAPI_SALESORDER_CREATEFROMDAT2 for creating sales orders with configurable
Hi All,
I want to create sales order with a material which in turn triggers a configurable network order.
I am using the following BAPI : BAPI_SALESORDER_CREATEFROMDAT2.
After reading the "[Variant Configuration (LO-VC)|http://help.sap.com/printdocu/core/print46c/en/data/pdf/lovc/lovc.pdf]" documentation, I thought I had to populate the
following tables ORDER_CFGS_REF, ORDER_CFGS_INST and ORDER_CFGS_VALUE.
The call function return no errors and the sale order is well created. However, I have no values in the network.
If I created a sale order in VA01, a network is created with value. So the customizing is good.
Do you have any idea how to populate this tables ? Sample code will be very helpful.
We found in this forum a lot of sample code about configurable material, with obj_type populate with MARAu2019. But no example with configurable network.
Actually I complete these tables like this :
" E1CUCFG
ls_order_cfgs_ref-posex = '000010'.
* ls_order_cfgs_ref-config_id = '000010'.
ls_order_cfgs_ref-config_id = '000001'.
ls_order_cfgs_ref-root_id = '00000001'.
ls_order_cfgs_ref-complete = 'T'.
ls_order_cfgs_ref-consistent = 'T'.
* ls_order_cfgs_ref-cbase_id = '4ECADFC4BE9F03A6E10080000AC4AB76'.
* ls_order_cfgs_ref-cbase_id_type = 'G'.
APPEND ls_order_cfgs_ref TO lt_order_cfgs_ref.
" E1CUINS
ls_order_cfgs_inst-config_id = '000001'.
ls_order_cfgs_inst-inst_id = '00000001'.
ls_order_cfgs_inst-obj_type = 'PLKONET'. u201C(in replacement of MARA)
ls_order_cfgs_inst-class_type = '300'. u201C(or 020).
ls_order_cfgs_inst-obj_key = '01000000801'.
APPEND ls_order_cfgs_inst TO lt_order_cfgs_inst.
" E1CUVAL
ls_order_cfgs_value-config_id = '000001'.
ls_order_cfgs_value-inst_id = '00000001'.
ls_order_cfgs_value-charc = 'XXXX'. u201C(corresponding to Flag DTA)
ls_order_cfgs_value-charc_txt = 'Flag DTA'.
ls_order_cfgs_value-value = '0'.
APPEND ls_order_cfgs_value TO lt_order_cfgs_value.
Thanks,Have a look to OSS-Message 567348. There is sample coding for using BAPI_SALESORDER_CHANGE, but the parameters should be the same to yout BAPI
Best regards
Torsten Manhardt -
Do not change the payment term created a Sales Order with reference
Hi Gurus,
Do not change the payment term created a Sales Order with reference to a contract where the payer of the change in Sales Order.Hello ,
As per my understanding , you do not want the payment terms to be changed even if the payer partner function is changed ,
as standard sap redetermines the payment terms with change in partner function, you may use the exit
USEREXIT_MOVE_FIELD_TO_VBAK- header level
USEREXIT_MOVE_FIELD_TO_VBAP- Item level
in this you could write a small code which will not change the payment terms when payer is redetermined
hope this helps
Thanks
akasha -
Change open sales order with new condition schema
Hi SD Experts,
I have to change condition type on condition schema. For example, now we have ZPVI (Discount %). I have to change with ZPFI (Discount %). But we have some open sales orders with old schema. Can I correct old sales orders with new condition schema? Is it possible?
Thank you.
Gulay Celik>
Shai Sinai wrote:
> 3) The item categories of document items are assigned to billing plan types. This customization does create separate billing plan for each item, but the billing plans of item are refrenced to the header billing plan (according database field FPLA-RFPLN and screen field RV60F-KFREL), what means that item's values are not taken into consideration.
>
In this case it is obvious that it's not possible to have an item on the same document, which would have a billing plan different from the header. Unless, of course, you are ready to change the existing configuration or create a new item category, which would be independent from the header billing plan.
If, despite configuration, such entry is possible in VA41/VA42, then you'll have to use BDC instead of BAPI. Unfortunately, BAPIs do not have all the same functionality that might be available in the transaction.
Maybe you are looking for
-
Query results to Excel problems
I'm trying to get results from a ColdFusion query called q to go into an Excel file. There are 2 things going wrong. 1. An Excel message comes up that says "The file you are trying to open 'stc.xls', is in a different format than specified by the fil
-
*Hi,* *when fi posting done these value are reflects in mb5b? .* *Because some values are also seen in mb5b without movement type.* *what are the logic behind this please explain me* Thanks and Regards Anil
-
Whenever I click on a photo Preview opens up all the most recent photos I have opened using Preview, then Preview freezes. I can't close any of the photos individually or open any of the bar menu items (Preview, File, etc.). The only way to close Pre
-
There is a red 1 on my settings app
I have a red 1 on my settings app how do i get it off
-
i want to pass values to applet from my jsp. am using <object>tag and am getting the values dynamicaly from database and i want to pass in while loop using <param> tag.i have tried something as below.but its not working.pls help me. <object type="app