cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass parameters from Java to a Function module with a 'structure'?

Former Member
0 Kudos

Hi,

I am trying to pass some import parameters to an RFC enabled Function Module from Java using JCo and get some export parameters back in Java. In the function module that I am using, one of the import parameter and one of the export parameter is of type Structure (FIS_BANK_DETAIL). But I am not sure how to pass parameters to a 'structure'.

I know how to pass and get parameters from an FM when the import/export parameter is of normal data type(char, int.. etc.). This is how I do it:

			SAPConnection connObj = new SAPConnection();
			connection = connObj.getConnection(request, response);
			interaction = connection.createInteractionEx();
			IInteractionSpec interactionSpec = interaction.getInteractionSpec();
			interactionSpec.setPropertyValue("Name", "Z_EP_GET_BP_RECORD");

			RecordFactory rf = interaction.getRecordFactory();
			MappedRecord input = rf.createMappedRecord("INPUT");
			MappedRecord output = rf.createMappedRecord("OUTPUT");

			// put function module input parameters
			input.put("I_NAME_LAST", lastName);
			input.put("I_NAME_FIRST", firstName);
			output = (MappedRecord) interaction.execute(interactionSpec, input);

//			get function module export parameters
			email = (String) output.get("E_EMAIL");

How should the above code be changed for an import/export parameter of structure type?

Thanks,

Ajay

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ajay,

Follow this code.

Function func = getDefaultJCoConnection().getJCoFunction(FuctionModuleName);

func.getImportParameterList().getStructure(StructureName1).setValue(Value1, FieldName1);

func.getImportParameterList().getStructure(StructureName2).setValue(Value2, FieldName2);

getDefaultJCoConnection().execute(func);

Regards,

Sateesh Chandra Ch

Former Member
0 Kudos

Hi Sateesh,

How can I incorporate the code you have written in my method? Moreover, I am getting an error (The method getDefaultJCoConnection() is undefined for my class) in the following line:

Function func = getDefaultJCoConnection().getJCoFunction("ZGEN_EBPP_CHANGE_BANK");

Thanks,

Ajay

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Ajay,

This is the method we have it in our super class. This is the general scenario which is followed in ISA programming. And the Function is available with JCO API

Regards,

Sateesh Chandra.

Former Member
0 Kudos

Hi Sateesh,

Can I have a larger piece of sample code, since I am new to ISA programming?

Thanks,

Ajay