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

ALV Grid Column Issue

Former Member
0 Likes
794

Hellow Experts,

i got the some code to genrate auto genrated column based on date my out put is as follow


StudentID        Day00  Day01  Day02 ......Day31
   178           20     30      40          50      

My Code for genrate day is


LOOP AT gt_cols INTO gs_col.
 TRY.
        CONCATENATE 'DATE' gs_col-date INTO g_col.      "Define Column name
        gr_column ?= gr_columns->get_column( g_col ).   "Get column
        CONCATENATE 'Day' gs_col-date+6(2) INTO g_txt.  "Define new label (Day01, .., Day31)
 gr_column->set_long_text( g_txt ).              "Set label long text
      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    ENDTRY.


*      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
*    ENDTRY.
  ENDLOOP.

My requirment is i dont need 'Day00' like follow


StudentID         Day01  Day02 ......Day31
   178              30      40          50      

PLz help me and Ammend my above code to remove Day00.Thanks

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
757

Hi Neha,

While copying the code from somewhere else please try to know what s written and understand it. Your problem is indicated in your code itself. You do not need a help for this simple thing.

Kesav

Hellow Experts,

i got the some code to genrate auto genrated column based on date my out put is as follow


StudentID        Day00  Day01  Day02 ......Day31
   178           20     30      40          50      

My Code for genrate day is


LOOP AT gt_cols INTO gs_col.
 TRY.
        CONCATENATE 'DATE' gs_col-date INTO g_col.      "Define Column name
        gr_column ?= gr_columns->get_column( g_col ).   "Get column
        CONCATENATE 'Day' gs_col-date+6(2) INTO g_txt.  "Define new label (Day01, .., Day31)
 gr_column->set_long_text( g_txt ).              "Set label long text
      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    ENDTRY.


*      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
*    ENDTRY.
  ENDLOOP.

My requirment is i dont need 'Day00' like follow


StudentID         Day01  Day02 ......Day31
   178              30      40          50      

PLz help me and Ammend my above code to remove Day00.Thanks

5 REPLIES 5
Read only

Former Member
0 Likes
757

Hi Neha ,

if you have date ranges at the selection screen , then you need to use FM DAY_ATTRIBUTES_GET to get dates in given date ranges....and it wil determines no of columns needed for the output...

or simply put following code corrections


LOOP AT gt_cols INTO gs_col whre date is not initial."Added By Prabhu , no point to have a column if date is initial.
 TRY.
        CONCATENATE 'DATE' gs_col-date INTO g_col.      "Define Column name
        gr_column ?= gr_columns->get_column( g_col ).   "Get column
        CONCATENATE 'Day' gs_col-date+6(2) INTO g_txt.  "Define new label (Day01, .., Day31)
 gr_column->set_long_text( g_txt ).              "Set label long text
      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    ENDTRY.
 
 
*      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
*    ENDTRY.
  ENDLOOP.

Read only

Former Member
0 Likes
757

Hi Neha,

can you share some more code like the declaration's.

Regards,

Abhisek.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
758

Hi Neha,

While copying the code from somewhere else please try to know what s written and understand it. Your problem is indicated in your code itself. You do not need a help for this simple thing.

Kesav

Read only

0 Likes
757

Thanks Kehsv ,

yes u was right, i sloved problm my self. only i make one condition ststment if Day00 then execute

any way many thanks to all of you.

Regards

Neha

Read only

Former Member
0 Likes
757

Sloved