cancel
Showing results for 
Search instead for 
Did you mean: 

Filling node problem

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Answers (2)

Answers (2)

Former Member
0 Kudos

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).

Former Member
0 Kudos

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

Former Member
0 Kudos

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);
	}

Former Member
0 Kudos

Hi,

For the time being can you put the execute code in the view itself and try executing once.

Regards,

Murtuza