Problem with Sales Order Creation
Hi,
In my sales order creation program if item qty is zero, it should not include that item in the order. It is not working properly with this example it is creating same order for customer 1001 and 1004. It is checking for qty = 0 condition and executing 'continue' statememt , then it is not checking 'At end of kunnr' and creating only one order for all the remaining 4 items from 1001 and 1004 other than 0 qty's.
kunnr matnr qty order#
1001 51038 723 102255
1001 51054 0
1001 51055 0
1004 51038 207 102255
1004 51054 236 102255
1004 51055 219 102255
it should create like this.
kunnr matnr qty order#
1001 51038 723 102255
1001 51054 0
1001 51055 0
1004 51038 207 102256
1004 51054 236 102256
1004 51055 219 102256
Please help me fix this.
Thanks,
veni.
Hi,
Here is the code.
WHEN 'ORDERS'.
DESCRIBE TABLE gt_zprice LINES lv_cnt.
DO lv_cnt TIMES.
lv_index = sy-index + 4.
READ LINE lv_index FIELD VALUE chbox.
IF chbox = 'X'.
READ TABLE gt_zprice INTO gs_zprice1 INDEX sy-index.
IF sy-subrc EQ 0.
gs_zprice1-index = sy-index.
APPEND gs_zprice1 TO gt2_zprice.
CLEAR gs_zprice1.
ENDIF.
ENDIF.
CLEAR chbox.
ENDDO.
gt4_zprice[] = gt2_zprice[].
SORT gt4_zprice BY kunnr vtweg.
LOOP AT gt4_zprice INTO gs_zprice1.
IF gs_zprice1-crmemo IS INITIAL.
AT NEW kunnr.
MOVE 'Y' TO lv_flg.
ENDAT.
IF lv_flg EQ 'Y'.
PERFORM headerdata.
PERFORM texts.
CLEAR lv_flg.
ENDIF.
IF gs_zprice1-eohqty IS INITIAL.
CONTINUE.
ENDIF.
PERFORM itemdata.
APPEND gs_zprice1 TO gt3_zprice.
CLEAR gs_zprice1.
AT END OF kunnr.
PERFORM call_function.
PERFORM update_pricetable.
PERFORM errorcheckandcommit.
REFRESH gt2_zprice.
CLEAR chbox.
REFRESH partner.
REFRESH item.
REFRESH itemx.
REFRESH lt_schedules_in.
REFRESH lt_schedules_inx.
REFRESH conditions1.
REFRESH order_text.
lv_itemno = 10.
ENDAT.
ELSE.
REFRESH gt2_zprice.
CLEAR chbox.
ENDIF.
ENDLOOP.
WRITE: /01(179) sy-uline.
PERFORM headings.
WRITE: /01(179) sy-uline.
PERFORM displaydata.
ENDCASE.
Thanks,
Veni.
Similar Messages
-
BAPI - Problem in Sales order creation
Hi Friends,
I have problem in Sales order creation using BAPI ,I am getting a messsage - Error in creating document ,I have sent the code along with this mail ,can you help it out.
Code:
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text FOR FIELD p_auart.
PARAMETERS: p_auart TYPE auart OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Sales organization
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text1 FOR FIELD p_vkorg.
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Distribution channel
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text2 FOR FIELD p_vtweg.
PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Division.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text3 FOR FIELD p_spart.
PARAMETERS: p_spart TYPE spart OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SKIP 1.
Sold-to
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text4 FOR FIELD p_sold.
PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Ship-to
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text5 FOR FIELD p_ship.
PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SKIP 1.
Material
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text6 FOR FIELD p_matnr.
PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Quantity.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text7 FOR FIELD p_menge.
PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Plant
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text9 FOR FIELD p_plant.
PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Data declarations.
DATA: v_vbeln LIKE vbak-vbeln.
DATA: header LIKE bapisdhead1.
DATA: headerx LIKE bapisdhead1x.
DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
WITH HEADER LINE.
DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
WITH HEADER LINE.
Initialization.
INITIALIZATION.
v_text = 'Order type'.
v_text1 = 'Sales Org'.
v_text2 = 'Distribution channel'.
v_text3 = 'Division'.
v_text4 = 'Sold-to'.
v_text5 = 'Ship-to'.
v_text6 = 'Material'.
v_text7 = 'Quantity'.
v_text9 = 'Plant'.
Start-of-selection.
START-OF-SELECTION.
Header data
Sales document type
header-doc_type = p_auart.
headerx-doc_type = 'X'.
Sales organization
header-sales_org = p_vkorg.
headerx-sales_org = 'X'.
Distribution channel
header-distr_chan = p_vtweg.
headerx-distr_chan = 'X'.
Division
header-division = p_spart.
headerx-division = 'X'.
headerx-updateflag = 'I'.
Partner data
Sold to
partner-partn_role = 'AG'.
partner-partn_numb = p_sold.
APPEND partner.
Ship to
partner-partn_role = 'WE'.
partner-partn_numb = p_ship.
APPEND partner.
ITEM DATA
itemx-updateflag = 'I'.
Line item number.
item-itm_number = '000010'.
itemx-itm_number = 'X'.
Material
item-material = p_matnr.
itemx-material = 'X'.
Plant
item-plant = p_plant.
itemx-plant = 'X'.
Quantity
item-target_qty = p_menge.
itemx-target_qty = 'X'.
APPEND item.
APPEND itemx.
Fill schedule lines
lt_schedules_in-itm_number = '000010'.
lt_schedules_in-sched_line = '0001'.
lt_schedules_in-req_qty = p_menge.
APPEND lt_schedules_in.
Fill schedule line flags
lt_schedules_inx-itm_number = '000010'.
lt_schedules_inx-sched_line = '0001'.
lt_schedules_inx-updateflag = 'X'.
lt_schedules_inx-req_qty = 'X'.
APPEND lt_schedules_inx.
Call the BAPI to create the sales order.
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = header
sales_header_inx = headerx
IMPORTING
salesdocument_ex = v_vbeln
TABLES
return = return
sales_items_in = item
sales_items_inx = itemx
sales_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_partners = partner.
Check the return table.
LOOP AT return WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE: / 'Error in creating document'.
ELSE.
Commit the work.
COMMIT WORK AND WAIT.
WRITE: / 'Document ', v_vbeln, ' created'.
ENDIF.
Regards,
Dineshwhat messages u are gettting in RETURN ? Please check the RETURN tables data.
[code]CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = header
sales_header_inx = headerx
IMPORTING
salesdocument_ex = v_vbeln
TABLES
return = return
sales_items_in = item
sales_items_inx = itemx
sales_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_partners = partner.
Regards
Prabhu -
Problem with sales order and Service order
Dear Guru's
We have a real problem with sales orders and service orders and how we treat these. For a project that uses a WBS, it's not a problem to manipulate SAP to give us a list of shortages (orders with no or limited supply) for each order, but for some reason our after sales orders and our service orders do not work this way.
Thanks and Regards,
Deethya.CLOSED
-
Transfer Posting problem with "sales order stock type" status
Hello, i have this problem, i spend 2 days looking in the forum, but
nothing, the question is:
The SD users sell an item, and the item get the status of "sales order
stock type" in the MMBE, but at the same time, the MM user made a
trasfer posting in two steps, he take out material with transaction
MIGO, mvt 351, to another plant, but the materail was already
compromised with SD; now he cant sell the items, because he dont
realize that the material was in sales order stock type, and he already
transfer it to another plant. how can i block this? if a material in
MMBE is with "sales order stock type" status, he CANT transfer it with
351 mvt type, what config i have to make? thanks a lot!!!!
now the quantity of the unrestict use
stock is lower than the sales order, we dont want to have this issue,
thanks again
Edited by: Alex Arti on Aug 6, 2008 7:14 PM
Edited by: Alex Arti on Aug 6, 2008 7:16 PMHi!
Have you recently upgraded to EHP4? In this case, please, check the note 1441195. This note should solve the issue that you are reporting.
I hope this helps,
Esther. -
Problem in Sales Order Creation with reference to Contract
Hi All,
We had enhanced Contracts (VA41) by adding fields thru append structures in VBAP and the same is provided in the "Additional Data B" tab at the item level.
The Z fields are populated with data and gets saved along with the contracts line items.
But when a sale order is created with reference to a contract, the data in the Z fields (maintained in Append Structures) of the contract are not getting copied to the line item of Sales orders.
Should a routine be necessarily written for copying Z fields from contract to Sales orders or Copy control must be set up for Z fields separately?
Any info on this would help.
Thanks,
K.V.VenkatasubramanianHi VJ,
The copying from Contract to Orders worked. I copied the standard routine (151) in data transfers and added the code to transfer Z fields from work area CVBAP to work area VBAP and attached the same in the copy control. It works!!!
Thanks for the help VJ.
Cheers,
Venkat -
Pricing problem in sales order creation
Hi friends,
My requirement is to create sales order with ref to contract i am using 'BAPI_SALESORDER_CREATEFROMDAT2' , and I am extracting data from konv table to get price through condition record , but i am getting 4 messages
(S) SALES_HEADER_IN has been processed successfully
(E) Condition PR00 is not allowed as header condition
(W) The sales document is not yet complete: Edit data
(E) Sales document was not changed
and i am not getting pricing for created sales order document.
please help.
regards,
Sravani.hi
ZK01 Company Selling Price - 21.86 INR 1 BT - 2360.41 INR for 108 BT( your statement)
This is wrong 21.86 x 108 = 2360.88 and not 2360.41 as written by you
so the calculation of the system is correct
21.86 x 108 =2360.88
1.41 x 108 =153.28
So total 23.27 x 108 = 2513.16 (also 2360.88 +152.28 also is equal to 2513.16 )
you can check in calculator
If ZK01 is showing a wrong vaule 2360.41 instead of correct 2360.88 in your case then you need to check the configuration of that condition type
The subtoatal valuew hich you have written is also wrong because of ZK01
Problem lies in ZK01 check the other controls and rounding profile etc of ZK01 in V/06
Regards
Raja -
Problem in Sales order creation BDC
Dear ABAPers,
I have Developed the BDC For VA01 Transaction code.While creating the Sales order it automatically creates the Serial number.But in BDC i am getting the Error message 'Serial Number is Being Created for the Material'.I am getting this message only for few serial numbers.What could be the Problem.
Thanks & Regards,
Ashok.Hi
U chk ur recording..Because that serail number autamitacally picking or u are record that serial number.According to ur recording only uhave prepare ur flat file.
Better u condiser ur FUnctional consulatant.
Note:
When ever u record the BDC program u must sit with Functional consulatnt. Otherwise problem with u only.
Regards:
Prabu -
Hi Guys
we created a Salesorder with 10 items in which the material for last item of 118 qty was got abosolute before getting deliveres and a new item was created throught back order on the next day and allocated 1 qty from 118 qty
the remaining Items and one qty conformed was deliverd and got shipped.
here my problem is
the item which i talking got stucked at that level with out making availability check for the remaining 117 qty thought there is stock for that material
and also it is disabling the feilds in the VA02 Tcode to change the status .
the one qty conformed was deliverd and shipped to cust with the othere items
below are the two lines of item in my sales order
120 8201532 118 EA START-DEV ZOBS 0 D 10/17/2006 F002
130 8201786 118 EA START-DEV ZTAN 120 D 10/17/2006 F002
can any tell me please why and where this problem occured
Thanks & Regards
BabuHi,
Check up the material type of the Sales item and the availabillity checking group allocated in the material master.
Reward points if satisfied.
Thanks
Augustine Ponraj -
Problem with sales order line items
hey All,
I wrote a simple test program this morning Using DI API that creates and updates orders, and I found some weird behaviour:
1. Once an order is created, if a line item is deleted off the order in B1 - the updates work fine.
2. If an item is added to the end of the order, the updates work fine.
3. If an item is added in the middle of the existing line items, the next update does weird things - it swaps prices and item keys and screws up the order total.
4. If an item code is changed to an existing item (such as changing the AddModel the actual item code), the update does weird thing, same as #3.
Has anyone experienced issues such as this? Or has anyone successfully completed an application like this that works properly?Ok can anyone from SAP comment on this please? I have some more details if you want to duplicate this.
My simple program just creates a sales order from DI API. Then you complete step 2, 3, 4 as listed below using a Business One Client.
I then go back to my program and do some simple updates to the sales order through DI API using the SetCurrentLine method and looping over the Lines object count. Once I call the update method and go back into B1 to look at the order the DI API has updated the wrong items.
Anyone have any ideas or run into a similiar problem? We are desperate here for a fix.
Steps to duplicate
1. Create B1 sales order using DI API with 4 line items for example
2. In B1, delete a line item in the middle of the order
3. Change the first any item Code to a different item
4. Save the order in B1.
6. Run a sales order update from DI API.
7. Recall the order in B1 - the totals will be all jacked up and the prices will no longer match the items -
Problem with sales order consumption
Hi
I hope someone can help? I have a problem with consumption of sales orders in APO. When a sales order comes across from R/3 it doesn't consume the forecast until a later sales order comes across, then the previous one consumes forecast. So all sales orders consume forecast apart from the latest one on each material.
Many thanks
MichaelHi Please confirm the following are right in your strategy configuration in R/3:
Strategy: 40 Planning with final assembly
Reqmts type for indep.reqmts VSF Planning with final assembly
Reqmts class: 101
Consumption: 1 Consume planning with assembly
Planning Ind. 1 Net requirements planning
Reqmt type of customer reqmt KSV Sales order with consumption
Requirements class 050 Warehouse consumpt.
Allocation indicat. 1 Consume planning with assembly
No MRP Requirement planned -
Problem in Sales order Creation
Dear Group,
While creating sales order with MTO senario by using material master strategy group as 20 i am getting the following error.
ERROR
Receiver categ. is not allowed by settlement prof. SD1 for this sender
Message no. KD031
Please guide me how to proceed further.
Thanks
TamilHi
Please find the below link
Receiver categ. is not allowed by settlement prof. SD1 for this sender
Hope this will helps you
Dasaradha -
Problem with sales order stock.
Hi all,
I have stuck in one problem, please help.
We created one sales order A and after production stock is moved to that sales order.But then we created sales order B and moved stock of A to sales order B(By 413 E?). system created materail document for stock movement but stock was not transfered. we can see that stock is against sales order A only. But material document shows that stock is moved to B. then we deleted Sales order B.
Now the stck is against sales order A. when we try to do shipment systen gives error ' VALUATED STOCK BECOMES NEGATIVE.' Message No. M7 314. We have to.ship this material.
When I see the value of this stock it is showing zero.
Please advice what to do.
Thanks.
Edited by: s j on May 10, 2010 3:25 PMHi!
Have you recently upgraded to EHP4? In this case, please, check the note 1441195. This note should solve the issue that you are reporting.
I hope this helps,
Esther. -
Problem with Sales order Credit Limit
Hi,
Ex: Customer - A
Credit Limit - 50000
While creating the sales order, if the customer exceeds the credit limit, Block the customer for creating the sales order.
How can i do this
Solution Pls
Rgds
sunficoHi,
Good morning and greetings,
You maintain the credit limits in FD32 and for establishing auto credit check functionalities use OVA8 and you can also specify leverage for +/- deviations...For releasing the blocked orders use VKM2.
Please reward points if found useful
Thanking you
With kindest regards
Ramesh Padmanabhan -
Document Date Problem with Sale Order
Hi,
This issue is related to Create Sales Order ( VA01).
In sales order after entering sold to party, purchase order no, required delivery date ,delivering plant , material, order quantity etc.
When I am going through menu path GOTO>HEADER>SALES . In that DOCUMENT DATE
field is there and this field taking back date that is 26.06.2008. Even I am preparing sales order today
but in document date field system capturing fix date 26.06.2008. Please help me why system capturing
same date & how I can solve this problem.
Manoj Pise.Hi
manoj
please check the system datum. date setting in yr computer u may fix the problem.
pl check.
thx -
I am trying to update the sales order text using "BAPI_SALESORDER_CHANGE" But i am getting an error as " Sold-to party E455 not maintained for sales area E901 C1"
I passed the sales order no, and the text to be upated and the Update flag is set to "U".
When i try giving the same values in se37 it updates the sales order text successfully but when i use the same BAPI in the report i am getting the above error. Can anyone pls help me out.hi
the message is very clear that the sold to party ur refering is not from the same sales area. if u have the customer already then extend the same to the said sales area, by common division and distribution channel
<b>reward points</b>
Regards
Maybe you are looking for
-
Getting the following error while creating a new configuration
Hi team, I am trying to create configuration of my web dynpro application. When I right click on my application and choose create/change configuration, browser started. Now when I give a name ( e.g zabc) to it and choose the function create, the foll
-
Cancellation of sales excise invoice
Hi I am trying to cancel the a sales excise invoice In tcode J!IH > cancel excise invoice, the system is giving an error Excise modvat accounts not defined for CEIV transaction and excise group Kindly provide solution for this Regards Suresh
-
Hi, I am using JIDE for GUI development in my project. Almost all the JIDE components are extends Swing Component. For example (JButton in the swing is JideButton in JIDE). As all you know that TreeTable is something which will show the information w
-
Macbook pro freezes when open finder
Hi, I have a problem with my macbook pro, since mountain lion os 10.8.2 update, every time I open the Finder freezes and I have to shut down my macbook with the button, because it does nothing, it only happens when I open the finder , which may be th
-
How can I make links between tracks in my iTunes library with out duplicating tracks in memory
I like to collecte complet albums of artist I like, this causes duplication of tracks between album. If I was able to link duplication track to one file in memory this will save memory.