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

CALL_FUNCTION_PARM_MISSING in standalone program while calling bapi dynamically

hiriyappa_myageri
Participant
0 Likes
5,283

Hi Folks,

Greetings,

I am facing the problem in calling dynamic function module or BAPI in s/4 hana system.

It is giving me an error saying that parameter missing.

Kindly help on this .

Please find my code snippet.

REPORT zdynamic.
TYPE-POOLS : abap.

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,
str TYPE TABLE OF BAPIPARAM.

FIELD-SYMBOLS : <itab> TYPE ANY TABLE.
ASSIGN str TO <itab>.
DATA : lv_level TYPE string.
DATA : lv_type TYPE char10.

lv_level = 'xyz'.

*** Importing
ls_ptab-name = 'USERNAME'.
ls_ptab-kind = abap_func_importing.
GET REFERENCE OF lv_level INTO ls_ptab-value.
INSERT ls_ptab INTO TABLE lt_ptab.

** Table
ls_ptab-name = 'PARAMETER'.
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 = 'NOT_EXISTS'.
ls_etab-value = 1.
INSERT ls_etab INTO TABLE lt_etab.
ls_etab-name = 'OTHERS'.
ls_etab-value = 2.
INSERT ls_etab INTO TABLE lt_etab.

lv_fname = 'BAPI_USER_GET_DETAIL'." Function Name

CALL FUNCTION lv_fname
PARAMETER-TABLE
lt_ptab
EXCEPTION-TABLE
lt_etab.
IF sy-subrc NE 0.
*** Error Handling
ENDIF.


I referred the many posts the gui_download dynamic function call is working fine but i am not able to call the functions other than gui_download dynamically.

Regards,

Hiri

1 ACCEPTED SOLUTION
Read only

MateuszAdamus
Active Contributor
0 Likes
4,726

Hello Hiriyappa Myageri,

As Andrea said, it would be easier if you provided a code snipper of the call.

However, judging from the short dump description it seems you have not provided a value for a required parameter of the function you're trying to use. Please check that functions definition and provide values for all required parameters. Otherwise it will not work.

Edit: You can open the function module in SE37 transaction to check its parameters and their attributes.

Kind regards,

Mateusz

8 REPLIES 8
Read only

abo
Active Contributor
0 Likes
4,726

Please edit the question to add the relevant snippet of code.

Read only

MateuszAdamus
Active Contributor
0 Likes
4,727

Hello Hiriyappa Myageri,

As Andrea said, it would be easier if you provided a code snipper of the call.

However, judging from the short dump description it seems you have not provided a value for a required parameter of the function you're trying to use. Please check that functions definition and provide values for all required parameters. Otherwise it will not work.

Edit: You can open the function module in SE37 transaction to check its parameters and their attributes.

Kind regards,

Mateusz

Read only

0 Likes
4,726

Hi Mateusz,

I have added code snippet. Kindly find same in original post.

Regards,

Hiri

Read only

0 Likes
4,726

Thanks.

You're missing the RETURN tables parameter in your call. This parameter is obligatory.


Kind regards,
Mateusz
Read only

4,726

Hi hirizm

RETURN is an obligatory parameter in BAPI_USER_GET_DETAIL function.

Please format your code with the "Code" button in the message editor's toolbar.

If function's parameter is marked as IMPORTING, you have to mark it as EXPORTING in your report. And vice versa. Like in normal ABAP function call.


Kind regards,
Mateusz

Read only

0 Likes
4,726

Hi Mateusz,

You are right . Parameter table is we need to pass the values as you mentioned .
Now it is working fine

Regards,

Hiri

Read only

ArthurParisius
Contributor
0 Likes
4,726

By using the model option to add the function in some ABAP code it looks like your missing RETURN table parameter.

Read only

hiriyappa_myageri
Participant
0 Likes
4,726

Hi Mateusz,

In the example I gave the return parameter is not a obligatory.
Please find another example where return parameter is not present still there is dump as missing parameter .

REPORT zdynamic.
TYPE-POOLS : abap.
DATA: func 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,

str TYPE TRDIR.

FIELD-SYMBOLS : <itab> TYPE any.

ASSIGN str TO <itab>.

DATA : lv_level TYPE string.

DATA : lv_type TYPE char10.

lv_level = 'ZDYNAMIC'.

** Exporting ls_ptab-name = 'E_TRDIR'.

ls_ptab-kind = abap_func_exporting.

GET REFERENCE OF lv_type INTO ls_ptab-value.

INSERT ls_ptab INTO TABLE lt_ptab.

*** Importing ls_ptab-name = 'I_PROGNAME'.

ls_ptab-kind = abap_func_importing.

GET REFERENCE OF lv_level INTO ls_ptab-value.

INSERT ls_ptab INTO TABLE lt_ptab.

*** Exceptions ls_etab-name = 'NOT_EXISTS'.

ls_etab-value = 1.

INSERT ls_etab INTO TABLE lt_etab.

ls_etab-name = 'OTHERS'.

ls_etab-value = 2.

INSERT ls_etab INTO TABLE lt_etab.

func = 'READ_TRDIR'.

" Function Name

CALL FUNCTION func

PARAMETER-TABLE lt_ptab

EXCEPTION-TABLE lt_etab.

IF sy-subrc NE 0. *** Error Handling ENDIF.

is there any restrictions while calling the dynamic FM.

Regards,

Hiri