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: 

Using internal table data in smartform

far_sid2103
Explorer
0 Kudos
578

Hi

I am extracting data from excel in internal table, now i wanted to use that internal table and display the data in smartform. If anyone can provide me with some document related to this or tell me how should I approach with this requirement. Some help would be fine.

Thanks

Farhan

5 REPLIES 5

dominik_jacobs
Participant
534

You can use internal table data in a Smartform by creating a table node in the Smartform layout and then binding the internal table data to the table node. Here is an overview of the steps you need to follow:

  1. Create a new Smartform and define the layout for the form.
  2. In the layout, create a new table node and define the structure of the table, including the number of columns and the data types of each column.
  3. In the ABAP program that calls the Smartform, fill the internal table with the data that you want to display in the Smartform.
  4. Use the FILL_TABLE method of the Smartform to bind the internal table data to the table node in the Smartform.
  5. Use the CALL_FORM method of the Smartform to call the Smartform and display the data in the table node.
  6. Here is an example of how to use internal table data in a Smartform:
* Declare internal table
DATA: it_data TYPE TABLE OF ztable.
* Fill internal table with data
SELECT * FROM ztable INTO TABLE it_data.
* Bind internal table to Smartform table node
CALL FUNCTION 'FILL_TABLE'
EXPORTING
formname = 'MY_SMARTFORM'
tablename = 'MY_TABLE'
it_fields = it_data.
* Call the Smartform
CALL FUNCTION 'CALL_FORM'
EXPORTING
formname = 'MY_SMARTFORM'
output_options = 'X'
EXCEPTIONS
form_not_found = 1
OTHERS = 2.

0 Kudos
534

I am not uploading that data into a standard table i have to use the data in internal table only.

Sandra_Rossi
Active Contributor
534

FILL_TABLE and CALL_FORM are not recommended and supported as far as I know. This is the classic way:

  1. Create a structure in the DDIC which corresponds to the internal table
  2. Define the internal table as parameter of the Smart Form (in the "Interface" block)
  3. Define a LOOP or TABLE node in your Smart Form to output its contents

This below code is taken from the demo program SF_EXAMPLE_01, see the BOOKINGS and CONNECTIONS internal tables defined as parameters:

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname           = p_form
  IMPORTING
    fm_name            = l_fm_name
  EXCEPTIONS
    no_form            = 1
    no_function_module = 2
    OTHERS             = 3.

ls_output_options-tdcopies = 0.
CALL FUNCTION l_fm_name
  EXPORTING
    control_parameters   = ls_control_parameters
    output_options       = ls_output_options
    user_settings        = space
    customer             = customer
    bookings             = bookings             "<========================= 
    connections          = connections          "<=========================

0 Kudos
534

ok thanks, I'll see the program once.

raymond_giuseppi
Active Contributor
0 Kudos
534