cancel
Showing results for 
Search instead for 
Did you mean: 

Routine syntax error

Former Member
0 Kudos

Hi Gurus,

I am trying to to write a routine which will look into masterdata table and populate one keyfigure.

Here is the code:

TYPES:

BEGIN OF tys_SC_1_full,

ZFTE TYPE /BIC/OIZFTE,

END OF tys_TG_1_full.

TYPES:

BEGIN OF tys_SC_1__RULE_81,

  • InfoObject: 0CALMONTH Calendar Year/Month.

CALMONTH TYPE /BI0/OICALMONTH,

  • InfoObject: 0EMPLOYEE Employee.

EMPLOYEE TYPE /BIC/OIZEMPLOYEE,

*InfoObject: ZFTE FTE Benefits.

ZFTE TYPE /BIC/OIZFTE,

END OF tys_SC_1__RULE_81.

  • Additional types for start routine interface

TYPES:

data_package_structure type tys_SC_1_full.

  • Additional declaration for update rule interface

DATA:

MONITOR type standard table of rsmonitor WITH HEADER LINE,

MONITOR_RECNO type standard table of rsmonitors WITH HEADER LINE,

RECORD_NO LIKE SY-TABIX,

RECORD_ALL LIKE SY-TABIX,

SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS.

  • global definitions from update rules

DATA:

*employee_md LIKE /bi0/memployee,

  • employee_wa LIKE /bi0/memployee,

  • person_md LIKE /bi0/mperson,

  • person_wa LIKE /bi0/mperson.

employee_md LIKE /bic/mzemployee,

employee_wa LIKE /bi0/memployee,

person_md LIKE /bi0/mperson,

person_wa LIKE /bi0/mperson.

FORM routine_0060

USING

COMM_STRUCTURE type tys_SC_1__RULE_81

CHANGING

RESULT TYPE tys_TG_1_full-ZFTE

RETURNCODE LIKE sy-subrc

ABORT LIKE sy-subrc

RAISING

cx_sy_arithmetic_error

cx_sy_conversion_error.

  • init variables

IF G_RECORD_NO <> RECORD_NO.

G_RECORD_NO = RECORD_NO.

CLEAR: EMPLOYEE_MD, PERSON_MD.

CLEAR: EMPLOYEE_WA, PERSON_WA.

ENDIF.

PERFORM READ_MD_EMPLOYEE.

using COMM_STRUCTURE-employee

COMM_STRUCTURE-calmonth

RECORD_NO

RECORD_ALL

SOURCE_SYSTEM

changing employee_wa1

RETURNCODE.

employee_md = employee_wa.

  • fill the internal table "MONITOR", to make monitor entries

  • result value of the routine

RESULT = employee_md-/BIC/ZFTE.

  • if the returncode is not equal zero, the result will not be updated

RETURNCODE = 0.

  • if abort is not equal zero, the update process will be canceled

ABORT = 0.

ENDFORM. "routine_0060

$$ begin of routine - insert your code only below this line -

Data:

*--

COMM_STRUCTURE type tys_SC_1__RULE_81,

l_subrc type sy-tabix,

l_abort type sy-tabix,

ls_monitor TYPE rsmonitor,

ls_monitor_recno TYPE rsmonitors.

REFRESH:

MONITOR.

  • Runtime attributs

SOURCE_SYSTEM = p_r_request->get_logsys( ).

MOVE-CORRESPONDING SOURCE_FIELDS to COMM_STRUCTURE.

  • Migrated update rule call

Perform routine_0060

USING

COMM_STRUCTURE

CHANGING

RESULT

l_subrc

l_abort.

*-- Convert Messages in Transformation format

LOOP AT MONITOR INTO ls_monitor.

move-CORRESPONDING ls_monitor to MONITOR_REC.

append monitor_rec to MONITOR.

ENDLOOP.

IF l_subrc <> 0.

RAISE EXCEPTION TYPE cx_rsrout_skip_val.

ENDIF.

IF l_abort <> 0.

RAISE EXCEPTION TYPE CX_RSROUT_ABORT.

ENDIF.

$$ end of routine - insert your code only before this line -

The syntax error : E:Different number of parameters in FORM and PERFORM (routine:

READ_MD_EMPLOYEE, number of formal parameters: 7, number of actual

parameters: 0).

I haven't understood this. What is formal parameters and actual parameters.

Best Regards,

Reddy.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi,

When you are calling the subroutine, that is the FORM using the PERFORM statement in your code you need to pass the PARAMTERS of that subroutine.

SO your PERFORM statement should list all the parameters that you want to pass to the subroutine.

Formal paramters are parameters that are defined in the FORM, and actual parameters are the parameters that you pass along with PERFORM statement.

Double click on the statement

PERFORM READ_MD_EMPLOYEE. This will take you to FORM READ_MD_EMPLOYEE. there check the parameters this routine expects you to pass.

Regards,

Sesh

Former Member
0 Kudos

Hi Sesh,

Thanks for reply, When i double clicked on perform_md_employee no sub routine exists with that name. My understanding is this routine is getting created when i execute the program.

How to debug what formal paramers is passed in form statement. This particular routine is system generated one.

Best Regards,

Reddy.

0 Kudos

Hi,

I dont think its a a system generated routine, you need to create this FORM.

Double click on the name and you can create it from there.

If you have copy and pasted some code from any other program then goto that program and double click on the PERFORM statement you will betaken to that FORM then copy that FORM and put it in your program.

But this is not advised as some routines might be using GLOBAL data.

Regards,

Sesh

Former Member
0 Kudos

Hi Sesh,

Thanks, Yes, Its using global data, In this case whats the best approach.

Best Regards,

Reddy.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Actual and formal parameters are used in modularization technique while calling a subroutine. Generally we use subroutines using PERFORM statement and the functionality of this subroutine is defined at the end of the program using FORM and ENDFORM statements. The variables used in perform statement are called ACTUAL PARAMETERS and the variables used in form, endform statements are called FORMAL parameters. During the program execution these actual parameters are passed to the formal parameters. We can use the same variable name for both actual and formal parameters.

EXAMPLE:

data: n3 type i.

parameters: n1 type i,

n2 type i.

perform addition using n1 n2 n3. " n1, n2, n3 are actual parameters.

write:/ n3.

form addtion using a b c. " a, b and c are formal parameters.

c = a + b.

endform.

Regards