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: 

How to pass an internal table to smartform.

Former Member
0 Kudos
1,665

Hi Folks,

I have collected data in an internal table in my driver program. Now I want to pass that internal table to my smartform. Where all I have to define the variable for the same?

Thanks

Siddarth.

9 REPLIES 9

Former Member
0 Kudos
243

Hi Sid,

Chek this code i am coping my whole program here.

REPORT ZDP_SMARTFORMS_REPORT3 .

TABLES: MARA,

MAKT.

DATA: FNAME TYPE RS38L_FNAM.

DATA: BEGIN OF ITJOIN OCCURS 0.

INCLUDE STRUCTURE ZDP_JOIN__IN_SMARTFORM.

  • INCLUDE STRUCTURE MARA.

  • INCLUDE STRUCTURE MAKT.

data: END OF ITJOIN.

*DATA: BEGIN OF ITJOIN OCCURS 0,

  • MATNR LIKE MARA-MATNR,

  • END OF ITJOIN.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS: MAT FOR MARA-MATNR.

SELECTION-SCREEN END OF BLOCK B1.

***----


SELECT MARA~MATNR MAKTX "UP TO 5 ROWS

FROM MARA JOIN MAKT ON MARAMATNR = MAKTMATNR

INTO TABLE ITJOIN

WHERE MARAMATNR IN MAT and maktspras eq 'EN'.

  • into corresponding fields of table it

*SELECT MATNR UP TO 5 ROWS FROM MARA INTO TABLE ITJOIN

  • WHERE MATNR IN MAT.

***----


CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZDP_SMARTFORMS_3'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FNAME

  • EXCEPTIONS

  • NO_FORM = 1

  • NO_FUNCTION_MODULE = 2

  • OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

    • not necessar y above function if u copy function name from

**- smartforms>environment>function name

CALL FUNCTION '/1BCDWB/SF00000037'

  • EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS =

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

TABLES

ITJ = ITJOIN

  • EXCEPTIONS

  • FORMATTING_ERROR = 1

  • INTERNAL_ERROR = 2

  • SEND_ERROR = 3

  • USER_CANCELED = 4

  • OTHERS = 5

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Reward if it is useful.

Message was edited by:

GURPRIT BHATIA

Former Member
0 Kudos
243

Hi Siddarth,

Check out this link,

http://www.erpgenie.com/abap/smartforms.htm

and also refer these threads,

hope this helps.

former_member223537
Active Contributor
0 Kudos
243

Create a Zstructure in SE11.

in the program:

DATA i_rmain type standard table of Z_rmain,

CALL FUNCTION lf_fm_name

EXPORTING

archive_index = toa_dara

  • archive_index_tab =

archive_parameters = arc_params

control_parameters = ls_control_param

  • MAIL_APPL_OBJ =

mail_recipient = ls_recipient

mail_sender = ls_sender

output_options = ls_composer_param

user_settings = c_blank

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

<b> TABLES

i_rmain = i_rmain</b>

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc <> 0.

ENDIF.

In the Smartform use the same name in TABLE tab.

Best regards,

Prashant

messier31
Active Contributor
0 Kudos
243

Hi,

The internal table shud be declared in the interface tab of your smartform.

so when you call the smartform function module u will see this as table parameter

and there you can pass your internal table.

To do so :-

1. Go to your smrtform, there is node call FORM INTERFACE, here declare your internal table in tables tab.

2. Generate your smartform.

3. then in your driver program re-insert your smartform's function module.

now you will see table paramter where you can pass your internal table.

Hope this solves your problem..

Enjoy SAP.

Pankaj Singh.

Former Member
0 Kudos
243

Hi Jain

ok u have data in internal table itab in u r se38 program

then call this fm CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

and pass u r smartform name to this one then it will gives the fm name in one variable let us say fm_name. then call this fm

call function fm_name.

here you have to pass us internal table and this table should be defined in u r smartform under form interface.

reward points to all helpful answers

kiran.M

Former Member
0 Kudos
243

hi

good

in the global settings->form setting->Export rab in the right hand side

here you declare all your fields related to internal table fields.

thanks

mrutyun^

varma_narayana
Active Contributor
0 Kudos
243

Hi..

To pass any data from Driver program to Smartform, We have to Declare the Formal Parameters in the FORM INTERFACE.

Open the Smartform.

Under Global settings

You can find the node: FORM INTERFACE.

In that you can see TABLES tab.

You have to Declare the internal table here.

Eg : IT_VBAP LIKE VBAP.

While calling the Smartform FM from Driver program you have to pass the Internal table to this parameter.

You can add a TABLE node under the MAIN window to display this internal table.

<b>Reward if Helpful</b>

Former Member
0 Kudos
243

Hi Pankaj,

Can you tell me what will I put in the "Associated Types" column? internal table in my code is combination of two to three tables.

Thanks

Siddarth.

Former Member
0 Kudos
243

Hi! Siddarth

WITHOUT LOOPING THE INTERNAL TABLE VALUES CANNOT BE DISPLAYED.

1. Smartforms

2. Form Interface - Table

3. Declare a table name like the structure you have to display.

4. Global definition - Global Data

5. Declare the work_area like the same structure you have used to declare your table.

6. Re-insert your Function Module in your Driver Program.

7. now come back to SmartForms

8. now your internal table values are passed to the work_area you declared in Smartforms through function module.

9. to pass these values in your display screen LOOP it.

10. whiling looping it asks to connect the Internal table and the Work_area you declared in smartforms.

11. pass the work_area variables to the Textbox.

12 to do this - go to the FIELD LIST (ON/OFF) [ near Form Painter Tab ] it displays a list of variables you declared.

- go to Global data in the list

- select the variable to display drag and drop it to the window.

IF its Useful to you Reward it.

Regards,

Nagulan