Skip to Content
Author's profile photo Eitan Rosenberg

The case of “dynamic columns in smartform”

Hi all,

Recently there were some posts regarding dynamic columns in smart form.

So I thought I will share an idea how to make life a little more easier when you are facing such a pesky requirement.

Also I hope people will look at the code and verify that it is working well…

The input for this program is table SPFLI .

The program output:



This is repeated…..


The idea was to create a data model that will represent a matrix in the program.

The matrix is represented by intenal tables:

it_axis_x : represent the horizontal axis, this will contain the headers data.


it_axis_y : represent the vertical axis, this will contain the label data .


it_cell_v : Contain the actual data and pointer information relating to the axis .

And now lets dive into the code:

Class Y_R_EITAN_TEST_31_03_CL

All the data elements that are shared by the program and the smartform are stored in this class .

Every thing is in the “PUBLIC SECTION” .


Program Y_R_EITAN_TEST_31_03

The main forms are:

FORM get_data_1 : This form read the input table and transform the data into matrix .

I put a BREAK-POINT statement so we can look at the data:




FORM prt_data_1 : This form receive the matrix and print the matrix slice by slice.

Since I need to call the smartform in a loop I am using functions SSF_OPEN and SSF_CLOSE .

SmartForm Y_R_EITAN_TEST_31_03

The form source is y_r_eitan_test_31_03.xml (attach file)

Note the use of Y_R_EITAN_TEST_31_03_CL=>


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hello Eitan,

      Finally some originality in the ABAP forums. In the recent times the quality of the blogs/documents have been poor 😐 & your blog is a welcome relief 😳 .



      Author's profile photo Eitan Rosenberg
      Eitan Rosenberg
      Blog Post Author

      Hello Suhas ,

      Thanks for a very encouraging remarks.

      I am blushing over here... 😳

      I promise that I will try to be interesting and if I fail please let me know .


      Author's profile photo Former Member
      Former Member

      Hi Elintan,

      This is helpful document, 🙂 🙂 in all recent activities of SCN  😉 😉 i had came across this issue. 😐 😐

      Thanks for Sharing with us.



      Author's profile photo Former Member
      Former Member

      Good Information ...Thanks....

      Author's profile photo Sijin Chandran
      Sijin Chandran

      Hello Eitan ,

      Reminds me Matrix Processing done in C classes.

      Good one , useful Idea for sure.


      Author's profile photo Ramesh Babu Srikakollu
      Ramesh Babu Srikakollu

      Good One and interesting too..

      Author's profile photo Arpit Gupta
      Arpit Gupta

      Hi Eitan,

      Awsome post.... keep up the good work...

      Author's profile photo jeetendra singh
      jeetendra singh

      Hi Eitan,

      Good one ... I have achieved same in ALV report 😳 .

      Good to see for Smartforms 🙂 .

      Loved your work.



      Author's profile photo Eitan Rosenberg
      Eitan Rosenberg
      Blog Post Author


      With ALV it is much simpler.

      You just have to create enough columns.....

      See here:


      Author's profile photo Aneel Munawar
      Aneel Munawar

      Its working perfect according to  my requirement.


      Author's profile photo stallone christian
      stallone christian

      Well Good work.

      But, I am able to generate complete dynamic smartform without smartform 😉

      Author's profile photo Florian Henninger
      Florian Henninger


      that should end in an own blog and not throwing some words into other content 😈 .


      Author's profile photo Eitan Rosenberg
      Eitan Rosenberg
      Blog Post Author

      Hi ,

      Great idea please share....


      Author's profile photo Ahmed Saleh
      Ahmed Saleh

      i can not find the attached file ...

      Author's profile photo Maecy Mariano
      Maecy Mariano


      The link for attached file is disabled. 🙁

      Author's profile photo Former Member
      Former Member


      Can u please provide code for the solution , all the links are disabled now.

      Author's profile photo Jose Dario Jaimes Alviarez
      Jose Dario Jaimes Alviarez


      Anyone has the files attached?

      I'll appreciate it a lot!

      Author's profile photo Masoud Eb
      Masoud Eb

      Hi , goooooooooood job

      Where is the attachment?