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

Perform in Smartform

Former Member
0 Likes
2,613

Hi All,

I am using perform statement in smartforms. But is is not working.

same code is working in script.

Can I use perform in smartforms?

Regards,

Dilip

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,656

In Gobal Definitions, In INTIALIZATION tab you can define a perform and write the FOrm routine in FORMROUTINES tab.

You can also use Code Lines to write you code. FI you are talking about using PERFORM ENDPERFORM kinda of as in script, No you cannot .

But as i said above you can use those places to write your code.

Rgds,

Mano Sri

Hi All,

I am using perform statement in smartforms. But is is not working.

same code is working in script.

Can I use perform in smartforms?

Regards,

Dilip

9 REPLIES 9
Read only

Former Member
0 Likes
1,656

Hi Diliip,

Yes you can. In the Global Defenitions of a smartform you see a Tab on the right called 'Form Routines'.

Here you can make your formroutines with the code.

Furtheron in your form (code parts) you can call these formroutines with the Perform statement.

Hope this helps.

Grtz. Marcel Leeraar.

Read only

Former Member
0 Likes
1,657

In Gobal Definitions, In INTIALIZATION tab you can define a perform and write the FOrm routine in FORMROUTINES tab.

You can also use Code Lines to write you code. FI you are talking about using PERFORM ENDPERFORM kinda of as in script, No you cannot .

But as i said above you can use those places to write your code.

Rgds,

Mano Sri

Read only

0 Likes
1,656

Hi Mano,

I declare perform in initialization like this.

data data1 like makt-maktx.

PERFORM GET_DATA USING PERFORM GET_DATA IN PROGRAM ZGET_DATA.

USING &IT_RESULT-MATNR&.

CHANGING &DATA1&.

ENDPERFORM.

Here I am writing my code in formruutine, how smartforms identify "IN PROGRAM ZGET_DATA"? OR there is any other syntax?

But I am getting a errot saying that perform is not declared.

Also tell me what to define in initialization & what in

form routines.

Regards,

Dilip

Message was edited by: Diliip Gupchup

Read only

0 Likes
1,656

Hi,

Here I am giving you a simple example.

In Global Definition-Global Data,I declared

cnt type I 0(default value).

In Global Definiton-Form Routines,I coded as below.

form calc changing cnt.

cnt = cnt + 1 .

endform.

Then after that Inside the loop, in program lines,I coded

as below and given cnt as both input and output parameter.

perform calc changing cnt.

In text element inside the loop,I tried printing the cnt.

It's printing correctly.

Hope this helps.

Read only

0 Likes
1,656

Hi Jayanti,

Thaks for your informative reply.

As you have told following are my declarations :

<b>global data</b> - data1 like makt-maktx.

<b>form routines</b> -

form get_data changing data1.

select single maktx into data1 from makt.

break-point.

select maktx from makt into table it_makt for all entries in it_result1 where matnr eq it_result1-matnr .

endform.

<b>In program lines under loop -

</b>

perform get_data changing data1.

<b>ip/op parameters as data1.</b>

put that DATA1 field in textarea.

But not showing any o/p.

Also i declared it_makt in form interfaces - tables tab.

Is there any part i m missing?

Regards,

Dilip

<b></b><b></b>

Read only

0 Likes
1,656

Hi,

In global data,declare data1 & it_makt[ no need in form interfaces]

In form rourines, you are populating both data1 and it_makt.

So changing should be for both data1 & it_makt

and using should be for it_result1[since you are using for all entries]

In program lines,

give data1 & it_makt[] as output parameter

& it_result1[] as input parameter.

from where you are getting it_result?Is it from report or from smartform?

Read only

0 Likes
1,656

Hi,

To be more specific.

I worked out according to your requirement.

Just try this.

Global definitions:

Global data:

IT_RESULT1 TYPE STANDARD TABLE OF MARA

IT_MAKT TYPE STANDARD TABLE OF MAKT

MARA TYPE MARA

MAKT TYPE MAKT

WA TYPE MAKT

Form Routines:

FORM get_data TABLES p_it_makt STRUCTURE makt

p_it_result1 structure mara.

select * from makt into table p_it_makt for all entries in

p_it_result1 where matnr = p_it_result1-matnr.

endform.

Program Lines under Main window:

Input parameters:

Mara

It_result1

Output parameters:

It_result1

It_makt

Coding:

select * from mara into table it_result1.

perform get_data tables it_makt

it_result1.

After that , I created a loop .

In that IT_MAKT into wa.

Inside that loop,I created a text element.

Text Element:

Printing the required fields

Reward points for useful answers.If you have any doubt,please get back to me.

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,656

Hi,

You can do so by the text-editor icon available in left side of text element.

Just go and type in the text editor as you do in sap script.

Read only

Former Member
0 Likes
1,656

Hi,

Please refer the following site, this is for sap script. But the same thing you can also do in Smart form

by clicking the text-editor icon.

http://www.sapdevelopment.co.uk/sapscript/sapscript_executeabap.htm

Thanks & Regards,

Venkat Ramanan