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
1,006

Hi all,

I want to add 2 fields to ALV report.

What are the prerequisites needs be taken in this scenarios?

Little bit urgent.

regards,GA

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
986

change Field catalog.

Hi all,

I want to add 2 fields to ALV report.

What are the prerequisites needs be taken in this scenarios?

Little bit urgent.

regards,GA

7 REPLIES 7
Read only

Former Member
0 Likes
987

change Field catalog.

Read only

h_senden2
Active Contributor
0 Likes
986

Add the 2 fields to the definition of the output table.

If in the fieldcatalog definition the output field isnt disabled, the 2 additional fields will be displayed.

regards,

Hans

Please reward all helpful answers !!!!!

Read only

Former Member
0 Likes
986

hi,

just add these two fields in the fieldcatalog,

Reward points if useful..

Regards

Nilesh

Read only

Former Member
0 Likes
986

Define those two fields in the internal table thu which you are desplaying the output ... populate the field in the internal table .... if the fieldcalalog is built using function module you don;t need to do anything then... it will automatically be displayed..

other wise if fieldcalaog table is popul;ated seperately then you need to add two fieldcatalog....

Regards,

Jayant.

Read only

Former Member
0 Likes
986

hi G.A

just follow this code,

*define ur fieldcatlog...

data: l_tab_fieldcatlog type slis_t_fieldcat_alv.

*call ur fieldcatlog...

perform build_catlog using l_pos 'G_TAB_SUCC' 'VBELN' '16' text-005.

perform build_catlog using l_pos 'G_TAB_SUCC' 'MESSAGE' '90' text-007.

*fill fieldcatlog...

&----


*& Form build_catlog

&----


  • text

----


  • -->P_L_POS text

  • -->P_0348 text

  • -->P_0349 text

  • -->P_0350 text

  • -->P_TEXT_004 text

----


form build_catlog using u_pos type any

value(u_0348) type any

value(u_0349) type any

value(u_0350) type any

u_text type any.

data: l_wa_fieldcatlog type slis_fieldcat_alv.

add 1 to u_pos.

l_wa_fieldcatlog-col_pos = u_pos.

l_wa_fieldcatlog-tabname = u_0348.

l_wa_fieldcatlog-fieldname = u_0349.

l_wa_fieldcatlog-outputlen = u_0350.

l_wa_fieldcatlog-reptext_ddic = u_text.

append l_wa_fieldcatlog to l_tab_fieldcatlog.

endform. " build_catlog

*assume this as ur initial fieldcatlog then add two new fileds like as follows....

*call ur fieldcatlog...

perform build_catlog using l_pos 'G_TAB_SUCC' 'VBELN' '16' text-005.

perform build_catlog using l_pos 'G_TAB_SUCC' 'MESSAGE' '90' text-007.

perform build_catlog using l_pos 'G_TAB_SUCC' 'EKK0' '10' text-005.

perform build_catlog using l_pos 'G_TAB_SUCC' 'EKPO '10' text-005.

*then it satisfies ur requirements...

Regards...

seshu.

Read only

Former Member
0 Likes
986

Hi GA,

This is a sample prg.

If u want to add two fields means

just gothrough this prg.

Its simple only.

REPORT ZEASALV_04 .

TABLES : zeastable_02,zeastable_04.

TYPE-POOLS : slis.

TYPES : BEGIN OF fieldst,

name LIKE zeastable_02-name,

znum LIKE zeastable_02-znum,

empno LIKE zeastable_04-empno,

zempsalary LIKE zeastable_04-zempsalary,

<b>NEW FIELD1 LIKE ZEASTABLE_02-*******,

NEW FIELD2 LIKE ZEASTABLE_04-*******,</b>

END OF fieldst.

DATA itab TYPE TABLE OF fieldst WITH HEADER LINE.

DATA: w_report_id LIKE sy-repid. "Program name

DATA: w_title TYPE lvc_title VALUE 'Assignment 1 in ALV'.

DATA: w_layout TYPE slis_layout_alv. "Layout setup

DATA: w_fieldcat TYPE slis_t_fieldcat_alv. "Field Catlog

START-OF-SELECTION.

SELECT-OPTIONS employee FOR zeastable_04-empno.

SELECT zeastable_02name zeastable_02znum

zeastable_04empno zeastable_04zempsalary

<b> ZEASTABLE_02~NEWFIELD1

ZEASTABLE_02~NEWFIELD2</b>

INTO CORRESPONDING FIELDS OF TABLE itab FROM

zeastable_02 INNER JOIN zeastable_04 ON

zeastable_02name = zeastable_04name

WHERE zeastable_04~empno IN employee.

w_report_id = sy-repid.

PERFORM i_layout CHANGING w_layout.

PERFORM i_fieldcat CHANGING w_fieldcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = 'ZEASALV_04'

i_grid_title = w_title

is_layout = w_layout

it_fieldcat = w_fieldcat

i_save = 'A'

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

OTHERS = 2

.

IF sy-subrc <> 0.

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

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

ENDIF.

**********************************************************************************

form i_layout changing p_w_layout.

clear w_layout.

w_layout-colwidth_optimize = 'X'.

w_layout-edit = ' '.

endform. " i_layout

*************************************************************************************

form i_fieldcat changing p_w_feildcat.

data: l_line_fieldcat type slis_fieldcat_alv.

clear l_line_fieldcat.

l_line_fieldcat-fieldname = 'NAME'.

l_line_fieldcat-ref_tabname = 'itab'.

l_line_fieldcat-seltext_m = 'NAME'.

  • l_line_fieldcat-key = 'X'.

append l_line_fieldcat to w_fieldcat.

clear l_line_fieldcat.

l_line_fieldcat-fieldname = 'ZNUM'.

l_line_fieldcat-ref_tabname = 'itab'.

l_line_fieldcat-seltext_m = 'NUMBER'.

  • l_line_fieldcat-key = 'X'.

append l_line_fieldcat to w_fieldcat.

clear l_line_fieldcat.

l_line_fieldcat-fieldname = 'EMPNO'.

l_line_fieldcat-ref_tabname = 'itab'.

l_line_fieldcat-seltext_m = 'EMPLNUM'.

*l_line_fieldcat-key = 'X'.

append l_line_fieldcat to w_fieldcat.

clear l_line_fieldcat.

l_line_fieldcat-fieldname = 'ZEMPSALARY'.

l_line_fieldcat-ref_tabname = 'itab'.

l_line_fieldcat-seltext_m = 'SALARY'.

*l_line_fieldcat-key = 'X'.

append l_line_fieldcat to w_fieldcat.

<b>LIKE THAT HERE ALSO ADD THAT

FIELDS</b>

endform. " i_fieldcat

Reward for useful answers.

Read only

Former Member
0 Likes
986

Hi ,

Just do the following

1. Add the two feilds in the output internal table , table to be displayed as ALV

2. Add these feilds in the feild catalog.

Regards

Arun