Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to pass Hardcoded values from Form to Function Module

Hi All,

I am creating a form which will fetch the Material Details (Material Number and Material Desc) for a given Material Group ()eg. COMPNB,COMPSFT) etc.

I have imported the model and created a Custom Controller.

In the view I have created a DropDownByKey for Material Group. This has been binded to a Simple Type (Local Dictionary) which contains the Material Group code and Desc as key value pair eg COMPNB-->Computer Notebook.

Also, the plant has been hardcoded as 0002 in the View.

Now the thing is, how should I pass these parameters (Material Group and Plant) to the funtion module.

Please let me know.

Regards

Nikhil Bansal

Former Member
Former Member replied

Hi,

Firstly get the value that has been selected from the dropdown by using the code

String matcode = wdContext.currentMaterialNode.getMaterialgrpCode();

String matdesc = wdContext.currentMaterialNode.getMaterialDesc();

next create an instance

fun_module_name_Input model = new fun_module_name_Input();

then create an element of this

IPrivateview_name.I_fn_module_name_InputElement element = wdContext.node_fun_module_name_Input.create__fun_module_name_InputElement(model);

then bind it

wdContext.node_fun_module_name_Input.bind(element);

now set the value of the element to pass it to function module and execute it

element.setMaterialcode(matcode);

element.setMaterialDesc(matdesc);

For hard code value u can write

element.setMaterialcode("COMP");

wdContext.node__fun_module_name_Input().current___fun_module_name_InputElement().modelObject().execute();

the values will be passed to the function module as input and the FM will be executed.

Regards,

Prasy

Message was edited by:

prasy p

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question