ALV Doubt
what d/w SLIS_FIELDCAT_ALV , SLIS_T_FIELDCAT_ALV
regards,anji
this is an internal table : <b>SLIS_T_FIELDCAT_ALV</b>
this is not an internal table : <b>SLIS_FIELDCAT_ALV</b> (with out header line)
Field catalog containing descriptions of the list output fields (usually a subset of the internal output table fields).
<b>A field catalog is required for every ALV list output.</b>
The field catalog for the output table is built-up in the caller's coding. The build-up can be completely or partially automated by calling the REUSE_ALV_FIELDCATALOG_MERGE module
and <b>slis_fieldcat_alv</b>.contains...check in ABAP program
types: begin of slis_fieldcat_alv.
include type slis_fieldcat_main.
include type slis_fieldcat_alv_spec.
types: end of slis_fieldcat_alv.
types: slis_t_fieldcat_alv type slis_fieldcat_alv occurs 1.
reward if it helps u
Vijay Pawar
Similar Messages
-
i want to print header details and item details, suppose there are some 100 item details for a particular header data, but i dont want to display all 100 item details, just want to display 5 item detials, how can i do this ? can any one help me in this...
Points for sure
thanks and regards
VijayaHi vijaya,
pass the complete table(Header 100 rec) to FM
REUSE_ALV_BLOCK_LIST_HS_APPEND.
loop at 2nd table where sy-tabix le 5.
move-corresponding 2nd table to 3rd table.
append 3rd table.
endloop.
Pass second item table i.e 3rd table to same FM
REUSE_ALV_BLOCK_LIST_HS_APPEND.
Try this, i think it works.
Dont forget to reward points if found useful.
Thanks,
Satyesh -
Doubt in calltransaction in ALV
Hi, i have doubt in calltransction in alv..In my report am using ALV grid display to display purchase order number , material docu number ..If i click on purchasing docu number it has to call transaction ME23N for the purchase order number that i have clicked and if i click material document number it has to call trainsaction MIGO for the corresponding material document number..Here i have done some coding plz correct me if iam wrong..
*& Report YCALLTRANSACTIONALV *
REPORT YCALLTRANSACTIONALV .
TYPE-POOLS: icon.
TYPE-POOLS: slis.
TABLES: vbak,vbap,vbep, makt,lips.
DATA: BEGIN OF gt_vbak OCCURS 0,
vbeln LIKE vbak-vbeln,
audat LIKE vbak-audat,
vdatu LIKE vbak-vdatu,
kunnr LIKE vbak-kunnr,
posnr LIKE vbap-posnr,
matnr LIKE vbap-matnr,
kwmeng LIKE vbap-kwmeng,
END OF gt_vbak.
DATA: BEGIN OF gt_vbep OCCURS 0,
vbeln LIKE vbep-vbeln,
wadat LIKE vbep-wadat,
END OF gt_vbep.
DATA: BEGIN OF gt_lips OCCURS 0,
vbeln LIKE lips-vbeln,
posnr LIKE lips-posnr,
lfimg LIKE lips-lfimg,
vgbel LIKE lips-vgbel,
vgpos LIKE lips-vgpos,
END OF gt_lips.
DATA: BEGIN OF gt_makt OCCURS 0,
matnr LIKE makt-matnr,
maktx LIKE makt-maktx,
END OF gt_makt.
DATA: gv_tab TYPE slis_tabname VALUE 'GT_REPORT'.
DATA: BEGIN OF gt_report OCCURS 0,
vbeln LIKE vbak-vbeln,
posnr LIKE vbep-posnr,
matnr LIKE vbap-matnr,
maktx LIKE makt-maktx,
kwmeng LIKE vbap-kwmeng,
vdatu LIKE vbak-vdatu,
lfimg LIKE lips-lfimg,
wadat LIKE vbep-wadat,
vgbel LIKE lips-vgbel,
icon TYPE icon-id,
tabcolor TYPE lvc_t_scol,
END OF gt_report.
DATA: gt_fieldcat TYPE slis_t_fieldcat_ alv,
gs_fieldcat TYPE slis_fieldcat_ alv,
gs_layout TYPE slis_layout_ alv,
gt_events TYPE slis_t_event,
gs_events TYPE slis_alv_event,
repid LIKE sy-repid.
DATA: gt_lines TYPE TABLE OF tline WITH HEADER LINE,
gv_name LIKE thead-tdname,
gv_fld(40),gv_ fval(50).
DATA: BEGIN OF gt_outlines OCCURS 0,
text TYPE tdline,
END OF gt_outlines.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-006.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: p_cust RADIOBUTTON GROUP rad1 USER-COMMAND ch DEFAULT 'X'.
SELECTION-SCREEN COMMENT 5(20) text-001.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: p_date RADIOBUTTON GROUP rad1 .
SELECTION-SCREEN COMMENT 5(10) text-002 .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-005.
SELECT-OPTIONS: s_sale FOR vbak-vbeln MODIF ID cus,
s_cust FOR vbak-kunnr MODIF ID cus.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-005.
SELECT-OPTIONS: s_sale1 FOR vbak-vbeln MODIF ID dat,
s_dat FOR vbak-audat MODIF ID dat.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-007.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: p_clas RADIOBUTTON GROUP rad2 ."USER-COMMAND ch DEFAULT'X'.
SELECTION-SCREEN COMMENT 5(20) text-003.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: p_alv RADIOBUTTON GROUP rad2 ."USER-COMMAND ch DEFAULT'X'.
SELECTION-SCREEN COMMENT 5(20) text-004.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b4.
AT SELECTION-SCREEN.
CHECK sy-ucomm = 'CH'.
AT SELECTION-SCREEN OUTPUT.
IF p_cust = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'DAT'.
screen-active = 0.
ELSE.
screen-active = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-group1 = 'CUS'.
screen-active = 0.
ELSE.
screen-active = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
START-OF-SELECTION.
IF p_cust = 'X' .
CLEAR gt_vbak.
REFRESH gt_vbak.
SELECT avbeln aaudat avdatu akunnr bposnr bmatnr b~kwmeng
INTO TABLE gt_vbak
FROM vbak AS a INNER JOIN vbap AS b
ON avbeln = bvbeln
WHERE a~vbeln IN s_sale
AND a~kunnr IN s_cust.
ELSEIF p_date = 'X'.
CLEAR gt_vbak.
REFRESH gt_vbak.
SELECT avbeln aaudat avdatu akunnr bposnr bmatnr b~kwmeng
INTO TABLE gt_vbak
FROM vbak AS a INNER JOIN vbap AS b
ON avbeln = bvbeln
WHERE a~vbeln IN s_sale1
AND a~audat IN s_dat.
ENDIF.
PERFORM sel_data.
IF p_alv = 'X'.
PERFORM disp_data1.
ELSE.
PERFORM disp_data.
ENDIF.
AT LINE-SELECTION.
GET CURSOR FIELD gv_fld .
CASE gv_fld.
WHEN 'ICON_DISPLAY_ TEXT'.
PERFORM concate_text.
CLEAR gv_name.
CONCATENATE gt_report-vbeln gt_report-posnr INTO gv_name.
PERFORM read_text.
PERFORM write_text.
PERFORM disp_text.
WHEN 'GT_REPORT-VBELN' .
SET PARAMETER ID 'AUN' FIELD gt_report-vbeln.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDCASE.
*& Form sel_data
FORM sel_data .
CLEAR gt_vbep.
REFRESH gt_vbep.
IF NOT gt_vbak[] IS INITIAL.
SELECT vbeln wadat FROM vbep INTO TABLE gt_vbep
FOR ALL ENTRIES IN gt_vbak
WHERE vbeln = gt_vbak-vbeln.
CLEAR gt_lips.
REFRESH gt_lips.
SELECT vbeln posnr lfimg vgbel vgpos FROM lips INTO TABLE gt_lips
FOR ALL ENTRIES IN gt_vbak
WHERE vgbel = gt_vbak-vbeln
AND vgpos = gt_vbak-posnr.
CLEAR gt_makt.
REFRESH gt_makt.
SELECT matnr maktx FROM makt INTO TABLE gt_makt
FOR ALL ENTRIES IN gt_vbak
WHERE matnr = gt_vbak-matnr.
ENDIF.
REFRESH gt_report.
CLEAR gt_report.
LOOP AT gt_vbak.
gt_report-vbeln = gt_vbak-vbeln.
gt_report-vdatu = gt_vbak-vdatu.
gt_report-posnr = gt_vbak-posnr.
gt_report-matnr = gt_vbak-matnr.
gt_report-kwmeng = gt_vbak-kwmeng.
CLEAR gt_vbep.
READ TABLE gt_vbep WITH KEY vbeln = gt_vbak-vbeln.
gt_report-wadat = gt_vbep-wadat.
CLEAR gt_lips.
READ TABLE gt_lips WITH KEY vgbel = gt_vbak-vbeln
vgpos = gt_vbak-posnr.
gt_report-lfimg = gt_lips-lfimg.
gt_report-vgbel = gt_lips-vbeln.
CLEAR gt_makt.
READ TABLE gt_makt WITH KEY matnr = gt_vbak-matnr.
gt_report-maktx = gt_makt-maktx.
CLEAR gt_report-icon.
PERFORM concate_text.
CLEAR gv_name.
CONCATENATE gt_report-vbeln gt_report-posnr INTO gv_name.
PERFORM read_text.
IF gt_lines[] IS NOT INITIAL.
gt_report-icon = '@0P@'.
ENDIF.
APPEND gt_report.
ENDLOOP.
ENDFORM. " sel_data
*& Form disp_data
FORM disp_data .
WRITE:/(8) 'orderno.',
(8) 'lineno.',
(11) 'mat.',
(27) 'matdes.',
(10) 'ord.qty',
(12) 'req.del.',
(10) 'del.qty',
(10) 'gidate',
(10) 'delno.'.
ULINE.
LOOP AT gt_report.
WRITE:/(8) gt_report-vbeln COLOR 6 HOTSPOT,
(8) gt_report-posnr ,
(8) gt_report-matnr,
(25) gt_report-maktx,
(11) gt_report-kwmeng,
(15) gt_report-vdatu,
(7) gt_report-lfimg,
(10) gt_report-wadat,
(10) gt_report-vgbel.
PERFORM concate_text.
CLEAR gv_name.
CONCATENATE gt_report-vbeln gt_report-posnr INTO gv_name.
PERFORM read_text.
IF gt_lines[] IS NOT INITIAL.
WRITE:120 icon_display_ text AS ICON HOTSPOT.
HIDE: gt_report-vbeln, gt_report- posnr.
ENDIF.
ENDLOOP.
ENDFORM. " disp_data
*& Form disp_data1
FORM disp_data1 .
DATA :
ls_tabcolor TYPE lvc_s_scol.
CLEAR gs_fieldcat.
gs_fieldcat- tabname = gv_tab.
gs_fieldcat- fieldname = 'VBELN'.
gs_fieldcat- hotspot = 'X'.
gs_fieldcat- seltext_l = 'ORDERNO'.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
gs_fieldcat- tabname = gv_tab.
gs_fieldcat- fieldname = 'POSNR'.
gs_fieldcat- seltext_l = 'LINENO'.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
gs_fieldcat- tabname = gv_tab.
gs_fieldcat- fieldname = 'MATNR'.
gs_fieldcat- seltext_l = 'MATNO'.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
gs_fieldcat- tabname = gv_tab.
gs_fieldcat- fieldname = 'MAKTX'.
gs_fieldcat- seltext_l = 'MATDESCR'.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
gs_fieldcat- tabname = gv_tab.
gs_fieldcat- fieldname = 'KWMENG'.
gs_fieldcat- seltext_l = 'ORDERQTY'.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
gs_fieldcat- tabname = gv_tab.
gs_fieldcat- fieldname = 'VDATU'.
gs_fieldcat- seltext_l = 'REQ.DEL.DAT' .
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
gs_fieldcat- tabname = gv_tab.
gs_fieldcat- fieldname = 'LFIMG'.
gs_fieldcat- seltext_l = 'QTY.DEL'.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
gs_fieldcat- tabname = gv_tab.
gs_fieldcat- fieldname = 'WADAT'.
gs_fieldcat- seltext_l = 'ISS.DATE'.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
gs_fieldcat- tabname = gv_tab.
gs_fieldcat- fieldname = 'VGBEL'.
gs_fieldcat- seltext_l = 'DOUC.NO'.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
gs_fieldcat- tabname = gv_tab.
gs_fieldcat- fieldname = 'ICON'.
gs_fieldcat- seltext_l = 'TEXT'.
gs_fieldcat- icon = 'X'.
gs_fieldcat- hotspot = 'X'.
APPEND gs_fieldcat TO gt_fieldcat.
gs_layout-coltab_ fieldname = 'TABCOLOR'.
gs_events-name = 'USER_COMMAND' .
gs_events-form = 'VAL'.
APPEND gs_events TO gt_events.
LOOP AT gt_report.
ls_tabcolor- fname = 'VBELN'.
ls_tabcolor- color-col = 4.
ls_tabcolor- color-int = 1.
ls_tabcolor- color-inv = 0.
INSERT ls_tabcolor INTO TABLE gt_report-tabcolor.
MODIFY gt_report.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_ DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = gs_layout
it_fieldcat = gt_fieldcat
it_events = gt_events
TABLES
t_outtab = gt_report.
ENDFORM. " disp_data1
*& Form READ_TEXT .
FORM read_text .
CLEAR gt_lines.
REFRESH gt_lines.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = '0002'
language = sy-langu
name = gv_name
object = 'VBBP'
TABLES
lines = gt_lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_ to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " READ_TEXT
*& Form WRITE_TEXT.
FORM write_text.
REFRESH gt_outlines.
CLEAR gt_outlines.
CLEAR gt_lines.
LOOP AT gt_lines .
MOVE gt_lines-tdline TO gt_outlines- text .
APPEND gt_outlines.
ENDLOOP.
CLEAR gt_outlines.
ENDFORM. "WRITE_TEXT
*& Form VAL .
FORM val USING
user_command LIKE sy-ucomm
sel TYPE slis_selfield.
IF sel-fieldname = 'VBELN'.
SET PARAMETER ID 'AUN' FIELD gt_report-vbeln.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
IF sel-fieldname = 'ICON'.
CLEAR gt_report.
READ TABLE gt_report INDEX sel-tabindex.
perform concate_text.
CLEAR gv_name.
CONCATENATE gt_report-vbeln gt_report-posnr INTO gv_name.
PERFORM read_text.
PERFORM write_text.
PERFORM disp_text1.
ENDIF.
ENDFORM. "val
*& Form disp_text
FORM disp_text .
CALL FUNCTION 'POPUP_WITH_ TABLE_DISPLAY_ OK'
EXPORTING
endpos_col = 50
endpos_row = 30
startpos_col = 20
startpos_row = 20
titletext = 'TEXT'
TABLES
valuetab = gt_outlines.
ENDFORM. " disp_text
*& Form disp_text1
FORM disp_text1 .
DATA: lt_fieldcat TYPE slis_t_fieldcat_ alv,
ls_fieldcat TYPE slis_fieldcat_ alv.
ls_fieldcat- fieldname = 'TEXT'.
ls_fieldcat- outputlen = 40.
ls_fieldcat- tabname = gt_outlines.
APPEND ls_fieldcat TO lt_fieldcat.
CALL FUNCTION 'REUSE_ALV_POPUP_ TO_SELECT'
EXPORTING
i_title = 'TEXT'
i_tabname = 'TLINE'
it_fieldcat = lt_fieldcat
i_callback_program = sy-repid
TABLES
t_outtab = gt_outlines.
ENDFORM. " disp_text1
*& Form concate_text
FORM concate_text .
CLEAR gv_name.
CONCATENATE gt_report-vbeln gt_report-posnr INTO gv_name.
PERFORM read_text.
ENDFORM. " concate_text
ThanksHello skk
Here is a sample report performing the required task using OO-means. I think you will agree that the OO-based approach is much simpler and easier to understand than the FM-based approach.
The screen '0100' has the following flow logic without any dynpro elements:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
*& Report ZUS_SDN_ALVGRID_EVENTS
REPORT zus_sdn_alvgrid_events.
DATA:
gd_okcode TYPE ui_func,
gt_fcat TYPE lvc_t_fcat,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid1 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1.
PARAMETERS:
p_bukrs TYPE bukrs DEFAULT '1000' OBLIGATORY.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
* define local data
DATA:
ls_knb1 TYPE knb1,
ls_col_id TYPE lvc_s_col.
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row_id-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CASE e_column_id-fieldname.
WHEN 'KUNNR'.
SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
WHEN 'ERNAM'.
* SET PARAMETER ID 'USR' FIELD ls_knb1-ernam.
* NOTE: no parameter id available, yet simply show the priciple
CALL TRANSACTION 'SU01' AND SKIP FIRST SCREEN.
WHEN OTHERS.
* do nothing
ENDCASE.
* Set active cell to field BUKRS otherwise the focus is still on
* field KUNNR which will always raise event HOTSPOT_CLICK
ls_col_id-fieldname = 'BUKRS'.
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
is_row_id = e_row_id
is_column_id = ls_col_id.
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = p_bukrs.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR go_grid1.
* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog_knb1.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
CHANGING
it_outtab = gt_knb1
it_fieldcatalog = gt_fcat
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form BUILD_FIELDCATALOG_KNB1
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog_knb1 .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'KNB1'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT gt_fcat INTO ls_fcat
WHERE ( fieldname = 'KUNNR' OR
fieldname = 'ERNAM' ).
ls_fcat-hotspot = abap_true.
MODIFY gt_fcat FROM ls_fcat.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG_KNB1
Regards
Uwe -
Doubts in alv interactive report
Hello Gurus
i am new to abap i have doubt regarding interactive alv . i wrote one but it gives runtime error . i taken reference to a sample program availiable please explain this code so i can write interactive alv effectively.
FORM POPULATE_EVENT.
READ TABLE ITAB_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY ITAB_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
IF ITAB_EMPLOY-EMPID NE ''.
READ TABLE ITAB_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND'. MODIFY ITAB_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
ENDIF.
ENDIF.
ENDFORM.Hi,
Event form names are appended to an internal table and passed to the ALV. And whatever you write inside that form
can be called through the function module.
What you are trying to do is modify the internal table with the form name, which does not exsist. Instead of this append it.
There are lot of example of this ALV list events.
DATA: T_EVENT TYPE SLIS_T_EVENT,
W_EVENT TYPE SLIS_ALV_EVENT.
CLEAR W_EVENT.
W_EVENT-FORM = SLIS_EV_AFTER_LINE_OUTPUT.
W_EVENT-NAME = SLIS_EV_AFTER_LINE_OUTPUT."AFTER_LINE_OUTPUT event
APPEND W_EVENT TO T_EVENT.
Thanks & Regards,
Tapodipta Khan -
Doubt in hiding columns in ALV list
Hi Experts ,
I am working on block ALV list . I need to hide certain columns in the list based on condition . For example : ALV structure has fields such MATNR MEINS MBRSH MTART
For a particular material if ITAB-MEINS EQ C_SPACE . Then the column - MEINS should be hidden for particular material record.
Could anyone suggest me code for this logic .
Thanks ,
Kumaran.CHi Rajnesh ,
Thanks for that reply , But one doubt .
Should we have to loop the ITAB before creating the feildcatalog ?
say for ex :
loop at itab.
if itab-meins eq c_space.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-selfield_m = 'UOM'.
fieldcatalog-col_pos = 3.
fieldcatalog-no_out = 'MEINS'.
append fieldcatalog from fieldcatalog.
end if.
endloop.
is this the way to code the above logic , pls explain .
Thanks,
Kumaran.C -
Doubt regarding editable ALV report using Classes
I need to create an ALV report and make few fields editable
and i need to update the changes to the corresponding database tables
for that please suggest me some idea or provide me sample code for that
urgentHi ramesh,
Please check this example program. I think it will help for some extent.
[code]&----
*& Report ZSUMA_INTERACTIVEREPORT *
report zsuma_interactivereport.
tables: vbak.
data :gr_alvgrid type ref to cl_gui_alv_grid,
gr_cc_name type scrfname value 'CC_ALV',
gr_ccontainer type ref to cl_gui_custom_container,
gr_fieldcat type lvc_t_fcat,
gr_layout type lvc_s_layo,
gr_sort type lvc_t_sort,
gr_get_cell type lvc_t_cell,
gr_set_cell type lvc_t_cell,
gr_hyper type lvc_t_hype,
gr_drop_down type lvc_t_drop,
is_variant type disvariant,
line_number type lvc_s_roid-row_id,
line(5) type c ,
cell_value type lvc_value.
data: begin of it_vbak occurs 0,
vbeln type vbak-vbeln,
erdat like vbak-erdat,
erzet like vbak-erzet,
netwr like vbak-netwr,
waerk like vbak-waerk,
*Below field is useful for making the entire row with different colors.
it must be a char of 4.and layout-info_fname should populate with
*this field.
rowcolor(4) type c,
*Below field is useful for making the INDIVIDUAL CELL with different
*colors.for this we have to include structure of type lvc_t_scol.
*layout-ctab_fname should be populate with this field.
cellcolor type lvc_t_scol,
*below field is added for for providing the hyperlinks to perticular
*field. at the time of field catalog , it_fcatalog-web_field should be
*populate with this field.
vbeln_hyper type int4,
*For displaying one cell as button.we have to declare one styles
*internal table .it has to be populate.at layout structure this table
*name has to be populate at layout-stylename.
cellstyle type lvc_t_styl,
end of it_vbak.
*& SELECTION SCREEN
selection-screen begin of block b1 with frame title text-001.
select-options s_vbeln for vbak-vbeln.
selection-screen end of block b1.
start-of-selection.
select vbeln
erdat
erzet
netwr
waerk
from vbak
into corresponding fields of table it_vbak
where vbeln in s_vbeln.
data: wa_cellcolor type lvc_s_scol,
wa_style type lvc_s_styl.
loop at it_vbak.
FOR ROW COLORING
if sy-tabix = 1.
it_vbak-rowcolor = 'C511'.
FOR PUTTING THE HYPERLINKS ON VBELN FIELD
it_vbak-vbeln_hyper = '1'.
modify it_vbak.
endif.
FOR CELL COLORING
if sy-tabix = 2.
wa_cellcolor-fname = 'ERZET'.
wa_cellcolor-color-col = '6'.
wa_cellcolor-color-int = '1'.
wa_cellcolor-color-inv = '1'.
append wa_cellcolor to it_vbak-cellcolor.
modify it_vbak index 2.
endif.
FOR DISPLAYING THE CELL AS A BUTTON
clear it_vbak-cellstyle.
at last.
read table it_vbak index sy-tabix.
wa_style-fieldname = 'NETWR'.
wa_style-style = cl_gui_alv_grid=>mc_style_button.
append wa_style to it_vbak-cellstyle .
modify it_vbak .
endat.
endloop.
if not it_vbak[] is initial.
call screen 100.
endif.
*CLASS DEFINITION FOR HANDLING THE EVENTS IN ALV GRID
class gr_event_handler definition.
public section.
methods:handle_hotspot_click
for event hotspot_click of cl_gui_alv_grid
importing e_row_id e_column_id es_row_no.
endclass.
*CLASS IMPLEMENTATIONFOR HANDLING THE EVENTS IN ALV GRID
class gr_event_handler implementation.
method handle_hotspot_click.
perform handle_hotspot_click using e_row_id e_column_id es_row_no.
endmethod.
endclass.
*& Form BUILDING_FIELDCATALOG
text
<--P_GR_FIELDCAT text
form building_fieldcatalog changing p_gr_fieldcat type lvc_t_fcat.
data s_fieldcat type lvc_s_fcat.
s_fieldcat-fieldname = 'VBELN'.
s_fieldcat-outputlen = '15'.
s_fieldcat-col_pos = '1'.
s_fieldcat-coltext = 'DOCCUMENT NO.'.
s_fieldcat-key = ' '.
s_fieldcat-emphasize = 'C511'.
s_fieldcat-web_field = 'VBELN_HYPER'.
append s_fieldcat to p_gr_fieldcat .
clear s_fieldcat.
s_fieldcat-fieldname = 'ERDAT'.
s_fieldcat-outputlen = '15'.
s_fieldcat-col_pos = '2'.
s_fieldcat-coltext = 'REC CREATE DATE.'.
s_fieldcat-emphasize = 'C311'.
s_fieldcat-hotspot = 'X'.
append s_fieldcat to p_gr_fieldcat .
clear s_fieldcat.
s_fieldcat-fieldname = 'ERZET'.
s_fieldcat-outputlen = '15'.
s_fieldcat-col_pos = '3'.
s_fieldcat-coltext = 'TIME ENTRY.'.
*S_FIELDCAT-EMPHASIZE = 'C311'.
append s_fieldcat to p_gr_fieldcat .
clear s_fieldcat.
s_fieldcat-fieldname = 'NETWR'.
s_fieldcat-outputlen = '15'.
s_fieldcat-col_pos = '4'.
s_fieldcat-emphasize = 'C311'.
s_fieldcat-coltext = 'NET WEIGHT.'.
s_fieldcat-do_sum = 'X'.
append s_fieldcat to p_gr_fieldcat .
clear s_fieldcat.
s_fieldcat-fieldname = 'WAERK'.
s_fieldcat-outputlen = '5'.
s_fieldcat-col_pos = '5'.
s_fieldcat-emphasize = 'C511'.
s_fieldcat-coltext = 'CURR.'.
FOR PUTTING THE DROP DOWN BOX.
s_fieldcat-drdn_hndl = '1'.
s_fieldcat-edit = 'X'.
append s_fieldcat to p_gr_fieldcat .
clear s_fieldcat.
endform. " BUILDING_FIELDCATALOG
*& Form CREATE_CCONTAINER_INSTANCE
text
--> p1 text
<-- p2 text
form create_ccontainer_instance .
create object gr_ccontainer
exporting
container_name = gr_cc_name
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " CREATE_CCONTAINER_INSTANCE
*& Form CREATE_ALVGRID_INSTANCE
text
--> p1 text
<-- p2 text
form create_alvgrid_instance .
create object gr_alvgrid
exporting
i_parent = gr_ccontainer
exceptions
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " CREATE_ALVGRID_INSTANCE
*& Form DISPLAYING_ALVGRID
text
--> p1 text
<-- p2 text
form displaying_alvgrid .
call method gr_alvgrid->set_table_for_first_display
exporting
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
is_variant = is_variant
i_save = 'A'
I_DEFAULT = 'X'
is_layout = gr_layout
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
it_hyperlink = gr_hyper
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
changing
it_outtab = it_vbak[]
it_fieldcatalog = gr_fieldcat
it_sort = gr_sort
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*CALL METHOD GR_ALVGRID->GET_FRONTEND_LAYOUT
IMPORTING
ES_LAYOUT = GR_LAYOUT
*GR_LAYOUT-GRID_TITLE = 'HAI ALV'.
*CALL METHOD GR_ALVGRID->SET_FRONTEND_LAYOUT
EXPORTING
IS_LAYOUT = GR_LAYOUT
endform. " DISPLAYING_ALVGRID
*& Form REFRESH_DISPLAY_TABLE
text
--> p1 text
<-- p2 text
form refresh_display_table .
call method gr_alvgrid->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
exceptions
finished = 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.
endform. " REFRESH_DISPLAY_TABLE
*& Form SETTING_LAYOUT
text
<--P_GR_LAYOUT text
form setting_layout changing p_gr_layout type lvc_s_layo.
p_gr_layout-grid_title = 'ALV GRID USING ABAP OBJECTS'.
p_gr_layout-zebra = 'X'.
p_gr_layout-no_toolbar = ''.
p_gr_layout-sel_mode = 'D'.
p_gr_layout-info_fname = 'ROWCOLOR'.
p_gr_layout-ctab_fname = 'CELLCOLOR'.
p_gr_layout-stylefname = 'CELLSTYLE'.
endform. " SETTING_LAYOUT
*& Module STATUS_0100 OUTPUT
text
module status_0100 output.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
set pf-status 'MENU'.
if gr_alvgrid is initial.
*CREATING THE CONTAINER INSTANCE BY SENDING THE CONTAINER NAME( IT HAS
*TO COINSIDE WITH COSTUM CONTROL NAME OF TRANSACTION SCREEN
perform create_ccontainer_instance.
perform create_alvgrid_instance.
*VARIANT POPULATION.
perform setting_variants changing is_variant.
*BELOW FORM IS USEFUL TO FILL THE HYPER LINK TABLE AND WE PASS THAT
*TABLE TO 'IT_HYPERLINK' PARAMETER IN FIRST DISPLAY METHOD.
perform setting_hyperlinks_field changing gr_hyper.
*TO MAKE THE COLOUMN AS DROP DOWN.
perform setting_dropdown_column changing gr_drop_down.
perform building_fieldcatalog changing gr_fieldcat.
perform setting_layout changing gr_layout.
perform setting_sorting changing gr_sort.
perform setting_cells changing gr_set_cell.
perform displaying_alvgrid.
*PERFORM GETTING_CELL_DETAILS CHANGING GR_GET_CELL. " IT IS NOT WORKING
FOR ME AND I HAVE DOUBT .
perform creating_event_object.
*PERFORM REFRESH_DISPLAY_TABLE.
endif.
endmodule. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
module user_command_0100 input.
case sy-ucomm.
when 'BACK'.
leave to screen 000.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
*& Form SETTING_SORTING
text
<--P_GR_SORT text
form setting_sorting changing p_gr_sort type lvc_t_sort.
data: lr_sort type lvc_s_sort.
lr_sort-spos = '1'.
lr_sort-fieldname = 'VBELN'.
lr_sort-up = 'X'.
append lr_sort to p_gr_sort.
lr_sort-spos = '2'.
lr_sort-fieldname = 'ERDAT'.
lr_sort-up = 'X'.
append lr_sort to p_gr_sort.
endform. " SETTING_SORTING
*& Form GETTING_CELL_DETAILS
text
<--P_GR_GET_CELL text
form getting_cell_details changing p_gr_get_cell.
call method gr_alvgrid->get_selected_cells
importing
et_cell = p_gr_get_cell
*CELL_VALUE = P_GR_GET_CELL-VALUE.
endform. " GETTING_CELL_DETAILS
*& Form SETTING_CELLS
text
<--P_GR_SET_CELL text
form setting_cells changing p_gr_set_cell type lvc_t_cell.
data:s_gr_set_cell type lvc_s_cell.
s_gr_set_cell-col_id-fieldname = 'NETWR'.
s_gr_set_cell-row_id-index = '3'.
append s_gr_set_cell to p_gr_set_cell.
call method gr_alvgrid->set_selected_cells
exporting
it_cells = p_gr_set_cell.
endform. " SETTING_CELLS
*& Form SETTING_HYPERLINKS_FIELD
text
<--P_GR_HYPER text
form setting_hyperlinks_field changing p_gr_hyper type lvc_t_hype.
data: is_hype type lvc_s_hype.
is_hype-handle = '1'.
is_hype-href = 'HTTP://WWW.GOOGLE.CO.IN'.
append is_hype to p_gr_hyper.
is_hype-handle = '2'.
is_hype-href = 'HTTP://SDN.SAP.COM'.
append is_hype to p_gr_hyper.
endform. " SETTING_HYPERLINKS_FIELD
*& Form SETTING_DROPDOWN_COLUMN
text
<--P_GR_DROP_DOWN text
form setting_dropdown_column changing p_gr_drop_down type lvc_t_drop.
data: wa_drop type lvc_s_drop.
wa_drop-handle = '1'.
wa_drop-value = '$'.
append wa_drop to p_gr_drop_down.
wa_drop-handle = '1'.
wa_drop-value = 'Rs'.
append wa_drop to p_gr_drop_down.
wa_drop-handle = '1'.
wa_drop-value = 'CUR'.
append wa_drop to p_gr_drop_down.
call method gr_alvgrid->set_drop_down_table
exporting
it_drop_down = p_gr_drop_down
IT_DROP_DOWN_ALIAS =
endform. " SETTING_DROPDOWN_COLUMN
*& Form SETTING_VARIANTS
text
<--P_IS_VARIANT text
form setting_variants changing p_is_variant type disvariant.
p_is_variant-report = sy-repid.
endform. " SETTING_VARIANTS
*& Form HANDLE_HOTSPOT_CLICK
text
-->P_E_ROW text
-->P_E_COLUMN text
-->P_E_ROW_NO text
form handle_hotspot_click using p_e_row_id type lvc_s_row
p_e_column_id type lvc_s_col
p_es_row_no type lvc_s_roid.
read table it_vbak index p_es_row_no-row_id.
if sy-subrc = 0 and p_e_column_id-fieldname = 'ERDAT'.
line = p_es_row_no-row_id.
line_number = p_es_row_no-row_id.
leave to screen 200.
endif.
endform. " HANDLE_HOTSPOT_CLICK
*& Form CREATING_EVENT_OBJECT
text
--> p1 text
<-- p2 text
form creating_event_object .
data event_handle type ref to gr_event_handler.
create object event_handle.
set handler event_handle->handle_hotspot_click for gr_alvgrid.
endform. " CREATING_EVENT_OBJECT
*& Module STATUS_0200 OUTPUT
text
module status_0200 output.
set pf-status 'BB'.
SET TITLEBAR 'xxx'.
*LINE = LINE_NUMBER.
endmodule. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
text
module user_command_0200 input.
if sy-ucomm = 'BACK'.
leave to screen 100.
endif.
endmodule. " USER_COMMAND_0200 INPUT[/code]
Reward points if helpful
Thanks,
Suma. -
how can i page breakin alv report ?
what are the types of variants and events in alv report?
how to hide field in alv?
how to change standard pf status in alv reports?
plz give me sample program for how to use variants in alv?
<THREAD LOCKED. Please stop asking interview questions. There is already a lot of information out there, refer to the [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] on how to ask a good question and learn to search>
Edited by: Mike Pokraka on Oct 15, 2008 4:52 PMhow can i page breakin alv report ?
- Yes... using NEW-PAGE
what are the types of variants and events in alv report?
- DATA: g_variant LIKE disvariant.
- DATA: gt_eventos TYPE slis_t_event.
how to hide field in alv?
- When you define the field catalog mark this field ls_fieldcat-no_out = 'X'.
how to change standard pf status in alv reports?
CLEAR ls_extab.
ls_extab-fcode = 'ZASSIG'.
APPEND ls_extab TO extab.
SET PF-STATUS 'Z09_STATUS' EXCLUDING extab. -
Hi Expart,
In ALV report ,what is the work of
1) REUSE_ALV_VARIANT_DEFAULT_GET function module
2) SLIS_LAYOUT_ALV
Regards
BhabaniHi,
1.SELECTING THE VARIANTS FOR INITIAL LIST DISPLAY (DEFAULT VARIANT)
The variants in the list display can be both user-specific and general. The user can programmatically set the initial (default) variant for list display.
The default variant can be found using the function module 'REUSE_ALV_VARIANT_DEFAULT_GET'.
Sample code:
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = variant save condition ( A=all, U = user-specific )
CHANGING
cs_variant = internal table containing the program name (and the default variant---optional )
EXCEPTIONS
not_found = 2.
2.A layout is build for the report output list description USING the internal table declared above (I_LAYOUT).
Output list description structure.
The parameters are described under the following heads:
Display options
Exceptions
Totals
Interaction
Detail screen
Display variants (only for hierarchical-sequential lists)
Color
Other
The layout table is of type slis_layout_alv_spec and has the following fields:
Reward,if useful.
Thanks,
Chandu -
Doubt in ALV grid (OO ALV) download to Excel
Hi All,
I done Report using OOALV when down loading to Excel one row got automatically inserted to the ALV Excel downloaded sheet at the top and the row contains Sy datum , Dynamic list display , page no
my requirement is to delete that row. Is that possible. If so please suggest me how to handle that
Thanks
KiranHi,
Check this link:
Re: Digit missing in the alv export
Hope this helps.
Regards,
Satish Kanteti -
Hi!
In Block AlV we r using Fun Mod
REUSE_ALV_BLOCK_LIST_APPEND
To display data in blocks and called again to display other data in block in same screen.
I want to know REUSE_ALV_BLOCK_LIST_DISPLAY Fun mod is optional or mandatory
without using this also shall i get the required o/p.
Looking for your reply.
Rahul.REUSE_ALV_BLOCK_LIST_DISPLAY is mandatory, without calling this FM, you will not get any disply.
In the below ALV if you comment out t REUSE_ALV_BLOCK_LIST_DISPLAY FM call call you will not get disply.
REPORT ztest1 .
TABLES: ekko, mara.
TYPE-POOLS: slis.
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
TYPES: BEGIN OF t_mara,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
matkl TYPE mara-matkl,
END OF t_mara.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
it_mara TYPE STANDARD TABLE OF t_mara INITIAL SIZE 0.
*ALV data declarations
DATA: fieldcatalog1 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
fieldcatalog2 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_layout TYPE slis_layout_alv,
gt_events_ekko TYPE slis_t_event,
xs_event TYPE slis_alv_event,
gt_events_mara TYPE slis_t_event,
gd_repid TYPE sy-repid,
gt_print TYPE slis_print_alv.
* START-OF-SELECTION
START-OF-SELECTION.
PERFORM data_retrival.
PERFORM build_fieldcat.
PERFORM build_layout.
PERFORM events_ekko.
PERFORM events_mara.
PERFORM display_alv_report.
*SUBROUTINES
*& Form data_retrival
FORM data_retrival .
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekko.
SELECT matnr mtart matkl
UP TO 10 ROWS
FROM mara
INTO TABLE it_mara.
ENDFORM. " data_retrival
*& Form build_fieldcat
FORM build_fieldcat .
* FOR EKKO
fieldcatalog1-fieldname = 'EBELN'.
fieldcatalog1-seltext_m = 'Purchase Order'.
fieldcatalog1-col_pos = 0.
fieldcatalog1-outputlen = 10.
fieldcatalog1-emphasize = 'X'.
fieldcatalog1-key = 'X'.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'EBELP'.
fieldcatalog1-seltext_m = 'PO Item'.
fieldcatalog1-col_pos = 1.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'STATU'.
fieldcatalog1-seltext_m = 'Status'.
fieldcatalog1-col_pos = 2.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'AEDAT'.
fieldcatalog1-seltext_m = 'Item change date'.
fieldcatalog1-col_pos = 3.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'MATNR'.
fieldcatalog1-seltext_m = 'Material Number'.
fieldcatalog1-col_pos = 4.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'MENGE'.
fieldcatalog1-seltext_m = 'PO quantity'.
fieldcatalog1-col_pos = 5.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'MEINS'.
fieldcatalog1-seltext_m = 'Order Unit'.
fieldcatalog1-col_pos = 6.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'NETPR'.
fieldcatalog1-seltext_m = 'Net Price'.
fieldcatalog1-col_pos = 7.
fieldcatalog1-outputlen = 15.
fieldcatalog1-do_sum = 'X'. "Display column total
fieldcatalog1-datatype = 'CURR'.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
fieldcatalog1-fieldname = 'PEINH'.
fieldcatalog1-seltext_m = 'Price Unit'.
fieldcatalog1-col_pos = 8.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
* FOR MARA
fieldcatalog2-fieldname = 'MATNR'.
fieldcatalog2-seltext_m = 'Material No'.
fieldcatalog2-col_pos = 0.
fieldcatalog2-outputlen = 10.
fieldcatalog2-emphasize = 'X'.
fieldcatalog2-key = 'X'.
APPEND fieldcatalog2 TO fieldcatalog2.
CLEAR fieldcatalog1.
fieldcatalog2-fieldname = 'MTART'.
fieldcatalog2-seltext_m = 'Material type'.
fieldcatalog2-col_pos = 1.
APPEND fieldcatalog2 TO fieldcatalog2.
CLEAR fieldcatalog2.
fieldcatalog2-fieldname = 'MATKL'.
fieldcatalog2-seltext_m = 'Material Group'.
fieldcatalog2-col_pos = 2.
APPEND fieldcatalog2 TO fieldcatalog2.
CLEAR fieldcatalog2.
ENDFORM. " build_fieldcat
*& Form build_layout
FORM build_layout .
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
ENDFORM. " build_layout
*& Form events_ekko
FORM events_ekko .
CLEAR xs_event.
xs_event-name = slis_ev_top_of_page.
xs_event-form = 'TOP_OF_PAGE-EKKO'.
APPEND xs_event TO gt_events_ekko.
CLEAR xs_event.
xs_event-name = slis_ev_end_of_list.
xs_event-form = 'END_OF_LIST_EKKO'.
APPEND xs_event TO gt_events_ekko.
ENDFORM. " events_ekko
*& Form TOP_OF_PAGE-EKKO
FORM top_of_page-ekko.
WRITE: / 'TOP OF PAGE : Purchase Order'.
ENDFORM. "XTOP_OF_PAGE
*& Form END_OF_LIST_EKKO
FORM end_of_list_ekko.
WRITE: / 'end OF list : Purchase Order'.
ENDFORM. "END_OF_LIST_EKKO
*& Form events_mara
FORM events_mara .
CLEAR xs_event.
xs_event-name = slis_ev_top_of_list.
xs_event-form = 'TOP_OF_LIST-MARA'.
APPEND xs_event TO gt_events_mara.
CLEAR xs_event.
xs_event-name = slis_ev_end_of_page.
xs_event-form = 'END_OF_PAGE_MARA'.
APPEND xs_event TO gt_events_mara.
ENDFORM. "events_mara
*& Form TOP_OF_LIST-MARA
FORM top_of_list-mara.
WRITE: / 'TOP OF LIST : Material Master'.
ENDFORM. "TOP_OF_LIST-MARA
*& Form END_OF_PAGE_MARA
FORM end_of_page_mara.
WRITE: / 'End OF Page : Material Master'.
ENDFORM. "END_OF_PAGE_MARA
*& Form display_alv_report
FORM display_alv_report .
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = sy-repid.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gd_layout
it_fieldcat = fieldcatalog1[]
i_tabname = 'it_ekko'
it_events = gt_events_ekko
TABLES
t_outtab = it_ekko
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gd_layout
it_fieldcat = fieldcatalog2[]
i_tabname = 'it_mara'
it_events = gt_events_mara
TABLES
t_outtab = it_mara
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
gt_print-reserve_lines = 2.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
is_print = gt_print.
ENDFORM. " display_alv_report -
Hi All
I am creating a ALV report and had realized that we can use REUSE_ALV_FIELDCATALOG_MERGE to create a fieldcatalog.
However in I_STRUCTURE_NAME parameters I have to pass only structure that are defined in DDIC. I can"t pass my internal table defined for output.
So this option maynot be much useful. instead I can build fieldcatalog manually.
Am I right ? also at this time I am only concentrating on ALV using Functional Modules. Please let me know.
Regards
Madhu.Hi ERIC and others,
Thanks you once again.
Can you please let me know where I am doing mistake, i am not getting totals on price but I getting sort on carrid and they are grouping.
Please help me.
REPORT ZALV_REPORT_SFLIGHT.
TABLES : SFLIGHT.
TYPE-POOLS : SLIS.
DATA : IT_SFLIGHT TYPE TABLE OF SFLIGHT.
**DATA DECLARTION
DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GD_sort type STANDARD TABLE OF slis_sortinfo_alv WITH HEADER LINE,
I_REPID LIKE SY-REPID.
i_repid = sy-repid.
perform get_data.
perform build_fieldcat.
perform display.
*& Form get_data
form get_data .
select * from sflight into table it_sflight.
endform. " get_data
*& Form build_fieldcat
form build_fieldcat .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = i_repid
I_INTERNAL_TABNAME = 'IT_SFLIGHT'
I_STRUCTURE_NAME = 'SFLIGHT'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = FIELDCATALOG[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
GD_sort-fieldname = 'CARRID'.
GD_sort-tabname = 'SFLIGHT'.
*GD_sort-up =
*GD_sort-down =
*GD_sort-group = 'X'.
GD_sort-subtot = 'X'.
append gd_sort TO GD_SORT.
endform. " build_fieldcat
*& Form display
form display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = I_REPID
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = FIELDCATALOG[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GD_sort[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_SFLIGHT
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.
endform. " display
Thank you -
Doubt in Alv Report Coloumn Heading
Hi Gurus
I want to print 2 coloumn headings in ALv Report.
For eg: 1st line coloumn heading contains
Name Number Date status
2nd line coloumn heading contains under status
Active Incative
Then if my list size is not enough to show the full details. so i can cut it in 2 lines
if my list contains 20 coloumns
i have to put 10 coloumns in first line
then remaning 10 coloums in second line.
i want the solution for both the questions.
Help me.
Regards.
Bhuvana.For the first issue
Use Top of Page Event to write a simple list which will act as a header for the alv list.
Second issue:
In the fieldcat,
Position all the first 10 coloums row_pos = 1
Position all the next 10 coloums row_pos = 2
Regards,
Lijo Joseph
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 14, 2008 12:35 PM -
hi,
I am trying to pass top of page to my alv report.
DATA : TY_EVENTS TYPE SLIS_ALV_EVENT,
IT_EVENTS TYPE SLIS_T_EVENT.
CLEAR TY_EVENTS.
TY_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
TY_EVENTS-FORM = 'TOP_OF_PAGE'.
APPEND TY_EVENTS TO IT_EVENTS.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME = 'itab'
IS_LAYOUT = s_layout
IT_FIELDCAT = t_fieldcatalog[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = IT_EVENTS
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
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
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.
Now i have to write the code for top of page in the perform 'TOP_OF_PAGE'.
My problem is when i double click the 'TOP_OF_PAGE'
in here TY_EVENTS-FORM = 'TOP_OF_PAGE'.
,its not creating a form but insted it is asking
Program text 'TOP_OF_PAGE' does not exist.
Do you want to create the object .
and when i click yes its taking to text elements
I need to get some like this
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
SKIP.
ULINE.
WRITE :/2 ' DATE :', SY-DATUM,
ENDFORM. "TOP_OF_PAGE
waiting for replies
How do i get the form so that i can write the code for my top of pagehi Preeti,
if you click on the 'TOP_OF_PAGE', it will not create a form routine, because, the name of the form is passed as a character text to the function module. So you need to manually write the form routine with the name top_of_page.
Please use the following code; your requirement would be met!!!!
form top_of_page.
data:
ls_line type slis_listheader,
lt_line type table of slis_t_listheader,
lv_date(10).
ls_line-typ = 'H'.
concatenate sy-datum6(2) sy-datum4(2) sy-datum+0(4)
into lv_date separated by '/'.
concatenate 'Date' lv_date into ls_line-info
separated by space.
append ls_line to lt_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = lt_line.
endform.
Hope this works.
Sajan. -
Hi Frds,
A13001 : is Material Number..
I have maintained text in material master
1st : RMCODE1 RMDECSRIPTION1 USAGE1
2nd : RMCODE2 RMDECSRIPTION1 USAGE2
Present output is A13001 : RMCODE1 RMDECSRIPTION1 USAGE1 RMCODE2 RMDECSRIPTION1 USAGE2
My customer is asking in alv output as given below...
A13001 : RMCODE1 RMDECSRIPTION1 USAGE1
A13001 : RMCODE2 RMDECSRIPTION1 USAGE2
For reference screen shot attached........
Pls help me ........
Regards,
KabilHi Sreekanth,
Pls find my piece of code as you said...........
FORM fill_final .
DATA : it_tline TYPE TABLE OF tline,
wa_tline LIKE LINE OF it_tline.
DATA : text(250) TYPE c.
DATA : wrk_name TYPE thead-tdname.
REFRESH gt_final.
LOOP AT gt_mara INTO gw_mara.
MOVE: gw_mara-matnr TO gw_final-matnr,
gw_mara-werks TO gw_final-werks.
READ TABLE gt_makt INTO gw_makt WITH KEY matnr = gw_mara-matnr.
IF sy-subrc = 0.
MOVE : gw_makt-maktx TO gw_final-maktx.
ENDIF.
REFRESH : it_tline.
CLEAR : wrk_name.
wrk_name = gw_final-matnr.
* CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
* EXPORTING
* input = gw_final-line1
* IMPORTING
* output = gw_final-line1
* EXCEPTIONS
* length_error = 1
* OTHERS = 2.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id = 'GRUN'
language = 'E'
name = wrk_name
object = 'MATERIAL'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
lines = it_tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_tline INTO wa_tline.
CASE sy-tabix.
WHEN 1.
gw_final-line1 = wa_tline-tdline.
WHEN 2.
gw_final-line2 = wa_tline-tdline.
WHEN 3.
gw_final-line3 = wa_tline-tdline.
WHEN 4.
gw_final-line4 = wa_tline-tdline.
ENDCASE.
ENDLOOP.
REFRESH : it_tline.
CLEAR : wrk_name.
wrk_name = gw_final-matnr.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id = 'IVER'
language = 'E'
name = wrk_name
object = 'MATERIAL'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
lines = it_tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_tline INTO wa_tline.
CASE sy-tabix.
WHEN 1.
gw_final-line5 = wa_tline-tdline.
WHEN 2.
gw_final-line6 = wa_tline-tdline.
WHEN 3.
gw_final-line7 = wa_tline-tdline.
WHEN 4.
gw_final-line8 = wa_tline-tdline.
ENDCASE.
ENDLOOP.
APPEND gw_final TO gt_final.
CLEAR gw_final.
ENDLOOP.
ENDFORM. " FILL_FINAL -
Hi,
I have few doubts in Reuse_Alv_List_Display.
1. How to use It_Filter?
2. Their is a direct filter option in he list display. then what is the need of this It_Filter?
Thanks.Hi ajay
Use
Set current filter settings. A row of the table describes the selection conditions for column entries that are not to be displayed.
You should never manually set up the internal table with the filter settings. Use this method only to set filter criteria that you got using get_filter_criteria or a layout.
Features
CALL METHOD <ref. var. to CL_GUI_ALV_GRID > ->set_filter_criteria
EXPORTING
IT_FILTER = <internal table of type LVC_T_FILT > .
<b>IT_FILTER</b>
Table with filter properties for columns for which a filter is to be set initially
check this link
http://sap.ittoolbox.com/groups/technical-functional/sap-dev/top_of_page-top_of_list-using-alvgrid-functions-617843
http://www.sap-basis-abap.com/sapalv.htm
Rewards if helpfull
Regards
Pavan
Maybe you are looking for
-
RAR 5.3 SP10 Mitigating Control Import Utility
All - I exported my mitigating controls from a RAR 5.3 SP9 system and imported them into a 5.3 SP10 system. I received a successful confirmation of the import, but when I "searched" my mitigating controls there were duplicated mitigating control numb
-
Buildserver error when using aCC
Hi, When trying to buildserver on HPUX11 using aCC i get the following errors... arning 829: "BS-5be9.c", line 18 # Implicit conversion of string literal to 'ch ar *' is deprecated. { "Esa_aSanoma", "Esa_aSanoma", (void (*) _((TPSVCINFO *))) Esa_aS ^
-
ADS Error when opening Benefits Confirmation Statement
Hello, I am on EP7.0 NW04s ECC6.0 and trying to open Benefits Confirmation Statement in ESS and when clicking on it I get the following error with the SAP GUI in the portal saying : ADS : Request Start Time : Tue Oct 09 13:43:00 CDT 2007(200101) and
-
Flash plugin crash frequency has gone up in latest Firefox update
I am a webmaster for ezHomeHeating.com and have noticed that some of my flash content often ends up crashing on Firefox 22.0. This problem was pointed out to me by some site visitors and I found out that it seems be happening mostly in Firefox 22.0 -
-
Problem adding attribute dimension
Version: 9.2 Cube: ASO I feel like I am dropping the ball. I am trying to add an attribute to my ASO cube at the bottom of my outline. Everything I try to edit the member properties I get an "Attribute Calculations dimension can not be created". I do