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: 

incompatible formal parameter in from a Perform program

Former Member
0 Kudos

hello abapers!

I am new to abap and having trouble with this error message

In PERFORM or CALL FUNCTION "EXECUTE", the actual parameter "INT_EMP" is incompatible with the formal parameter "E_INT_EMP".

I have this include statement written out

Include ZPERFORMSUB

&----


TYPES: BEGIN OF EMP,

NO TYPE Z105TT216EMPNO,

AGE TYPE Z105TT216_EMP-EMPAGE,

NAME TYPE Z105TT216_EMP-EMPNAME,

SEX TYPE Z105TT216_EMP-EMPSEX,

END OF EMP.

TYPES: BEGIN OF PAY,

NO TYPE Z105TT216EMPNO,

SAL TYPE Z105TT216EMP_SAL,

DATE TYPE Z105TT216EMP_SAL_DATE,

END OF PAY.

TYPES: BEGIN OF FINAL,

NO TYPE Z105TT216EMPNO,

AGE TYPE Z105TT216_EMP-EMPAGE,

NAME TYPE Z105TT216_EMP-EMPNAME,

SEX TYPE Z105TT216_EMP-EMPSEX,

SAL TYPE Z105TT216EMP_SAL,

DATE TYPE Z105TT216EMP_SAL_DATE,

END OF FINAL.

DATA: INT_EMP TYPE STANDARD TABLE OF EMP WITH HEADER LINE,

INT_SAL TYPE STANDARD TABLE OF PAY,

INT_FINAL TYPE STANDARD TABLE OF FINAL.

DATA: WA_EMP TYPE EMP,

WA_SAL TYPE PAY,

WA_FINAL TYPE FINAL.

DATA INDEX TYPE I.

........................................................................

and called it from the main program

Report Z_PERFORM

*&

&----


*&

*&

&----


REPORT Z_PERFORM.

  • THE INCLUDE DECLARES ALL DATA DECLARATIONS AND TYPES

INCLUDE ZPERFORMSUB.

  • CALL THE SUBROUTINE HERE

PERFORM HEADLINE.

PERFORM EMP_DATA.

PERFORM EMP_SAL.

PERFORM EXECUTE USING INT_EMP[]

INT_SAL[]

INT_FINAL[]

WA_EMP

WA_SAL

WA_FINAL.

PERFORM DISPLAY USING INT_FINAL[]

WA_FINAL.

FORM EMP_DATA.

SELECT

EMPNO

EMPAGE

EMPNAME

EMPSEX

FROM Z105TT216_EMP

INTO TABLE INT_EMP.

SORT INT_EMP BY NO.

ENDFORM.

FORM EMP_SAL.

SELECT

EMPNO

SALARY

DATEOFPAYMENT

FROM Z105TT216_SAL

INTO TABLE INT_SAL.

SORT INT_SAL BY NO.

ENDFORM.

FORM EXECUTE USING E_INT_EMP TYPE EMP

E_INT_SAL TYPE PAY

E_INT_FINAL TYPE FINAL

E_WA_EMP TYPE EMP

E_WA_SAL TYPE PAY

E_WA_FINAL TYPE FINAL.

LOOP AT E_INT_SAL INTO E_WA_SAL.

READ TABLE E_INT_EMP WITH KEY NO = E_WA_SAL-NO.

IF SY-SUBRC EQ 0.

INDEX = SY-TABIX.

LOOP AT E_INT_SAL INTO E_WA_SAL.

MOVE-CORRESPONDING E_WA_SAL TO E_WA_FINAL.

APPEND E_WA_FINAL TO E_INT_FINAL.

ENDLOOP.

ELSE.

MOVE-CORRESPONDING E_WA_SAL TO E_WA_FINAL.

APPEND E_WA_FINAL TO E_INT_FINAL.

ENDIF.

ENDLOOP.

ENDFORM.

FORM DISPLAY USING D_INT_FINAL TYPE FINAL

D_WA_FINAL TYPE FINAL.

LOOP AT D_INT_FINAL INTO D_WA_FINAL.

WRITE : / D_WA_FINAL-NO CENTERED, D_WA_FINAL-DATE CENTERED, D_WA_FINAL-SAL LEFT-JUSTIFIED,D_WA_FINAL-SEX CENTERED.

ULINE:/3(55).

ENDLOOP.

ENDFORM.

FORM HEADLINE .

SKIP 2.

WRITE:/50(30) 'Employee Information'.

SKIP 2.

ULINE:/49(102).

WRITE:/49 SY-VLINE(1),

53 'Employee #',

65 SY-VLINE(1),

67 'Name',

108 SY-VLINE(1),

110 'Age',

115 SY-VLINE(1),

117 'Sex',

119 SY-VLINE(1),

120 'Date of Payment',

136 SY-VLINE(1),

138 'Salary',

150 SY-VLINE(1).

ULINE:/49(102).

ENDFORM. " HEADING_INFO

I will appreciate your hints- have searched some of the context related to this, tried it out without success

Thanks

Edited by: Adeyinka Owotuyi on Jul 29, 2009 1:17 AM

Edited by: Adeyinka Owotuyi on Jul 29, 2009 1:22 AM

1 REPLY 1

former_member555112
Active Contributor
0 Kudos

Hi,

The problem is that your are passing parameters as follow:-

PERFORM EXECUTE USING INT_EMP[] I
                                            INT_SAL[] 
                                            INT_FINAL[]
                                            WA_EMP
                                            WA_SAL
                                             WA_FINAL

The form is defined as follows:-

FORM EXECUTE USING E_INT_EMP    TYPE EMP
                                      E_INT_SAL    TYPE PAY
                                      E_INT_FINAL TYPE FINAL
                                      E_WA_EMP   TYPE EMP
                                      E_WA_SAL  TYPE PAY
                                      E_WA_FINAL TYPE FINAL.

If you notice that you are passing internal table INT_EMP to parameter E_INT_EMP and so on.

However the parameter E_INT_EMP if of TYPE EMP.

The type EMP is declared as follows:-

TYPES: BEGIN OF EMP, 
                NO    TYPE Z105TT216EMPNO,
               AGE   TYPE Z105TT216_EMP-EMPAGE,
               NAME TYPE Z105TT216_EMP-EMPNAME, 
               SEX    TYPE Z105TT216_EMP-EMPSEX,
           END OF EMP

So it is just a structure and not a table. So you cannot pass a table to a structure.

That is why you get the error.

If you want to pass an internal table to the parameter E_INT_EMP .

Then E_INT_EMP should have a table type instead.

Declare a table type as follows:-

TYPES : TT_EMP TYPE STANDARD TABLE OF EMP.

Then use it in the form definition as follows:-

FORM EXECUTE USING E_INT_EMP    TYPE TT_EMP

Similary do it for the other tables.

Regards,

Ankur Parab