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: 

Calling Form from Another program

former_member194669
Active Contributor

All.

I have program A and program B. While executing Program A i need to call a perform (form) from Program B and result out this needs to flow into program A

Like Program B having a form f_select_data


form f_select_data.
select * from mara into table it_mara
     where matnr  in s_matnr
endform.

I need to call this from program A and results back to A

1 ACCEPTED SOLUTION

Former Member

Hi,

You can call like below

PERFORM f_select_data N PROGRAM B.

ie.,

PERFORM form IN PROGRAM prog.

Regards

Nehruu

18 REPLIES 18

Former Member
0 Kudos

Hi,

Why can't you use the IMPORT and EXPORT parameters to get the data from Program B to Program A.

Regards

Thiru

Former Member

Hi,

To call the form f_select_data in program A. Use the below syntax


PERFORM <f_select_data> IN PROGRAM <program_b>.

This is called as external subroutine.

Regards

Dillip Sahoo

Former Member

Hi,

You can call like below

PERFORM f_select_data N PROGRAM B.

ie.,

PERFORM form IN PROGRAM prog.

Regards

Nehruu

0 Kudos

You can also do this


 PERFROM formaname(program).

0 Kudos

All,

I specified specifically in my query that i want the results back. all the above said statements not returning results back.

0 Kudos

hi

look at this example:


REPORT  ZREP1.

perform get(ZREP2).
field-symbols <f1> type mara.
data fs(20) value '(ZREP2)zmara'.
assign (fs) to <f1>.
write: / <f1>-matnr


REPORT  ZREP2                                   .

data: zmara type mara.

form get.
  select single * from mara into zmara.
endform

reagards,darek

0 Kudos

Darek,

Thanks , Your suggestion really worked out.

Issue resolved

Former Member

Hi,

write this in program A.

perform <form name>

in program <program B name> using <xyz>.

then write form in program B

form <form name> using <abc>.

endform.

Jitendra

Edited by: Jitendra Singh on May 31, 2010 11:44 AM

former_member181995
Active Contributor
0 Kudos

How about to include the program B in A. and call perform statement from A?

p.s. i believe your user ID and pwd has not been hacked

Cheers

0 Kudos

I cannot able to include Program B in A because Program B is report program.

and Export/Import cannot be used due to program B is a standard program.

0 Kudos

> p.s. i believe your user ID and pwd has not been hacked

I'm not so sure either...language and level of expertise does not seem to correspond to what I've seen during many years here. Maybe a®s can comment?

Thomas

kesavadas_thekkillath
Active Contributor
0 Kudos

Export and Import would do...but we must modify the program B.

@ars - One way i think is get data and set data .. in a same function pool.

or globbal class to get data and set data.

HI amit .... thats a good idea

Edited by: Keshav.T on May 31, 2010 3:18 PM

former_member1245113
Active Contributor
0 Kudos

HI

data : it_final type standard table of sflight.
  perform Form_name(Program_name)  tables it_final.


in other program
data : it_Final type standard table of sflight.
form vc_confirmation tables it_final1 like it_final.
"
"
"
" Lets say in this step your final Table gets filled, 


"Amit Wrote

"p.s. i believe your user ID and pwd has not been hacked ;-)

" Even for a bit of time I am afraid to Post 

endform.

Cheerz

Ram

sivaprasad_ml
Participant
0 Kudos

Hi,

Kindly explore the usage of SUBMIT statement to call an executable report from another program.

eg : program B

parameter p1(5) type c..

start-of-selection.

write p1.

to call prog B execute program A with the following syntax.

SUBMIT <program B> WITH p1 = 'hello' and RETURN.

Regards

Siva

Edited by: Sivaprasad ML on May 31, 2010 5:13 PM

Edited by: Sivaprasad ML on May 31, 2010 5:28 PM

Edited by: Sivaprasad ML on May 31, 2010 5:32 PM

Former Member
0 Kudos

Hi

Try to below syn...

SUBMIT (p_prog)

WITH dd_kunnr-low EQ t_cli-kunnr

WITH dd_bukrs-low EQ p_bukrs

WITH p_langu EQ t_cli-lang

WITH x_opsel EQ 'X'

WITH x_shbv EQ 'X'

WITH pa_vari EQ g_vari

WITH pa_stida EQ p_date

TO SAP-SPOOL

SPOOL PARAMETERS s_pri_params

WITHOUT SPOOL DYNPRO

AND RETURN.

Thanks

Regards.

I.Muthukumar.

asik_shameem
Active Contributor
0 Kudos

Hello ars,

Why don't you do like this.

Program A:

REPORT  ZAK_A.

DATA: gv_field TYPE STRING VALUE '(ZAK_B)GT_MARA'.

FIELD-SYMBOLS: <fs_field> TYPE ANY TABLE.

PERFORM abc(ZAK_B).

ASSIGN (gv_field) TO <fs_field>.

Program B (Standard):

REPORT  zak_b.

DATA: gt_mara TYPE TABLE OF mara.


FORM abc.

  SELECT * FROM mara INTO TABLE gt_mara UP TO 10 ROWS.

ENDFORM. 

0 Kudos

Sorry, It's been already proposed by Dariusz Sobczak.

0 Kudos

Try this:.

In Z_PROGRAM use function

..PERFORM get_data_from_z_program in Y_PROGRAM.

In Y_PROGRAM write:

FIELD-SYMBOLS: <qals>. (example for qals table)

* inspection lot data
DATA: t_qals LIKE qals OCCURS 0 WITH HEADER LINE.
DATA: wa_qals LIKE LINE OF t_qals.


   ASSIGN ('(Z_PROGRAM)QALS[]') TO <qals>.
   IF NOT ( <qals> IS INITIAL ) .
     t_qals[] = <qals>.
     READ TABLE t_qals INTO wa_qals INDEX 1.
     IF sy-subrc = 0.
       qals = wa_qals.
     ENDIF.
   ENDIF.


hope helps..