Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to use a function module in a subroutine

Former Member
0 Likes
660

Hi,

I am working on a report where i have to create list boxes for 5 fields.Instead of using the function module VRM_SET_VALUES for each field can i use subroutine?

If so, can anyone tell me the procedure for that?Its very urgent.

Thanks and Regards,

Hema

5 REPLIES 5
Read only

Former Member
0 Likes
628

Hi

Write the subroutine PERFORM statement for 5 times for the 5 fields passing the fields

and in FORM call the fun module VRM_SET_VALUES only one time.

Reward points for useful Answers

Regards

Anji

Read only

0 Likes
628

Hi,

I have done the same.But here i have to use different variable names for different fields.then i can't use same perform statement for all the fields.In that case what should i do?

Thanks and Regards,

Hema

Read only

0 Likes
628

Ya u can use the same

You have to pass those variable names in repective Perform statement

But in Form its just variable whichever u passed will go into subroutine.

Read only

0 Likes
628

Hi,

I have written the code like this.

FORM VALUE USING V_NAME.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING id = v_name

values = v_list.

ENDFORM.

AT SELECTION-SCREEN OUTPUT.

REFRESH V_LIST.

v_name = 'P_COMMER'.

v_value-key = 'C'.

v_value-text = 'Commercial'.

APPEND v_value TO v_list.

v_value-key = 'N'.

v_value-text = 'Non-Commercial'.

APPEND v_value TO v_list.

v_value-key = ' ' .

v_value-text = 'Both'.

APPEND v_value to v_list.

PERFORM VALUE USING V_NAME.

REFRESH V_LIST1.

v_name1 = 'P_DIRECT'.

v_value1-key = 'D'.

v_value1-text = 'Direct'.

APPEND v_value1 to v_list1.

v_value1-key = 'I'.

v_value1-text = 'Indirect'.

APPEND v_value1 to v_list1.

PERFORM VALUE USING V_NAME1.

REFRESH V_LIST2.

v_name2 = 'P_DIR'.

v_value2-key = 'D'.

v_value2-text = 'D'.

APPEND v_value2 TO v_list2.

v_value2-key = 'C'.

v_value2-text = 'C'.

APPEND v_value2 TO v_list2.

v_value2-key = ' ' .

v_value2-text = ' '.

APPEND v_value2 to v_list2.

PERFORM VALUE USING V_NAME2.

REFRESH V_LIST3.

v_name3 = 'P_LOW'.

v_value3-key = 'Y'.

v_value3-text = 'Yes'.

APPEND v_value3 TO v_list3.

v_value3-key = 'N'.

v_value3-text = 'No'.

APPEND v_value3 TO v_list3.

v_value3-key = ' ' .

v_value3-text = ''.

APPEND v_value3 to v_list3.

PERFORM VALUE USING V_NAME3.

REFRESH V_LIST4.

v_name4 = 'P_PARENT'.

v_value4-key = 'P'.

v_value4-text = 'Parent'.

APPEND v_value4 TO v_list4.

v_value4-key = 'C'.

v_value4-text = 'Child'.

APPEND v_value4 TO v_list4.

v_value4-key = ' ' .

v_value4-text = ''.

APPEND v_value4 to v_list4.

PERFORM VALUE USING V_NAME4.

REFRESH V_LIST5.

v_name5 = 'P_PREF'.

v_value5-key = 'P'.

v_value5-text = 'Preferred'.

APPEND v_value5 TO v_list5.

v_value5-key = 'N'.

v_value5-text = 'NotPreferred'.

APPEND v_value5 TO v_list5.

v_value5-key = ' ' .

v_value5-text = ''.

APPEND v_value5 to v_list5.

PERFORM VALUE USING V_NAME5.

Now I am getting the same set of values in all the fields.How can I solve this?

Thanks and Regards,

Hema

Read only

Former Member
0 Likes
628

Hi,

U first create subroutine as follows.

Form Formname using Fldname.

Call Function VRM_SET_VALUES

Exporting values = Fldname

EndForm.

Then U call Subroutine 5 times for 5 fields

Ex - Perform Formname using Fldname1.

Perform Formname using Fldname2.

...

..

Perform Formname using Fldname5.

Reward Points if useful.

Regards,

A.Thuyavan