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: 

ALV - add another column

Former Member
0 Kudos

good day experts...

I just want to ask why is it that when I added another column in an ALV,

the one in bold letter) It does not appear when I execute it? My declarations is herein below:

Please tell me what to do to correct my statements.

Thank you.

CODE:

FORM f_display_aging .

SORT it_aging BY swenr smenr.

REFRESH it_fdcat.

PERFORM f_create_layout USING wa_layout.

PERFORM f_create_fieldcat USING it_fdcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = v_repid

i_callback_pf_status_set = 'PFSTATUS'

i_grid_title = text-alv

is_layout = wa_layout

it_event_exit = it_event

it_fieldcat = it_fdcat[]

TABLES

t_outtab = it_aging.

ENDFORM. " f_display_aging

&----


*& Form f_create_layout

&----


  • ALV Layout

----


FORM f_create_layout USING p_wa_layout TYPE slis_layout_alv.

p_wa_layout-zebra = 'X'.

p_wa_layout-colwidth_optimize = 'X'.

ENDFORM. " f_create_layout

&----


*& Form pfstatus

&----


  • Set PF-Status

----


FORM pfstatus USING ut_extab TYPE slis_t_extab.

SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLKKBL'.

ENDFORM. " PF_STATUS_SET

FORM f_create_fieldcat USING p_it_fdcat TYPE slis_t_fieldcat_alv.

DATA: ls_fieldcat TYPE slis_fieldcat_alv.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f01.

ls_fieldcat-seltext_l = text-t01.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f02.

ls_fieldcat-seltext_l = text-t02.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f17.

ls_fieldcat-seltext_l = text-t17.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f18.

ls_fieldcat-seltext_l = text-t18.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f19.

ls_fieldcat-seltext_l = text-t19.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f20.

ls_fieldcat-seltext_l = text-t20.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f21.

ls_fieldcat-seltext_l = text-t21.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f22.

ls_fieldcat-seltext_l = text-t22.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f03.

ls_fieldcat-seltext_l = text-t03.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f04.

ls_fieldcat-seltext_l = text-t04.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f05.

ls_fieldcat-seltext_l = text-t05.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f06.

ls_fieldcat-seltext_l = text-t06.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f24.

ls_fieldcat-seltext_l = text-t24.

ls_fieldcat-outputlen = 25.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f07.

ls_fieldcat-seltext_l = text-t07.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f08.

ls_fieldcat-seltext_l = text-t08.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f09.

ls_fieldcat-seltext_l = text-t09.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f10.

ls_fieldcat-seltext_l = text-t10.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f11.

ls_fieldcat-seltext_l = text-t11.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f12.

ls_fieldcat-seltext_l = text-t12.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f13.

ls_fieldcat-seltext_l = text-t13.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f14.

ls_fieldcat-seltext_l = text-t14.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f15.

ls_fieldcat-seltext_l = text-t15.

ls_fieldcat-outputlen = 15.

APPEND ls_fieldcat TO p_it_fdcat.

ENDFORM.

19 REPLIES 19

h_senden2
Active Contributor
0 Kudos

Adding a record to the fieldcatalog is not enough.

You should add it also to the data table, it_aging in this case.

Regards,

Hans

Former Member
0 Kudos

Yes, I did it already. Actually here is my decalaration.

TYPES: BEGIN OF ty_aging,

swenr TYPE swenr,

smenr TYPE smenr,

sell1 TYPE name1,

sell2 TYPE name1,

sell3 TYPE name1,

sell4 TYPE name1,

sell5 TYPE name1,

kunnr TYPE kunnr,

name1 TYPE name1,

zterm TYPE knb1-zterm,

netwr TYPE dmbtr,

paymd TYPE dmbtr,

nydue TYPE dmbtr,

les30 TYPE dmbtr,

due60 TYPE dmbtr,

due90 TYPE dmbtr,

du120 TYPE dmbtr,

du121 TYPE dmbtr,

todue TYPE dmbtr, "total due

lspay TYPE budat, "last pay date

lsamt TYPE dmbtr, "last pay amount

ausdt TYPE ausdt, "dunning level date 1

madat TYPE madat, "dunning level date 2

colle type dmbtr, "percentage of total payments

END OF ty_aging.

DATA: it_aging TYPE TABLE OF ty_aging,

wa_aging TYPE ty_aging.

NOTE:some codes were omitted....I just want to show the declarations I did.

"As I debug, wa_aging-colle will handles 2.66 value

l_total_coll = ( wa_aging-paymd / l_nettcp ) * 100.

wa_aging-colle = l_total_coll.

xxx...

APPEND wa_aging to it_aging.

xxx...

After this statements, I now declare the ALV I wrote above. Also, I have included t24 and f24 on the text symbols.

But unluckily, when I execute my program, this column I added does not appear.

I also change the layout of the ALV, but I noticed too that the additional field I included does not appear

on the column selection.

I dont know now what to do...

Please help me...

0 Kudos

try this change and see.. may be text element is not active.

CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'COLLE'. "text-f24.
ls_fieldcat-seltext_l = text-t24.
ls_fieldcat-outputlen = 25.
APPEND ls_fieldcat TO p_it_fdcat.

Former Member
0 Kudos

Im sorry

but still doesnt work..

Im now crazy with this thing.

0 Kudos

give a final try

CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'COLLE'. "text-f24.
ls_fieldcat-seltext_l = text-t24.
ls_fieldcat-tabname = 'IT_AGING'.  "<-----use this also then it will come
ls_fieldcat-outputlen = 25.
APPEND ls_fieldcat TO p_it_fdcat.

Former Member
0 Kudos

Im sorry... but still no output.... Even with the last solution you give...

Former Member
0 Kudos

Hi,

text-f24 should be in your internal table....check it first

Former Member
0 Kudos

levis,

check whether that field is present in it_arging table .

Regards

Hitesh

0 Kudos

Yes it is included.. Please read the following replies to Vidjay...

Please help what to do..

Thanks a lot.

former_member188685
Active Contributor
0 Kudos

did you add the same field to your internal table, and did you added the logic for selecting the data for that field. all these matters. and make sure the field name you mentioned should be same as that of the field which you added in the internal table.and the fieldname should be CAPS.

0 Kudos

yes.. I did all the things you mentioned..

But still, it cant be shown when I execute it.

It wonders me a lot.

Former Member
0 Kudos

Levis ,

Can you do one favor to me ...

1) Debug your code and check the values in it_fieldcat [] and it_arging

or when instead of this perform

PERFORM f_create_fieldcat USING it_fdcat.

use

PERFORM f_create_fieldcat changing it_fdcat.

Hope it works

Regards

Hitesh

0 Kudos

Im sorry, but still doesnt work..

I also tried to replaced it manually typing the

fieldname = 'COLLE'

but still no output.

I also tried to comment out all the other columns and maintain this only column

but there is no more output.

I dont know why...

Former Member
0 Kudos

Hi levis,

check field is adding the selection statement .

Regrds

Swamy.

Former Member
0 Kudos

hi..

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = text-f24.

ls_fieldcat-seltext_l = text-t24.

ls_fieldcat-outputlen = 25.

ls_fieldcat-no_out = ' '.

APPEND ls_fieldcat TO p_it_fdcat.

try this...

use the firld no_out... and put it to blank..

regards

palak

0 Kudos

Still no effect.

0 Kudos

post your entire code. if it is not so big program.

former_member181995
Active Contributor
0 Kudos

post your entire code,srrounded in .even if it is not so big program.

Former Member
0 Kudos

i got it now.. just restart my gui. and bingo.