cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with RFC table input

Former Member
0 Kudos

Greetings Experts,

I'm having trouble with calling an RFC with table input.

Here is my code so far:


  public void executeZps_Fm_War_Mat_Update_Input( )
  {
    //@@begin executeZps_Fm_War_Mat_Update_Input()
		//$$begin Service Controller(344531631)
		IWDMessageManager manager = wdComponentAPI.getMessageManager();
		try {
			int size =
				wdContext
					.nodeZps_Fm_War_Mat_Prefill_Input()
					.nodeWarOut()
					.nodeEx_Warout()
					.size();
			for (int i = 0; i < size; i++) {
				IPublicWARComp.IEx_WaroutElement srcElement =
					wdContext
						.nodeZps_Fm_War_Mat_Prefill_Input()
						.nodeWarOut()
						.nodeEx_Warout()
						.getEx_WaroutElementAt(i);
				IPublicWARComp.IIm_WarmatinElement trgElement =
					wdContext.createIm_WarmatinElement(
						new com.kaisa.mwci.models.updatezpsmur.Zps_War());
				WDCopyService.copyCorresponding(srcElement, trgElement);
				wdContext
					.nodeZps_Fm_War_Mat_Update_Input()
					.nodeIm_Warmatin()
					.addElement(
					trgElement);
			}
			wdContext
				.currentZps_Fm_War_Mat_Update_InputElement()
				.modelObject()
				.execute();
			wdContext.nodeOutWarMatIn().invalidate();
		} catch (WDDynamicRFCExecuteException e) {
			manager.reportException(e.getMessage(), false);
		}
		//$$end
    //@@end
  }

I can call the RFC, it actually returns a value, but not one that I expect. I think the table data is not being passed at all?

Ideas will be greatly appreciated. Thanks!

Cheers,

Alfonso

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

problem solved. it was all a matter of defining an arbitrary input data instance and binding it as a collection rather than adding one element at a time.

cheers,

alfonso

former_member300754
Participant
0 Kudos

Hi Alfonso

Would you please elaborate the solution? I'm struck on this problem.

Thanks for your effort.

Peerasit

Former Member
0 Kudos

HI

try for external debugging of you RFC , and whether you are able to pass you data to the RFC ,

public void executeZps_Fm_War_Mat_Update_Input( )

{

//@@begin executeZps_Fm_War_Mat_Update_Input()

//$$begin Service Controller(344531631)

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try {

int size =

wdContext

.nodeZps_Fm_War_Mat_Prefill_Input()

.nodeWarOut()

.nodeEx_Warout()

.size();

for (int i = 0; i < size; i++) {

IPublicWARComp.IEx_WaroutElement srcElement =

wdContext

.nodeZps_Fm_War_Mat_Prefill_Input()

.nodeWarOut()

.nodeEx_Warout()

.getEx_WaroutElementAt(i);

IPublicWARComp.IIm_WarmatinElement trgElement =

wdContext.createIm_WarmatinElement(

new com.kaisa.mwci.models.updatezpsmur.Zps_War());

// here instead of creating a element , there would be some Class

created for IIm_Warmatin , so you can create a instance for this class and set the

source data element to the target .

ZIIm_Warmatin target = new IIm_WarmatinElement();

target.set(...);

........

wdcontext.nodeIIm_Warmatin.bind(target);

try this . or you can set the source data to the element created for the target .

hopefully should work

}

wdContext

.currentZps_Fm_War_Mat_Update_InputElement()

.modelObject()

.execute();

wdContext.nodeOutWarMatIn().invalidate();

} catch (WDDynamicRFCExecuteException e) {

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

}

//$$end

//@@end

}

former_member197348
Active Contributor
0 Kudos

Hi Alfonso,

Did you try like this?

public void executeZps_Fm_War_Mat_Update_Input( )
  {
    //@@begin executeZps_Fm_War_Mat_Update_Input()
 //$$begin Service Controller(344531631)
IWDMessageManager manager = wdComponentAPI.getMessageManager();
try {
WDCopyService.copyCorresponding(wdContext
		.nodeZps_Fm_War_Mat_Prefill_Input()
		.nodeWarOut()
		.nodeEx_Warout(), wdContext
		.nodeZps_Fm_War_Mat_Update_Input()
		.nodeIm_Warmatin());	
	
wdContext	.currentZps_Fm_War_Mat_Update_InputElement()
		.modelObject().execute();
	wdContext.nodeOutWarMatIn().invalidate();
	} catch (WDDynamicRFCExecuteException e) {
	manager.reportException(e.getMessage(), false);
	}
	//$$end
    //@@end
  }

Regards,

Siva