cancel
Showing results for 
Search instead for 
Did you mean: 

SmartForms: Passing Internal Tables

Former Member
0 Kudos

I am trying to pass an internal table to a SmartForm and I am having no luck at all. I have tried so many things that I am starting to get confused. I do not want to have to create this internal table type in the data dictionary se11. Can anyone help me out? Here is what I have:

<u>In the Print Program:</u>

TYPES:

BEGIN of mytab,

my_batch type c,

my_char(20) type c,

my_unit(10) type c,

my_value(10) type c,

charg(10) type c,

END OF mytab.

TYPES: wa_mytab TYPE STANDARD TABLE OF mytab initial size 0.

...... code to put data into table .....

CALL FUNCTION func_mod_name

EXPORTING

OUTPUT_OPTIONS = output_options

USER_SETTINGS = space

Plant_Addr = kna1-adrnr

mytab = mytab

EXCEPTIONS

OTHERS = 5.

<u>SmartForms Global Data Types Tab:</u>

TYPES:

BEGIN of mytab,

my_batch type c,

my_char(20) type c,

my_unit(10) type c,

my_value(10) type c,

charg(10) type c,

END OF mytab.

TYPES: wa_mytab TYPE STANDARD TABLE OF mytab initial size 0.

<u>Global Data Tab:</u>

wa_mytab TYPE mytab

<u>Form Interface Import Tab:</u>

mytab TYPE mytab

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Janice,

Define your internal table under tables and same the way..

Tables tab in smartforms is meant for passing tables of data.

Regards,

Raj

Former Member
0 Kudos

Sounds to me like I have no choice.

- I will have to use the tables tab and

- I will have to create a type for my internal table in the data dictionary se11

Not the answer I was hoping for, but I do appreciate your responses and at least I now have the answer. I'm not sure of the best way to reward points so I will give them to both of you. thx again

Former Member
0 Kudos

Hi Janice,

Try out having the declaration of your internal table structure under <b>types</b> in smartform.

Regards,

Raj

Former Member
0 Kudos

I must be missing something here. This is what I have in my TYPES tab in the Smart Form

TYPES:

BEGIN of mytab,

my_batch type c,

my_char(20) type c,

my_unit(10) type c,

my_value(10) type c,

charg(10) type c,

END OF mytab.

If I add the following line I get a syntax error when I activate the smart form -- "Statement in Context Not Permitted"

data: i_mytab TYPE STANDARD TABLE OF mytab initial size 0.

This is what I have in my print program:

TYPES:

BEGIN of mytab,

my_batch type c,

my_char(20) type c,

my_unit(10) type c,

my_value(10) type c,

charg(10) type c,

END OF mytab.

data: i_mytab TYPE STANDARD TABLE OF mytab initial size 0.

Any chance you provide me with a specific example?

Former Member
0 Kudos

To pass Internal table in smartforms, you have to declare your Internal table in TABLES tab of Form Interface and Associated Type of the Internal table has to be:

<b>"ABAP associated type for an interface parameter. The associated type must be a global Dictionary type or exist in a type pool. In the latter case, the type pool must be declared in the function group."</b>

There is no other way to pass Internal table. Please try the method I have given and you will achieve your result.

thanks

sharmistha

Former Member
0 Kudos

Hi,

I will give u a method which i have implemented to pass internal tables and it works.

Create a structure in data dictionary say ZMYTAB with fields as your mytab structure. Create a Table Type in data dictionary ZTY_MYTAB with Line Type as ZMYTAB.

Then In the Form Interface in Tables tab, pass Parameter name as your Internal table name, Type Assignment TYPE and Associated Type as ZTY_MYTAB.

In the print program ,

Declare ur itab as

itab TYPE TABLE OF zmytab WITH HEADER LINE.

And while passing the internal table in the call function module, pass as itab[].

Let me know if it helps.

Thanks

sharmistha

Former Member
0 Kudos

tx for your suggestion. Is there any though that I can pass my internal table to the smart form without having to create a structure or type in the data dictionary? I am trying to avoid this if possible.

Former Member
0 Kudos

Are you passing in the Form Interface Tables tab,

your internal table name type mytab?

Former Member
0 Kudos

I am trying to pass it in the Import Tab of the Form Interface -- only because I was told by someone that the Tables Tab is for old backwards compatibility and because the only way I could get it to work with the Tables Tab was by defining the Table Type in the Data Dictionary se11 -- I don't want to have to do this.

former_member181962
Active Contributor
0 Kudos

Hi Janice,

re you sure about this statement?

TYPES: wa_mytab TYPE STANDARD TABLE OF mytab initial size 0.

Don't you think it should be

data: wa_mytab TYPE STANDARD TABLE OF mytab initial size 0.

Ravi

Former Member
0 Kudos

I'm not sure about anything anymore :). I changed the statement in my print program as you suggested. Everything in the print program and in the smart form compiles o.k., but when I run the actual program I get the horrid ABAP Dump and it says:

<i>The function module interface allows you to specify only

fields of a particular type under "MYTAB"

The field WA_MYTAB Specified here is a different field type</i>

Any other suggestions?