on 10-19-2005 6:39 AM
Hi,
I am trying to execute <b>BAPI_SALESORDER_CREATEFROMDAT2</b> using <b>JCo</b>.
I created a JSP Dynpage with the following is the code
JCO.Client client = JCO.createClient("100", "Username", "password", "EN", "hostname", "00");
client.connect();
JCO.Repository repository = new JCO.Repository("REPOSITORY", client);
JCO.Function function = repository.getFunctionTemplate("BAPI_SALESORDER_CREATEFROMDAT2").getFunction();
JCO.Structure orderHeaderIn = function.getImportParameterList().getStructure("ORDER_HEADER_IN");
orderHeaderIn.setValue(salesOrg,"SALES_ORG");
orderHeaderIn.setValue(distChannel,"DISTR_CHAN");
orderHeaderIn.setValue(division,"DIVISION");
orderHeaderIn.setValue(salesDocType,"DOC_TYPE");
JCO.Table orderPartners = function.getTableParameterList().getTable("ORDER_PARTNERS");
orderPartners.appendRow();
orderPartners.setValue(partnerRole,"PARTN_ROLE");
orderPartners.setValue(partnerNumber,"PARTN_NUMB");
JCO.Table orderItemsIn = function.getTableParameterList().getTable("ORDER_ITEMS_IN");
orderItemsIn.appendRow();
orderItemsIn.setValue(material,"MATERIAL");
client.execute(function);
Created a iView and when I try to execute nothing happens in the back end?
Any clue of what I am doing wrong?
Thank you,
Vamsi
hi Vamsi,
The only thing you need to check is the connection.
check the paramters that you are passing in createClient(),
client = JCO.createClient(Client,userid,passoword,Lang,Server,SysNum);
Just make sure that the server is correct.
Regards,
Richa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi~
in my option,it miss the item quantity of material.
wish help.
sapsky....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hai Vamsi...
If you have solved this problem can you please help me out as i am new to Jco and i am getting the same problem
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did this get solved?
Stephen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you check that the server that you are running the SAP Netweaver on can actually get to the server that your Enterprise system runs on. There are no firewalls between the two? Make sure that if you are not using IP that the DNS is setup correctly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found out that the connection to the back end is failing, following is the exception I am getting:
error occured com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed Connect_PM TYPE=A ASHOST= SYSNR=00 GWHOST= GWSERV=sapgw00 PCS=1 LOCATION CPIC (TCP/IP) on local host with Unicode ERROR partner not reached (host , service sapgw00) TIME Thu Oct 20 13:10:24 2005 RELEASE 640 COMPONENT NI (network interface) VERSION 37 RC -10 MODULE nixxi_r.cpp LINE 8672 DETAIL NiPConnect2 SYSTEM CALL SiPeekPendConn ERRNO 10060 ERRNO TEXT WSAETIMEDOUT: Connection timed out COUNTER 1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is my connection statement and variables that i just. Maybe this will help:
client = JCO.createClient(SAPConnect.SAPClient, request.getParameter("user"),request.getParameter("pass"),SAPConnect.SAPLang,SAPConnect.SAPServer,SAPConnect.SAPSysNum);
SAPClient = 100
SAPLang = EN
SAPServer = sapserver.corporate.paccoast.com
SAPSysNum = 00
Hi Vamsi
Check Whether you are passing all the mandatory fields. One more thing is there is one more structure ORDER_HEADER_INX and a table ORDER_ITEMS_INX which have to be assigned. Hope this helps.
Regards
Vasundhara.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vasundhara,
Yes, I am passing all the mandatory fields .
<b>Mandatory Fields:</b>
<b>ORDER_HEADER_IN :</b>
DOC_TYPE Sales document type
SALES_ORG Sales organization
DISTR_CHAN Distribution channel
DIVISION Division
<b>ORDER_PARTNERS..:</b>
PARTN_ROLE Partner role, SP sold-to party
PARTN_NUMB Customer number
<b>ORDER_ITEMS_IN..:</b>
MATERIAL Material number
I dont think <b>structure ORDER_HEADER_INX and table ORDER_ITEMS_INX</b> need to be assigned. I mean they are not mandatory so I dont think they need to be assigned. But I will try.
Thank you,
Vamsi
Hi Vamsi,
Have you checked executing your FM in SAP R/3 with same data?
If it is working properly then debug your code.
I guess i are getting problem in connecting to sap system.
Regards,
Bhavik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bhavik,
It cant be the problem connecting to R/3 system because I am execting BAPI_SALESORDER_GETLIST and I am getting the data.
I tried executing the FM and it is workign fine.
I think I am doing some thing wrong some where in the following code, but cant figure out what.
The following code might be correct also, since <b>ORDER_HEADER_IN</b> is a structure I got it using JCo and assigned values, and the remaining (<b>ORDER_PARTNERS and ORDER_ITEMS_IN</b>) are tables, I am getting them and assigning the values, so the following code (I think) is correct.
JCO.Structure orderHeaderIn = function.getImportParameterList().getStructure("ORDER_HEADER_IN");
orderHeaderIn.setValue(salesOrg,"SALES_ORG");
orderHeaderIn.setValue(distChannel,"DISTR_CHAN");
orderHeaderIn.setValue(division,"DIVISION");
orderHeaderIn.setValue(salesDocType,"DOC_TYPE");
JCO.Table orderPartners = function.getTableParameterList().getTable("ORDER_PARTNERS");
orderPartners.appendRow();
orderPartners.firstRow();
orderPartners.setValue(partnerRole,"PARTN_ROLE");
orderPartners.setValue(partnerNumber,"PARTN_NUMB");
JCO.Table orderItemsIn = function.getTableParameterList().getTable("ORDER_ITEMS_IN");
orderItemsIn.appendRow();
orderItemsIn.firstRow();
orderItemsIn.setValue(material,"MATERIAL");
Hi Vamsi,
I hope you have executed a commit after a call to BAPI. Maybe its just that all the data that you are sending may be correct. Its just that you may not be commiting after the BAPI call and hence the documnet is not visible in SAP.
if possible try creating a wrapper around the BAPI module and in that wrapper also issue a commit and then call it using JCO.
Hope this helps.
Regards
Sidharth
Hi Vamsi,
What i meant by a wrapper module was that create a Z RFC function module which has an interface similar to BAPI and also calls BAPI_TRANSACTION_COMMIT after the call to the actual BAPI. You can then call this Z RFC FM.
Or you can call the actual BAPI using JCO and then also follow it up with a call to BAPI_TRANSACTION_COMMIT as has been explained by Nathan.
Regards
Sidharth
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.