How to retrieve sales Order details from BAPI_SALESORDER_GETLIST
Hi Experts,
I am using Visual Studio 2003 and SAP.Net Connector for Microsoft .NET 1.0.3 .
I need to get the details of sales order.Following is the code snip.
protected ConnectorDemo2.BAPIRETURN bapireturn; /*Manually Added */
proxy.Connection = SAP.Connector.SAPLoginProvider.GetSAPConnection(this);
proxy.Bapi_Salesorder_Getlist("0000000006","","","","","","0001","0",
out bapireturn,ref bapiordersTable1);
I already check records in SAP R/3 system for data Cust No=00000006 and Sales Org=0001.
Please let me know about out parameter and if anyone is having correct list of ref and out parameter.
Help will appreciated and points will rewarded.
Thanks
Sunil Pawar
Edited by: Sunil Pawar on Nov 26, 2008 1:54 PM
To Solve the problem I created one custome RFC and call BAPI_SALESORDER_GETLIST in it and my problem get solved.
This is just work around but still not found why no data when using OUT parameter.
CALL FUNCTION 'BAPI_SALESORDER_GETLIST'
EXPORTING
CUSTOMER_NUMBER = Z_CUSTOMER_NUMBER
SALES_ORGANIZATION = Z_SALES_ORGANIZATION
IMPORTING
RETURN =
TABLES
SALES_ORDERS = Z_SALES_ORDERS
Thanks
Sunil Pawar
Similar Messages
-
HOW to retrieve PURCHASE ORDER DATA from archieve file and print a report
Dear all
1) I have retrieve purchase order data from archived files.
2) print purchase order data and created pdf file.
VIJ.............
Moderator message - Please ask a specific question - post locked
Edited by: Rob Burbank on Apr 28, 2009 12:00 PMDear all
1) I have retrieve purchase order data from archived files.
2) print purchase order data and created pdf file.
VIJ.............
Moderator message - Please ask a specific question - post locked
Edited by: Rob Burbank on Apr 28, 2009 12:00 PM -
How to transfer Sales order data from R/3 to APO!!
Hi Techies,
I am in the process of moving some sales order data for a particular mat/loc combination in cfm1 after creating a integration model iam even activating even in R/3 but after doing this iam not able to view those sales orders in RRP3 t-code IN APO side.
Kindly let me know what is the procedure to transfer transactional data from R/3 to APO and to do enhancement in CIF which carries Transactional data .
Problem solving answers would be rewarded duly !!.
+PKP.Hi PKP,
The field SPEC_STOCK has the description "Key for Special Stock Section" and is linked to schedule line of the PO. This seems to be something linked to special stock, but I am not very sure about the relevance of this field.
I do not see any related field when I check the order in RRP3 or in RRP2. In standard SAP, you would only be able to use the fields that are already visible in APO. Otherwise you need to add the field to the standard SAP t-code display (read the value from SOMEWHERE and then display it in RRP3. This is possible using Badi /SAPAPO/RRP_IO_COL). Then only you can see the values which you have populated.
If this field SPEC_STOCK already has some functionality (which it should have, though I am not sure what it is), you might not be able to use it for other purposes (since system does some validations for certain fields).
You are updating the value for this field in IT_OUTPUT internal table, you also need to add an X in the corresponding field in the internal table IT_OUTPUTX.
You could try putting this X, so that your changes are considered in CIF, but I am not sure what the impact may be, and you could get a dump also possibly. Even otherwise, since this field doesn't seem to be visible against a PO in APO, I am not sure if this would be helpful for you.
As far as I could see, I did not find any standard field which could be helpful for you.
May be if you open a fresh thread and ask for advice on how to send any custom comments for PO to APO, someone could provide some inputs.
Thanks - Pawan -
How to transfer sales order idoc from R/3 to CRM
Hi,
I want to generate the sales order idoc in R/3 (ORDERS) and replicates to CRM through XIF adapter.
The sales documents are not realy existing in R/3. We can only get the information from related biling documents and try to gerenate ORDERS idoc.
The problem is how to map R/3 idoc to CRM idoc(CRMXIF_ORDER_SAVE_M01). The administration console seems can only send the idocs but not receiving them.
Thanks,
InaHello Yina,
Can you please answer the questions? I am a little bit confused.
If you don't have the order in R/3, are you not going to create one when creating the ORDERS IDoc? If yes, then this order will go to CRM automatically if you have the middleware set properly.
If you are NOT creating any order in R/3 during the IDoc step, Why would you want the order in CRM when you don't have it in R/3?
Are you not going to keep the middleware between R/3 and CRM open? If you keep it open, the order from CRM will crossover to R/3 - in which case you could have created the order in R/3 in the first step itself !!!
If you are not keeping the middleware open between R/3 and CRM - I don't know why would you want to keep the orders in CRM, but not in R/3. Is it because of lack of good CRM consultants in the project?
Easwar Ram
http://www.parxlns.com -
How to trace sales order number from delivery number, when batch is split
Hi All,
I have created a Sales Order and a Outbound Delivery against the sales order.
While creating the Outbound delivery, I have split the qty in two batches.
Now when I go in table LIPS, and search on the basis of the Delivery number, I get two rows, one for each batch. But here the sales order LIPS-VGBEL, and Sales order item no (LIPS-VGPOS) is updated only for the 1st batch line item, but is not updated for the second batch line item.
Please help me so that on the basis of the delivery number, i will be able to find record from tables for sales order for both the line items (i.e. for each batch).
Immediate help would be appreciated.
Thanks in Advance.
AnkushHi,
I have created delivery against sales order.
While picking (during delivery PGI), I selected two batches to suffice the delivery qty. Please refer the example quoted below.
Sales order (SO1) - Material (Mat1) - qty (15 ea)
Delivery against sales order (Del1) - batch split: batch1 - 10 ea
batch2 - 5 ea
In table LIPS: when I enter delivery number as "Del1" and execute, I get 2 records:
del no. Item No. Material Qty Batch no Sales Order no Sales Order Item no
1. DEL1 10 Mat1 10 ea batch1 SO1 10
2. DEL1 20 Mat1 5 ea batch2 ______ ____
Thus in the 2nd record, the Sales order no.(LIPS-VGBEL) and sales order item no. (LIPS-VGPOS) does not get updated.
I have to develop a report to display the Sales Order number and sales order line item number for each batch of the Delivery for the same item number. Please guide me to know how I can get the same.
Hope this clarifies the issue faced.
Regards,
Ankush -
How to retrieve sales order line type
Hello,
Maybe I found a workaround for the previous issue but I faced a new problem (matrix of form 139).
I tried to read the matrix column 257 but it's always blank even if the row is a text row (of type = T).
I need to exclude this type of line in a loop.
Is there a way to do this ?
Please help me.
Best regards.
AndreaHi Andrea,
Line Status field is not linked to the Type of row. Line status is O or C - Open or Closed. If all lines are closed then the document will close.
Try writing 2 queries like this
select * from RDR1 where DocEntry = '4'
select * from RDR10 where DocEntry = '4'
where 4 will be the doc entry of the Sales order which contains Sub types. In the Table RDR10, you'll find LineType which contains the types.
Can you tell me what do you need the line Type for so that i can give you a better solution? -
Deleting Sales Order Details using BAPI_SALESORDER_CHANGE And Reinserting
Hi All,
I need to <b>change a Sales Order</b> in such a way that I would <b>delete all the existing Line Items</b> of that SO And <b>then reinsert new Line Items</b> as generally is the practice of saving a document.(Update Header-Delete Old Item Entries-Reinsert New Present Entries).
I coded a small test program in ABAP using the <b>BAPI_SALESORDER_GETLIST And BAPI_SALESORDER_CHANGE</b>.
In order to affect the Qty I have to update the Schedule Parameter also of the BAPI_SALESORDER_CHANGE Function.But this causes a new entry in VBEP.
eg:
<b>Before BAPI Calls</b>
SO-Number:9001
Header:9001,etc......
Detail:ItemNo=10,Material=xyz,TargetQty=100,etc..
Scedule:ItemNo=10,Scheduleline=1,Req_Qty=100,etc...
I coded the program such that
1.I <b>Get the List of Items</b> using BAPI_SALESORDER_GETLIST.
2.Call the <b>BAPI_SALESORDER_CHANGE</b> filling appropraite values in Parameters <b>with UpdateFlag = 'D'</b>
3.<b>Insert new values</b> in OrderItems And Schedule Parameters
say:
Detail:ItemNo=10,Material=xyz,TargetQty=25,etc..
Scedule:ItemNo=10,Scheduleline=1,Req_Qty=25,etc...
4.<b>Call the BAPI_SALESORDER_CHANGE</b> filling appropraite values in Parameters <b>with UpdateFlag = 'I'</b>
<b>The output now becomes.</b>Header:9001,etc......
Detail:ItemNo=10,Material=xyz,TargetQty=100,etc..
Scedule:ItemNo=10,Scheduleline=1,Req_Qty=100,etc...
ItemNo=10,Scheduleline=2,Req_Qty=25,etc...
Now After Commit when I see my <b>SO it shows me a qty of
125</b>.
I am attaching the code for your analysis.
Thanx in advance.
*& Report ZSM_CHANGESALESORDER *
REPORT ZSM_CHANGESALESORDER .
DATA:
For Calling the GetList BAPI Function
CUSTOMER_NUMBER LIKE BAPI1007-CUSTOMER,
SALES_ORGANIZATION LIKE BAPIORDERS-SALES_ORG,
IT_SALES_ORDERS LIKE TABLE OF BAPIORDERS,
WA_SALES_ORDERS LIKE LINE OF IT_SALES_ORDERS,
IT_RETURN LIKE TABLE OF BAPIRETURN,
WA_RETURN LIKE LINE OF IT_RETURN.
For Calling the ChangeFromData BAPI Function
DATA:
SALESDOCUMENT LIKE BAPIVBELN-VBELN,
WA_ORDER_HEADER_IN LIKE BAPISDH1,
WA_ORDER_HEADER_INX LIKE BAPISDH1X,
IT_ORDER_ITEM_IN LIKE TABLE OF BAPISDITM ,
WA_ORDER_ITEM_IN LIKE LINE OF IT_ORDER_ITEM_IN,
IT_ORDER_ITEM_INX LIKE TABLE OF BAPISDITMX ,
WA_ORDER_ITEM_INX LIKE LINE OF IT_ORDER_ITEM_INX,
IT_SCHEDULE_LINES LIKE TABLE OF BAPISCHDL ,
WA_SCHEDULE_LINES LIKE LINE OF IT_SCHEDULE_LINES,
IT_SCHEDULE_LINESX LIKE TABLE OF BAPISCHDLX ,
WA_SCHEDULE_LINESX LIKE LINE OF IT_SCHEDULE_LINESX,
IT_RETURN_CHG LIKE TABLE OF BAPIRET2,
WA_RETURN_CHG LIKE LINE OF IT_RETURN_CHG.
DATA:
IT_RETURN_CT LIKE BAPIRET2.
PARAMETERS:
P_SO LIKE VBAK-VBELN,
P_CUSTNO LIKE BAPI1007-CUSTOMER,
P_SORG LIKE BAPIORDERS-SALES_ORG.
START-OF-SELECTION.
SALESDOCUMENT = P_SO.
CUSTOMER_NUMBER = P_CUSTNO.
SALES_ORGANIZATION = P_SORG.
Retrieve the Existing Sales Order details for that Sales Order.
PERFORM GETREQSODETAILS.
Delete the Existing Sales Order details from that Sales Order.
PERFORM DELETEOLDSODETAILS.
Insert New details for that Sales Order.
PERFORM ADDNEWSODETAILS.
END-OF-SELECTION.
PERFORM COMMITTRANS.
*& Form GetReqSODetails
FORM GETREQSODETAILS .
CALL FUNCTION 'BAPI_SALESORDER_GETLIST'
EXPORTING
CUSTOMER_NUMBER = CUSTOMER_NUMBER
SALES_ORGANIZATION = SALES_ORGANIZATION
IMPORTING
RETURN = WA_RETURN
TABLES
SALES_ORDERS = IT_SALES_ORDERS.
*delete the Sales Order Details of Sales Orders other than the req.One
IF NOT IT_SALES_ORDERS[] IS INITIAL.
SORT IT_SALES_ORDERS BY SD_DOC.
LOOP AT IT_SALES_ORDERS INTO WA_SALES_ORDERS.
IF WA_SALES_ORDERS-SD_DOC NE SALESDOCUMENT.
DELETE IT_SALES_ORDERS.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. " GetReqSODetails
*& Form deleteOldSODetails
FORM DELETEOLDSODETAILS .
DATA: IRECCOUNT TYPE I.
IRECCOUNT = 1.
*Clear all the Inernal Tables And Work Areas
*and Update the SO Header Index
PERFORM CLEARDATA.
PERFORM SOHEADERINDEX.
LOOP AT IT_SALES_ORDERS INTO WA_SALES_ORDERS.
*Fill the Order Details Index Internal Table
PERFORM FILLSODELETEDTLS_INDEX_PARAM
USING WA_SALES_ORDERS-ITM_NUMBER 'D'.
*Fill the Order Scedule Index Internal Table
PERFORM FILLSODELETESCH_INDEX_PARAM
USING WA_SALES_ORDERS-ITM_NUMBER IRECCOUNT 'D'.
ENDLOOP.
*call the Sales Order Change Fumction to delete the Existing Data
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = SALESDOCUMENT
ORDER_HEADER_INX = WA_ORDER_HEADER_INX
TABLES
RETURN = IT_RETURN_CHG
ORDER_ITEM_INX = IT_ORDER_ITEM_INX
SCHEDULE_LINESX = IT_SCHEDULE_LINESX.
ENDFORM. " deleteOldSODetails
*& Form SOHeaderIndex
FORM SOHEADERINDEX .
WA_ORDER_HEADER_INX-UPDATEFLAG = 'U'.
ENDFORM. " SOHeaderIndex
*& Form FillSODeleteDtls_Index_param
FORM FILLSODELETEDTLS_INDEX_PARAM
USING VALUE(P_ITM_NUMBER) VALUE(P_FLAG).
WA_ORDER_ITEM_INX-ITM_NUMBER = P_ITM_NUMBER.
WA_ORDER_ITEM_INX-UPDATEFLAG = P_FLAG.
APPEND WA_ORDER_ITEM_INX TO IT_ORDER_ITEM_INX.
ENDFORM. " FillSODeleteDtls_Index_param
*& Form FILLSODELETEsch_Index_PARAM
FORM FILLSODELETESCH_INDEX_PARAM
USING VALUE(P_ITM_NUMBER) VALUE(P_RECCOUNT) VALUE(P_FLAG).
WA_SCHEDULE_LINESX-ITM_NUMBER = P_ITM_NUMBER.
WA_SCHEDULE_LINESX-SCHED_LINE = P_RECCOUNT.
WA_SCHEDULE_LINESX-UPDATEFLAG = P_FLAG.
APPEND WA_SCHEDULE_LINESX TO IT_SCHEDULE_LINESX.
ENDFORM. " FILLSODELETEsch_Index_PARAM
*& Form addnewSODETAILS
FORM ADDNEWSODETAILS .
DATA: IRECCOUNT TYPE I, ITEMNO TYPE I.
IRECCOUNT = 1.
*Clear all the Inernal Tables And Work Areas
*and Update the SO Header Index
PERFORM CLEARDATA.
PERFORM SOHEADERINDEX.
WHILE IRECCOUNT <= 1.
ITEMNO = IRECCOUNT * 10.
*Fill the New Order Details in the Internal Table
PERFORM FILLSODTLDATA USING ITEMNO 'TEST FG' 37 .
*Fill the Order Details Index Internal Table
PERFORM FILLSODELETEDTLS_INDEX_PARAM USING ITEMNO 'I'.
*Fill the New Schedule Details in the Internal Table
PERFORM FILLSOSCHDATA USING ITEMNO IRECCOUNT 37 .
*Fill the Order Scedule Index Internal Table
PERFORM FILLSODELETESCH_INDEX_PARAM
USING ITEMNO IRECCOUNT 'I'.
IRECCOUNT = IRECCOUNT + 1.
ENDWHILE.
*call the Sales Order Change Fumction to Insert New Data
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = SALESDOCUMENT
ORDER_HEADER_INX = WA_ORDER_HEADER_INX
TABLES
RETURN = IT_RETURN_CHG
ORDER_ITEM_IN = IT_ORDER_ITEM_IN
ORDER_ITEM_INX = IT_ORDER_ITEM_INX
SCHEDULE_LINES = IT_SCHEDULE_LINES
SCHEDULE_LINESX = IT_SCHEDULE_LINESX.
ENDFORM. " addnewSODETAILS
*& Form clearData
FORM CLEARDATA .
CLEAR WA_ORDER_HEADER_INX.
CLEAR WA_ORDER_ITEM_INX.
REFRESH IT_ORDER_ITEM_INX.
CLEAR WA_SCHEDULE_LINESX.
REFRESH IT_SCHEDULE_LINESX.
CLEAR WA_RETURN.
REFRESH IT_RETURN.
CLEAR WA_ORDER_ITEM_IN.
REFRESH IT_ORDER_ITEM_IN.
CLEAR WA_SCHEDULE_LINES.
REFRESH IT_SCHEDULE_LINES.
ENDFORM. " clearData
*& Form FILLSODTLDATA
FORM FILLSODTLDATA USING VALUE(P_ITEMNO) VALUE(P_MATERIAL)
VALUE(P_TARGET_QTY) .
WA_ORDER_ITEM_IN-ITM_NUMBER = P_ITEMNO.
WA_ORDER_ITEM_IN-MATERIAL = P_MATERIAL.
WA_ORDER_ITEM_IN-TARGET_QTY = P_TARGET_QTY.
APPEND WA_ORDER_ITEM_IN TO IT_ORDER_ITEM_IN.
ENDFORM. " FILLSODTLDATA
*& Form FILLSOschDATA
FORM FILLSOSCHDATA USING VALUE(P_ITEMNO)
VALUE(P_RECCOUNT)
VALUE(P_REQ_QTY) .
WA_SCHEDULE_LINES-ITM_NUMBER = P_ITEMNO.
WA_SCHEDULE_LINES-SCHED_LINE = P_RECCOUNT.
WA_SCHEDULE_LINES-REQ_QTY = P_REQ_QTY.
APPEND WA_SCHEDULE_LINES TO IT_SCHEDULE_LINES.
ENDFORM. " FILLSOschDATA
*& Form committrans
FORM COMMITTRANS .
DATA:SUCCESSFLAG(1).
LOOP AT IT_RETURN_CHG INTO WA_RETURN_CHG.
IF WA_RETURN_CHG-TYPE = 'S'
AND WA_RETURN_CHG-ID = 'V1'
AND WA_RETURN_CHG-NUMBER = 311
AND SUCCESSFLAG IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = IT_RETURN_CT.
SUCCESSFLAG = 'X'.
ENDIF.
ENDLOOP.
IF SUCCESSFLAG IS INITIAL.
WRITE: 'SORRY SOME ERROR'.
ELSE.
WRITE: 'SUCCESSFUL'.
ENDIF.
ENDFORM. " committransThanx wolfgang,
I needed that info.
As I had mentioned in the earlier posts, I want to delete the old Sales Order Item Details,
Schedule Details,Basic Price data And Reinsert data in the same.
I am giving u the algo that I have used.
1.<b>Get the SalesOrder Details</b> for a particular Sales Order using BAPI_SALESORDER_GETLIST(para:customer & sales Org and then deleting unwanted SO data).
2.<b>Delete</b> the Sales Order <b>Item Details,Schedule Details</b> using BAPI_SALESORDER_CHANGE.
3.<b>Commit</b> Transaction(<b>If I dont use this commit Error comes in Step No.7 while Commiting</b>)
using BAPI_TRANSACTION_COMMIT.
4.Check <b>Return Table</b> of both BAPI_SALESORDER_CHANGE and BAPI_TRANSACTION_COMMIT.
5.if Step No.4 is <b>Not okay</b> <b>then Rollback</b>(BAPI_TRANSACTION_TRANSACTIN) <b>and Exit</b> <b>else move to step 6</b>.
6.<b>Add New</b> Sales Order <b>Item Details,Schedule Details, Basic Price</b> using BAPI_SALESORDER_CHANGE.
7.<b>Commit Transaction</b> using BAPI_TRANSACTION_COMMIT.
8.<b>Check Return</b> Log of both BAPI_SALESORDER_CHANGE and BAPI_TRANSACTION_COMMIT.
9.if Step No.9 is okay then Exit else Rollback(BAPI_TRANSACTION_TRANSACTIN) and move to step 10.
10.Add Old Sales Order Item Details,Schedule Details, Basic Price from Data available in Internal
table(Filled in step.1 ) using BAPI_SALESORDER_CHANGE.
11.Commit Transaction using BAPI_TRANSACTION_COMMIT.
This <b>works fine in 1 server in which I get the message of Incomplete Data,etc...when I make a Sales Order from va01</b>.
But in another server where I dont this message,I get <b>error in step 7 or 11 as per the flow</b>.
The return structure of BAPI_TRANSACTION_COMMIT contains error with Message 'Updating was not possible'. Also the message 'Updation was terminated' cms frm the SAP server.
What could be the reason?
Thanx in advance -
How to send sales orders through XI to non sap system
Hello Experts,
i need to send Sales order details from ECC to non sap system.
anybody can help me to proceed with this in detailed way.
i know how to send idoc through xi between sap systems.
But i need between sap to non sap system.
Thanks & Regards,
Lakshmi..Hi !!
Check this weblog on how to enable SSL:
/people/gregor.wolf3/blog/2005/10/11/setup-https-ssl-for-the-sneak-preview-sap-netweaver-04-abap-edition-on-windows
refer this realtive thread which shows the .NETnet integration with XI
Re: .NET Client Integration with SAP XI
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2131 [original link is broken] [original link is broken] [original link is broken]
for idoc related settings in r/3 refer the below link...
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/73527b2c-0501-0010-5398-c4ac372c9692
IDoc to File scenario
/people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters
check this out ..
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFAALEQS/CABFAALEQS.pdf
http://www.thespot4sap.com/Articles/SAP_ALE_Introduction.asp
Also go thru this Blogs
ALE Configuration for Pushing IDOC's from SAP to XI by Swaroopa Vishwanath
Configuration Steps for Posting IDOC's by Ravikumar Allampalam.
IDOC - File scenario
/people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters
configuring IDOCS
/people/sravya.talanki2/blog/2006/12/27/aspirant-to-learn-sap-xiyou-won-the-jackpot-if-you-read-this-part-iii
IDOC scenarios
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/cdded790-0201-0010-6db8-beb9bb2b2660
Idoc related setting
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/73527b2c-0501-0010-5398-c4ac372c9692
refer this thread also
Integration between sap and non-sap
/people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5651.. [original link is broken] [original link is broken] [original link is broken]
also referthe concept of SSO
To undersand SSO scenarios gothro the links in my reply in the following thread:
SSO scenarios and configuring steps
Check the following link to know the procedure for user mapping:
Procedure to follow for user mapping.
The following link gives you more idea on User Mapping:
More Info on User Mapping
Pls reward if useful -
Do we have any BAPI to get the Sales quote or Sales order details
Hi Experts,
Do we have any BAPI to get the sales quote or sales order details from my other SAP system.
My requirement is to get the sales quote or sales order details from the other SAP system.
Please help.
Regards,
ChitrasenHi Experts,
Thanks for ur help. The BAPI is BAPI_SALESORDER_GETSTATUS which helps in fetching the sales quote information.
Thanks,
Chitrasen -
How to get sales order data with GL tables
I want to get sales order details from my GL query. I need to get item number, quantity and customer PO from there. Here is my query from GL.
SELECT PH.po_header_id,
I.GL_DATE,
R.je_header_id JE_HEADER_ID,
R.je_line_num JE_LINE_NUM,
aeh.org_id ORG_ID ,
I.invoice_num TRX_NUMBER_C ,
ael.description COMMENTS ,
ael.ACCOUNTED_CR ACCOUNTED_CR,
ael.ACCOUNTED_DR ACCOUNTED_DR,
ael.code_combination_id CODE_COMBINATION_ID,
ael.currency_code CURRENCY_CODE,
ael.entered_cr ENTERED_CR,
ael.entered_dr ENTERED_DR,
PH.segment1 PO_ORDER_NUMBER,
GL.segment1 company,
GL.segment2,
GL.segment3,
GL.segment4,
GL.segment5 account
,ael.description
,PD.quantity_ordered, PD.amount_billed, D.quantity_invoiced, D.unit_price
FROM gl_import_references R, --ok
gl_je_categories jc,
ap_ae_lines_all AEL, --ok
ap_ae_headers_all AEH, --ok
ap_invoice_distributions_all D,
ap_invoices_all I,
ap_accounting_events_all AE,
po_releases_all PR,
po_headers_all PH,
po_distributions_all PD,
po_vendor_sites_all VS,
gl_code_combinations GL
WHERE 1=1
AND jc.je_category_name = aeh.ae_category
AND PR.po_release_id(+) = PD.po_release_id
AND PH.po_header_id(+) = PD.po_header_id
AND PD.po_distribution_id(+) = D.po_distribution_id
AND ael.third_party_sub_id = VS.vendor_site_id
AND AE.accounting_event_id = AEH.accounting_event_id
AND I.invoice_id = AE.source_id
AND AE.source_table = 'AP_INVOICES'
AND AEH.ae_header_id = AEL.ae_header_id
AND DECODE(ael.source_table,'AP_INVOICE_DISTRIBUTIONS', AEL.source_id,NULL) = D.invoice_distribution_id(+)
AND AEL.gl_sl_link_id = R.gl_sl_link_id
and ael.code_combination_id = GL.code_combination_idThen your query is completely wrong.
Your query is looking at Purchase Order tables.
If you want sales order data, you should be looking at OE tables (such as OE_ORDER_HEADERS_ALL, OE_ORDER_LINES_ALL etc.)
Sandeep Gandhi -
How to get sales order data in substitution of fi-docu from GM posting ?
How to get sales order data in substitution of FI documents from goods movement posting?
When I posting a material document with movement type "501E", the system will creating a FI document automatically. And I need to get the sales order data in the substitution of FI document.
I tried to export the data of the material document in user-exit "MB_CF001 Updating of material document data upon posting", but this user-exit does not triggered in the posting process at all. what's the problem?
Do you have better solution or idea for this? Please help me. Thank you!Hello Harish,
Please use BAPI_BUSPROCESSND_GETDETAILMUL to read details of sales order. This works as a remote enabled counterpart of CRM_ORDER_READ.
Similarly if you want to display sales order from R/3, use FM BAPI_BUSPROCESSND_DISPLAY.
Regards
Kaushal -
How to get master sales order number from delivery number
Hi All,
I need logic for getting master sales order number from available Delivery number.
Note: There can be many SO's in diffrent levels.
Finally i need to pick up master sales order no.
Thanks in advance.
Thanks,
Deep.Hi,
I have a outbound delivery[VL03N] 'X' in my system .
Then for getting sales order no i am writing below code:
SELECT single vbelv vbeln
from vbfa
INTO (vbelv, vbeln)
where vbeln EQ p_vbeln AND
vbtyp_n EQ 'J'.
Then vbelv i need to pick up master sales order no.
SELECT vbelv vbeln
from vbfa
INTO TABLE i_so
where vbeln EQ l_vbelv AND
vbtyp_n EQ 'C'.
If i write code as above it is giving four sales orders which one of them is master sales order no!
Thanks,
Deep. -
Sales Order uplaod from JAVA to SAP R/3
Hi all,
My cousin is working on uploading Sales Order Document
from java server to R/3.
for that he is having a code from JCO jar.
the below is the file from which one can upload his SO details from JAVA to R/3.
But in this program he is just able to upload one Item detail for one Sales document.
but requirement is to upload 'n' item details for one Sales document.
Here is the Java code.
@author pega
TODO To change the template for this generated type comment go to
Window - Preferences - Java - Code Style - Code Templates
Created on Jun 24, 2004
To change the template for this generated file go to
Window>Preferences>Java>Code Generation>Code and Comments
package com.sap.satyam.salesorder;
import java.sql.Timestamp;
import java.util.Calendar;
import com.sap.mw.jco.IFunctionTemplate;
import com.sap.mw.jco.IRepository;
import com.sap.mw.jco.JCO;
public class SalesOrder {
static final String SID = "R3";
static final String errorID = "E";
IRepository repository;
//String orderNumber = orderCreation("M-01","3000","0002",3,"ST");
int counter;
public SalesOrder()
try {
// Add a connection pool to the specified system
JCO.addClientPool(SID, // Alias for this pool
10, // Max. number of connections
"800", // SAP client
"develop", // userid
"bslabap", // password
"EN", // language
"172.18.33.20", // host name
"00");
// Create a new repository
repository = JCO.createRepository("MYRepository", SID);
catch (JCO.Exception ex) {
System.out.println("Caught an exception: \n" + ex);
// Retrieves and sales order Create
public void createSalesOrder(String PO_NO, String MAT,String RQTY,String CUSTMAT, String SOLD_NAME, String SOLD_STREET,String SOLD_COUNTRY, String SOLD_POST_CODE,String SHIP_NAME, String SHIP_STREET,String SHIP_COUNTRY, String SHIP_POST_CODE)
try {
// Get a function template from the repository
IFunctionTemplate ftemplate = repository.getFunctionTemplate("BAPI_SALESORDER_CREATEFROMDAT1");
JCO.MetaData so_metadata = new JCO.MetaData("BAPI_SALESORDER_CREATEFROMDAT1");
// Create a function from the template
JCO.Function function = new JCO.Function(ftemplate);
// Get a client from the pool
JCO.Client client = JCO.getClient(SID);
// Fill in input parameters
// Header
JCO.ParameterList input = function.getImportParameterList();
JCO.ParameterList tables = function.getTableParameterList();
JCO.Structure input_header = input.getStructure("ORDER_HEADER_IN");
// Item details
JCO.Table table_item = tables.getTable("ORDER_ITEMS_IN");
//JCO.Structure input_item = table_item.getStructure("ORDER_ITEMS_IN");
// Partner details
JCO.Table table_partner = tables.getTable("ORDER_PARTNERS");
// Populate the header details
input_header.setValue("ZAD5","DOC_TYPE"); // Document Type
input_header.setValue("3000","SALES_ORG"); // Sales Organization
input_header.setValue("10","DISTR_CHAN"); // Distribution Channel
input_header.setValue("00","DIVISION"); // Distribution Channel
input_header.setValue("20041212","REQ_DATE_H");// can be changed in yyyymmdd (Requested date)
input_header.setValue(PO_NO,"PURCH_NO_C");// can be changed ( Customer PO Number )
//Populate the item detalis
table_item.appendRow();
table_item.setRow(1);
table_item.setValue("000010","ITM_NUMBER");
table_item.setValue("AA01","PO_ITM_NO");// can be changed
table_item.setValue("IAD-SC3000","MATERIAL");
table_item.setValue(CUSTMAT,"CUST_MAT");// can be changed
table_item.setValue("20041212","REQ_DATE");// can be changed in yyyymmdd
table_item.setValue(RQTY,"REQ_QTY");// can be changed Qty * 1000
table_item.appendRow();
table_item.setRow(2);
table_item.setValue("000020","ITM_NUMBER");
table_item.setValue("AA01","PO_ITM_NO");// can be changed
table_item.setValue("IAD-SC3000","MATERIAL");
table_item.setValue(CUSTMAT,"CUST_MAT");// can be changed
table_item.setValue("20041212","REQ_DATE");// can be changed in yyyymmdd
table_item.setValue(RQTY,"REQ_QTY");// can be changed Qty * 1000
//Populate the Partner details
// Sold to Party
table_partner.appendRow();
table_partner.setRow(1);
table_partner.setValue("AG","PARTN_ROLE");
//table_partner.setValue("0000002007","PARTN_NUMB");
table_partner.setValue("0000100067","PARTN_NUMB");
table_partner.setValue(SOLD_NAME,"NAME"); // can be changed
table_partner.setValue(SOLD_STREET,"STREET"); // can be changed
table_partner.setValue(SOLD_COUNTRY,"COUNTRY");
table_partner.setValue(SOLD_POST_CODE,"POSTL_CODE"); // can be changed
// Ship to party
table_partner.appendRow();
table_partner.setRow(2);
table_partner.setValue("WE","PARTN_ROLE");
table_partner.setValue("0000100067","PARTN_NUMB");
table_partner.setValue(SHIP_NAME,"NAME");// can be changed
table_partner.setValue(SHIP_STREET,"STREET"); // can be changed
table_partner.setValue(SHIP_COUNTRY,"COUNTRY");
table_partner.setValue(SHIP_POST_CODE,"POSTL_CODE");// can be changed
// Call the remote system
client.execute(function);
// Print return message
JCO.Structure ret = function.getExportParameterList().getStructure("RETURN");
System.out.println("BAPI_SALES_ORDER_GETLIST RETURN: " + ret.getString("MESSAGE"));
// Get table containing the orders
//JCO.Table sales_orders = function.getTableParameterList().getTable("SALES_ORDERS");
JCO.Field sales_order = function.getExportParameterList().getField("SALESDOCUMENT");
// Print results
String so = sales_order.getString();
String message = ret.getString("MESSAGE");
String message_type = ret.getString("TYPE");
if (message_type.equalsIgnoreCase("E")) {
System.out.println("Error in Sales Order Creation:" + message);
else{
System.out.println("Sales Order " + so + " Created Succesfully");
// Release the client into the pool
JCO.releaseClient(client);
catch (Exception ex) {
System.out.println("Caught an exception: \n" + ex);
// Retrieves and sales order Create
public void listSalesOrders()
try {
// Get a function template from the repository
IFunctionTemplate ftemplate = repository.getFunctionTemplate("BAPI_SALESORDER_GETLIST");
// Create a function from the template
JCO.Function function = new JCO.Function(ftemplate);
// Get a client from the pool
JCO.Client client = JCO.getClient(SID);
// Fill in input parameters
JCO.ParameterList input = function.getImportParameterList();
//input.setValue("0000002007", "CUSTOMER_NUMBER" );
input.setValue( "3000", "SALES_ORGANIZATION");
//input.setValue( "0", "TRANSACTION_GROUP" );
//input.setValue("PO_NUMBER_JAVA01","PURCHASE_ORDER_NUMBER");
// Call the remote system
client.execute(function);
// Print return message
JCO.Structure ret = function.getExportParameterList().getStructure("RETURN");
System.out.println("BAPI_SALES_ORDER_GETLIST RETURN: " + ret.getString("MESSAGE"));
// Get table containing the orders
JCO.Table sales_orders = function.getTableParameterList().getTable("SALES_ORDERS");
// Print results
if (sales_orders.getNumRows() > 0) {
// Loop over all rows
do {
counter++;
System.out.println("--" + counter + "--
// Loop over all columns in the current row
for (JCO.FieldIterator e = sales_orders.fields(); e.hasMoreElements(); ) {
JCO.Field field = e.nextField();
System.out.println(field.getName() + ":\t" + field.getString());
}//for
} while(sales_orders.nextRow());
else {
System.out.println("No results found");
}//if
// Release the client into the pool
JCO.releaseClient(client);
catch (Exception ex) {
System.out.println("Caught an exception: \n" + ex);
public static void main(String[] argv) {
SalesOrder so = new SalesOrder();
so.createSalesOrder("PO_NUMBER_JAVA02", "","0000000020000","121-223-2332-1231", "SOFTWARE SYSTEME GMBH-WE", "STREET-SH","US", "53125","SOFTWARE SYSTEME GMBH-WE", "STREET-SH","US", "53125");
//so.listSalesOrders();
>>>>Please if any of SDN users can help in resolving this issue. It will be very helpful to my cousin.Before:
//Populate the item detalis
table_item.appendRow();
table_item.setRow(1);
table_item.setValue("000010","ITM_NUMBER");
table_item.setValue("AA01","PO_ITM_NO");// can be changed
table_item.setValue("IAD-SC3000","MATERIAL");
table_item.setValue(CUSTMAT,"CUST_MAT");// can be changed
table_item.setValue("20041212","REQ_DATE");// can be changed in yyyymmdd
table_item.setValue(RQTY,"REQ_QTY");// can be changed Qty * 1000
table_item.appendRow();
table_item.setRow(2);
table_item.setValue("000020","ITM_NUMBER");
table_item.setValue("AA01","PO_ITM_NO");// can be changed
table_item.setValue("IAD-SC3000","MATERIAL");
table_item.setValue(CUSTMAT,"CUST_MAT");// can be changed
table_item.setValue("20041212","REQ_DATE");// can be changed in yyyymmdd
table_item.setValue(RQTY,"REQ_QTY");// can be changed Qty * 1000
Try to add:
//Populate the item detalis
table_item.appendRow();
table_item.setRow(2);
table_item.setValue("000020","ITM_NUMBER");
table_item.setValue("AA01","PO_ITM_NO");// can be changed
table_item.setValue("IAD-SC3000","MATERIAL");
table_item.setValue(CUSTMAT,"CUST_MAT");// can be changed
table_item.setValue("20041212","REQ_DATE");// can be changed in yyyymmdd
table_item.setValue(RQTY,"REQ_QTY");// can be changed Qty * 1000
table_item.appendRow();
table_item.setRow(2);
table_item.setValue("000020","ITM_NUMBER");
table_item.setValue("AA01","PO_ITM_NO");// can be changed
table_item.setValue("IAD-SC3000","MATERIAL");
table_item.setValue(CUSTMAT,"CUST_MAT");// can be changed
table_item.setValue("20041212","REQ_DATE");// can be changed in yyyymmdd
table_item.setValue(RQTY,"REQ_QTY");// can be changed Qty * 1000
Regards. -
Sales order detail in AR invoice
Hi,
I want know Sales order details like SalesOrder No, Sales Order Value. Total Sales Order Qty in AR Invoice PLD screen. Please help how can i retrieve the information.
Thanks in advance.
RajeshRajesh
Expanding to what Kamlesh has replied. Adding Sales Order fields to the Invoice PLD would require a bunch of formula fields and the results might not be all that perfect.
So as Kamlesh mentioned, create the UDF's you need for each data component you need from SO in the Marketing document rows.
To these UDF's at the Invoice rows add SQL based formatted searches which will fetch the values from SO.
Map these UDF's in the Invoice template.
Suda -
FM to get sales order details with billing document .
hi ,
is there any standard FM or BAPI to get the sales order details with input as billing document ?
i have the billing document number now i need to get the sales order number and its details ..
is that possible ..
i very well know how to get it by using query, i need standard FM.
Points will be awarded for sure , if it helps .
Thanks and regards
JKHere is the list of BAPIs
BAPI_QUOTATION_GETDETAILBOS
BAPI_INQUIRY_GETDETAILBOS
BAPI_SALESORDER_GETDETAILBOS
SALES ORDER->
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
Maybe you are looking for
-
Aperture 3 VS. iPhoto Library management policies
Let me start this off with the fact that I am new to the whole Mac scene. I am used to the PC world of managing everything neatly in folders and subfolders inside My Pictures folder. In PC land I was using importing everything automaticaly with my
-
Wifi unable to connect and incorrect password problem/issues
since i updated to iOS5.1 i started having a problem with our wifi connection. it is locked but even though i enter the correct password my itouch is promting that i have punched in an icorrect password itried using a different iDevice and punched in
-
RECEIVER FILE FCC - Help needed.
Hi, Iam working on a idoc-to-file interface.My receiver structure is as follows: <HEADER_1st_LINE> <field1> <field2> <field n> </ HEADER_1st_LINE> <HEADER_2nd_LINE> <field1> <field2> <field n> </ HEADER_2nd_LINE> <PO_LINE>
-
PeopleTools on Windows 2008 and TEMP and TMP directories
Anyone running PeopleTools on Windows 2008 R2? I've created services using a local admin account to start the app server. I'm just about to go live on 8.52 with HR9.0 and am hitting occasional problems with pagelets rendering output. The PeopleCode t
-
Hello, I recently made an application, and everything works fine. The main issue is the app does not work on newer phones it seems. I have been trying to understand why this is. I believe it is from me only being able to export for AIR 3.2, I have se