on 07-24-2006 7:31 PM
I am working on an app where users enter some hours. I then fire a plug to another page, for my own testing purposes to verify that the data is being entered and saved correctly. So input is taken from Bapi_Ptmgrattabas_Mngcreation_Input->Att_Abs_Hours
and then I'm using the output of the same type:
Bapi_Ptmgrattabas_Mngcreation_Input->Output->Att_Abs_Hours
The hours are not being displayed on the next page, and no matter what is entered, 0 is displayed (I assume this was the default). Everything is mapped and bound correctly, so I'm not really sure where the problem might be. Suggestions? Thank you!
Hi Kathleen,
Try to display Bapi_Ptmgrattabas_Mngcreation_Input->Output->Att_Abs_Hours without navigation. If it doesn`t work check did you invalidate output after RFC execution.
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kathleen,
Make sure that:
1. "supplyingRelationRole" is set correctly for "Output" node.
2. You call node.invalidate() after query.execute(), not before!!!
Valery Silaev
EPAM Systems
Kathleen,
Try to debug in the following way:
if (null == query.getOutput() || query.getOutput().get<TableName>() == null)
wdComponentAPI.getMessageManager().reportWarning("NULL result");
else
wdComponentAPI.getMessageManager().reportWarning("SIZE: " + query.getOutput().get<TableName>().size());
What size is reported?
VS
Bapi_Ptmgrattabs_Mngcreation_Input query = wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1Element().modelObject();
if (null == query.getOutput() || query.getOutput().getHrabsatt_Out().getAbs_Att_Hours() == null)
wdComponentAPI.getMessageManager().reportWarning("NULL result");
else
wdComponentAPI.getMessageManager().reportWarning("SIZE: " + query.getOutput().getHrabsatt_Out().getAbs_Att_Hours().size());
Thats what I have at the moment, and now it says size is undefined for type BigDecimal. I added the .getOuput.getAtt_Abs_Hours()
Kathleen,
At last some light!
My (wrong) guess was that you are trying to output table, but this is just sole value!
Try:
if (null == query.getOutput() || query.getOutput().getHrabsatt_Out() == null)
wdComponentAPI.getMessageManager().reportWarning("NULL result");
else
wdComponentAPI.getMessageManager().reportWarning("HOURS:" + query.getOutput().getHrabsatt_Out().getAbs_Att_Hours());
VS
Message was edited by: Valery Silaev
Ok,
Let us narrow possible reason:
if (null == query.getOutput() )
wdComponentAPI.getMessageManager().reportWarning("NULL result, query not executed");
else if (query.getOutput().getHrabsatt_Out() == null)
wdComponentAPI.getMessageManager().reportWarning("NULL result, output structure is null");
What this debug code reports?
VS
Kathleen,
Let me do my latest guess -- you are "eating" exception.
Your code looks like (not exactly, but kind of):
try {
...
query.execute();
...
node.invalidate();
}
catch (Exception ex {
}
Rewrite it as following (the important part is catch block):
try {
...
query.execute();
...
node.invalidate();
}
catch (Exception ex {
wdComponentAPI.getMessageManager().reportException(
new WDNonFatalRuntimeException(ex), false
);
}
There are should be an error reported. And this error musty explain the reason.
VS
public void executeBapi_Ptmgrattabs_Mngcreation_Input1( )
{
//@@begin executeBapi_Ptmgrattabs_Mngcreation_Input1()
try
{
// Calls remote function module BAPI_FLIGHT_GETLIST
Bapi_Ptmgrattabs_Mngcreation_Input query = wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1Element().modelObject();
if (null == query.getOutput() || query.getOutput().getHrabsatt_Out() == null)
{
wdComponentAPI.getMessageManager().reportWarning("NULL result");
}
else
{
wdComponentAPI.getMessageManager().reportWarning("HOURS query.getOutput().getHrabsatt_Out().getAbs_Att_Hours().size()");
}
if (null == query.getOutput() )
{
wdComponentAPI.getMessageManager().reportWarning("NULL result, query not executed");
}
else if (query.getOutput().getHrabsatt_Out() == null)
{
wdComponentAPI.getMessageManager().reportWarning("NULL result, output structure is null");
}
wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1Element().modelObject().setEmployeenumber("650617");
wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1Element().modelObject().setAbs_Att_Type("105");
wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1Element().modelObject().execute();
wdContext.nodeOutput().invalidate();
}
catch (Exception ex)
{
// If an exception is thrown, then the stack trace will be printed
wdComponentAPI.getMessageManager().reportException(new WDNonFatalRuntimeException(ex), false);
ex.printStackTrace();
Object[] errMsg = new String[2];
errMsg[0] = ex.getMessage();
errMsg[1] = "" + wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1Element().modelObject().getHrabsatt_In().getAbs_Att_Hours();
MessageManager msgMgr = (MessageManager) wdThis.wdGetAPI().getComponent().getMessageManager();
msgMgr.reportMessage(IMessageEnterTime.SAP_ERROR, errMsg, true);
wdComponentAPI.getMessageManager().reportException(new WDNonFatalRuntimeException(ex), false);
}
// Synchronise the data in the context with the data in the model
// wdContext.nodeOutput().invalidate();
//@@end
}
Kathleen,
I cannot understand you now.
First you say that some filed in output is zero while you expecting non-zero value.
Test we used shows that BAPI is executed without Java errors. If it uses standard BAPI mechanism for errors, check something like BAPI_RETURN structure in SE37
Does this hours attribute is non-zero when you test your function in SE37?
VS
Kathleen,
Then there are could be 2 reasons:
1. You are using different users with SAP GUI and for Adaptive RFC connection. Sometimes (but rare) this may cause different behavior.
2. The most realistic reason is that input is in fact different between 2 cases:
a) Some parameters has default values. When you running RFM with SAP GUI default values are always supplied, when you are using JCo or Adaptive RFC Model default values are never supplied. Check RFM input parameters and set default values.
b) Something wrong with conversion exits for input parameters. In your code you have:
wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1Element().modelObject().setEmployeenumber("650617");
wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1Element().modelObject().setAbs_Att_Type("105");
Say, first type requires numeric string of 18 characters, second is numeric string of 10 characters. Normally, when you invoke Adaptive RFC Query conversion exit routine is executed and backend get EmployeeNumber prepended with 12 zeroes and Abs_Att_Type prepended with 7 zeroes. Probably something went wrong with this. Try to check corresponding type in ABAP, and if it is numeric string of fixed length try to pad your values with leading zeroes.
Valery Silaev
EPAM Systems
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.