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 report (SAP-ABAP)

Former Member
0 Kudos
185

Hi friends,

I want to add a field in my report output.field header is appearing but its value not coming due to some logic problem

but there is some value in table .could u guide me hw to do it with small example. pls treat it urgent.

Thx in Adv.

bapi

4 REPLIES 4

former_member223537
Active Contributor
0 Kudos
155

Hi,

In the fieldcatalog, do mention that field.

I hope you have passed the correct FIELD name of the internal table to Fieldcatalog.

In the table which you are passing to ALV FM, check whether the field is populated correctly in debug mode.

If not, then pass correct value to the field.

Best regards,

Prashant

Former Member
0 Kudos
155

Hi

Am giving the code which i understand

Insert the new field in the internal table.

data : tabix type sy-tabix.

LOOP AT ITAB.

tabix = sy-tabix.

select single <newfield-name>

from <newfeidld-table>

where <condition>.

MODIFY ITAB INDEX TABIX.

EndLoop.

Hope it will solve your answer.

Thanks

Ravi

0 Kudos
155

For building an ALV you may use the function module:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

i_bypassing_buffer = 'X'

  • I_BUFFER_ACTIVE = ' '

i_callback_program = v_aux

i_callback_pf_status_set = c_formname_pf_status_set

i_callback_user_command = c_formname_callback_user1

  • I_CALLBACK_TOP_OF_PAGE =

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • i_grid_title = v_titulo

  • I_GRID_SETTINGS =

is_layout = xlayout

it_fieldcat = t_catalogoalv

  • it_excluding = t_excluding

  • IT_SPECIAL_GROUPS =

  • it_sort = t_sort

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

i_save = 'A'

  • IS_VARIANT =

  • it_events = t_eventos

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = gt_outtab_ebeln[]

EXCEPTIONS

program_error = 1

OTHERS = 2

.

The data are in gt_outtab_ebeln table. The header is in the table: t_catalogoalv

This table is building using:

DATA: xcatalogo TYPE slis_fieldcat_alv.

DATA: t_catalogoalv TYPE slis_fieldcat_alv OCCURS 1.

CLEAR t_catalogoalv.

REFRESH t_catalogoalv.

CLEAR xcatalogo.

xcatalogo-fieldname = 'EBELN'.

xcatalogo-tabname = e_ebeln.

xcatalogo-just = 'L'.

xcatalogo-outputlen = '10'.

xcatalogo-seltext_l = 'Nº de pedido'.

xcatalogo-datatype = 'CHAR'.

APPEND xcatalogo TO t_catalogoalv.

Regards.

Former Member
0 Kudos
155

hi bapi,

try this code

<b>data : it_field type slis_t_fieldcat_alv,

wa_field TYPE slis_fieldcat_alv,

PERFORM f005_grid USING <seltext> <field_name>.

FORM f005_grid USING <seltext> <field_name>.</b>

<b>wa_field-seltext_l = sel.

wa_field-fieldname = fname.</b>

wa_field-intlen = 15.

wa_field-outputlen = 15.

<b>APPEND wa_field TO it_field.</b>

CLEAR wa_field.

CALL FUNCTION <b>'REUSE_ALV_GRID_DISPLAY'</b>

EXPORTING

i_callback_program = sy-repid

it_fieldcat = it_field

TABLES

t_outtab = it_final

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc IS NOT INITIAL.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

in this way u can add a field to ur code for ur ALV report,

hope this is useful

reward points if helpful,

thanks

ginni

Message was edited by:

Ginni Makkar