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
637

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

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

4 REPLIES 4
Read only

Former Member
0 Likes
605
LOOP AT gt_cols INTO gs_col.
 TRY.

	IF gs_col-date+6(2) NE '00'.      "Add this IF statement and see if it solves the problem

          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

	ENDIF.

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

-- Aniruddha

Read only

0 Likes
605

Thank a lot Friend its working Fine,

How can i making Do_SUM for Auto Genrated Column Like,User entered date between 01 to 20 so i am able to get 20 column but i need the SUM of column at footer Like Do_SUm , i m not using Field catalog ,Thanks for your help.

Read only

Former Member
0 Likes
605

If I understand your requirement correctly:

Do you want to sum up all the dates in a certain column? If that is so, I guess it would produce an absurd result.

Or is it that, I am not understanding your query correctly?

Read only

0 Likes
605

sorry its my mistake i didnt explain completley.

Actually i m getting the O/P


daye1  day2   day3
20      10     20
10      12     14

And i need only the Sub Total Like Follow


      daye1  day2   day3
      20      10     20
      10      12     14
   
     30       22      34      *this is the sub total i need 

I m not using Field catalog .Thanks for reponse.