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: 

Problem with decaring formal parameters

Former Member
0 Kudos

Hello,

I have written the following piece of code:


 FORM PC_SSL_UPLOAD USING WA_UPLOAD_DATA LIKE LINE OF LT_UPLOAD_DATA
                          CHANGING P_UPLOAD_DATA TYPE STANDARD TABLE OF TY_UPLOAD_DATA.

where LT_UPLOAD_DATA was declared as an internal table of type TY_UPLOAD_DATA.

When I tried to do a syntax check, I've got the following message:

Different number of parameters in FORM and PERFORM (routine:PC_SSL_UPLOAD, number of formal parameters: 4, number of actual parameters: 2).

I thought all I have declared was 2 formal parameters: WA_UPLOAD_DATA as the work space and P_UPLOAD_DATA as the parameter, why there are 4 parameters? and how can I change the code such that it works the way I intend to get it to work?

Thanks a lot!

Regards,

Anyi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

do this


FORM PC_SSL_UPLOAD 
     tables P_UPLOAD_DATA 
     USING  WA_UPLOAD_DATA type TY_UPLOAD_DATA

or 

FORM PC_SSL_UPLOAD 
     tables P_UPLOAD_DATA  like <original table name>
     USING  WA_UPLOAD_DATA type TY_UPLOAD_DATA

Note :- whatever u use in type or like should be global; that is accessable in the form

7 REPLIES 7

Former Member
0 Kudos

hi,

do this


FORM PC_SSL_UPLOAD 
     tables P_UPLOAD_DATA 
     USING  WA_UPLOAD_DATA type TY_UPLOAD_DATA

or 

FORM PC_SSL_UPLOAD 
     tables P_UPLOAD_DATA  like <original table name>
     USING  WA_UPLOAD_DATA type TY_UPLOAD_DATA

Note :- whatever u use in type or like should be global; that is accessable in the form

0 Kudos

Or you can do this too. Using a table type and changing .



types: begin of ty_upload_data,
       str type string,
       end of ty_upload_data.

<b>Types: ty_tab_upload_data type table of ty_upload_data.</b>

data: i_upload_data type table of ty_upload_data.
data: wa_upload_data like line of i_upload_data.


perform pc_ssl_upload
                      using wa_upload_data
                     <b> changing i_upload_data.</b>



*---------------------------------------------------------------------*
*       FORM PC_SSL_UPLOAD                                            *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  WA_UPLOAD_DATA                                                *
*  -->  P_UPLOAD_DATA                                                 *
*  -->  OF                                                            *
*  -->  TY_UPLOAD_DATA                                                *
*---------------------------------------------------------------------*
form pc_ssl_upload
                     using wa_upload_data structure wa_upload_data
                    <b> changing p_upload_data type ty_tab_upload_data</b>.




endform.

Regards,

Rich Heilman

0 Kudos

Hi,

Thanks for all the replies.

However, when I tried to use USING...CHANGE way, like what Rich has suggested, I got an error message like this:

In PERFORM or CALL FUNCTION "PC_SSL_UPLOAD", the actual parameter "LT_UPLOAD_DATA" is incompatible with the formal parameter "P_UPLOAD_DATA".

However, I did declare the LT_UPLOAD_DATA like this:

 DATA: LT_UPLOAD_DATA TYPE STANDARD TABLE OF TY_UPLOAD_DATA,

And I am pretty sure I declared P_UPLOAD_DATA as:

CHANGING P_UPLOAD_DATA TYPE TY_UPLOAD_DATA

So where is the problem now?

Thanks!

Regards,

Anyi

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Please try it like this.



types: begin of ty_upload_data,
       str type string,
       end of ty_upload_data.

data: i_upload_data type table of ty_upload_data.
data: wa_upload_data like line of i_upload_data.


perform pc_ssl_upload tables i_upload_data
                      using wa_upload_data.



*---------------------------------------------------------------------*
*       FORM PC_SSL_UPLOAD                                            *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  WA_UPLOAD_DATA                                                *
*  -->  P_UPLOAD_DATA                                                 *
*  -->  OF                                                            *
*  -->  TY_UPLOAD_DATA                                                *
*---------------------------------------------------------------------*
form pc_ssl_upload  tables p_upload_data structure wa_upload_data
                     using wa_upload_data structure wa_upload_data.




endform.

Regards,

Rich Heilman

Former Member
0 Kudos

p_upload_data should be a TABLES parameter and not CHANGING.

PERFORM PC_SSL_UPLOAD USING W_UPLOAD_DATA TABLES T_UPLOAD_DATA .

FORM PC_SSL_UPLOAD

USING PW_UPLOAD_DATA LIKE LT_UPLOAD_DATA

TABLES PT_UPLOAD_DATA STRUCTURE LT_UPLOAD_DATA.

ENDFORM

-Kiran

former_member181962
Active Contributor
0 Kudos

Hi Anyi,

It is always better if you write your perform statement and then double click on the form name to create the form routine by itself.

perform pc_sll_upload using <data> tables <itab>.

double click on the pc_sll_upload to create a form routine.

Regards,

Ravi

Former Member
0 Kudos

Hi use Structure

DATA: wa_upload_data like line of lt_upload_data.

FORM PC_SSL_UPLOAD TABLES p_upload_data structure wa_upload_data

USING P_UPLOAD LIKE wa_upload_data