2007 May 02 7:58 AM
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
2007 May 02 7:59 AM
change Field catalog.
2007 May 02 7:59 AM
2007 May 02 7:59 AM
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 !!!!!
2007 May 02 8:00 AM
hi,
just add these two fields in the fieldcatalog,
Reward points if useful..
Regards
Nilesh
2007 May 02 8:02 AM
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.
2007 May 02 8:07 AM
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.
2007 May 02 10:49 AM
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.
2007 May 02 10:53 AM
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
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |