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

calling subroutine

Former Member
0 Likes
1,026

hai!

i am trying to do subroutine using the following code, but while compiling i am getting some error saying tht : different number of parameters in FORM and PERFORM ( routine: ADD_SEATS, number of formal parameters : 3, number of actual parameters : 1).

REPORT zdemo2 MESSAGE-ID zmsg_demo2.

DATA : itab TYPE table of sflight,

wa like line of itab.

PARAMETERS : pa_carr TYPE s_carr_id.

IF sy-subrc <> 0.

MESSAGE e001.

ELSE.

SELECT carrid

connid

seatsocc

FROM sflight

INTO corresponding fields of TABLE itab

WHERE carrid = pa_carr.

PERFORM add_seats USING itab.

ENDIF.

form add_seats using value(f_itab) type table of sflight.

data : f_wa like line of f_itab.

loop at f_itab into f_wa.

f_wa-seatsocc = f_wa-seatsocc + 1.

write : / f_wa-carrid color col_key,

f_wa-connid color col_key,

f_wa-seatsocc color col_key.

endloop.

endform.

plz give me a solution

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
998

Hi Ammu .,

please check with this code

XXXXXXXXXXX

PERFORM add_seats TABLES itab.

XXXXXXXXXXXXX

form add_seats tableS f_itab .

data : f_wa LIKE sflight.

loop at f_itab into f_wa.

f_wa-seatsocc = f_wa-seatsocc + 1.

write : / f_wa-carrid color col_key,

f_wa-connid color col_key,

f_wa-seatsocc color col_key.

endloop.

endform.

Thanks

Sreenivas Reddy

8 REPLIES 8
Read only

Former Member
0 Likes
998

Use "TABLE f_itab" instead of "value(f_itab)".

Regards,

Shano

Read only

0 Likes
998

hai Shano!

thanks 4 reply..

still i am getting the same error..

Read only

0 Likes
998

PERFORM <your form name> TABLES <your internal table name>.

Your perform stmt should be in the above mentioned way.

Read only

Former Member
0 Likes
998

Hi,

Use form add_seats using value(f_itab) like itab.

Regards,

Raju.

Read only

RahulKeshav
Active Contributor
0 Likes
998

Hi A,

write...

PERFORM add_seats tables itab.

Read only

Former Member
0 Likes
999

Hi Ammu .,

please check with this code

XXXXXXXXXXX

PERFORM add_seats TABLES itab.

XXXXXXXXXXXXX

form add_seats tableS f_itab .

data : f_wa LIKE sflight.

loop at f_itab into f_wa.

f_wa-seatsocc = f_wa-seatsocc + 1.

write : / f_wa-carrid color col_key,

f_wa-connid color col_key,

f_wa-seatsocc color col_key.

endloop.

endform.

Thanks

Sreenivas Reddy

Read only

Former Member
0 Likes
998

hi,

insted of

form add_seats using value(f_itab) type table of sflight

Use

FROM add_seats using f_itab TYPE tt_flight.

where tt_flight is a table type of strure ts_sflight

do this :

TYPES: ts_sflight TYPE flight,

tt_sflight TYPE TABLE of ts_sflight.

pradeep

Read only

shadow
Participant
0 Likes
998

Hi ammu,

Write "perform add_seats tables itab " insted of PERFORM add_seats USING itab.

With Regard's

shaik.