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

mapping function module paramters dynamically with a selection screen

Former Member
0 Likes
651

Hi Experts,

I got a situation,

i am maintaining data of a function module paramters in a dictionary table.

in the screen pbo i will fetch the the fm data from that table into the internal table(ITAB).

in my report screen i am having the selection screen and the selection screen parameters are also mentioned in the FM Dictionary Table, we are having the those details in our internal table (ITAB).

now the issue is how to call the FM by using the ITAB values.

example: ITAB

fmname parametr type str_name ss_field

-


-


-


-


-


get_notif im_notif import qmnum s_notif

here s_notif[ ] is having the values in it which is nothing but selection screen parameter.

and we are having S_NOTIF as a string values in the ITAB.

now how can i link this S_notif(type string) to s_notif(value of notification) ?

what i have done is ,

loop at itab into wa_itab where type = 'import'.

case wa_itab-parameter.

when 'IM_NOTIF'. " for example im dealing with only one parameter this can have many

get reference of S_NOTIF[ ] to v_notif.

endcase.

endloop.

now i dont wanmt hard code the parameter name ,

is there any way to do it dynamically... ?

experts please help me on this ?

thanks

3 REPLIES 3
Read only

naimesh_patel
Active Contributor
0 Likes
510

In your situation, you would be able to use the option PARAMETER-TABLE of the CALL FUNCTION. In this table, you need to pass the parameter name and corresponding values.

Check out the help - [CALL FUNCTION - parameter_tables |http://help.sap.com/abapdocu_702/en/abapcall_function_dynamic.htm]

Regards,

Naimesh Patel

Read only

huseyindereli
Active Contributor
0 Likes
510

Hi ,

This sample will help you.

DATA: lv_fname TYPE string,
        lt_ptab TYPE abap_func_parmbind_tab,
        ls_ptab TYPE abap_func_parmbind,
        lt_etab TYPE abap_func_excpbind_tab,
        ls_etab TYPE abap_func_excpbind.

*** Table
  ls_ptab-name = 'IT_TABLE'.
  ls_ptab-kind = abap_func_tables.
  GET REFERENCE OF <itab> INTO ls_ptab-value.
  INSERT ls_ptab INTO TABLE lt_ptab.

*** Exceptions
  ls_etab-name = 'DATA_NOT_FOUND'.
  ls_etab-value = 1.
  INSERT ls_etab INTO TABLE lt_etab.

  lv_fname = 'GET_MY_DATA'." Function Name

  CALL FUNCTION lv_fname
    PARAMETER-TABLE
      lt_ptab
    EXCEPTION-TABLE
      lt_etab.
  IF sy-subrc NE 0.
	

  ENDIF.

Read only

Former Member
0 Likes
510

thanks guys, i solved it with your help.