cancel
Showing results for 
Search instead for 
Did you mean: 

Bapi parameters problem

Former Member
0 Kudos

Hello!! I want to use a bapi which requires a list of personnel numbers. The bapi works fine!

The problem is passing the list of numbers. I have the following code:

public boolean executeZgav_Tc_Morosidad_Input( )

{

//@@begin executeZgav_Tc_Morosidad_Input()

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try {

Zgav_Wa_Pernr nroPersonal = new Zgav_Wa_Pernr();

String pernr = ""+wdContext.currentContextElement().getNroEmpleado() ;

nroPersonal.setPernr(pernr);

wdContext.currentZgav_Tc_Morosidad_InputElement().modelObject().addI_Itpernr(nroPersonal);

wdContext.currentZgav_Tc_Morosidad_InputElement().modelObject().execute();

wdContext.nodeOutput_Morosidad().invalidate();

return true;

} catch (WDDynamicRFCExecuteException e) {

manager.reportException(e.getMessage(), false);

manager.reportMessage(IMessageData.SIN_LISTA_SOLICITUDES, new Object[] {}, false);

return false;

}

//@@end

}

The code is not working from the moment I set the parameter's value. I know it because of the debugger. There I can see that the value that is sending is not the one that I'm setting.

Any help?? I've also tried to complete the length of the number up to 8 with no results!

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

I solved the problem! It was at ABAP level. The bapi was reading the header of the table with the parameters instead of reading the content. Once it was corrected everything worked as expected!!

Thanks a lot for the answers!!

Former Member
0 Kudos

No, it didn't work... this is the new code I'm trying:

public void executeZgav_Tc_Morosidad_Input( )

{

//@@begin executeZgav_Tc_Morosidad_Input()

//$$begin Service Controller(369637891)

Zgav_Tc_Morosidad_Input input = new Zgav_Tc_Morosidad_Input();

wdContext.nodeZgav_Tc_Morosidad_Input().bind(input);

//$$end

//$$begin Service Controller(-38757806)

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try

{

Zgav_Wa_Pernr nroPersonal = new Zgav_Wa_Pernr ();

wdContext.nodeI_Itpernr().bind(nroPersonal);

nroPersonal.setPernr("00002195");

wdContext.currentZgav_Tc_Morosidad_InputElement().modelObject().execute(); (****)

wdContext.nodeOutput_Morosidad().invalidate();

wdContext.nodeZgav_Tc_Morosidad_Input().nodeE_Itmorosidad().moveFirst();

manager.reportSuccess("Morosidad: "wdContext.currentE_Itmorosidad_outElement().getMorosidad()"->" + wdContext.currentE_Itmorosidad_outElement().getPernr());

}

catch(WDDynamicRFCExecuteException e)

{

manager.reportException(e.getMessage(), false);

}

//$$end

//@@end

}

I put a breakpoint at the (****) mark, and when i check the value that nroPersonal has, it says 0, not 2195 as I expect to. that's why I think it has something to do with the set method!!

thanks

Former Member
0 Kudos

Hi,

You have created the object of your Model node called Zgav_Wa_Pernr but did not bound it to your context node. That is why the value is not getting set to your context. So first bind your model object to your context in the following way and then only that value will set to your parameters. wdContext.nodeZgav_Wa_Pernr.bind(nroPersonal);

Please reward points if it helps. If you need further help then paste your mail address here and I will send you a sample application which is same to your requirement.. Please reward points if it helps..

Thanks and Regards

Avijit

Former Member
0 Kudos

No, sorry, it didn't work neither.

I'm sure it has somenthing to do with the nroPersonal.set( ... ). I've tried changing the value directly through the debugger with no results at all!!

Is there any reason for it to be happening? Maybe the RAM of the computer or something like that?

Hope you can help!!

raja_thangamani
Active Contributor
0 Kudos

Use the below code..

Zgav_Wa_Pernr nroPersonal = new Zgav_Wa_Pernr();
String pernr = ""+wdContext.currentContextElement().getNroEmpleado() ;
nroPersonal.setPernr(pernr);

      Z_YOUR_BAPI_Input request = new Z_YOUR_BAPI_Input(WDModelScopeType.TASK_SCOPE);

request.addI_Itpernr(nroPersonal);

Hope this will solve your problem..

<i>*Reward each useful answer</i>

Raja T