Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ALV

Hi ,

I am just learning ALV reporting.

I have an internal table and I have an issue here.

I am getting the output but the only problem is ...I am not getting the heading(field names ) for the output .

Please review my code and let me know if there is anything else I need to add in it..

-


CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = G_REPID

I_INTERNAL_TABNAME = 'GT_OUTPUT'

I_INCLNAME = G_repid

CHANGING

CT_FIELDCAT = GT_FIELDCAT

EXCEPTIONS

INCONSISTENT

INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = G_REPID

  • IS_LAYOUT = GS_LAYOUT

  • I_SAVE = G_SAVE

  • IS_VARIANT = GS_VARIANT

IT_FIELDCAT = GT_FIELDCAT[]

  • IT_EVENTS = GT_EVENTS[]

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER = G_EXIT_CAUSED_BY_CALLER

  • ES_EXIT_CAUSED_BY_USER = GS_EXIT_CAUSED_BY_USER

TABLES

T_OUTTAB = gt_output

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF SY-SUBRC = 0.

endif.

Tags:
Former Member
Former Member replied

Hi Ramana,

As I told you the field names are poulated only if those fields are referrend from the dictionary structure. That is when you pass the structure name to the FM.

As you are using only 7 fields just create the fieldcatlog in the same way as below for the fields

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'UNIT_PRICE'.

ls_fieldcat-tabname = 'GT_DISP_TABLE'.

ls_fieldcat-ref_fieldname = 'DMBTR'.

ls_fieldcat-ref_tabname = 'MSEG'.

ls_fieldcat-reptext_ddic = text-c01.

ls_fieldcat-seltext_l = text-c01.

ls_fieldcat-seltext_m = text-c01.

ls_fieldcat-seltext_s = text-c01.

ls_fieldcat-ddic_outputlen = 15.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'DMBTR'.

ls_fieldcat-tabname = 'GT_DISP_TABLE'.

ls_fieldcat-ref_fieldname = 'DMBTR'.

ls_fieldcat-ref_tabname = 'MSEG'.

ls_fieldcat-reptext_ddic = text-c04.

ls_fieldcat-seltext_l = text-c04.

ls_fieldcat-seltext_m = text-c04.

ls_fieldcat-seltext_s = text-c04.

ls_fieldcat-ddic_outputlen = 15.

APPEND ls_fieldcat TO gt_fieldcat.

Regards,

Atish

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question