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

Error in Perform with SmartForms

Former Member
0 Likes
994

I have a PERFORM statement in my SmartForms and I am getting an error as follows:

<b>Error analysis

An exception occurred. This exception is dealt with in more detail below

. The exception, which is assigned to the class

'CX_SY_DYN_CALL_PARAM_NOT_FOUND', was neither

caught nor passed along using a RAISING clause, in the procedure

"CONVERT_TO_PALLETS" "(FORM)"

.

Since the caller of the procedure could not have expected this exception

to occur, the running program was terminated.

The reason for the exception is:

A PERFORM was used to call the routine "CONVERT_TO_PALLETS" of the program

"ZRVADEK01".

This routine contains 4 formal parameters, but the current call

contains 6 actual parameters.

parameters.</b>

Below is the code in the SmartForm

*&---------------------------------------------------------------------*
*&      Form  CONVERT_TO_PALLETS                                        
*&---------------------------------------------------------------------*
FORM convert_to_pallets                                                 
  USING     matnr                                                       
            lfimg                                                       
            vrkme                                                       
  CHANGING  w_nbrpal                                                    
            w_nbrpce                                                    
            w_nbrft2.                                                   
* Call form in external program                                         
  PERFORM convert_to_pallets IN PROGRAM zrvadek01                       
    USING     matnr                                                     
              lfimg                                                     
              vrkme                                                     
    CHANGING  w_nbrpal                                                  
              w_nbrpce                                                  
              w_nbrft2.                                                 
ENDFORM.                                                                

Following is part of the Form Routine in program zrvadek01

FORM convert_to_pallets TABLES   inttab STRUCTURE itcsy
                                 outtab STRUCTURE itcsy.

I am confused by this error because I have 6 parameters (3 each of using and changing) both in the perform call and the form definition.

Regards,

Davis

1 ACCEPTED SOLUTION
Read only

ferry_lianto
Active Contributor
0 Likes
913

Hi Davis,

Please try this.


Following is part of the Form Routine in program zrvadek01

FORM convert_to_pallets using matnr type matnr
                              lfimg type lfimg
                              vrkme type vrkme 
                        changing w_nbrpal type <nbrpal>
                                 w_nbrpce type <nbrpce>
                                 w_nbrft2 type <nbrft2>.

Regards,

Ferry Lianto

7 REPLIES 7
Read only

Former Member
0 Likes
913

Hi

This is something related to PERFORM and FORM statements

check them correctly

parameters passed to perform is not matching with the FORM parameters

Why 2 FORMs appearing in the code

one is

<b>FORM convert_to_pallets</b> TABLES inttab STRUCTURE itcsy

outtab STRUCTURE itcsy.

and the other is

<b>

FORM convert_to_pallets </b>

USING matnr

lfimg

vrkme

CHANGING w_nbrpal

w_nbrpce

w_nbrft2.

but only one PERFORM

PERFORM convert_to_pallets IN PROGRAM zrvadek01

USING matnr

lfimg

vrkme

CHANGING w_nbrpal

w_nbrpce

w_nbrft2.

So which FORM it has to consider

why the first FORm is needed for you?

check and correct it.

Reward points if useful

Regards

Anji

Read only

0 Likes
913

Anji, thanks for the reply. I have two forms because this is a conversion from SAPScript. I am trying to avoid copying the FORM Convert_To_Pallets into the SmartForm; I am also trying to avoid having to alter that FORM. Right now, as it stands, Convert_To_Pallets (in the external program) accepts two parameters (tables). I was told that SmartForms could not handle tables as parameters and that is why I have

*&---------------------------------------------------------------------*
*&      Form  CONVERT_TO_PALLETS
*&---------------------------------------------------------------------*
FORM convert_to_pallets
  USING     matnr
            lfimg
            vrkme
  CHANGING  w_nbrpal
            w_nbrpce
            w_nbrft2.
* Call form in external program
  PERFORM convert_to_pallets IN PROGRAM zrvadek01
    USING     matnr
              lfimg
              vrkme
    CHANGING  w_nbrpal
              w_nbrpce
              w_nbrft2.
ENDFORM.

This is inside the SmartForm Global Def. -> Form Routines. What I am doing is calling Convert_To_Pallets which is in an external program. This Form (in the external program) accepts the parameters as two tables (inttab and outtab).

I hope that I answered your questions and that it helped you understand my situation a little better.

Regards,

Davis

Read only

ferry_lianto
Active Contributor
0 Likes
914

Hi Davis,

Please try this.


Following is part of the Form Routine in program zrvadek01

FORM convert_to_pallets using matnr type matnr
                              lfimg type lfimg
                              vrkme type vrkme 
                        changing w_nbrpal type <nbrpal>
                                 w_nbrpce type <nbrpce>
                                 w_nbrft2 type <nbrft2>.

Regards,

Ferry Lianto

Read only

0 Likes
913

Ferry, thanks for the tip. I was trying to avoid that because other reports may use this form. Right now, as it stands, the form is accepting the parameters using structures of itcsy. Below is how they are handling the parameters:

 READ TABLE inttab INDEX 1.
  WRITE inttab-value(18) TO w_save_matnr RIGHT-JUSTIFIED.
  OVERLAY w_save_matnr WITH w_zeros.
*    NEXT GET Actual quantity delivered (in sales units) VBLKP-LFIMG
  READ TABLE inttab INDEX 2.
  WRITE inttab-value(17) TO w_save_qtyx RIGHT-JUSTIFIED.
  IF inttab-value(17) CA '.'.
  ELSE.
    SHIFT w_save_qtyx LEFT BY 4 PLACES.
    w_save_qtyx+9(4) = '.000'.
  ENDIF.

That was just a portion of the code handling the parameters. I suppose that it would be best for me to alter the code so that it accepts 6 parameters instead of two structures/tables. I do question how this would help though. The error messages said that "This routine contains 4 formal parameters, but the current call contains 6 actual parameters." It may be that I am new to ABAP but would the structure have anything to do with this error?

Seshu, The structure itcsy is not in the SmartForm it is in an external program.

Read only

Former Member
0 Likes
913

do not use ITCSY Structure in Smartform ..

Read only

ferry_lianto
Active Contributor
0 Likes
913

Hi Davis,

I were you ... I will create two separate routines, one for sapscript and the other one for smartform. It is redundancy but make the program easy to follow and enhance in the future for next developer/support.

Please don't use table/structure for passing and changing parameters for Smartform purposes. The structure itcsy is usually for SAPScript.

Regards,

Ferry Lianto

Read only

0 Likes
913

Ferry, thanks. I was going to do that (have two separate routines) but, as I want to train myself in the "correct way", I was looking for the acceptable way of handling this. Thank you for your input; I am going to do what you suggested.

Thanks again,

Davis