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

adding custom field into ALV grid

Former Member
0 Likes
1,480

Hi all,

I would like to add some custom fields into an ALV grid from a FI/CO report.

I have succesfully added the custom field 'VAT' number for example

FORM fieldcat_init
       USING rt_fieldcat TYPE slis_t_fieldcat_alv.
...

  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = g_tabname.
  ls_fieldcat-fieldname     = 'STCEG'.
* LS_FIELDCAT-KEY           = ' '.        "sets key field
  ls_fieldcat-ref_fieldname = 'STCEG'.
  ls_fieldcat-ref_tabname   = 'KNA1'.
  APPEND ls_fieldcat TO  rt_fieldcat.

....

ENDFORM.                    " FIELDCAT_INIT

This works fine. But I have a problem to add another field named 'due days'.

The due days for one record is calculated by a FM that gives back a NUMC datatype. for example : 6

How can I get calculated fields into an ALV ?

Hi all,

I would like to add some custom fields into an ALV grid from a FI/CO report.

I have succesfully added the custom field 'VAT' number for example

FORM fieldcat_init
       USING rt_fieldcat TYPE slis_t_fieldcat_alv.
...

  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = g_tabname.
  ls_fieldcat-fieldname     = 'STCEG'.
* LS_FIELDCAT-KEY           = ' '.        "sets key field
  ls_fieldcat-ref_fieldname = 'STCEG'.
  ls_fieldcat-ref_tabname   = 'KNA1'.
  APPEND ls_fieldcat TO  rt_fieldcat.

....

ENDFORM.                    " FIELDCAT_INIT

This works fine. But I have a problem to add another field named 'due days'.

The due days for one record is calculated by a FM that gives back a NUMC datatype. for example : 6

How can I get calculated fields into an ALV ?

4 REPLIES 4
Read only

uwe_schieferstein
Active Contributor
0 Likes
793

Hello Abjuh

You could take the data element of the fm parameter which returns the calculated due date as basis for your fieldcatalog entry. Presumably you have to adjust the texts (e.g. LVC_S_FCAT-SCRTEXT_S) as well.

Regards

Uwe

Read only

0 Likes
793

Thx Uwe, I managed to do it like you said. Don't know what you meant with LVC_S_FCAT-SCRTEXT_S though ... But now it works

Read only

0 Likes
793

Hello Abjuh

I did not notice that you are using the SLIS-based fieldcatalog. In this case you would need to modify slis_t_fieldcat_alv-scrtext_s in order to change the description of the additional column.

Regards

Uwe

Read only

0 Likes
793

Ok, I see ... thx for clarifying !