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: 

HI Smartforms Internal table with subroutine

Former Member
0 Kudos

Hi,

Anybody have example code to write a program inside the smartforms(not in driver program) which includes subroutine passing internal table and retriving data through internal table step by step examples.

Please,send me examples for that.

Thanks

Regards,

Nandha..

1 ACCEPTED SOLUTION

former_member221770
Contributor
0 Kudos

Nandha,

To write a program inside a SmartForm, you need to use the PROGRAM LINES node. You must pass in the Internal Tables as "Input Parameters" and "Output Parameters".

Eg.

Create a PROGRAM LINES node. Let's say that you want to pass in a internal table (TBL_DATA - which is defined in the Global Definitions). Make sure TBL_DATA is defined as both Imput and Output parameetrs.

Now you can type in your code:

  • Define your TBL_DATA work area

data: st_data type line of tbl_data.

loop at tbl_data into st_data.

  • do your logic here

endloop.

Note: you must define a work area (ST_DATA) because in SmartForms, you cannot define internal tables with header lines.

Hope this helps.

Cheers,

Pat.

3 REPLIES 3

former_member221770
Contributor
0 Kudos

Nandha,

To write a program inside a SmartForm, you need to use the PROGRAM LINES node. You must pass in the Internal Tables as "Input Parameters" and "Output Parameters".

Eg.

Create a PROGRAM LINES node. Let's say that you want to pass in a internal table (TBL_DATA - which is defined in the Global Definitions). Make sure TBL_DATA is defined as both Imput and Output parameetrs.

Now you can type in your code:

  • Define your TBL_DATA work area

data: st_data type line of tbl_data.

loop at tbl_data into st_data.

  • do your logic here

endloop.

Note: you must define a work area (ST_DATA) because in SmartForms, you cannot define internal tables with header lines.

Hope this helps.

Cheers,

Pat.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Here is an example.

Step 1:Global Definition->Global Data,declare the following.

PA0001 TYPE PA0001

ITAB TYPE STANDARD TABLE OF PA0001

LN TYPE I 0

Step 2:Global Defnition->Form Rotinues,write the following.

form find_lines tables itab changing ln.

describe table itab lines ln.

endform.

Step 3:Create FLow logic under Main window.

In that declare

Input parameters:Pa0001,ln

Output Parameters:ln,itab

Write the code as follows:

select * from pa0001 into table itab.

perform find_lines tables itab changing ln.

Step 4:Create Text Element and drag and drop ln from field list.

Step 5:Activate and execute the program.

Kindly reward points if it helps.

If your problem is solved,close the thread by clicking the blue star on the left of reply which solves your problem.Otherwise,get back.

Message was edited by: Jayanthi Jayaraman

Former Member
0 Kudos

HI,

You can write the normal ABAP code inside the smartforms using the <b>Program lines</b>, This Program lines works like SE38 editor, so you can write the code as you write in se38, but here you need to maintain the Input parameters and output parameters, whenever you goto the Program lines, what fields you are going to use in that Program lines you need to write those fields in input parameters, which fields you want to take out, i mean the results need to write in the Out prameters. so that these parameters you can use in the entire smartforms..

Gothrough this PDF -->

www.sap-press.com/downloads/h955_preview.pdf

Regards

Sudheer