LSMW bapi sales order
hi folks,
iam doing LSMW Bapi method for sales order creation do we need to create mandatorly header and item structure for in source structure creation in LSMW ?points will be rewarded for useful answers.
Yes u need to create two structures one for header and the other for line item. Within Src structure first create Structure for Header Data then create another structure UNDER Header Data (LOWER LEVEL).
~Sid
Similar Messages
-
LSMW-BAPI Sales order creation
Hi All,
I was trying to create sales order through the LSMW BAPI method.
For the first line item i'm getting the correct quantity that i''m passing.
But from second line item onwards quantity field is appearing as 0 (zero) even though i pass the different quantity values.
i'm assiging the quantity to the REQ_QTY field in the schedule line items structure.
Please suggest any solution for this.
Thanking you.
with regards,
BharathHi,
Can u tell me the steps to create a sales order using idoc, i've created a bapi but thats a temprory use. I wanted to created a sales order automatically when a purchase order is saved.
Please let me know if u can help me, i wanted to do it using idoc
Regards
Sanju -
Scheduling problem in LSMW for Sales Order
I am doing LSMW for Sales Order using the BAPI method.
I am able to upload the item details along with their quantities also but the problem that I am now facing is the scheduling problem.I am unable to schedule the item quantities, only the last quantity passed is taken as the final quantity and the consolidated quantity is also getting ignored.
I am using E1BPSCHDL structure, in this structure I am mapping Itm_number , req_date and req_qty(scheduled qty).....
in the structure E1BPSCHDLX, the same fields are mapped as 'X'.
in the structure E1BPSDITM, I am mapping the item info along with the consolidated qty(TARGET_QTY), but this is getting ignored and the last scheduled qty is taken as the final consolidated qty and the rest scheduled qty data is getting rejected.
Please do help... I dont know why this problem is coming... tried n number of alternatives but of no hope... do try to help me
with regards,
Daya.Check the format of your date and check the format expected.
sometimes you can have diff like YYYYMMDD, MM.DD.YYYY,...
Look at the converted data.
Hope this helps,
Erwan -
Error in JCo while connecting BAPI SALES ORDER.
package com.sap;
import com.sap.mw.jco.JCO;
import com.sap.mw.jco.JCO.Exception;
import com.sapportals.portal.prt.component.AbstractPortalComponent;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentResponse;
public class DirectBAPI extends AbstractPortalComponent
public void doContent(IPortalComponentRequest request,
IPortalComponentResponse response)
JCO.Client mConnection;
JCO.Repository mRep;
response.write("Connecting..........");
try
// Change the logon information to your own system/user
mConnection = JCO.createClient("<client number>", "<user Id>", "password",
null, // language
"application server number", "<system no..>");
response.write("Reached");
mConnection.connect(); // connecting JCo...
mRep = new JCO.Repository("SAPJCo", mConnection); //use JCo Repository....
response.write("Connected Succesfully");
//response.write( mConnection.getAttributes() );
// mConnection.disconnect();
catch (Exception ex)
ex.printStackTrace();
response.write(ex.getMessage());
JCO.Function function = null;
JCO.FunctionTemplate ftp = null;
JCO.Table codes = null;
try
ftp = mRep.getFunctionTemplate();
function = ftp.getFunction();
function = this.createFunction("BAPI_SALESORDER_GETSTATUS");
// Accessing SALES_ORDER_GETSTATUS.
if (function == null)
response.write("BAPI_COMPANYCODE_GETLIST" + " not found in SAP.");
catch (Exception exx)
response.write(exx.getmessage() );
In the above code while while connecting to the BAPI SALES ORDER GET_STATUS an error is coming for JCO connection for the JCo Repository.
The method createFunction() is undefined for the type of Project.
plz guide how to rectify this so as to connect BAPI SALES ORDER thru JCo connection.
Thanx in advance.
Regards:
HanifHi,
The below Code is helpful for Calling BAPI's Using JCO .
public class TestJCO {
JCO.Client mConnection;
JCO.Repository mRepository;
public TestJCO() {
try {
// Change the logon information to your own system/user
// mConnection =
// JCO.createClient("800", // SAP client
// "USERID", // userid
// "password", // password
// null, // language
// "appserver hostname", // application server host name
// "00"); // system number
mConnection =
JCO.createClient("002", // SAP client
"userid", // userid
"password", // password
null, // language
"app server host name", // application server host name
"00"); // system number
mConnection.connect();
mRepository = new JCO.Repository("companyname", mConnection);
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
JCO.Function function = null;
JCO.Table codes = null;
try {
function = this.createFunction("BAPI_COMPANYCODE_GETLIST");
if (function == null) {
System.out.println("BAPI_COMPANYCODE_GETLIST" +
" not found in SAP.");
System.exit(1);
mConnection.execute(function);
JCO.Structure returnStructure =
function.getExportParameterList().getStructure("RETURN");
if (! (returnStructure.getString("TYPE").equals("") ||
returnStructure.getString("TYPE").equals("S")) ) {
System.out.println(returnStructure.getString("MESSAGE"));
System.exit(1);
codes =
function.getTableParameterList().getTable("COMPANYCODE_LIST");
for (int i = 0; i < codes.getNumRows(); i++) {
codes.setRow(i);
System.out.println(codes.getString("COMP_CODE") + '\t' +
codes.getString("COMP_NAME"));
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
try {
codes.firstRow();
for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow()) {
function = this.createFunction("BAPI_COMPANYCODE_GETDETAIL");
if (function == null) {
System.out.println("BAPI_COMPANYCODE_GETDETAIL" +
" not found in SAP.");
System.exit(1);
function.getImportParameterList().
setValue(codes.getString("COMP_CODE"), "COMPANYCODEID");
function.getExportParameterList().setActive(false, "COMPANYCODE_ADDRESS");
mConnection.execute(function);
JCO.Structure returnStructure =
function.getExportParameterList().getStructure("RETURN");
if (! (returnStructure.getString("TYPE").equals("") ||
returnStructure.getString("TYPE").equals("S") ||
returnStructure.getString("TYPE").equals("W")) ) {
System.out.println(returnStructure.getString("MESSAGE"));
JCO.Structure detail =
function.getExportParameterList().
getStructure("COMPANYCODE_DETAIL");
System.out.println(detail.getString("COMP_CODE") + '\t' +
detail.getString("COUNTRY") + '\t' +
detail.getString("CITY"));
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
mConnection.disconnect();
public JCO.Function createFunction(String name) throws Exception {
try {
IFunctionTemplate ft = mRepository.getFunctionTemplate(name.toUpperCase());
if (ft == null)
return null;
return ft.getFunction();
catch (Exception ex) {
throw new Exception("Problem retrieving JCO.Function object.");
public static void main(String[] args) {
TestJCO app = new TestJCO();
Please Check your code with above code.
Thanks,
SubbaRao Chinta -
Userexit in BAPI sales order creation
HI all,
My requirement is one SERIALNUMBER field add BAPI salesorder creation.
That field not existed in satndard BAPI structures.BAPI input XML file.
Salesorder>extras(menu)>Technical object->serialmumber[RIPW0SERNR).
please give any enhancement serial number BAPI sales order creation.
Thanks.
Edited by: sreddy GPs on Sep 23, 2008 5:59 AMHello,
Whatever the Structure that you are refering to in the BAPI for Sales Order Creation, use an Append Structure to add the SERIALNUMBER field to the existing Standard BAPI Structure.
For your information, the following are the BAPIs that can be used for Sales Order Creation.
BAPI_SALESORDER_CREATEFROMDAT1
BAPI_SALESORDER_CREATEFROMDAT2
BAPI_SALESORDER_CREATEFROMDATA
BAPI_SALESORDER_CREATEBOS
Hope it would serve your purpose.
Thanks and Regards,
Venkat Phani Prasad Konduri -
Updating a child of a BOM material using bapi sales order change
Hi, Appreciate your thoughts on the following issue..
We have a batch program which uses a bapi sales order change and updates the plant at the line items of the sales order. when this plant is assigned.. if any of the line item is a BOM item, it explodes and the data from the parent ( like payment terms, fixed val date ) should get copied to the child items same as the parent. This is happening fine if manual mode using va01 and va02 but when plant is updated using bapi the childs are not getting the data from the parent ( which comes through config )...
Appreciate your inputs and any additional information to be passed to the bapi for the BOM materials to get the same config data as parent to the child when exploded...
Thanks and will reward helpful answers..Hi, Appreciate your thoughts on the following issue..
We have a batch program which uses a bapi sales order change and updates the plant at the line items of the sales order. when this plant is assigned.. if any of the line item is a BOM item, it explodes and the data from the parent ( like payment terms, fixed val date ) should get copied to the child items same as the parent. This is happening fine if manual mode using va01 and va02 but when plant is updated using bapi the childs are not getting the data from the parent ( which comes through config )...
Appreciate your inputs and any additional information to be passed to the bapi for the BOM materials to get the same config data as parent to the child when exploded...
Thanks and will reward helpful answers.. -
Hi All,
I've worked with LSMW to record transactions in the past, but I'm unsure of what the best approach is for sales orders. Our requirement is to upload a simple tab-delimited text file that contains the PO#, PO type, Material, Grid (we are using AFS), Name/Phone/Address of the ship-to party, and shipping notes text.
My main question is concerned with handling the multiple line items on the orders. I have seen some posts here that suggest using one LSMW to do the header data (VA01), and then a second to do line item data (VA02). However, I need this to be one step. I see there is a BAPI with Business Object BUS2032, but I have not worked with that method.
Any idea on the easiest way to complete this? I'd like to have a simple step for a user to run to automate entering 15-20 orders a day. Any help is appreciated, thanks!
JHi,
Firstly you can create the sales orders using the BPAI with header data and for line item details you can go for anothere BAPI
BAPI_SALESORDER_CHANGE. hope it will work.
~linganna -
LSMW for sales order uploading
Hi Guys,
I need to upload single time sales order detials into SAP through flat file, is any sap standard LSMW methods are available or I need to develop a Z program.
Could you please give your suggestions?
Thanks,
Gourisankar.Hi gourishankar,
LSMW is not a bad one, but striaght BDC programme with BAPI would be the
best
so see this link it may help you.
http://www.****************/Tutorials/LSMW/Bank/page1.htm
thanks
karthik -
Hello Friends
I want to find if anybody can guide me on how to get all open sales order tables , i want to create a format and create a flat file for uplodading the file , for this what do i need and how do i do it.
Also for creating LSWM can i use the existing one which i can just Assign the New file to the existing one .
Regards.Dear Mehmood,
I want to find if anybody can guide me on how to get all open sales order tables
You want to extract all the open sales orders- which you can get from Table:VBUP key in overall document status in selection screen ( You can use VBUK also- but if there are certain sales orders in which some of the items are completed or few of them open, using VBUK - you will not get exact records)
Secondly, you can get the data by using Query also- in SQVI
design a query with VBAK / VBAP & VBUP
so that from VBAK you can give time period & sales area details
from VBAP - you can enter plant relevant details to filter certain records & item category as well
where as VBUP- filter wth the status.
once downloaded store in flat file.
Now Create LSMW object by using batch input recording method. after mapping the relevant fields,
prepare the flat file in such a - it suits to the upload file / recording file. then you can upload the already downloaded n stored open sales orders in flat file.
Hope this is what you are looking for.
Regards,
ReazuddinMD -
BAPI SALES ORDER & Copy with reference
Hello,
I'm creating sales order copied with reference to an invoice. My problem is that the data item is empty. When I create the sales order manually and use the option 'Create with reference' and choose an invoice, the sales order is created with all data item. I don't know how I can get to copy the data item from the invoice in the new sales order. The code that I'm using is the following:
DATA: order_header_in LIKE bapisdhd1,
order_partners LIKE bapiparnr OCCURS 0 WITH HEADER LINE,
order_text LIKE bapisdtext OCCURS 0 WITH HEADER LINE,
order_header_inx LIKE bapisdhd1x,
order_item_in LIKE bapisditm OCCURS 0 WITH HEADER LINE,
order_schedules_in LIKE bapischdl OCCURS 0 WITH HEADER LINE,
order_conditions_in LIKE bapicond OCCURS 0 WITH HEADER LINE,
extensionin LIKE bapiparex OCCURS 0 WITH HEADER LINE,
partneraddresses LIKE bapiaddr1 OCCURS 0 WITH HEADER LINE,
order_cfgs_ref like BAPICUCFG occurs 0 with header line.
DATA: salesdocument LIKE bapivbeln-vbeln.
DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
order_header_in-doc_type = 'ZA09'.
order_header_in-sales_org = '1700'.
order_header_in-distr_chan = '01'.
order_header_in-division = '01'.
order_header_in-BILL_DATE = '20060701'.
order_header_in-ref_doc = '0900000019'.
order_header_in-refdoc_cat = 'M'.
*order_header_in-REF_DOC_L_LONG = '0900000019'.
order_header_in-purch_no_c ='prueba'.
*order_header_in-ord_reason = '003'.
*order_header_in-pmnttrms = '0002'.
*order_header_in-sales_off = '2800'.
order_header_in-ref_doc_l = 'FACTURA ES'.
*order_header_in-fix_val_dy = '20060701'.
*order_header_in-currency = 'USD'.
*order_header_in-exchg_rate = '1.2'.
order_partners-partn_role = 'AG'.
order_partners-partn_numb = '0000000001'.
order_partners-langu = 'EN'.
order_partners-name = 'El corte aleman'.
order_partners-country = 'ES'.
APPEND order_partners.
order_partners-partn_role = 'RE'.
order_partners-partn_numb = 'ARR000'.
order_partners-addr_link = '0000030044'.
APPEND order_partners.
CALL FUNCTION 'ADDR_GET_COMPLETE_ALL_TYPES'
EXPORTING
addrnumber = order_partners-addr_link
PERSNUMBER =
address_object_type = '1'
IV_CURRENT_COMM_DATA = 'X'
IMPORTING
ADDR1_COMPLETE =
ADDR2_COMPLETE =
ADDR3_COMPLETE =
ADDR1_COMPLETE_BAPI = partneraddresses
ADDR2_COMPLETE_BAPI =
ADDR3_COMPLETE_BAPI =
EXCEPTIONS
PARAMETER_ERROR = 1
ADDRESS_NOT_EXIST = 2
PERSON_NOT_EXIST = 3
INTERNAL_ERROR = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
data: vl_texto(40) value 'NUEVOOOOO'.
partneraddresses-name = vl_texto. clear vl_texto.
partneraddresses-name_2 = vl_texto.
partneraddresses-name_3 = vl_texto.
partneraddresses-name_4 = vl_texto.
partneraddresses-langu = 'E'.
APPEND partneraddresses.
DATA: vl_cantidad LIKE bapisditm-target_qty.
vl_cantidad = 1.
order_item_in-itm_number = 10.
order_item_in-material = 'HONORARIOS'.
order_item_in-ref_doc = '0900000019'.
order_item_in-ref_doc_it = 10.
order_item_in-ref_doc_ca = 'M'.
APPEND order_item_in.
order_schedules_in-itm_number = 10.
order_schedules_in-req_qty = vl_cantidad.
APPEND order_schedules_in.
order_text-text_id = 'Z001'.
order_text-ITM_NUMBER = ''.
order_text-langu = 'EN'.
order_text-text_line = 'Hola, CARACOLAcola'.
APPEND order_text.
order_text-text_id = 'Z001'.
order_text-langu = 'EN'.
order_text-text_line = 'Adios caracol'.
APPEND order_text.
order_text-itm_number = '000010'.
order_text-text_id = '0001'.
order_text-langu = 'EN'.
order_text-text_line = 'Hola, POSICIÓN'.
APPEND order_text.
extensionin-structure = 'BAPE_VBAK'.
extensionin-valuepart1 = ' BCL 7'.
APPEND extensionin.
order_cfgs_ref-posex = '10'.
order_cfgs_ref-config_id = '10'.
order_cfgs_ref-root_id = '00000001'.
append order_cfgs_ref.
CALL FUNCTION 'ZBAPI_SALESORDER_CREATEFROMDT2'
EXPORTING
SALESDOCUMENTIN = salesdocument
order_header_in = order_header_in
ORDER_HEADER_INX = order_header_inx
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
salesdocument = salesdocument
TABLES
return = return
order_items_in = order_item_in
ORDER_ITEMS_INX =
order_partners = order_partners
order_schedules_in = order_schedules_in
ORDER_SCHEDULES_INX =
order_conditions_in = order_conditions_in
ORDER_CONDITIONS_INX =
ORDER_CFGS_REF = 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_text
ORDER_KEYS =
extensionin = extensionin
partneraddresses = partneraddresses
PERFORM report TABLES return.
*DATA: salesdocument LIKE bapivbeln-vbeln.
*DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
*refresh return.
*CALL FUNCTION 'BAPI_SALESDOCUMENT_COPY'
EXPORTING
salesdocument = '0400000191'
documenttype = 'ZA04'
TESTRUN = ' '
IMPORTING
SALESDOCUMENT_EX = salesdocument
TABLES
RETURN = return
*PERFORM report TABLES return.
*write: / salesdocument.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
*& Form report
text
-->P_MENSAJE text
FORM report TABLES p_mensaje STRUCTURE bapiret2.
DATA: vl_mensaje TYPE string.
LOOP AT return.
CLEAR vl_mensaje.
MESSAGE ID return-id
TYPE return-type
NUMBER return-number
INTO vl_mensaje
WITH return-message_v1
return-message_v2
return-message_v3
return-message_v4.
WRITE: / vl_mensaje.
ENDLOOP.
ENDFORM. " reportHi Manuel,
There are some function modules which is there to copy the order details. I am not sure about the function module name. But you can search in SE37. But bapi for creating the sales order does not have the functionality of copying the data from one document to another document.
You can try using this function module.
BAPI_SALESDOCUMENT_COPY
Data will be copied based on the copy control routines that is set between the two document types.
Thanks,
Arun -
Error in bapi sales order creation
hi..
I m creating sales order using bapi fm, It was working fine, but all of a sudden it is giving error 'NO OBJECT STATUS AVAILABLE FOR SDI 0.' and Sales order is not gettign created. Any idea why the problem occurs?Hi Cynthia,
This is probably caused by a COMMIT WORK in a user exit during sales order processing. This COMMIT WORK triggers FM BUFFER_STATUS_REFRESH which in turn causes this problem.
You can easily find out by putting a break-point in this FM and then take a look in the call-stack to find out where the commit work occurred.
Regards.
John. -
Bapi sale order Reason for rejection
hi,
i want to update "Reason for rejection" of sale order
through BAPI ,
So how should i find it in BAPI_SALESORDER_CHANGE .
in which table of this bapi ?
ThanksHi
Re: update sales orders
http://abap.wikiprog.com/wiki/BAPI_SALESORDER_CHANGE
regards
Pavan -
Hi folks,
Can anybody tell me the BAPI name to update the plant, route and storage location in the sales order.
if possible please tell me BAPI name in general which updates the sales order values...
thanks in advanceHi,
Use the bapi'S 'BAPI_SALESORDER_CHANGE'
and 'BAPI_TRANSACTION_COMMIT' to update the sales orders.
Regards,
Sudheer Kumar -
Hello all,
This is a simple question in regards to the sales order bapi. If I have an external program call the bapi and it has 10 line items will the sales order be created if one of the line items is in valid. For example, 10 line items are passed and line item 8 has an invalid material. Will the order be created with 9 items or will the bapi call fail due to the error.
Thanks,
ChrisI just made a quick test with an existing upload report where I am using 'BAPI_SALESDOCU_CREATEFROMDATA'. In case you pass in a material which doesn't exist, the BAPI errors out completely and no order is created at all. In your example you would not get the 9 valid items created but the whole order will fail.
In my case we might get invalid ISBN numbers which we translate into materials before we call the BAPI. At this point I do a check to MARA to make sure that the material is valid. If not I am not even passing it to the BAPI.
Your example again, my check would find out that one of the materials is invalid and only pass the 9 valid items to the BAPI which will then successfully create the order.
Hope that helps,
Michael -
LSMW ( For sales order item)
Dear all,
I have a question, can LSMW batch change some data in sales order line item?
For example, there has a sales order with 20 items. I have to change the material group in item 10 and 50, can i achieve this by LSMW?Dear all,
I still cannot found item in my recording. In my recording just show below information:
I am not sure if " BDC_OKCODE =ITEM" means item?
SAPMV45A 0102
BDC_CURSOR VBAK-VBELN
BDC_OKCODE /00
VBAK-VBELN 17380
SAPMV45A 4001
BDC_OKCODE =ITEM
BDC_SUBSCR SAPMV45A
VBKD-BSTKD 1
BDC_SUBSCR SAPMV45A
KUWEV-KUNNR 211011
BDC_SUBSCR SAPMV45A
BDC_SUBSCR SAPMV45A
RV45A-KETDAT 2008.06.23
RV45A-KPRGBZ D
VBKD-PRSDT 2008.06.23
VBKD-ZTERM 0001
VBAK-AUGRU 002
BDC_SUBSCR SAPMV45A
BDC_SUBSCR SAPLV45W
BDC_SUBSCR SAPMV45A
BDC_CURSOR RV45A-KWMENG(01)
BDC_SUBSCR SAPMV45A
SAPMV45A 4003
BDC_OKCODE =T\02
BDC_SUBSCR SAPMV45A
BDC_SUBSCR SAPMV45A
BDC_CURSOR RV45A-KWMENG
RV45A-KWMENG 2
VBKD-PRSDT 2008.06.23
SAPMV45A 4003
BDC_OKCODE /00
BDC_SUBSCR SAPMV45A
BDC_SUBSCR SAPMV45A
BDC_CURSOR VBAP-MATKL
VBAP-PRODH 50...510..5100
VBAP-MATKL 730
VBAP-SPART 10
VBAP-KONDM 11
VBKD-KDGRP 12
VBKD-KONDA 11
VBKD-PLTYP 11
Maybe you are looking for
-
Microsoft Office 2004 (Word) unable to save files I have been running Office 2004 on my Intel iMac with Snow Leopard for some time and all of a sudden I cannot save a document. Word just stopped responding and I have to force quit. I can open Word an
-
External Hard Drives Changing Permissions to Read Only
Three of my USB external hard drives have suddenly changed to read only. One of the times I was trying to transfer/back-up the files from one drive that had changed to read only to another external. Suddenly the second drive changed permissions. Then
-
Allow every user to create subfolders
Hello everybody, after some changes in our internal role system I need your help. In BEX there you can go to open query or open workbook. Then hit the button "Roles" There we can see the menu with all visible folders. How can I allow every user to cr
-
Encoder keeps crashing with camera MTS files during batch operation
I am trying to convert MTS files to WMV and I am constantly getting crashes. "Microsoft WIndows: Close programs to prevent information loss... Your computer is low on memory...Adobe Media Encoder.exe" and "Adobe Media Encoder Debug Event: Adobe Media
-
15.4" with lid open + external display
Hi there. I have a lovely new MacBook Pro 15.4", and have bought a Dell 20" UltraSharp external display. The Dell monitor has 1680 x 1050 resolution which is great. The only problem is I have inconsistent resolutions: when I close the lid of my Mac,