After creating new sales order through BAPI, it is not showing in VA03
Hi Experts
I am developing one program to create sales order using FM BAPI_SALESORDER_CREATEFROMDAT2. In output screen it is showing that the new sales order number created with new sales order number. But whenever I want to display the newly created sales order via VA03 it shows an error message SD document 10007547 is not in the database or has been archived but in program output it shows that 10007547 is created. This is in DEV server. Document numbers are generated by the system sequencially, but it is not reflected in database.
I am also attaching my code below.
REPORT z_bapi_salesorder.
DATA : gt_header LIKE bapisdhd1,
gt_item TYPE TABLE OF bapisditm,
gt_itemx TYPE TABLE OF bapisditmx,
gt_partner TYPE TABLE OF bapiparnr,
gt_return TYPE TABLE OF bapiret2.
DATA : gs_item LIKE LINE OF gt_item,
gs_itemx LIKE LINE OF gt_itemx,
gs_partner LIKE LINE OF gt_partner,
gs_return LIKE LINE OF gt_return.
DATA : v_vbeln TYPE vbeln_va.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(30) ord_type FOR FIELD p_auart.
PARAMETERS : p_auart TYPE auart OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_vkorg TYPE vkorg OBLIGATORY,
p_vtweg TYPE vtweg OBLIGATORY,
p_spart TYPE vbak-spart OBLIGATORY,
p_sold TYPE kunnr OBLIGATORY,
p_ship TYPE kunnr OBLIGATORY,
p_matnr TYPE matnr OBLIGATORY,
p_menge TYPE kwmeng OBLIGATORY,
p_plant TYPE werks_d OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK b1.
INITIALIZATION.
ord_type = 'Order Type'.
START-OF-SELECTION.
*Header information data.
gt_header-doc_type = p_auart.
gt_header-sales_org = p_vkorg.
gt_header-distr_chan = p_vtweg.
gt_header-division = p_spart.
*Partner information data.
gs_partner-partn_role = 'AG'.
gs_partner-partn_numb = p_sold.
APPEND gs_partner TO gt_partner.
CLEAR gs_partner.
gs_partner-partn_role = 'WE'.
gs_partner-partn_numb = p_ship.
APPEND gs_partner TO gt_partner.
CLEAR gs_partner.
*Item data
gs_item-itm_number = '000010'.
gs_itemx-itm_number = 'X'.
gs_item-material = p_matnr.
gs_itemx-material = 'X'.
gs_item-plant = p_plant.
gs_itemx-plant = 'X'.
gs_item-target_qty = p_menge.
gs_itemx-target_qty = 0.
APPEND gs_item TO gt_item.
APPEND gs_itemx TO gt_itemx.
CLEAR : gs_item, gs_itemx.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN =
order_header_in = gt_header
ORDER_HEADER_INX =
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
salesdocument = v_vbeln
TABLES
return = gt_return
order_items_in = gt_item
order_items_inx = gt_itemx
order_partners = gt_partner
ORDER_SCHEDULES_IN =
ORDER_SCHEDULES_INX =
ORDER_CONDITIONS_IN =
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 v_vbeln <> space.
COMMIT WORK.
WRITE :/ 'Document', v_vbeln ,'created'.
CLEAR : v_vbeln, gt_header.
REFRESH : gt_partner, gt_item, gt_itemx.
ELSE.
WRITE :/ 'Error in creating document'.
ENDIF.
Please give the possible solutions for this. What is reason for that update termination.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
EXPORTING
ORDER_HEADER_IN = ORDER_HEADER_IN
WITHOUT_COMMIT = ' '
CONVERT_PARVW_AUART = ' '
IMPORTING
SALESDOCUMENT = SALESDOCUMENT
SOLD_TO_PARTY =
SHIP_TO_PARTY =
BILLING_PARTY =
RETURN = RETURN
TABLES
ORDER_ITEMS_IN = ORDER_ITEMS_IN
ORDER_PARTNERS = ORDER_PARTNERS
ORDER_ITEMS_OUT =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CCARD =
ORDER_CFGS_BLOB =
ORDER_SCHEDULE_EX = ORDER_SCHEDULE_EX
use bapi_transaction_commit.
Regards,
Venkat
Similar Messages
-
Creating sales order through Bapi
Hi all,
I am trying to create sales order through bapi.
Now my problem is mapping sales order fields with bapi structure fields.
1.'Overall Order status' field in the 'Status' tab of the header in VA02.
2.'Tax'feild in the 'conditions' tab of the header in VA02.
Please help me to map these fields into Bapi structure.
Thanks in advance.
Regards,
Shalem.HI
GOOD
GO THROUGH THIS LINK,I HOPE THIS WILL GIVE YOU THE COMPLETE IDETA OF CREATING A SALES ORDER THROUGH BAPI,
http://help.sap.com/saphelp_nw04/helpdata/en/4c/fd7ebb515911d395f900a0c94260a5/content.htm
http://www.sappoint.com/abap/bapiintro.pdf
THANKS
MRUTYUN -
Creating sales order through BAPI - do not want to send idoc confirmation
Hi guys!
I'm creating a sales order using BAPI BAPI_SALESORDER_CREATEFROMDAT1. The system was cuztomized to send an idoc through an output type, so whenever this BAPI is executed an idoc is sent.
My problem is that I do not want the Idoc to be created when using this BAPI.
Is there a way not to use an output type when using the BAPI?
Thanks in advance for your help!Use an output requirement that stops the proposal of the output. You'll want to make sure that it works in both immediate and delayed modes, e.g., you can't use a field-symbol (or the KOMKBV1 user exit) for access to T180-TCODE or to the CALL_BAPI value in memory. You might want to try the VBAK-ERNAM value, since you probably use a specific (non-dialog) user for the call. Otherwise, use another field to identify a BAPI call and check that field in the requirement.
-
When I create Return Sales Order through BDC sales order doesnu2019t create.
Deal Guru,
When I create Return Sales Order through BDC sales order doesnu2019t create.
It shows created sales document number but when I display this document I am getting message Document is not in database.
After executing my BDC, message received in SAP in box : SAPSQL_ARRAY_INSERT_DUPREC
I am receiving following message in SAP inbox for following issue.
But when I create Return Sales Order through VA01, it is working. Please give me some idea.
Detail Message
Update was terminated
System ID.... PRO
Client....... 900
User..... DEVELOPER2
Transaction.. VA01
Update key... 4961DBF46A6B09D2E10080020A02281C
Generated.... 05.01.2009, 16:03:40
Completed.... 05.01.2009, 16:03:40
Error Info... 00 671: ABAP/4 processor: SAPSQL_ARRAY_INSERT_DUPREC
Regards
MakarandHi Rory
Try this link:
BAPI can't to create SO,But used bapi data with manual can?
Regards
Neha -
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. -
Sale Order Item Quantity Not Populating When Create A Sale Order Using BAPI
I am having a problem when creating a sale order using BAPI
BAPI_SALESORDER_CREATEFROMDAT2
Problem is that sale order item quantity field is not populating
code is as follows
ORDER_ITEMS_IN-ITM_NUMBER = '0010'.
ORDER_ITEMS_IN-MATERIAL = '000000000010000262'.
ORDER_ITEMS_IN-TARGET_QU = 'LB'.
ORDER_ITEMS_IN-TARGET_QTY = 1.Hi,
Try populating ORDER_SCHEDULES_IN table in the bapi field REQ_QTY.
Regds,
Rudra -
Billing document should not be cancelled after creating return sales order
Hi All,
Billing document should not be cancelled after creating return sales order with reference to billing document. Please suggest configuration settings on the same.
Sudheer.Hi,
In SAP, when the sub-sequent document is existing , we can not cancel the preceeding document. Therefore if you want to cancel the billing document you need to calcel the documents which are created with reference to that.
Check and confirm.
Regards,
Ravi Duggirala -
How to create the sales order using BAPI's ....?
Hi Guru's,
could you please provide how to create the sales order using BAPI's .....i need step by step process and please provide the details from scratch....basically i don't have basic knowledge on this....please provide required inputs ....:)
thanks in advance
Srinivas......Hi Guru's thanks for your inouts and your valuble time...
please find the program logic below...
*& Report ZAREPAS30
REPORT zarepas30.
DATA : gs_vbeln TYPE vbak-vbeln,
gs_order_header_in TYPE bapisdhd1,
gs_order_header_inx TYPE bapisdhd1x,
gt_order_items_in TYPE STANDARD TABLE OF bapisditm,
gwa_itab1 TYPE bapisditm,
gt_order_items_inx TYPE STANDARD TABLE OF bapisditmx,
gwa_itab2 TYPE bapisditmx,
gt_order_partners TYPE STANDARD TABLE OF bapiparnr,
gwa_itab3 TYPE bapiparnr,
gt_return TYPE STANDARD TABLE OF bapiret2,
gwa_itab4 TYPE bapiret2.
Sales document type
PARAMETERS: p_auart TYPE auart OBLIGATORY.
Sales organization
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
Distribution channel
PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
Division.
PARAMETERS: p_spart TYPE spart OBLIGATORY.
Requested Delivery Date
PARAMETERS: p_edatu TYPE edatu OBLIGATORY.
Sold-to
PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
Ship-to
PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
Material
PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
Quantity.
PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
Plant
PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
Start-of-selection.
START-OF-SELECTION.
Header data
Sales document type
gs_order_header_in-doc_type = p_auart.
gs_order_header_inx-doc_type = 'X'.
Sales organization
gs_order_header_in-sales_org = p_vkorg.
gs_order_header_inx-sales_org = 'X'.
Distribution channel
gs_order_header_in-distr_chan = p_vtweg.
gs_order_header_inx-distr_chan = 'X'.
Division
gs_order_header_in-division = p_spart.
gs_order_header_inx-division = 'X'.
Reguested Delivery Date
gs_order_header_in-req_date_h = p_edatu.
gs_order_header_inx-req_date_h = 'X'.
gs_order_header_inx-updateflag = 'I'.
Partner data
Sold to
gwa_itab3-partn_role = 'AG'.
gwa_itab3-partn_numb = p_sold.
APPEND gwa_itab3 TO gt_order_partners .
ship to
gwa_itab3-partn_role = 'WE'.
gwa_itab3-partn_numb = p_ship.
APPEND gwa_itab3 TO gt_order_partners .
ITEM DATA
gwa_itab2-updateflag = 'I'.
Line item number.
gwa_itab1-itm_number = '000010'.
gwa_itab2-itm_number = 'X'.
Material
gwa_itab1-material = p_matnr.
gwa_itab2-material = 'X'.
Plant
gwa_itab1-plant = p_plant.
gwa_itab2-plant = 'X'.
Quantity
gwa_itab1-target_qty = p_menge.
gwa_itab2-target_qty = 'X'.
APPEND gwa_itab1 TO gt_order_items_in.
APPEND gwa_itab2 TO gt_order_items_inx.
Line item number.
gwa_itab1-itm_number = '000020'.
gwa_itab2-itm_number = 'X'.
Material
gwa_itab1-material = p_matnr.
gwa_itab2-material = 'X'.
Plant
gwa_itab1-plant = p_plant.
gwa_itab2-plant = 'X'.
Quantity
gwa_itab1-target_qty = p_menge.
gwa_itab2-target_qty = 'X'.
APPEND gwa_itab1 TO gt_order_items_in.
APPEND gwa_itab2 TO gt_order_items_inx.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = gs_order_header_in
ORDER_HEADER_INX = gs_order_header_inx
IMPORTING
SALESDOCUMENT = gs_vbeln
tables
RETURN = gt_return
ORDER_ITEMS_IN = gt_order_items_in
ORDER_ITEMS_INX = gt_order_items_inx
order_partners = gt_order_partners.
Check the return table.
LOOP AT gt_return into gwa_itab4 WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE: / 'Error occured while creating sales order '.
ELSE.
Commit the work.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
WRITE: / 'Document ', gs_vbeln, ' created'.
ENDIF. -
How to create a sales order using bapi
hi
i need to create a sales order using bapi.
can any one help meDo NOT USE BAPI_SALESORDER_CREATEFROMDATA, that FM is obsolete!
Use BAPI_SALESORDER_CREATEFROMDAT1 .
To build a reference to your contract you have to supply ORDER_HEADER_IN.
Here´s a sample:
MOVE:
gs_vbak-vbeln TO ls_bapisdhd1-refobjkey,
gs_vbak-vbeln TO ls_bapisdhd1-ref_doc,
gs_vbak-vbtyp TO ls_bapisdhd1-refdoc_cat,
gs_vbak-auart TO ls_bapisdhd1-refdoctype.
also gothrouh the links
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap%2b-%2bsimple%2bprogram%2bto%2bcreate%2bsales%2border%2busing%2bbapi -
How to create a Sales Order through an EDI configuration.
Hi
How to create a Sales Order through an EDI configuration.
Tell me the step-by-step procedure for this.
Any power point presentation would be fine.
Cheers
MaruthiHi,
You can go to these links to know little bit about sales order creation through EDI/ALE by means of IDOCS.
http://www.riyaz.net/blog/index.php/2008/01/19/beginners-guide-to-ale-and-idocs-a-step-by-step-approach/
Sales Order Idoc Extension.
http://www.*******************/2007/11/abap-idocs-basic-tools.html
For any specific information, just do a google search(information like message t ype, IDOC type, Functoin module, etc. You will definitely get the information you are looking for
Please reward if this helps you -
Can we create new sales order for RMA?
Hi
We have processed one sales order eg.ABC in INR instead of USD and we have closed it. Later we found that the order entry was wrong (that is the currency was wrongly entered in INR instead of USD) and created a new sales order eg. XYZ for RMA of that material and entered the sales order number ABC and invoice number as reference under returns tab. Now if I go to take the receipt of the new sales order created for RMA that for XYZ , I was not able to see that order number XYZ from the list of values in Receiving Transactions under Customer tab.
Can anyone please give me an idea on how to open an closed order and to cancel the existing order so that i can take back the material in the same closed order i.e, ABC after reopening it and cancel the new sales order i.e, XYZ created for RMA.
Thanks in advance
Prem.You have mentioned that the sales order is closed. Does it mean that the lines are interfaced to AR ? Is the invoice generated? Is the shipment done?
-
How to create open sales order using BAPI....?
Hi Guru's,
please help me how to create open sales order and which BAPI i have to use for open sales order.
please provide any program logic related to this or step by step process.....
that would be helpful to me.
thanks in advance...
Srinivas....Hi sreenu,
Open PO or Open sales order means that the complete cycle is not complete. That means the Sales order is not completely delievered or is not billed or is not paid for. Only once the cycle is completed the order status shows as complete untill then its Open.
You can use VA05 to find open sales orders.
Similarlry open PO's are those PO's whos inbound delivery is not complete or whos goods receipt is not complete and whos payment is not done to the vendor
U cannot directly find the open PO and open SO from any table.
That u have to calculate from the status of the PO and SO and then check wheteher that is complete or not.
U have table VBUP for SO status.Check out the fields in that table
pls see the below link.
http://abaplovers.blogspot.com/2008/02/bapi-sales-order-create-code.html
http://msdn.microsoft.com/en-us/library/cc185190.aspx
thjanks
karthik -
Need to Create a Sales Order Using BAPI....
Hello Gurus,
I have called 'BAPI_SALESORDER_CREATEFROMDAT2' n a FM and trying to create a Sales Order. I have passed the header (auart, vkorg, vtweg, spart) and partner (nmbr and role). I passed the parameters to BAPI but in the return messages it says 'Sales Document was not changed V4 E'.
I hope I am clear, if not please ask...
Suggestions would be rewarded....
Regards
LeoHi Leo,
Check out the following codes:
Even I have worked in ECC 5.0.These are the mandatory parametersthat u need to pass to create a Sales Order successfully...
REPORT Z6SKS_HERSHEYS2.
data : order_header_in1 type BAPISDHD1.
data: order_partners1 type BAPIPARNR occurs 0 with header line.
data: ORDER_ITEMS_IN1 type BAPISDITM occurs 0 with header line.
DATA : SALESDOCUMENT1 TYPE BAPIVBELN-VBELN.
DATA : RETURN1 TYPE BAPIRET2 OCCURS 0.
DATA : RETURN2 TYPE BAPIRET2.
order_header_in1-doc_type = 'TA'.
order_header_in1-sales_org = '0001'.
order_header_in1-distr_chan = '01'.
order_header_in1-division = '01'.
ORDER_ITEMS_IN1-material = '000000000000000013'.
append ORDER_ITEMS_IN1.
order_partners1-PARTN_ROLE = 'WE'.
order_partners1-PARTN_NUMB = '0000000017'.
APPEND order_partners1.
Perform call_function.
*& Form call_function
text
--> p1 text
<-- p2 text
form call_function .
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN =
order_header_in = order_header_in1
ORDER_HEADER_INX =
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
SALESDOCUMENT = SALESDOCUMENT1
tables
RETURN = RETURN1
ORDER_ITEMS_IN = ORDER_ITEMS_IN1
ORDER_ITEMS_INX =
order_partners = order_partners1
ORDER_SCHEDULES_IN =
ORDER_SCHEDULES_INX =
ORDER_CONDITIONS_IN =
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 SALESDOCUMENT1 IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN = RETURN2
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
RETURN =
ENDIF.
endform. " call_function
This should help u...
Please reward points if found useful... -
How to avoid duplicated customer ref. no when create new sales order?
Hi,
In my company, we need input customer ref. no when create a new sales order, but I found there was no any validation to avoid input a existed number.
Can somebody show me how to add some check function on this filed?
thanks.Hi,
This can be handled in standard system.
Go to Administration> System Initialization> Document Settings>Per Document (Tab)> Select Sales Order-->Tick Block release (When duplicated customer reference no. occurs).
Thanks,
Joseph -
VPRS cond type is not appearing after creating a sales order
Dear Friends,
I have copied pricing procedure from Std pric procedure i.e from RVAA01.
In Material master in Accounting 1the following things are maintained,
Valuation Class--7920 ( Finished products)
VC Sales Order Stock--7920 ( Finished products)
Pricing Control-V ( Moving average Price/Periodic unit price)
Standard Price--- Blank
Price Unit--1
Total stock--100
In Pricing procedure VPrS cond type is included and settings are as follow,
Statistics---Relevant
Subtotal-- B ( carry over value to KOMP-WAVWR (cost))
Requirement--4
Item Catg is TAN and in Business data it is relevant for Determine Cost.
Activated cost determination for item categ TAN
But when I am creating sales order VPRS cond type is not appearing.
Analysis is saying
The requirement 004 is assigned to this condition in the pricing procedure. This requirement was not met and so the condition was excluded from further processing.
Can anybody tell me where I am going wrong?
Regards,
ShrikantHi Friends,
Thanks for your reply as per your instruction I have maintained cond type and also in Pric procedure I removed 4 from Requirement column.
Now I am getting following error,
Diagnosis
This condition has not been determined using condition records. The amount or value should be determined from another data source. For cost (condition category 'G') it is read using conditions from the material valuation segment, for a cash discount condition it is read using conditions from the terms of payment table.
In this transaction an error occurs - the material valuation segment or the terms of payment table could not be read or a currency translation has failed.
System Response
The condition has been provided with the deactivated indicator 'X'.
Procedure
Refer to the messages in the status line of the condition overview screen.
Regards,
Shrikant
Maybe you are looking for
-
Lots of problems with newer MacBook Pro
I bought my first Mac about a year and a half ago. Unfortunately I've had lots of problems with it. I need to get it repaired, but I'm not sure what's wrong. I live in Thailand so I want to have some idea of what's going on before taking it to a shop
-
I am going to be trading my personal mac for another for personal reasons. One thing that I want in the trade with this other fellow I am dealing with, is assured AppleCare. The offer is a 2011 13" Macbook Pro, but has had some changes. This person h
-
I bought the HDMI adapter wire. I was hoping to use the WatchESPN app to play through my TV. I am only getting sound. No video. When I play videos taken with my phone, I get both audio and video. I know other people that watch espn on their tv's
-
BizTalk AS2 Certificate configuration problem
Hi, I'm having a problem with signing a certificate to send port. I have imported 2 diferent certificates in mmc to "Local Computer\Other People" and "Local Computer\Trusted Root Certification Authorities". Then I went to BTAdmin and select some Send
-
Every time I try to shut the computer down Safari cancels shut down. Can someone please help?