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 Form from Another program

former_member194669
Active Contributor
42,093

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

a®

1 ACCEPTED SOLUTION
Read only

Former Member
15,149

Hi,

You can call like below

PERFORM f_select_data N PROGRAM B.

ie.,

PERFORM form IN PROGRAM prog.

Regards

Nehruu

18 REPLIES 18
Read only

Former Member
0 Likes
15,148

Hi,

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

Regards

Thiru

Read only

Former Member
15,148

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

Read only

Former Member
15,150

Hi,

You can call like below

PERFORM f_select_data N PROGRAM B.

ie.,

PERFORM form IN PROGRAM prog.

Regards

Nehruu

Read only

0 Likes
15,148

You can also do this


 PERFROM formaname(program).

Read only

0 Likes
15,148

All,

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

a®

Read only

0 Likes
15,148

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

Read only

0 Likes
15,148

Darek,

Thanks , Your suggestion really worked out.

Issue resolved

a®

Read only

Former Member
15,148

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

Read only

Former Member
0 Likes
15,148

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

Read only

0 Likes
15,148

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.

a®

Read only

0 Likes
15,148

> 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

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
15,148

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

Read only

Former Member
0 Likes
15,148

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

Read only

sivaprasad_ml
Participant
0 Likes
15,148

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

Read only

Former Member
0 Likes
15,148

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.

Read only

asik_shameem
Active Contributor
0 Likes
15,148

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. 

Read only

0 Likes
15,148

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

Read only

0 Likes
15,148

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..