Application Development 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: 

No syntax errors if import/export parameters are missing when calling FM

Former Member
0 Kudos
2,096

Hi,

When I call any FM, be it standard or custom, with some of the mandatory import/exporting parameters missing, the program doesn't show any syntax errors, even when activating it. However, it shows an error when checked with Code inspector.

You can even add any importing/exporting parameter when calling an FM and the report program will get activated without syntax errors. But it throws a dump when executing the same.

I remember that, it used show the syntax errors when some of the mandatory fields of FM are not used. Is there any change done by SAP recently?

Please let me know your thoughts.

Thanks,

Praveen

1 ACCEPTED SOLUTION

SuhaSaha
Advisor
Advisor
0 Kudos
245

I can actually call a non-existent FM and still the compiler won't complain. (ABAP 740, SP12)


  CALL FUNCTION 'I_AM_A_DUMMY_MODULE_YIPPEE'

    EXPORTING

      restriction                = restrict

    EXCEPTIONS

      too_late                   = 1

      repeated                   = 2

      not_during_submit          = 3

      db_call_after_report_call  = 4

      selopt_without_options     = 5

      selopt_without_signs       = 6

      invalid_sign               = 7

      report_call_after_db_error = 8

      empty_option_list          = 9

      invalid_kind               = 10

      repeated_kind_a            = 11

      OTHERS                     = 12.

* Exception handling

  IF sy-subrc NE 0.

    ...

  ENDIF.

I remember Horst Keller mentioning that a FM call is always dynamic in nature (the name is in quotes), which means that the static compiler cannot report the (static) syntax errors.

I am not sure how ATC (or CI) checks the errors in the call to the FM.

BR,

Suhas

7 REPLIES 7

ashraf_usmani
Participant
0 Kudos
245

hello

Try to read system messages in debug mode,

Give FM Name and dump as well

Regards

Ashraf

0 Kudos
245

Hi Ashraf,

The issue is that SAP allows, if any import/exporting parameter is missing, when coding and doesn't throw any syntax error.

You can create a custom program, call any standard FM which has mandatory and optional fields in importing or exporting parameters. Now, call the FM with one of the mandatory parameters missing and check the syntax errors and activate the code.

It allows you to activate the code without any syntax errors. I am expecting that the syntax error (that mandatory import parameter is missing) should been caught before activating it.

Please try and let me know your comments.

Thanks,
Praveen

ashraf_usmani
Participant
0 Kudos
245

hello

I have try create an example

found this dump CX_SY_DYN_CALL_PARAM_MISSING

REport  YDEMO.

PARAMETER DATE1 TYPE SY-DATUM.

DATA: DATE2 TYPE SY-DATUM.

CALL FUNCTION 'RE_ADD_MONTH_TO_DATE'

EXPORTING

*  months  = '2'    " This The Mandatory field i have commented

   olddate = DATE1

IMPORTING

   newdate = DATE2.

WRITE: / DATE1,

          DATE2..

Are we in the same page ?

Regards

Ashraf

0 Kudos
245

Hi,

Sometimes if you do not pass any value to the mandatory parameters of FM and it does not give any error or dump is because it contains some default value.

However I dont get what the requirement is here, you will have to pass a variable to the mandatory parameter even if the variable is initial.

Also I guess the compiler doesnot know about the mandatory parameters untill runtime and hence you doesn't get the syntax error. I would wait for others to comment over this.

Hope this helps.

ashraf_usmani
Participant
0 Kudos
245

system is checking missing import/export parameter using below class

go to se24

insert

CL CX_SY_DYN_CALL_PARAM_MISSING class name .

and read the documentation hope it help you

whenever there are mismatch in import/export above class will be hit.

Regads

Ashraf Usmani

SuhaSaha
Advisor
Advisor
0 Kudos
246

I can actually call a non-existent FM and still the compiler won't complain. (ABAP 740, SP12)


  CALL FUNCTION 'I_AM_A_DUMMY_MODULE_YIPPEE'

    EXPORTING

      restriction                = restrict

    EXCEPTIONS

      too_late                   = 1

      repeated                   = 2

      not_during_submit          = 3

      db_call_after_report_call  = 4

      selopt_without_options     = 5

      selopt_without_signs       = 6

      invalid_sign               = 7

      report_call_after_db_error = 8

      empty_option_list          = 9

      invalid_kind               = 10

      repeated_kind_a            = 11

      OTHERS                     = 12.

* Exception handling

  IF sy-subrc NE 0.

    ...

  ENDIF.

I remember Horst Keller mentioning that a FM call is always dynamic in nature (the name is in quotes), which means that the static compiler cannot report the (static) syntax errors.

I am not sure how ATC (or CI) checks the errors in the call to the FM.

BR,

Suhas

Former Member
0 Kudos
245

Thanks Suhas for explaining it.

Understood the static and dynamic syntax checks.

Others, please add if you would like to.

Regards,

Praveen