on 06-24-2016 8:27 AM
Hi
I am new to sap.
I want to pull data from sap table .I have wriiten following code
JCO.ParameterList input = function.getImportParameterList();
input.setValue(partner.getProject(), "I_PROJECT_DEFINITION");
log.info("New nessie partner details:populating import parameters"+partner.getProject());
// Execute function
client.execute(function);
JCO.Table partnerDef = function.getTableParameterList().getTable("ET_PARTNER_DETAIL");
for (int i = 0; i < partnerDef.getNumRows(); i++) {
partnerDef.setRow(i);
partner.setPartner(partnerDef.getString("PARTNER"));
partner.setPartnerfunction(partnerDef.getString("PARTN_ROLE"));
partner.setPartneraddress(partnerDef.getString("ADRESSE"));
partner.setPartneraddrflag(partnerDef.getString("ADRESSS_FLAG"));
partner.setPartnername(partnerDef.getString("NAME_LIST"));
partner.setPartnertext(partnerDef.getString("DEVISION_TEXT"));
retPartner.getCodes().add(partner);
}
But i am getting 0 rows,even though table has records .
please help me on this
Hello Manali,
You are still using JCo 2.1, which has been out of support for more than three years now. Switch to JCo 3.0 for your project. Furthermore, it's likely that you experience a behavior that is very common: The import parameter has language dependent inputs when being used in the SAP Gui, but when being used in JCo via RFC, you need to provide the internal language-independent value for it. Simply check this via the debugger in ABAP.
Best regards,
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Markus ,Hi Stefan
Thank you all for your suggestion .somehow i have managed to pull correct data...
once again Thanks for your help..
Regards,
Manali
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Markus,
Thanks for this information..i will try to use this clear option
we are running this interface on tomcat 6.Already existing functionality uses 2.1 API
Regards,
Manali
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
function.getImportParameterList().setValue(projectCode,"I_PROJECT_DEFINITION"); | ||||
// Execute function | ||||
client.execute(function); |
log.info("Function " + name + " executed ok..."); | ||||
//Connecting to ET_PARTNER_DETAIL Table | ||||
JCO.Table partnerDef = function.getTableParameterList().getTable("ET_PARTNER_DETAIL"); | ||||
log.info("New nessie partner details:setting parameters from ET_PARTNER_DETAIL no of rows: " + partnerDef.getNumRows()+ "\t no of columns:" + partnerDef.getNumColumns()); |
//fetching data from ET_PARTNER_DETAIL and setting that information | ||||||||||
for (int i = 0; i < partnerDef.getNumRows() ; i++) { | ||||||||||
if(i <21) | ||||||||||
{ | ||||||||||
partnerDef.setRow(i); | ||||||||||
NessieProjectsPartnerIntf partner= new NessieProjectsPartnerIntf(); | ||||||||||
partner.setProject(project); | ||||||||||
partner.setBusinessArea(1); | ||||||||||
partner.setPartner(partnerDef.getString("PARTNER")); | ||||||||||
log.info("PARTNER-----"+partnerDef.getString("PARTNER")); | ||||||||||
partner.setPartnerfunction(partnerDef.getString("PARTN_ROLE")); | ||||||||||
//log.info("PARTN_ROLE---"+partnerDef.getString("PARTN_ROLE")); | ||||||||||
retPartner.getCodes().add(partner); | ||||||||||
} | ||||||||||
} | ||||||||||
partnerDef.clear(); still its appending data ...please see the log
30.06.2016 12:31 INFO - PARTNER-----10001833 30.06.2016 12:31 INFO - Got the BAPI_BUS2001_PARTNER_GETDETAIL function object (New nessie partner details) 30.06.2016 12:31 INFO - coverted project code new :GB026480000 30.06.2016 12:31 INFO - Function BAPI_BUS2001_PARTNER_GETDETAIL executed ok...
30.06.2016 12:31 INFO - PARTNER-----10001833---//repeated from previous data 30.06.2016 12:31 INFO - PARTNER-----10005829 30.06.2016 12:31 INFO - PARTNER-----10005829 30.06.2016 12:31 INFO - PARTNER-----10139808 30.06.2016 12:31 INFO - PARTNER-----10139808 |
dont know what i need to use?
Please help
JCo 3.0 and JCo 2.1 can run simultaneously in the same process.
They do not interfere with each other.
So even if some other legacy application still uses JCo 2.1 there is no justification that another application would not be able to use JCo 3.0.
Besides, Markus did not say that there won't be a solution for your issue but only that there is no official support from SAP anymore. The maintenance and support period for JCo 2.1 ended on March 31, 2013.
Best regards,
Stefan
Hi Thank you
now i am able to get the data..but i am getting overridden values from previous rows.
Correct entry returned for project1
each time the issue is the field is not being cleared hence i am retaining records from previous call. can you please guide me
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Manali,
when considering seomthing helpful, you should also signal this in the forum so that others can learn from it as well.
What you are now asking is not really fully clear to me, but I have a guess. Are you re-using the same JCoFunction instance? If so, ET_PARTNER_DETAIL will send the previously received rows to the ABAP system and obviously, it is not disturbing the logic, but simply appending to the existing table. Table parameters are always bi-directional, just like Changing parameters. If you like to re-use a function object, you need to clear all tables. Or create a new JCoFunction instance from the JCoFunctionTemplate.
Best regards,
Markus
Hi Markus
Thanks a lot.I tried to create a new JCOFunction instance ,but still its appending data from previous rows.
In your comment,you also mentioned about clearing table
and I got this information
void | clear() Clears the table, i.e. deletes all rows |
does that mean it will actually delete table from sap end?or how it is?
i am doing this for production ..so just for safety, need to confirm
check this.. is this correct?
function.getImportParameterList().setValue(projectCode,"I_PROJECT_DEFINITION");
// Execute function
client.execute(function);
log.info("Function " + name + " executed ok...");
//Connecting to ET_PARTNER_DETAIL Table
JCO.Table partnerDef = function.getTableParameterList().getTable("ET_PARTNER_DETAIL");
//partnerDef.clear();
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.