BAPI_SALESORDER_CHANGE / CREATE
Hi All,
I have an urgent problem to solve, I need for specific reason to create or change another sales order during the creation or change of a, let me call, master sales order. This works, when I save the order A the bapi goes and create or change the sales order B. But the next issue is now that the order B has to be changed or created using a different USERID from the one who is changing the order A because of different levels of Authority.
Can anyone tell me how I can let the BAPI working as the B.I. session does, I mean with BDC_OPEN_GROUP I can specify which USERID has to be used to perform the BI session.
Is it possible using the BAPI?
Thanks a lot.
Ciao.
Maybe create an RFC destination as type 3 (R/3 connection) that connects to your system (RFC_DEST=MYOWN). Enter the userid in logon details in SM59. Call the BAPI with DESTINATION 'MYOWN'....
Similar Messages
-
BAPI_SALESORDER_CHANGE - Creating Large dialog overhead in Batch run
All,
I have a program that is calling the BAPI_SALESORDER_CHANGE repeatedly in a batch job.
Basis is complaining that it is creating a lot of dialog transactions that is creating too much overhead and draining system resources.
The program calls the bapi and does a committ /wait after each call.
Is there some switch, flag, etc. that can be set in the BAPI parms (I could not find one) or something that can be set in the batch job, etc. that will eliminate this.
Any help appreciated.
Thanks.
ScottTry BAPI_TRANSACTION_COMMIT after each call if the bapi is success.
Example
call function 'BAPI_SALESORDER_CHANGE'
exporting
salesdocument =
order_header_inx =
tables
return =
order_item_in =
order_item_inx =
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'. -
Creating new sales-order item with text using BAPI_SALESORDER_CHANGE
Hi all.
I want to create new sales-order item in an existing sales-order by using BAPI_SALESORDER_CHANGE. This works fine.
I also want to enter item-texts for the new item in the same call, but this doesn't work.
When I call the BAPI I do not assign an item-number for the new item, thus I have no item-number to assign to ITM_NUMBER in table ORDER_TEXT. IF ITM_NUMBER is empty, it's treated as a header text....
Any clues?
Regards
/Elisabetincrement the last itemnumber and pass it to that.
if they are following a sequence 10,20,30.
find the next sequence and send it to the ITEMNUMBER field.
or else you add the text after the Function call. -
Schedule lines creation with BAPI_SALESORDER_CHANGE
Dear All,
1. I'm trying to create a new Schedule Lines to an already existing Scheduling Agreement.
2. For this, I'm using the BAPI --> BAPI_SALESORDER_CHANGE.
3. This BAPI returns me a message saying that the Schedule line processed successfully.
4. When I check the VBEP Table with the Scheduling Agreement number, I'm able to see the newly created schedule line.
5. But, when I see the Transaction VA33, I'm not able to see the schedule lines.
I checked in SDN and OSS notes. I found 1647069 which says to pass the line number and Item number which I'm already doing it.
Can any one help me out ?
Regards,
Deepu.KI verified in my system that the below should work. Here, I am inserting a new schedule 0002 for item 10 with qty 1 and another date.
Of course, you should ensure that there is sufficient quantity that is not yet confirmed by existing schedule lines.
BAPI_SALESORDER_CHANGE
SALESDOCUMENT = '0011827125'
ORDER_HEADER_INX
UPDATEFLAG = 'U'
ORDER_ITEM_IN
ITM_NUMBER = '000010'
ORDER_ITEM_INX
ITM_NUMBER = '000010'
UPDATEFLAG = 'U'
SCHEDULE_LINES
ITM_NUMBER = '000010'
SCHED_LINE = '0002'
REQ_DATE = '20120104'
REQ_QTY = '1'
SCHEDULE_LINESX
ITM_NUMBER = '000010'
SCHED_LINE = '0002'
UPDATEFLAG = 'I'
REQ_DATE = 'X'
REQ_QTY = 'X'. -
How to pass Itab to "BAPI_SALESORDER_CHANGE"
Requirment : We cancel sales order that have been created but not fulfilled within 7 days.
At present, we do this manually. Can we configure to have the system auto cancel the sales order
after the said period?
selection screen
u2022 Sales organization (P_VKORG like ZSD_REJECT-VKORG)
u2022 Sales office (S_VKBUR for ZSD_REJECT-VKBUR)
u2022 Plant (S_WERKS for ZSD_REJECT-WERKS)
u2022 Sales order type (S_AUART for ZSD_REJECT-AUART)
u2022 Sales order no. (S_VBELN for ZSD_REJECT-VBELN)
u2022 Customer no. (S_KUNNR for ZSD_REJECT-KUNNR)
u2022 Rejection date (S_REJDTE for ZSD_REJECT-REJDATE)
Report format/columns should be as follows:
1. Sales organization (ZSD_REJECT-VKORG)
2. Sales office (ZSD_REJECT-VKBUR)
3. Plant (ZSD_REJECT-WERKS)
4. Customer no. (ZSD_REJECT-KUNNR)
5. Customer name (KNA1-NAME1)
6. Sales order no. (ZSD_REJECT-VBELN)
7. Sales order item (ZSD_REJECT-POSNR)
8. Material no. (VBAP-MATNR)
9. Material description (VBAP-ARKTX)
10. Order quantity (VBAP-KWMENG)
11. Rejected quantity (ZSD_REJECT-REJQTY)
12. Unit of measure (VBAP-VRKME)
13. Rejected net value (ZSD_REJECT-REJVAL)
14. Currency (VBAK-WAERK)
15. Rejection date (ZSD_REJECT-REJDATE)
16. Rejection time (ZSD_REJECT-REJTIME)
17. Rejection user (ZSD_REJECT-REJUSER)
Program : I have created one report & calling bapi BAPI_SALESORDER_CHANGE
TYPES: BEGIN OF t_tab,
vkorg TYPE zsd_reject-vkorg ,
vkbur TYPE zsd_reject-vkbur ,
auart TYPE zsd_reject-auart ,
END OF t_tab.
TYPES: BEGIN OF t_vbak,
vbeln TYPE vbak-vbeln ,
erdat TYPE vbak-erdat ,
waerk TYPE vbak-waerk,
vbtyp TYPE vbak-vbtyp,
auart TYPE vbak-auart,
vkorg TYPE vbak-vkorg ,
vkbur TYPE vbak-vkbur ,
kunnr TYPE vbak-kunnr ,
cmfre TYPE vbak-cmfre ,
gbsta type vpup-gbsta,
costa TYPE vbuk-costa ,
fkstk TYPE vbuk-fkstk,
END OF t_vbak.
TYPES: BEGIN OF t_data,
vbeln TYPE vbak-vbeln ,
waerk TYPE vbak-waerk,
auart TYPE vbak-auart,
vkorg TYPE vbak-vkorg ,
vkbur TYPE vbak-vkbur ,
kunnr TYPE vbak-kunnr ,
cmfre TYPE vbak-cmfre ,
END OF t_data.
TYPES: BEGIN OF t_vbap,
matnr TYPE vbap-matnr ,
vbeln TYPE vbap-vbeln ,
posnr TYPE vbap-posnr,
arktx TYPE vbap-arktx ,
pstyv TYPE vbap-pstyv,
abgru TYPE vbap-abgru,
kwmeng TYPE vbap-kwmeng,
werks TYPE vbap-werks ,
END OF t_vbap.
TABLES *
TABLES : zsd_reject.
INTERNAL TABLES, STRUCTURES & WORK AREAS *
DATA: it_vbak TYPE STANDARD TABLE OF t_vbak WITH HEADER LINE,
it_data TYPE STANDARD TABLE OF t_data WITH HEADER LINE ,
it_vbap TYPE STANDARD TABLE OF t_vbap ,
wa_vbak TYPE t_vbak ,
wa_vbap TYPE t_vbap ,
wa_data TYPE t_data.
PARAMETERS & SELECT-OPTIONS *
DUE TO AN SAP LIMITATION WITH CREATING / CHANGING VARIANTS,
selection screen fields over 45 characters in length should be avoided
SELECTION-SCREEN: BEGIN OF BLOCK a01 WITH FRAME TITLE text-001.
PARAMETERS: p_vkorg LIKE zsd_reject-vkorg.
SELECT-OPTIONS: s_vkbur FOR zsd_reject-vkbur,
s_werks FOR zsd_reject-werks,
s_auart FOR zsd_reject-auart,
s_vbeln FOR zsd_reject-vbeln,
s_kunnr FOR zsd_reject-kunnr,
s_rejdte FOR zsd_reject-rejdate.
SELECTION-SCREEN: END OF BLOCK a01.
DATA : p_days TYPE i VALUE 7,
l_checkdate LIKE sy-datum.
START-OF-SELECTION.
l_checkdate = sy-datum - p_days.
SELECT vbak~vbeln
vbak~erdat
vbak~waerk
vbak~vbtyp
vbak~auart
vbak~vkorg
vbak~vkbur
vbak~kunnr
vbak~cmfre
vbup~gbsta
vbuk~costa
vbuk~fkstk
INTO TABLE it_vbak
FROM vbak INNER JOIN vbuk
ON vbakvbeln = vbukvbeln
WHERE vbak~vkorg = p_vkorg
AND vbak~vkbur IN s_vkbur
AND vbak~auart IN s_auart
AND vbak~vbtyp = 'C'
AND vbuk~gbstk NE 'C'.
Requirment :
This checking is only for those order were previously blocked and has been released, which means credit release date not equal to 00.00.0000 and hence program will check rejection logic based on credit release date vs system date > 7 calendar days. For those orders which holding credit release date equals to 00.00.0000 will go through rejection checking
based on order creation date vs system date > 7 calendar days respectively.
LOOP AT it_vbak INTO wa_vbak.
IF NOT wa_vbak-cmfre IS INITIAL.
IF wa_vbak-cmfre > l_checkdate.
DELETE it_vbak FROM wa_vbak.
ENDIF.
ELSE.
IF wa_vbak-erdat > l_checkdate.
DELETE it_vbak FROM wa_vbak.
ENDIF.
ENDIF.
ENDLOOP.
SELECT vbapmatnr vbapvbeln vbapposnr vbaparktx vbap~pstyv
vbapabgru vbapkwmeng vbap~werks INTO TABLE it_vbap
FROM vbap INNER JOIN vbup ON
vbapvbeln = vbupvbeln AND vbapposnr = vbupposnr
FOR ALL entries
IN it_vbak WHERE vbap~vbeln = it_vbak-vbeln AND
gbsta NE 'C'.
I have taken the records in two internal table for header & item it_vbak & it_vbap
now I need to call the BAPI_SALESORDER_CHANGE and pass the internal table to Bapi .
Can anyone please let me know how to pass this into Bapi?
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument =
ORDER_HEADER_IN =
order_header_inx =
SIMULATION =
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
tables
return =
ORDER_ITEM_IN =
ORDER_ITEM_INX =
PARTNERS =
PARTNERCHANGES =
PARTNERADDRESSES =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
SCHEDULE_LINES =
SCHEDULE_LINESX =
ORDER_TEXT =
ORDER_KEYS =
CONDITIONS_IN =
CONDITIONS_INX =
EXTENSIONIN =
Thanks in advance
Regards
RahulHi,
I am trying to cancel the sales order that have been created but not fulfilled within 7 days.
If this condition is true dump is coming (when I am trying to delete the records from internal table)
if wa_vbak-erdat > l_checkdate.
delete it_vbak from wa_vbak.
endif.
Error analysis
The program attempted to interp 70000200KL " as a number, but since the value contravenes the
this was not possible.
types: begin of t_vbak,
vbeln type vbak-vbeln ,
erdat type vbak-erdat ,
waerk type vbak-waerk,
vbtyp type vbak-vbtyp,
auart type vbak-auart,
vkorg type vbak-vkorg ,
vtweg type vbak-vtweg,
spart type vbak-spart,
vkbur type vbak-vkbur ,
kunnr type vbak-kunnr ,
cmfre type vbak-cmfre ,
gbsta type vpup-gbsta,
costa type vbuk-costa ,
fkstk type vbuk-fkstk,
end of t_vbak.
data : p_days type i value 7,
l_checkdate like sy-datum.
DATA: it_vbak TYPE STANDARD TABLE OF t_vbak WITH HEADER LINE,
it_data TYPE STANDARD TABLE OF t_data WITH HEADER LINE ,
start-of-selection.
l_checkdate = sy-datum - p_days.
select vbak~vbeln
vbak~erdat
vbak~waerk
vbak~vbtyp
vbak~auart
vbak~vkorg
vbak~vtweg
vbak~spart
vbak~vkbur
vbak~kunnr
vbak~cmfre
vbup~gbsta
vbuk~costa
vbuk~fkstk
into corresponding fields of table it_vbak
from vbak inner join vbuk
on vbakvbeln = vbukvbeln
where vbak~vkorg = p_vkorg
and vbak~vkbur in s_vkbur
and vbak~auart in s_auart
and vbak~vbtyp = 'C'
and vbuk~gbstk ne 'C'
and vbak~vbeln = '0000003549'.
sort it_vbak by vbeln.
if not it_vbak[] is initial.
loop at it_vbak into wa_vbak.
if not wa_vbak-cmfre is initial.
if wa_vbak-cmfre > l_checkdate.
delete it_vbak from wa_vbak.
endif.
else.
******Error (short dump here if condition true )***************************
if wa_vbak-erdat > l_checkdate.
delete it_vbak from wa_vbak.
endif.
endif.
endloop.
endif.
Regards
Rahul -
Error while creating Sales Order Through BAPI
Hi Friends,
i am creating a RFC where i have to create sales order .
I am using bapi
BAPI_SALESORDER_CREATEFROMDAT2
for same and entering values to it.
I got the following return messages:
S V4 233 SALES_HEADER_IN has been processed successfully
S V4 233 SALES_ITEM_IN has been processed successfully
S V1 311 BDN Order 3112800903 has been saved
But when I go to transaction VA03 and enter the number i get the following error:
SD document 3112800903 is not in the database or has been archived
Can any one know how to resolve this error.I am also using BAPI_TRANSACTION_COMMIT with wait = 'X'.
Regards,
Santosh AlleHi,
Try to check the return message once.
SD document 3112800903 is not in the database or has been archived
You will get this message if the sales document is deleted from the database .The BAPI 'BAPI_SALESORDER_CHANGE' is used to delete salesorder.Check whether anyone has deleted it
Also, sometimes it may take few seconds to update the sales order in the database when using BAPI. Check the transaction after some time.
Regards,
Lakshman.
Edited by: Lakshman N on May 14, 2010 7:43 AM -
BAPI_SALESORDER_CHANGE add new line and conditions with a condition value
Hi,
I am using BAPI_SALESORDER_CHANGE to add new lines to a credit memo. All works fine except that I can not seem to put a condition value on the new lines. The condition is created but with a value of 0. I can popluate the condition amount field, KBETR but not KWERT. BAPICONDX seems to only have the COND_VALUE field in it and not CONDVALUE as in BAPICOND. Does anyone have any idea how to do this? In the code below I just want to change the material on the first line of the credit memo and not add the condition. Then add new lines with the the condition.
lw_order_header_inx-updateflag = 'U'.
LOOP AT i_accru INTO wa_accru.
lv_count = lv_count + 1.
lv_posnr = lv_count * 10.
* Order Items
lw_order_item_inx-itm_number = lv_posnr.
lw_order_item_inx-material = 'X'.
IF lv_count = 1.
lw_order_item_inx-updateflag = 'U'.
ELSE.
lw_order_item_inx-updateflag = 'I'.
ENDIF.
APPEND lw_order_item_inx TO lt_order_item_inx.
lw_order_item_in-itm_number = lv_posnr.
lw_order_item_in-material = wa_accru-vakey.
APPEND lw_order_item_in TO lt_order_item_in.
* Conditions
IF lv_count <> 1.
lw_conditions_inx-itm_number = lv_posnr.
lw_conditions_inx-cond_st_no = '905'.
lw_conditions_inx-cond_count = '01'.
lw_conditions_inx-cond_type = 'ZHIE'.
lw_conditions_inx-currency = 'X'.
lw_conditions_inx-updateflag = 'I'.
APPEND lw_conditions_inx TO lt_conditions_inx.
lw_conditions_in-itm_number = lv_posnr.
lw_conditions_in-cond_st_no = '905' .
lw_conditions_in-cond_count = '01'.
lw_conditions_in-cond_type = 'ZHIE'.
lw_conditions_in-condvalue = wa_accru-accru.
lw_conditions_in-currency = 'GBP'.
APPEND lw_conditions_in TO lt_conditions_in.
ENDIF.
ENDLOOP.
* Change the credit memo
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = lv_vbeln
order_header_in = lw_order_header_in
order_header_inx = lw_order_header_inx
* SIMULATION =
* BEHAVE_WHEN_ERROR = ' '
* INT_NUMBER_ASSIGNMENT = ' '
* LOGIC_SWITCH =
* NO_STATUS_BUF_INIT = ' '
TABLES
return = lt_return
order_item_in = lt_order_item_in
order_item_inx = lt_order_item_inx
* PARTNERS =
* PARTNERCHANGES =
* PARTNERADDRESSES =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CFGS_BLOB =
* ORDER_CFGS_VK =
* ORDER_CFGS_REFINST =
* SCHEDULE_LINES =
* SCHEDULE_LINESX =
* ORDER_TEXT =
* ORDER_KEYS =
conditions_in = lt_conditions_in
conditions_inx = lt_conditions_inx
* EXTENSIONIN =
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
ENDIF.Hi Rob,
Have you managed to solve this issue. If so, could you please share the solution.
I am also facing similar problem.
Thanks for your help.
Anoop -
Creating sales order using web dynpro JAVA
Hello everyone,
i am new to web dynpro. Can any one tell me how to creating sales order by web dynpro JAVA using BAPI.
Thanks.
Vinita SharmaHi...
you can use Adaptive RFC methodology in web dynpro java to work with BAPIs..... these are standard bapi's provided
Here are required Bapis... select which one you want....
BAPISDORDER_GETDETAILEDLIST Sales Order: List of All Order Data
BAPI_ORDER_CHANGE_STATUS_GET Change status for order
BAPI_SALESDOCU_CREATEFROMDATA Creating a Sales Document
BAPI_SALESORDER_CHANGE Sales Order: Change Sales Order
BAPI_SALESORDER_CREATEFROMDAT1 Sales Order: Create Sales Order
BAPI_SALESORDER_CREATEFROMDAT2 Sales Order: Create Sales Order
BAPI_SALESORDER_CREATEFROMDATA Create sales order, no more maintenance
BAPI_SALESORDER_GETLIST Sales order: List of all orders for customer
BAPI_SALESORDER_GETSTATUS Sales order: Display status
BAPI_SALESORDER_SIMULATE Sales Order: Simulate Sales Order
check this thread SALES ORDER creation using BAPI
sample java program which will call SAP bapi function sales order create
PradeeP -
Confirmation Quantity issue while creating Sales order using BAPI
Hi SDN,
Can anyone of you help mein the below issue:
I have a program to create a sales order using upload file. for this i use "BAPI_SALESORDER_CREATEFROMDAT2" & for changing existing "BAPI_SALESORDER_CHANGE".
Now If the upload file contains the Same Material, Based on other conditions, it needs to create Multiple sales order.
When the first Salesorder is created, the Quantity is getting confirmed (Confirmed quantity VBEP-BMENG). But during actual run, since the confirmation is getting done for the same material in the above Sales order, the confirmation is not being done in the subsequent Sales order".
This poses a problem for business, user need to manual refresh the u201Cconfirmed quantity for each line item in the particular SO where it failed during program upload.
Also while uploading using the BAPI, if we wait forsometime after creating the first sales order in Debug, then the above material is unlocked & the confirmation quantity is done for the subsequent sales order also.
But in the actual run, this is creating a problem. Some Refresh or Unlocking problem.
Can you please suggest a suitable solution for this issue.
Thanks & regrads,
Chaitanya LBKHave you tried backorder processing?
V_V1
V_V2
V_RA
V_R1
V_R2 -
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 -
Block For billing when sales order is created
Hi experts,
I have a requirement in which i want to block the sales documrnt for billing when the sales order is created with particular discount value.
for this i have checked the condition of discount first it works fine no i want to block it for billing.
My SD consultant told open the sales doc in change mode(VA02) and then go to Billing Block field (FAKSK) and then give 02 Compl confirm missing and save the doc
So for this i have writen a method.
SET Parameter ID 'VBELN' Field OBJECT-KEY.
Call Transaction 'VA02' and SKIP FIRST SCREEN.
SET Parameter ID 'FAKSK' Field '02'.
in this it is calling the VA02 screen but i am not able to pass the billing block value and save.
Please give me a solution how to do this.
for blocking i have also used the standard method in BUS2032 SetDefaultBillingBlock
it is not blocking the billing.
Or should i use some bapi for this.
Regards,
HariHi Hari,
SET parameter ID only sets the value to an input field. It wont saves to the database. More over i don't find any parameter ID for billing block in VA02.(May be because it is a drop down).
Use BAPI BAPI_SALESORDER_CHANGE Pass the sales order number, ORDER_HEADER_IN-BILL_BLOCK = ur blocking code, ORDER_HEADER_INX-BILL_BLOCK = X.
After calling the BAPI call BAPI_TRANSACTION_COMMIT.
Above procedure is to programativally.
If u want to do it manually then directly open VA02 and change the billing block and save.
I dont think we can set parameter ID for billing block
Thanks,
Vinod. -
Characteristic values in BAPI_SALESORDER_CHANGE
Hi,
I want to add new configurable item in existing sales order with charactersitic values.
Iam using bapi BAPI_SALESORDER_CHANGE.
Iam now able to insert configurable item in existing sales order.
But the characteristic values are not getting stored.
Latest code is attached. What else is missing for storing characteristic values ?
select maximum item number in sales order
SELECT MAX( POSNR ) FROM VBAP CLIENT SPECIFIED
INTO MAX_POSNR
WHERE MANDT = SY-MANDT AND
VBELN = I_SORDER.
TMP_POSNR = MAX_POSNR + 10.
WA_HDRX-UPDATEFLAG = 'U'. "update
SALES_DOC = I_SORDER.
item data
WA_ITEM-ITM_NUMBER = TMP_POSNR.
WA_ITEM-MATERIAL = 'LEFTEYE'.
WA_ITEM-PLANT = I_STORE.
WA_ITEM-SHIP_POINT = I_STORE.
APPEND WA_ITEM TO IT_ITEM.
WA_ITEMX-ITM_NUMBER = TMP_POSNR.
WA_ITEMX-UPDATEFLAG = 'I'. "add
WA_ITEMX-MATERIAL = 'X'.
WA_ITEMX-PLANT = 'X'.
WA_ITEMX-SHIP_POINT = 'X'.
APPEND WA_ITEMX TO IT_ITEMX.
Schedule lines
WA_SCHD-ITM_NUMBER = TMP_POSNR.
WA_SCHD-SCHED_LINE = TMP_POSNR.
WA_SCHD-REQ_DATE = SY-DATUM.
WA_SCHD-REQ_QTY = 1.
WA_SCHD-SCHED_TYPE = 'CN'.
APPEND WA_SCHD TO IT_SCHD.
WA_SCHDX-ITM_NUMBER = TMP_POSNR.
WA_SCHDX-SCHED_LINE = TMP_POSNR.
WA_SCHDX-REQ_DATE = 'X'.
WA_SCHDX-REQ_QTY = 'X'.
WA_SCHDX-SCHED_TYPE = 'X'.
APPEND WA_SCHDX TO IT_SCHDX.
config & characteristic values
WA_VALUE-CONFIG_ID = '000001'.
WA_VALUE-INST_ID = '00000001'.
WA_VALUE-CHARC = 'PRES_DIST_SPH'.
WA_VALUE-VALUE = '3.2'.
APPEND WA_VALUE TO IT_VALUE.
WA_INST-CONFIG_ID = '000001'.
WA_INST-INST_ID = '00000001'.
WA_INST-OBJ_TYPE = 'MARA'.
WA_INST-CLASS_TYPE = '300'.
WA_INST-OBJ_KEY = 'LEFTEYE'.
WA_INST-QUANTITY = 1.
WA_INST-QUANTITY_UNIT = 'NO'.
APPEND WA_INST TO IT_INST.
WA_REF-POSEX = TMP_POSNR.
WA_REF-CONFIG_ID = '000001'.
WA_REF-ROOT_ID = '00000001'.
APPEND WA_REF TO IT_REF.
WA_PART-CONFIG_ID = '000001'.
WA_PART-PARENT_ID = '00000001'.
WA_PART-INST_ID = '00000001'.
WA_PART-OBJ_TYPE = 'MARA'.
WA_PART-CLASS_TYPE = '300'.
WA_PART-OBJ_KEY = 'LEFTEYE'.
APPEND WA_PART TO IT_PART.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = SALES_DOC
ORDER_HEADER_INX = WA_HDRX
TABLES
RETURN = IT_RET
ORDER_ITEM_IN = IT_ITEM
ORDER_ITEM_INX = IT_ITEMX
ORDER_CFGS_REF = IT_REF
ORDER_CFGS_PART_OF = IT_PART
ORDER_CFGS_INST = IT_INST
ORDER_CFGS_VALUE = IT_VALUE
SCHEDULE_LINES = IT_SCHD
SCHEDULE_LINESX = IT_SCHDX.
READ TABLE IT_RET INTO WA_RET WITH KEY TYPE = 'E'.
IF SY-SUBRC = 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
I get the following messages from BAPI :
ORDER_HEADER_IN has been processed successfully.
ITEM_IN has been processed successfully
The sales document is not yet complete: Edit data
TIL-Direct Sales TINDC01372 has been saved
What else is missing ? Any help is appreciated.
thanks,
Nagarajan.JHello Nagarajan,
I have used this BAPI in my last task. You are passing the values correctly. I will tell you why it is giving like that message.
Whenever we will create a sales order in VA01 transaction, you will get a message like "The sales order is not complete, would you like to EDIT" while saving the sales order.... This is because of not providing complete data required for careation of sales order.
Try to implement the changes manually in VA02, if you get same errors, then you can find your code is correct.
Even I got same type of messages when changing a sales order to change the Rejection Reason for the items.
Best Regards,
Sasidhar Reddy Matli.
Edited by: Sasidhar Reddy Matli on Jul 31, 2008 2:20 PM -
Pricing conditions for sale order create BAPI
Hi guys and gals,
i am workin on a object where i would have to create a variant of VA01 screen with pricing details , item details , shipping details etc, visible in a single screen .
What i have understood so far is that i would have to use BAPI simulate to get the pricing conditions and ATP details to display to the user before he saves the order , the issue now is when is adding new pricing conditions or changing the existing conditions on my screen i would have to update the other conditions types based on his input and i also understand that some conditions r editable and some arn't and like in regular VA01 the user should be able to delete the pricing conditions also , which means i should taken into account all this when iam finally saving this order , please guide me further in this regards
Thanks in advanceHai
Try with the following
U need to give the step_nr, item_nr, cond_count and cond_type so the correct conditon will be updated. If no condition exists for the given parameters, a new condition will be created.
U can find these parameters for a particular condition type in table KONV.
*& Form saveTransactionJOCR
text
--> p1 text
<-- p2 text
FORM saveTransactionJOCR .
data: salesdocument like BAPIVBELN-VBELN,
order_header_inx like bapisdh1x,
order_header_in like bapisdh1,
return type standard table of bapiret2 with header line,
conditions_in type standard table of bapicond with header line,
conditions_inx type standard table of bapicondx with header line,
logic_switch like BAPISDLS,
step_nr like conditions_in-cond_st_no,
item_nr like conditions_in-itm_number,
cond_count like conditions_in-cond_count,
cond_type like conditions_in-cond_type.
salesdocument = wa_order_information-VBELN.
LOGIC_SWITCH-COND_HANDL = 'X'.
order_header_inx-updateflag = 'U'.
conditions
clear conditions_in[].
clear conditions_inx[].
clear: step_nr,
item_nr,
cond_count,
cond_type.
step_nr = '710'.
item_nr = '000000'.
cond_count = '01'.
cond_type = 'ZCP2'.
CONDITIONS_IN-ITM_NUMBER = item_nr.
conditions_in-cond_st_no = step_nr.
CONDITIONS_IN-COND_COUNT = cond_count.
CONDITIONS_IN-COND_TYPE = cond_type.
CONDITIONS_IN-COND_VALUE = 666.
CONDITIONS_IN-CURRENCY = 'EUR'.
append conditions_in.
CONDITIONS_INX-ITM_NUMBER = item_nr.
conditions_inx-cond_st_no = step_nr.
CONDITIONS_INX-COND_COUNT = cond_count.
CONDITIONS_INX-COND_TYPE = cond_type.
CONDITIONS_INX-UPDATEFLAG = 'U'.
CONDITIONS_INX-COND_VALUE = 'X'.
CONDITIONS_INX-CURRENCY = 'X'.
append conditions_inx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = salesdocument
ORDER_HEADER_IN = order_header_in
ORDER_HEADER_INX = order_header_inx
LOGIC_SWITCH = logic_switch
TABLES
RETURN = return
CONDITIONS_IN = conditions_in
CONDITIONS_INX = conditions_inx
if return-type ne 'E'.
commit work and wait.
endif.
ENDFORM. " saveTransactionJOCR
Thanks & regards
Sreenivasulu P -
ABAP program to change SD sales order originally created on CRM
Hello all!
Please, I would like to ask you some wisdom about this question:
I need to use a BAPI (BAPI_SALESORDER_CHANGE) or a call transaction (to t-code 'VA02') to modify in the R/3 system (v. 4.7) a sales order that was originally created in the CRM system.
If I try to do it manually, in t-code VA02, I get a message that this order must be modified only in the CRM system. I debugged and found that there are functions that check this and deny acces to the order.
I found this check on form FV45LF0M_MESSAGE_VARIABEL. This it the one that issues the error message.
Actually I need to find a way to, without modifying standard routines or tables, change the order the way I said.
Please, can someone help with some ideas?
Thank you very much for your time!
Best Regards,
Douglas CezarRob, thanks for the answer.
To adress a specific business need, I have to update the order directly in the R/3 system, without having to go to the CRM system. -
CRMXIF_ORDER_SAVE to create orders
Hi,
I'm trying to find ways to create sales orders in CRM via RFC calls. I would like to know from your experience:
1- Where I can find documentation, for precisely an example of how to fill the structure. I've seen ifr.sap.com but I've got no clue how to fill it all.
2- I need (it would be great) to create orders with custom conditions. I need for example that the value for condition PR00 is contained inside the struture so that when the order is created it uses the custom PR00 not the one from IPC automatic determiantion.
Tks in advanceJoao,
A few hints on how this works: The IPC is basically another RFC destination to CRM. The online processing for sales orders makes ABAP function module calls that eventually call the IPC as an RFC function.
In the structure for CRMXIF_ORDER_SAVE in the ITEMS segment there is a subsegment called PRICE_CONDITIONS. This is where you would actually input a pricing condition manually. You would need to setup your pricing procedure in such a fashion that the PR00 standard is not determined and instead your Z-condition is part of the calculation.
It is possible, to change the configuration or add pricing conditions via CRMXIF_ORDER_SAVE. It is very similiar to how BAPI_SALESORDER_CHANGE works in R/3. I would try seeing if you can first create a order in CRM with a PR00 condition and then see if you can simply add in your new condition via CRMXIF_ORDER_SAVE. If you can do that, then work with a pricing guru to figure out how to set the pricing procedure so no conditions are automatically determined, but require manual entry of the condition. Then you can programmatically come back in and dynamically add the pricing condition to your order.
Good luck,
Stephen
Maybe you are looking for
-
CF8, Multiple instances, archiving
I have a CF7 server installed as a stand alone installation. I have installed CF8 on the same box with the built-in web server, and multiserver. My developers want the multiple instances so they can use Subversion, versioning software. I am trying to
-
Using 10.6 iweb 3.04 . I make a small change on a page , then choose publish changes , but seems to take hours and seems to want to publish the whole site , not just a small change?
-
Dear All, i have an open sales order with a value 41677,8 this sales order was supposed to be delivered on the date 20.03.2011 (but it did not happen) and its value calculated in the credit management as open sales order (which is true ) but as del
-
Hi community, after I updated my MacBook Pro to Lion Mac OS X 10.7 I can´t synchronize my iPhone 4 with iTunes 10.4.1 anymore. Is there anybody who solved this problem in the meantime? Thanks for your support.
-
Workplace laptop install of Production Premium CS6 - invalid serial number
I started a new job a couple of months ago and was given a desktop machine running Windows 7 that had The Adobe Production Premium installed on it. Since a large part of my position entails video shoots, I was recently given a laptop (also Windows 7)