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

Incompatible formal parameter type

former_member367551
Participant
0 Likes
3,864

Dear forumers,

When the following code is executed:-

perform clear_component_value using    c_ryyrkeg_wwsub
                                       <ls_movement>
                                      changing <lv_ryyrkeg_wwsub>.

I have the following syntax error:-

In PERFORM or CALL FUNCTION "CLEAR_COMPONENT_VALUE", the actual parameter "C_RYYRKEG_WWSUB" is incompatible with the formal parameter "PV_COMP_NAME".

Further codes:-

form CLEAR_COMPONENT_VALUE  using    pv_comp_name type char255 " How can I type this parameter properly? - tried type STRING too
                                     pv_fs_struct type any
                            changing pv_fs_var    type any.

  ASSIGN COMPONENT pv_comp_name OF STRUCTURE pv_fs_struct TO pv_fs_var.
  IF sy-subrc = 0.
    CLEAR pv_fs_var.
  ENDIF.

  UNASSIGN pv_fs_var.

endform.                    " CLEAR_COMPONENT_VALUE

CONSTANTS:
  c_ryyrkeg_wwsub(13)  TYPE c VALUE 'RYYRKEG_WWSUB',
  c_racct(5)           TYPE c VALUE 'RACCT',
  c_ryymac(6)          TYPE c VALUE 'RYYMAC',
  c_rzzvbund(8)        TYPE c VALUE 'RZZVBUND',
  c_ryypma(6)          TYPE c VALUE 'RYYPMA',
  c_ryyrkeg_wwato(13)  TYPE c VALUE 'RYYRKEG_WWATO',
  c_rbukrs(6)          TYPE c VALUE 'RBUKRS',
  c_rtcur(5)           TYPE c VALUE 'RTCUR',
  c_tsl(3)             TYPE c VALUE 'TSL',
  c_hsl(3)             TYPE c VALUE 'HSL',
  c_ryear(5)           TYPE c VALUE 'RYEAR',
  c_tslvt(5)           TYPE c VALUE 'TSLVT',
  c_hslvt(5)           TYPE c VALUE 'HSLVT',
  c_rldnr(5)           TYPE c VALUE 'RLDNR'.

How may I resolve this error, seeing that the PV_COMP_NAME should actually be constant variables of type c? Please help me out here. Appreciate any inputs at all. Thanks.

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,774

Hello,

This is because the lenght of the actual & the formal parameters are different.

I understand from your code that you are trying to assign the field of the dynamic structure to some field-symbol & the constants declared are nothing but the fields of the structure try defining all of them as TYPE FIELDNAME & use the same in your FORM declaration as well.

form CLEAR_COMPONENT_VALUE  using    pv_comp_name type fieldname
                                     pv_fs_struct type any
                            changing pv_fs_var    type any

Hope this helps.

BR,

Suhas

8 REPLIES 8
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,775

Hello,

This is because the lenght of the actual & the formal parameters are different.

I understand from your code that you are trying to assign the field of the dynamic structure to some field-symbol & the constants declared are nothing but the fields of the structure try defining all of them as TYPE FIELDNAME & use the same in your FORM declaration as well.

form CLEAR_COMPONENT_VALUE  using    pv_comp_name type fieldname
                                     pv_fs_struct type any
                            changing pv_fs_var    type any

Hope this helps.

BR,

Suhas

Read only

0 Likes
2,774

Hi Suhas,

Type FIELDNAME resolved the issue.

Thanks to everyone for the inputs as well.

Read only

Former Member
0 Likes
2,774

Hi,

1.form CLEAR_COMPONENT_VALUE using pv_comp_name like c_ryyrkeg_wwsub

pv_fs_struct type any

changing pv_fs_var type any.

But the value can't be chnaged inside the subroutine.

2.Decalre wvl_temp as c_ryyrkeg_wwsub and use that in form

form CLEAR_COMPONENT_VALUE using pv_comp_name like wvl_temp

pv_fs_struct type any

changing pv_fs_var type any.

You can very well modify the values.

Thanks & Regards,

Vamsi.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,774

Hello Vamshi,

So you mean you cannot change the values of the formal params which are PASSED BY REFERENCE ? Please enlighten me.

Anyways i donot see where the value of the param pv_comp_name is changed in the sub-routine?

BR,

Suhas

Read only

Former Member
0 Likes
2,774

Hi Suhas,

If you see my code block.

It will behave in the manner which i have told.

And i mean by "You cannot change the value is an information as it is disadvantage " for my code block.

And your reply resolves, since the variable is not modified inside subroutine.

Thanks & Regards,

Vamsi.

Edited by: Vamsi Krishna on Mar 8, 2010 5:45 AM

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,774

Then you should rephrase your statement as : "You should not change the values of a USING param".

FYI , even if you do so in Extended Syntax Check you will get a warning message for this.

Suhas

Read only

Former Member
0 Likes
2,774

Hi,

Sorry for that.

And you are right.

Thanks & Regards,

Vamsi.

Read only

Former Member
0 Likes
2,774

hi deborah ,

i think make it char13 as it is defined as 13 char long

form CLEAR_COMPONENT_VALUE using pv_comp_name type char13

hope this will help you

thanks

tanmaya