on 09-04-2007 3:55 PM
Hi everybody,
Got a problem over here
I have a bapi i call where i pass 4 parameters as input and where i also have to pass a table as input parameter, but this last one doesn't work.
my model looks like:
<a href="http://img104.imageshack.us/img104/8040/contextqc0.jpg">context</a>
and my code:
public void onActiongoValider(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActiongoValider(ServerEvent)
IWDMessageManager mgr = wdComponentAPI.getMessageManager();
IPrivateMigoSecondView.IIt_AllocvaluescharElement it_Alloc_Elem = wdContext.nodeIt_Allocvalueschar().createIt_AllocvaluescharElement(new Bapi1003_Alloc_Values_Char());
wdContext.nodeIt_Allocvalueschar().addElement(it_Alloc_Elem);
it_Alloc_Elem.setCharact("COULEE");
it_Alloc_Elem.setValue_Char(wdContext.currentContextElement().getCouleeNumber());
IPrivateMigoSecondView.IIt_AllocvaluescharElement it_Alloc_Elem2 = wdContext.nodeIt_Allocvalueschar().createIt_AllocvaluescharElement(new Bapi1003_Alloc_Values_Char());
wdContext.nodeIt_Allocvalueschar().addElement(it_Alloc_Elem2);
it_Alloc_Elem2.setCharact("NUMEROCOMMANDE");
it_Alloc_Elem2.setValue_Char(wdContext.currentContextElement().getPONumber());
IPrivateMigoSecondView.IIt_AllocvaluescharElement it_Alloc_Elem3 = wdContext.nodeIt_Allocvalueschar().createIt_AllocvaluescharElement(new Bapi1003_Alloc_Values_Char());
wdContext.nodeIt_Allocvalueschar().addElement(it_Alloc_Elem3);
it_Alloc_Elem3.setCharact("QUANTITE");
it_Alloc_Elem3.setValue_Char(wdContext.currentContextElement().getQuantity());
IPrivateMigoSecondView.IIt_AllocvaluescharElement it_Alloc_Elem4 = wdContext.nodeIt_Allocvalueschar().createIt_AllocvaluescharElement(new Bapi1003_Alloc_Values_Char());
wdContext.nodeIt_Allocvalueschar().addElement(it_Alloc_Elem4);
it_Alloc_Elem4.setCharact("EMPLACEMENT");
it_Alloc_Elem4.setValue_Char(wdContext.currentContextElement().getEmplacement());
IPrivateMigoSecondView.IIt_AllocvaluescharElement it_Alloc_Elem5 = wdContext.nodeIt_Allocvalueschar().createIt_AllocvaluescharElement(new Bapi1003_Alloc_Values_Char());
wdContext.nodeIt_Allocvalueschar().addElement(it_Alloc_Elem5);
it_Alloc_Elem5.setCharact("N-BATCH");
wdThis.wdGetCutShapeCustController().execute_Z_Rfc_Cs_Migo_Input();
And in my controller i just call : as usual
wdContext.currentZ_Rfc_Cs_Migo_InputElement().modelObject().execute();
wdContext.nodeOutput_Migo().invalidate();
When i look what i have in my contextnodes i have all the information i'm looking for, but it isn't send to SAP.
And when we try to execute the function in SAP using transaction se37 it works fine.
So, i'm stuck on this.
Any idea would be welcome
Thanks in advance
Hi,
What are the input parameters you need to pass and what is the table you need to pass? If you want to pass the table as input parameter, try to change the following code as per your requirement.
Bapi_table table = new Bapi_table ();
//set the values in the table
table.setFirst("first");
table.setLast("last");
//bind table to your inptu bapi
wdContext.nodeZ_Rfc_Cs_Migo_InputElement().bind(table);
//add table to your input bapi
wdContext.addZ_Rfc_Cs_Migo_InputElement(table);
//execute your bapi
Regards
Suresh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks it solved my problem.
Here is how i did and how it worked
Bapi1003_Alloc_Values_Char tableChar = new Bapi1003_Alloc_Values_Char();
tableChar.setCharact("EMPLACEMENT");
tableChar.setValue_Char(wdContext.currentContextElement().getEmplacement());
wdContext.nodeIt_Allocvalueschar().bind(tableChar);
wdContext.currentZ_Rfc_Cs_Migo_InputElement().modelObject().addIt_Allocvalueschar(tableChar);
...
One again thank you.
Have good day
Did you try working only with the model objects? I mean:
Bapi1003_Alloc_Values_Char it_Alloc_Elem = new Bapi1003_Alloc_Values_Char();
it_Alloc_Elem.setCharact("COULEE");
it_Alloc_Elem.setValue_Char(wdContext.currentContextElement().getCouleeNumber());
wdContext.currentIIt_AllocvaluescharElement().modelObject().add(it_Alloc_Elem);
(Perhaps you have to access the model object of the parent node instead and use a method set of a collection of already created objects).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Just write this in your controller method:
ZRfc_Cs_Migo_Input ele = new ZRfc_Cs_Migo_Input();
wdContext.nodeZRfc_Cs_Migo_Input().bind(ele);
wdContext.currentZ_Rfc_Cs_Migo_InputElement().modelObject().execute();
wdContext.nodeOutput_Migo().invalidate();
Also, if possible then all the values that you are setting in view do that in controller.
Regards,
Murtuza
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I allready have this code
wdDoInit:
Z_Rfc_Cs_Migo_Input inputMigo = new Z_Rfc_Cs_Migo_Input();
wdContext.nodeZ_Rfc_Cs_Migo_Input().bind(inputMigo);
and in :
execute_Z_Rfc_Cs_Migo_Input( 😞
try{
wdContext.currentZ_Rfc_Cs_Migo_InputElement().modelObject().execute();
wdContext.nodeOutput_Migo().invalidate();
}catch(WDDynamicRFCExecuteException e){
mgr.reportException(e.getMessage(), false);
}
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
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.