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: 

Dynamic Report Column

Former Member
0 Kudos

HI,

I want some example where in internal table if the coulumn is filled then only it should be displayed in ALV output.

E.g

PERIOD AMNT1 AMNT2 AMNT3

2 100 200

3 200

Now here AMNT3 is empty so it should not be displayed in my ALV output.

And later if AMNT3 gets filled it should come.

Thanks

Anurodh

7 REPLIES 7

Former Member
0 Kudos

Hi

U need to set the field NO_OUT in catalog table

LOOP AT IT_FIELDCAT.
  
    IF <.........>.
       IT_FIELDCAT-NO_OUT = 'X'.

Max

Former Member
0 Kudos

While building the fieldcatalog use the following option:

no_zero = 'X'.

Former Member
0 Kudos

Hi

Please check these links

[]

or

[http://help-abap.blogspot.com/2008/09/dynamic-internal-table-creation.html ]

let me know if still u didn't get the solution.

Thanks,

Sourabh

former_member387317
Active Contributor
0 Kudos

Hi Anurodh Jindal ,

One way is ...

After Filling your internal table...

You can write a logic like

Check if there is any record where AMNT3 is not initial (Means it's having value...) either using LOOP or READ

Set One Flag for FLAG_AMNT3 = 'X'.

Now while creating fieldcat you check the above Flag...

if FLAG_AMNT3 = 'X'.

Append Fieldcat.

endif.

Repeat above logic for all the columns.. if there are limited number of columns..

Hope it will solve your problem..

Thanks & Regards

ilesh 24x7

ilesh Nandaniya

0 Kudos

hi,

while passing the values to the final table, set a flag if that is not initial.

like..

loop at it_temp1 into is_temp1.
 ...
. ...
  if is_temp1-amnt1 is not initial.
    flag1 = 'X'.
    is_final-amnt1= is_temp1-amnt1.
  endif. 
  if is_temp1-amnt2 is not initial.
    flag2 = 'X'.
    is_final-amnt2= is_temp1-amnt2.
  endif.   
  if is_temp1-amnt3 is not initial.
    flag3 = 'X'.
    is_final-amnt3= is_temp1-amnt3.
  endif.   
  append is_final to it_final.
endloop.

"now while creating field catalog
 if flag1 is not initial.
    populate field catalog for amnt1.
 endif.
 if flag2 is not initial.
    populate field catalog for amnt2.
 endif.
 if flag3 is not initial.
    populate field catalog for amnt3.
 endif.

0 Kudos

HI All,

Thanks for your instant reply...but i have one problem i need to check whole column and if column is empty then i have to remove that.

Anurodh

0 Kudos

anirudh,

did you get through the code i provided above, this checks for each line.