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

Former Member
0 Likes
980

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
945

Hi Ramana,

Put a breakpoint after Fm REUSE_ALV_FIELDCATALOG_MERGE and see if the fieldname are populated in the GT_FIELDCAT. This FM create the field label if those fields are referrend from the dictionary structure.

Regards,

Atish

9 REPLIES 9
Read only

Former Member
0 Likes
946

Hi Ramana,

Put a breakpoint after Fm REUSE_ALV_FIELDCATALOG_MERGE and see if the fieldname are populated in the GT_FIELDCAT. This FM create the field label if those fields are referrend from the dictionary structure.

Regards,

Atish

Read only

0 Likes
945

Yes Atish ,

I see that all the fields are populated in that itab of fieldcat.

Read only

0 Likes
945

Hi Ramana,

Look for the field reptext_ddic, or seltext_l, seltext_m or seltext_s.

These should be filled to show the field label.

Regards,

Atish

Read only

0 Likes
945

Yes Atish , I think you are at the right point of the fieldcat...

please find the fileds populated in that ...

0 | 1 |EBELN |GT_OUTPUT <

0 | 2 |EBELP |GT_OUTPUT <

0 | 4 |MATNR |GT_OUTPUT <

0 | 5 |MAKTX |GT_OUTPUT <

0 | 6 |GERNR |GT_OUTPUT <

0 | 7 |EQUNR |GT_OUTPUT <

_______________________________________________

I see that one field is missing in it ....please see the definition of the iternal table output...

DATA : BEGIN OF gt_output OCCURS 0,

ebeln TYPE ebeln,

ebelp TYPE ebelp,

zucode TYPE zitp01-zucode,

matnr TYPE matnr,

maktx TYPE maktx,

gernr TYPE gernr,

equnr TYPE equnr,

END OF gt_output.

Is there any correction I need to make in this???

Read only

0 Likes
945

Hi Ramana,

First change the defination of

zucode TYPE zitp01-zucode

and refer it to the dataelemnet of the field ZUCODE.

zucode TYPE <dataelement>

Regards,

Atish

Read only

0 Likes
945

Try to define your table like this:

DATA : BEGIN OF gt_output OCCURS 0,
ebeln TYPE ebeln,
ebelp TYPE ebelp,
zucode TYPE zucode,   "<<<
matnr TYPE matnr,
maktx TYPE maktx,
gernr TYPE gernr,
equnr TYPE equnr,
END OF gt_output.

Regards,

Naimesh Patel

Read only

0 Likes
945

Hi Naimesh & Atish ,

I changed it...

DATA : BEGIN OF gt_output OCCURS 0,

ebeln type ebeln,

ebelp type ebelp,

zucode type zucode,

matnr type matnr,

maktx type maktx,

gernr type sernr,

equnr type equnr,

END OF gt_output.

But it is the same ...

Read only

0 Likes
945

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

Read only

0 Likes
945

Thank you Atish