cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic columns in SAP script

Former Member
0 Kudos

Hi,

I have asked to provide a matrix type layout in SAP Script.Also in this matrix, number of columns is not fixed. At runtime it will be decided that how many columns will be there on the layout depending on the data fetch by the program. Can we provide this using requirement using SAP script or smartforms.

Thanks & Regards

vatsa

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Hi Vatsa,

Just before getting into the SAP-script, determine how many columns needs to be displayed in the output and pass that variable to the SAP-script.

In SAP-script, whereever you define the BOX for displaying the columns, use the following commands. Use the necessary size for the width of the column.

An example is given below.

Data: W_No_of_Columns&> type i.

/: IF &<W_No_of_Columns&> EQ '4'

/: BOX HEIGHT '22.20' LN WIDTH '59' CH FRAME 10 TW

/: BOX HEIGHT '22.20' LN WIDTH '6.5' CH FRAME 10 TW

/: BOX HEIGHT '22.20' LN WIDTH '15' CH FRAME 10 TW

/: BOX HEIGHT '22.20' LN WIDTH '25' CH FRAME 10 TW

/: BOX HEIGHT '22.20' LN WIDTH '36.5' CH FRAME 10 TW

ENDIF.

/: IF &<W_No_of_Columns& EQ '5'

/: BOX HEIGHT '22.20' LN WIDTH '59' CH FRAME 10 TW

/: BOX HEIGHT '22.20' LN WIDTH '6.5' CH FRAME 10 TW

/: BOX HEIGHT '22.20' LN WIDTH '15' CH FRAME 10 TW

/: BOX HEIGHT '22.20' LN WIDTH '25' CH FRAME 10 TW

/: BOX HEIGHT '22.20' LN WIDTH '35' CH FRAME 10 TW

/: BOX HEIGHT '22.20' LN WIDTH '45' CH FRAME 10 TW

ENDIF.

Hope this helps.

<REMOVED BY MODERATOR>

Thanks,

-G

Edited by: Alvaro Tejada Galindo on Jul 8, 2008 10:57 AM

Former Member
0 Kudos

Hi Vatsa,

I don't know why it shouldn't work. If your internal table contains e.g. max 10 fields for columns (let's say col01 - col10) you could define the sapscript as following:

col01,,col02,,col03,, ...... ,,col10

How many colums are filled with data is irrelevant in that case. Just make sure that no initial values are printed depending on the data definition.

Hope that helps

Kind Regards

Nicola

Former Member
0 Kudos

Hai,

You can not create Dynamic columns in SAP script.

Better to use Smart-Forms.

<REMOVED BY MODERATOR>

Regds,

Rama chary.Pammi

Edited by: Alvaro Tejada Galindo on Jul 8, 2008 10:57 AM