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

Dynamic table in smartforms?

Former Member
0 Likes
2,166

Hi All,

I have created a dynamic table in driver program and filled the data.

But in the form designing, how to declare the dynamic tables?

Kindly assist.

Regards,

Aj...

1 ACCEPTED SOLUTION
Read only

rajkumarnarasimman
Active Contributor
0 Likes
1,424

Hi Ajay,

Dynamic internal table, we can use in driver program, We can move the internal table value from driver program to smartform in the following way.

  • Using ABAP Memory
  • Using Structure

  1. Using ABAP Memory we can move it.
    1. Using IMPORT/EXPORT Statement, we can move the internal table, at the end we are suppose to show the value in the smartform table. In there, we have to mention the variable name in textfield (i.e. &FIELD1&) to show the  value in the smartform.
  2. Using Tables section in Smartform, we can move it.

          In order to create the structure, it is required to create the structure in SE11.

Convert the Dynamic internal table to static internal table. Create the structure in SE11, use the same structure in both driver program and smartform and move the values to smartform.


"Run the Loop

LOOP AT <dyn_table> INTO <fs_line>.

"Assign the value

ASSIGN COMPONENT 'BWART' OF STRUCTURE <fs_line> TO <fs_value>.

"Check value is initialized

IF <fs_value> IS ASSIGNED.

"Assign to final work area

  WA_FINAL-BWART = <FS_value>.

ENDIF.

"Append final internal table

APPEND WA_FINAL TO IT_FINAL.

"Clear WA

CLEAR WA_FINAL.

ENDLOOP.

I hope at the end, in both the cases, we are suppose to mention the structure field name in table text-field as shown in above screenshot. I recommend to create the structure and convert dynamic internal table to static internal table using the above code.

Regards

Rajkumar Narasimman

1 REPLY 1
Read only

rajkumarnarasimman
Active Contributor
0 Likes
1,425

Hi Ajay,

Dynamic internal table, we can use in driver program, We can move the internal table value from driver program to smartform in the following way.

  • Using ABAP Memory
  • Using Structure

  1. Using ABAP Memory we can move it.
    1. Using IMPORT/EXPORT Statement, we can move the internal table, at the end we are suppose to show the value in the smartform table. In there, we have to mention the variable name in textfield (i.e. &FIELD1&) to show the  value in the smartform.
  2. Using Tables section in Smartform, we can move it.

          In order to create the structure, it is required to create the structure in SE11.

Convert the Dynamic internal table to static internal table. Create the structure in SE11, use the same structure in both driver program and smartform and move the values to smartform.


"Run the Loop

LOOP AT <dyn_table> INTO <fs_line>.

"Assign the value

ASSIGN COMPONENT 'BWART' OF STRUCTURE <fs_line> TO <fs_value>.

"Check value is initialized

IF <fs_value> IS ASSIGNED.

"Assign to final work area

  WA_FINAL-BWART = <FS_value>.

ENDIF.

"Append final internal table

APPEND WA_FINAL TO IT_FINAL.

"Clear WA

CLEAR WA_FINAL.

ENDLOOP.

I hope at the end, in both the cases, we are suppose to mention the structure field name in table text-field as shown in above screenshot. I recommend to create the structure and convert dynamic internal table to static internal table using the above code.

Regards

Rajkumar Narasimman