ALV REPORT BY USING TOP_OF_PAGE
HI,
firends i want the code for the top_of_page procedure in ALV REPORT,
SO i can display data on top of my report .
REGARDS
SHAFEEQ AHMED
hi,
check this...
REPORT ZTEST .
type-pools: slis.
data: x_fieldcat type slis_fieldcat_Alv,
it_fieldcat type slis_t_fieldcat_alv,
x_events type slis_alv_event,
it_events type SLIS_T_EVENT.
data: begin of itab occurs 0,
vbeln like vbak-vbeln,
posnr like vbap-posnr,
end of itab.
select vbeln
posnr
from vbap
up to 100 rows
into table itab.
x_events-name = 'TOP_OF_PAGE'.
x_events-form = 'TOP_OF_PAGE'.
append x_events to it_events.
clear x_events.
call function 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IT_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 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.
read table it_events into x_events with key name = 'TOP_OF_PAGE'.
if sy-subrc = 0.
x_events-form = 'TOP_OF_PAGE'.
modify it_events from x_events index sy-tabix transporting form .
endif.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_INTERNAL_TABNAME = 'ITAB'
I_INCLNAME = sy-repid
changing
ct_fieldcat = IT_FIELDCAT
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.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FIELDCAT
IT_EVENTS = IT_EVENTS
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 TOP_OF_PAGE.
DATA: LS_LINE TYPE SLIS_LISTHEADER,
E04_LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
Listenüberschrift: Typ H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
LS_LINE-KEY: not used for this type
LS_LINE-INFO = 'Summary'.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
Kopfinfo: Typ S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Test'.
LS_LINE-INFO = ''.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
LS_LINE-KEY = 'ASIA'.
LS_LINE-INFO = 'test'.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
Aktionsinfo: Typ A
CLEAR LS_LINE.
LS_LINE-TYP = 'A'.
LS_LINE-KEY: not used for this type
LS_LINE-INFO = TEXT-105.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = E04_LT_TOP_OF_PAGE
I_LOGO = 'ENJOYSAP_LOGO'.
ENDFORM.
Similar Messages
-
ALV Report Development using OOPs concept
complete details of " ALV Report Development using OOPs concept".
Thanks in advance ...hi Sudharshan,
please use these sample codes to understand about OOALV
BC_ALV_GRID_CONTROL
BC_ALVHIERGRID1_D100
BC_ALVHIERGRID1_D210
BC_ALVHIERGRID1_HIER
BC_ALV_DEMO_HTML_D0100
BC_ALV_GRID_CONTROL
BC_ALVEXCEL
BC_ALVEXCEL_D100
BC_ALVEXCEL_D210
BC_ALVEXCEL_HIER
BC_ALVEXCEL_SAP_TEMPL
BC_ALVEXCEL_SAP_TEMPL_F01
BC_ALVEXCEL_SAP_TEMPL_TOP
BC_ALVEXCELTOP
BC_ALVHIERGRID1_D100
BC_ALVHIERGRID1_D210
BC_ALVHIERGRID1_HIER
BC_ALVHIERTOP
For learning OOPS-ALV in every SAP their is transaction named ZALV
or try the following links:
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
The ALV object Grid methods allow the same functionality as ALV grid report function modules but are displayed within
a screen (dialog program). SAP has provided a suit of programs which demonstrate how to For examples see standard SAP
programs as detailed below:
BCALV_EDIT_01 This report illustrates the simplest case of using an editable/noneditable ALV Grid Control.
BCALV_EDIT_02 This report illustrates how to set chosen cells of an ALV Grid Control editable.
BCALV_EDIT_03 In this example the user may change values of fields SEATSOCC (occupied seats) and/or PLANETYPE.
The report checks the input value(s) semantically and provides protocol messages in case of error
BCALV_EDIT_04 This report illustrates how to add and remove lines to a table using the ALV Grid Control and how to
implement the saving of the new data.
BCALV_EDIT_05 This example shows how to use checkboxes within an ALV Grid Control. You learn:
(1) how to define a column for editable checkboxes for an attribute of your list
(2) how to evaluate the checked checkboxes
(3) how to switch between editable and non-editable checkboxes
BCALV_EDIT_06 This example shows how to define a dropdown listbox for all cells of one column in an editable ALV
Grid Control.
BCALV_EDIT_07 This example shows how to define dropdown listboxes for particular cells of your output table.
BCALV_EDIT_08 This report implements an ALV Grid Control with an application specific F4 help. The following aspects
are dealt with:
(1) how to replace the standard f4 help
(2) how to pass the selected value to the ALV Grid Control
(3) how to build an f4 help, whose value range depend on a value of another cell. -
Adding new rows after displaying subtotals in an ALV report by using OOABAP
Dear All,
I am creating an ALV report, displaying subtotals and total by using Classes. I have used classes CL_SALV_AGGREGATIONS (Method : add_aggregation) and CL_SALV_AGGREGATIONS (Method : add_sort) for sorting and doing subtotals.
Output of my report as follows :- (I have used * for displaying spaces between fields)
Materia*******Quantity**SerialNo*Equipment**Value***WBS Element
ISM-DBSVR****1********12363****31872565***2165***Q-0040358945.001010
ISM-DBSVR****1********12364****31872566***2165***Q-0040358945.001010
**************************************Subtotal***********4330
-> If the value of "Quantity" is greater than 1 then the value of subtotal for the field "Value" is to be divided by the Quantity for that line item and needs to be displayed Quantity, SerialNo, Value details information after subtotal .
-> Basically I need to add few more rows for displaying above additional information in the ALV grid after displaying subtotal .
Q: Do we have any methods for change the layout for the above requirement.
I Appreciate your early response.
Thank you.
RajaSekhar.Hi,
For such type of requirement you need to use ALV hierchical table.
You can have your main table in master table.
For quantity greater than 1 you need to move the data into a seperate internal table....this internal table will have material as the key between the main table and the second table.
*... §2 create an ALV hierseq table
try.
cl_salv_hierseq_table=>factory(
exporting
t_binding_level1_level2 = lt_binding
importing
r_hierseq = gr_hierseq
changing
t_table_level1 = gt_master
t_table_level2 = gt_slave ).
catch cx_salv_data_error cx_salv_not_found.
endtry.
you can display both the tables together with the subtotals also.
please refer to program SALV_DEMO_HIERSEQ_SIMPLE to see how to display the hierarchical display.
Plr reward points if found helpful.
Regards,
Mayank -
ALV report without using field catalogue manually
I am looking for alv report in which I will not create fieldcatalogue manually but pass the structure as it is and display the alv. Please provide me sample code.
Moderator message: Please do not use all upper case in the future.
Edited by: Thomas Zloch on Apr 1, 2010 12:31 PM - converted to lower caseUse the function module "REUSE_ALV_FIELDCATALOG_MERGE" to create the field catalog of all the fields in a structure
eg :
data : xfieldcat type slis_t_fieldcat_alv.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = sy-repid
i_internal_tabname = <internal table structure>
i_bypassing_buffer = 'X'
i_buffer_active = ' '
changing
ct_fieldcat = xfieldcat
exceptions
inconsistent_interface = 1
program_error = 2
others = 3.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = xfieldcat[]
tables
t_outtab = <internal table>.
Regards
Vinod
Edited by: Vinod Kumar on Apr 1, 2010 3:45 PM -
Hi
I waana develop an alv report(OOPS) using 3 different tables. I waana know since i have to output fields from 3 different tables depending upon selection criteria. So can any body tell me how to use field catalog or field catalog merge using class.... not function REUSE alvHello Preet,
For creating the Field catalog
Internal table for Field Catalog
DATA: G_T_FIELDCAT_C TYPE LVC_T_FCAT,
G_R_FIELDCAT TYPE LVC_S_FCAT.
FORM BUILD_FIELD_CATALOG .
DATA: L_F_COUNT TYPE I VALUE '0'.
*/ Add properties values to ALV Catalog
ADD 1 TO L_F_COUNT.
PERFORM ADD_CATALOG USING 'MTART' 'C' SPACE L_F_COUNT "Sales Org
TEXT-005 4 SPACE SPACE SPACE.
ADD 1 TO L_F_COUNT.
PERFORM ADD_CATALOG USING 'VKORG' 'C' SPACE L_F_COUNT "Sales Org
TEXT-001 4 SPACE SPACE SPACE.
ADD 1 TO L_F_COUNT.
PERFORM ADD_CATALOG USING 'MATNR' 'C' SPACE L_F_COUNT
TEXT-002 18 'MATN1' SPACE SPACE.
ADD 1 TO L_F_COUNT.
PERFORM ADD_CATALOG USING 'STAWN' 'C' SPACE L_F_COUNT
TEXT-004 13 SPACE SPACE SPACE.
ENDFORM. " build_field_catalog
FORM ADD_CATALOG USING P_FNAME
P_INTTYPE
P_KEY
P_COL_POS
P_COL_TEXT
P_INTLEN
P_CONV
P_EDIT
P_HOTSPOT.
CLEAR G_R_FIELDCAT.
G_R_FIELDCAT-FIELDNAME = P_FNAME.
G_R_FIELDCAT-INTTYPE = P_INTTYPE.
G_R_FIELDCAT-KEY = P_KEY.
G_R_FIELDCAT-COL_POS = P_COL_POS.
G_R_FIELDCAT-COLTEXT = P_COL_TEXT.
G_R_FIELDCAT-OUTPUTLEN = P_INTLEN.
G_R_FIELDCAT-CONVEXIT = P_CONV.
G_R_FIELDCAT-EDIT = P_EDIT.
G_R_FIELDCAT-HOTSPOT = P_HOTSPOT.
APPEND G_R_FIELDCAT TO G_T_FIELDCAT_C.
ENDFORM. " add_catalog
If useful reward.
Vasanth -
Hi frnds,
I want to write an alv report program using oops concepts.CAn anybody send me a simple code to generate an alv reports?
Thanks a lot in advance.Hi
http://www.sapdev.co.uk/reporting/alv/alvobjgrid/alvobject_sort.htm
*& Report ZLCL_ALV_INVOICE *
REPORT ZLCL_ALV_INVOICE .
TABLES: VBRK.
DATA: ITAB LIKE VBRP OCCURS 1 WITH HEADER LINE.
DATA: O_CONT TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
O_GRID TYPE REF TO CL_GUI_ALV_GRID.
START-OF-SELECTION.
SET SCREEN 100.
*& Form GET_DATA
text
FORM GET_DATA .
SELECT *
FROM VBRP
INTO TABLE ITAB
WHERE VBELN = VBRK-VBELN.
ENDFORM. " GET_DATA
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MENU'.
IF O_CONT IS INITIAL.
CREATE OBJECT O_CONT
EXPORTING
CONTAINER_NAME = 'INV_CONT' "Screen custom control 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 I000(Z00) WITH 'Error in custom container'.
EXIT.
ENDIF.
CREATE OBJECT O_GRID
EXPORTING
I_PARENT = O_CONT "Custom container class object
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in alv grid linking'.
EXIT.
ENDIF.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module SHOW_ALV_GRID INPUT
text
MODULE SHOW_ALV_GRID INPUT.
PERFORM GET_DATA.
CALL METHOD O_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'VBRP'
CHANGING
IT_OUTTAB = ITAB[]
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in showing alv grid'.
EXIT.
ENDIF.
ENDMODULE. " SHOW_ALV_GRID INPUT
you can understand very easily -
How we can use call transaction xd03 in alv report
hey guys i want now that how we can use call transaction xd03 in alv report by using various tables in report or coding.
can you tell me about that by the way of coding so that it can be easy for me to understand and help ful to make report by using alv report with many tables. so please send me .
Moderator message: it seems to be XD03 day today, please search for available information/documentation/previous discussions.
Edited by: Thomas Zloch on Nov 25, 2011 1:24 PMWhere?
Max -
TOP-OF-PAGE During line-selection in alv report
Hi Expart
In intractive Alv report u using top-of-page during line-selection . If u using so u give me one example with codeing .
Regards
BhabaniHi,
try this code...
*& Report ZCS_PRG8
REPORT Z_SJALV__PRG8.
TYPE-POOLS: SLIS.
*type declaration for values from ekko
TYPES: BEGIN OF I_EKKO,
EBELN LIKE EKKO-EBELN,
AEDAT LIKE EKKO-AEDAT,
BUKRS LIKE EKKO-BUKRS,
BSART LIKE EKKO-BSART,
LIFNR LIKE EKKO-LIFNR,
END OF I_EKKO.
DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
WA_EKKO TYPE I_EKKO.
*type declaration for values from ekpo
TYPES: BEGIN OF I_EKPO,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
END OF I_EKPO.
DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
WA_EKPO TYPE I_EKPO .
*variable for Report ID
DATA: V_REPID LIKE SY-REPID .
*declaration for fieldcatalog
DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
declaration for events table where user comand or set PF status will
be defined
DATA: V_EVENTS TYPE SLIS_T_EVENT,
WA_EVENT TYPE SLIS_ALV_EVENT.
declartion for layout
DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
declaration for variant(type of display we want)
DATA: I_VARIANT TYPE DISVARIANT,
I_VARIANT1 TYPE DISVARIANT,
I_SAVE(1) TYPE C.
*PARAMETERS : p_var TYPE disvariant-variant.
*Title displayed when the alv list is displayed
DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
INITIALIZATION.
V_REPID = SY-REPID.
PERFORM BUILD_FIELDCATLOG.
PERFORM EVENT_CALL.
PERFORM POPULATE_EVENT.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_REPORT.
*& Form BUILD_FIELDCATLOG
Fieldcatalog has all the field details from ekko
FORM BUILD_FIELDCATLOG.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'AEDAT'.
WA_FIELDCAT-SELTEXT_M = 'DATE.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'LIFNR'.
WA_FIELDCAT-NO_OUT = 'X'.
WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG
*& Form EVENT_CALL
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 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. "EVENT_CALL
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
ENDIF.
ENDFORM. "POPULATE_EVENT
*& Form data_retrieval
retreiving values from the database table ekko
FORM DATA_RETRIEVAL.
SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
ENDFORM. "data_retrieval
*& Form bUild_listheader
text
-->I_LISTHEADEtext
FORM BUILD_LISTHEADER USING IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA HLINE TYPE SLIS_LISTHEADER.
HLINE-INFO = 'this is my first alv pgm'.
HLINE-TYP = 'H'.
ENDFORM. "build_listheader
*& Form display_alv_report
text
FORM DISPLAY_ALV_REPORT.
V_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = I_TITLE_EKKO
I_GRID_SETTINGS =
IS_LAYOUT = ALV_LAYOUT
IT_FIELDCAT = I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'ZLAY1'
I_SAVE = 'A'
is_variant = i_variant
IT_EVENTS = V_EVENTS
TABLES
T_OUTTAB = IT_EKKO
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_alv_report
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
PERFORM BUILD_FIELDCATLOG_EKPO.
PERFORM EVENT_CALL_EKPO.
PERFORM POPULATE_EVENT_EKPO.
PERFORM DATA_RETRIEVAL_EKPO.
PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_EKPO.
ENDCASE.
ENDFORM. "user_command
*& Form BUILD_FIELDCATLOG_EKPO
text
FORM BUILD_FIELDCATLOG_EKPO.
WA_FIELDCAT-TABNAME = 'IT_EKPO'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKPO'.
WA_FIELDCAT-FIELDNAME = 'EBELP'.
WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MENGE'.
WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-SELTEXT_M = 'UOM'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'NETPR'.
WA_FIELDCAT-SELTEXT_M = 'PRICE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG_EKPO
*& Form event_call_ekpo
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL_EKPO.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 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. "event_call_ekpo
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT_EKPO.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
ENDFORM. "POPULATE_EVENT
*& Form TOP_OF_PAGE
text
FORM F_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
*retreiving values from the database table ekko
FORM DATA_RETRIEVAL_EKPO.
SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
ENDFORM.
FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA: HLINE1 TYPE SLIS_LISTHEADER.
HLINE1-TYP = 'H'.
HLINE1-INFO = 'CHECKING PGM'.
ENDFORM.
FORM DISPLAY_ALV_EKPO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = I_TITLE_EKPO
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT =
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS = V_EVENTS
TABLES
T_OUTTAB = IT_EKPO
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.
reward if helpful
regards
Shashi -
Reg. Events in ALV Reports
Hi all,
Can anybody send me the sample program, related to Events on ALV Reports.
Use ful answers rewards more.Hi Raj,
Here I'm sending 2 programs with user command on grid and list.
along with interaction and commentory boxes and all.
separate box ****************
TABLES: KNA1,VBAK,VBAP.
TYPE-POOLS: SLIS.
SELECT-OPTIONS: CUST FOR KNA1-KUNNR.
DATA: BEGIN OF ITAB OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
NAME LIKE KNA1-NAME1,
LAND1 LIKE KNA1-LAND1,
END OF ITAB.
DATA: BEGIN OF JTAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
NETWR LIKE VBAK-NETWR,
END OF JTAB.
DATA: BEGIN OF KTAB OCCURS 0,
POSNR LIKE VBAP-POSNR,
MATNR LIKE VBAP-MATNR,
END OF KTAB.
DATA: REPID LIKE SY-REPID,
*INTERNAL TABLE AND STRUCTURE.
*SLIS_T_FIELDCAT_ALV IS AN INTERNAL TABLE.
*SLIS_FIELDCAT_ALV IS AN STRUCTURE.
F_KNA11 TYPE SLIS_T_FIELDCAT_ALV,
F_KNA1 TYPE SLIS_FIELDCAT_ALV,
F_VBAK1 TYPE SLIS_T_FIELDCAT_ALV,
F_VBAK TYPE SLIS_FIELDCAT_ALV,
F_VBAP1 TYPE SLIS_T_FIELDCAT_ALV,
F_VBAP TYPE SLIS_FIELDCAT_ALV,
I_EVENTS TYPE SLIS_T_EVENT,
S_EVENTS TYPE SLIS_ALV_EVENT.
PERFORM GET-VAL.
REPID = SY-REPID.
SELECT KUNNR NAME1 LAND1 FROM KNA1 INTO TABLE ITAB WHERE KUNNR IN
CUST
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = REPID
IT_FIELDCAT = F_KNA11
IT_EVENTS = I_EVENTS
TABLES
T_OUTTAB = ITAB.
GET VAL
FORM GET-VAL.
F_KNA1-FIELDNAME = 'KUNNR'.
F_KNA1-REF_TABNAME = 'KNA1'.
F_KNA1-REF_FIELDNAME = 'KUNNR'.
APPEND F_KNA1 TO F_KNA11.
F_KNA1-FIELDNAME = 'NAME'.
F_KNA1-REF_TABNAME = 'KNA1'.
F_KNA1-REF_FIELDNAME = 'NAME1'.
APPEND F_KNA1 TO F_KNA11.
F_KNA1-FIELDNAME = 'LAND1'.
F_KNA1-REF_TABNAME = 'KNA1'.
F_KNA1-REF_FIELDNAME = 'LAND1'.
APPEND F_KNA1 TO F_KNA11.
F_VBAK-FIELDNAME = 'VBELN'.
F_VBAK-REF_TABNAME = 'VBAK'.
F_VBAK-REF_FIELDNAME = 'VBELN'.
APPEND F_VBAK TO F_VBAK1.
F_VBAK-FIELDNAME = 'NETWR'.
F_VBAK-REF_TABNAME = 'VBAK'.
F_VBAK-REF_FIELDNAME = 'NETWR'.
F_VBAK-DO_SUM = 'X'.
APPEND F_VBAK TO F_VBAK1.
F_VBAP-FIELDNAME = 'POSNR'.
F_VBAP-REF_TABNAME = 'VBAP'.
F_VBAP-REF_FIELDNAME = 'POSNR'.
APPEND F_VBAP TO F_VBAP1.
F_VBAP-FIELDNAME = 'MATNR'.
F_VBAP-REF_TABNAME = 'VBAP'.
F_VBAP-REF_FIELDNAME = 'MATNR'.
APPEND F_VBAP TO F_VBAP1.
S_EVENTS-NAME = 'USER_COMMAND'.
S_EVENTS-FORM = 'VAL'.
APPEND S_EVENTS TO I_EVENTS.
ENDFORM.
FORM VAL USING USER_COMMAND LIKE SY-UCOMM SEL TYPE SLIS_SELFIELD.
DATA: CUS(10) TYPE N,
SALNO(10) TYPE N,
MAT(10) TYPE C.
display lists
IF SEL-FIELDNAME = 'KUNNR'.
CUS = SEL-VALUE.
SELECT VBELN NETWR FROM VBAK INTO TABLE JTAB WHERE KUNNR = CUS.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = REPID
IT_FIELDCAT = F_VBAK1
IT_EVENTS = I_EVENTS
TABLES
T_OUTTAB = JTAB.
ENDIF.
IF SEL-FIELDNAME = 'VBELN'.
SALNO = SEL-VALUE.
SELECT POSNR MATNR FROM VBAP INTO TABLE KTAB WHERE VBELN = SALNO.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE = ' ITEM DETAILS'
I_TABNAME = VBAP
IT_FIELDCAT = F_VBAP1
I_CALLBACK_PROGRAM = REPID
IMPORTING
ES_SELFIELD = SEL
TABLES
T_OUTTAB = KTAB.
ENDIF.
IF SEL-FIELDNAME = 'MATNR'.
MAT = SEL-VALUE.
SET PARAMETER ID 'MAT' FIELD MAT.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
ENDIF.
ENDFORM.
Grid Display ***************
TYPE-POOLS: SLIS.
TABLES: KNA1.
*DATA: ITAB TYPE STANDARD TABLE OF ZJKNA1 WITH HEADER LINE.
DATA: BEGIN OF ITAB OCCURS 0,
KUNNR TYPE KUNNR,
NAME1 TYPE KNA1-NAME1,
END OF ITAB.
DATA: JTAB LIKE ITAB OCCURS 0 WITH HEADER LINE.
DATA: IT_TOP TYPE SLIS_T_LISTHEADER.
DATA: W_TOP TYPE SLIS_LISTHEADER.
DATA: IT_EVENT TYPE SLIS_T_EVENT.
DATA: W_EVENT TYPE SLIS_ALV_EVENT.
W_EVENT-NAME = 'TOP_OF_PAGE'.
W_EVENT-FORM = 'TOPS'.
APPEND W_EVENT TO IT_EVENT.
W_EVENT-NAME = 'USER_COMMAND'.
W_EVENT-FORM = 'UCOM'.
APPEND W_EVENT TO IT_EVENT.
DATA: S_LAYOUT TYPE SLIS_LAYOUT_ALV.
*S_LAYOUT-NO_VLINE = 'X'.
S_LAYOUT-ZEBRA = 'X'.
S_LAYOUT-NO_COLHEAD = ''.
S_LAYOUT-TOTALS_ONLY = 'TL'.
DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA: W_LISTHEADER TYPE SLIS_LISTHEADER.
W_LISTHEADER-TYP = 'H'.
W_LISTHEADER-KEY = 'THIS IS LIST'.
APPEND W_LISTHEADER TO IT_LISTHEADER.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: W_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
W_FIELDCAT-COL_POS = 1.
W_FIELDCAT-FIELDNAME = 'KUNNR'.
W_FIELDCAT-TABNAME = 'ITAB'.
W_FIELDCAT-SELTEXT_M = 'CUST. NO'.
W_FIELDCAT-HOTSPOT = 'X'.
APPEND W_FIELDCAT TO IT_FIELDCAT.
CLEAR W_FIELDCAT.
W_FIELDCAT-COL_POS = 2.
W_FIELDCAT-FIELDNAME = 'NAME1'.
W_FIELDCAT-TABNAME = 'ITAB'.
W_FIELDCAT-SELTEXT_M = 'CUST. NAME'.
W_FIELDCAT-OUTPUTLEN = 30.
APPEND W_FIELDCAT TO IT_FIELDCAT.
CLEAR W_FIELDCAT.
SELECT KUNNR NAME1 FROM KNA1 INTO CORRESPONDING FIELDS OF TABLE ITAB
UP TO 50 ROWS.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = W_LISTHEADER
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = 'ENJOY.BMP'
I_GRID_TITLE = 'THIS IS MY FIRST ALV REPORT'
I_GRID_SETTINGS = W_LISTHEADER
IS_LAYOUT = S_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = IT_EVENT
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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
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.
**& Form TOPS
text
--> p1 text
<-- p2 text
FORM TOPS .
REFRESH IT_TOP.
W_TOP-TYP = 'H'.
*W_TOP-KEY = 'JAGAN'.
W_TOP-INFO = 'THIS IS SAMPLE HEADER'.
APPEND W_TOP TO IT_TOP.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_TOP
I_LOGO = 'IDLOGO1'
I_END_OF_LIST_GRID =
ENDFORM. " TOPS
*& Form UCOM
text
--> p1 text
<-- p2 text
FORM UCOM USING USER_COMMAND LIKE SY-UCOMM SEL TYPE SLIS_SELFIELD.
DATA: CUS(10) TYPE N VALUE '0000000000'.
CUS = SEL-VALUE.
REFRESH ITAB.
SELECT KUNNR NAME1 FROM KNA1 INTO TABLE ITAB WHERE KUNNR = CUS.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FIELDCAT
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = ITAB.
ENDFORM. " UCOM -
Hi there,
I added a column to an existing alv report which uses method 'set_table_for_first_display' to display the output.
The method is called via:
grid1 TYPE REF TO cl_gui_alv_grid,
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'MAT_DATA'
is_layout = lt_layout
is_variant = lt_variant
i_default = lt_default
i_save = 'A'
it_toolbar_excluding = lt_exclude[]
CHANGING it_outtab = mat_data[]
it_fieldcatalog = w_fieldcat[]
EXCEPTIONS
program_error = 1.
The extra columns are in the field catalog and mat_data.
The lt_variant-report field has the report name in it.
When I run the report the new column does NOT appear.
I cleared out the lt_variant-report value and now the new column DOES appear.
Any idea why this is happening?
Is there some way I can leave the report name in there and see the new columns?
Thanks.thanks.
no_out is initial.
But, in this case, I am not passing any variant.
It works if I don't pass the report name in the
is_variant-report
field.The columns will not display if I pass the report name. -
Change column headers in ALV report
Hi experts,
I have created a new simple ALV report (it uses only internal tables, no structures). I would like to change the names of column headers in the ALV report. Is this possible? How can I do it?
Thanks in advanced.Thanks for your reply,
I am trying to use the code mentioned in the link but I think that something
is missing, probably a CASE statement before WHEN in the LOOP.
Can you help me? What do I have to put before WHEN statement?
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = <program name>
i_structure_name = <DDIC structure>
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = gi_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3. "#EC *
LOOP AT gi_fieldcat INTO wa_fieldcat.
WHEN 'XXXX'.
wa_fieldcat-seltext_s = 'Fac'.
wa_fieldcat-seltext_m = 'Factory'.
wa_fieldcat-seltext_l = 'Factory'.
wa_fieldcat-reptext_ddic = 'Factory'.
MODIFY gi_fieldcat FROM wa_fieldcat.
ENDLOOP. -
Control User Specific button in ALV report
Hi,
Can anybody please suggest me how to control "USER SPECIFIC" button in ALV report layout using authorization object. I mean if you can tell me which authorization object is responsible to control the "USER SPECIFIC" button.additional info to what Lakshmi already said:-
normally the restrictions for saving layouts/display variants are done at 2 levels:
1) The developer of an ALV list first predetermines the authorization in the 'i_save' parameter within the code.
I_SAVE = ' ' -
layouts cannot be saved
I_SAVE = 'A' -
user-specific and cross-user layouts can be saved
I_SAVE = 'X' --- cross-user layouts can be saved
I_SAVE = 'U' --- user-specific layouts can be saved
2) The second level comes to us restriciting the S_ALV_LAYO which gives access to users to save global layouts if I_SAVE for that particular transaction is A or X.
for example, a report has I_SAVE= 'A', which means
it will allow to save User-specific layouts without any restrictions.
and if user has S_ALV_LAYO then he can save both User-Specific and Global Layouts(variants).
it would be better to keep this object separate. -
Context menu's in Alv Report (Grid)
hello,
what i have done- i have created a ALV report by using the function modlue REUSE_ALV_GRID_DISPLAY.
what i want- When user clicks with Right mouse button on some cell.
context menu should get displayed. a list of menu should appear then user can select one of these options and eventually i'll on user command.
however i know the concept of context menu's and i have created context menu on screen elements in module pool.
but i have no idea whether these menu's can be created on ALV Grid.(simple ALv Grid----not ABAP OOPS)check the program BCALV_GRID_06, it gives a demo of context menu functionalty,
but it uses cl_gui_alv_grid -
Hi experts,
I am using radio buttons in alv report by using screen painter but error occurs in alv that screen doesn't exist in module.
plz help me.Hi Ankita,
check this program.
*& Report ZALVGRID_WITH_RADIOBUTTONS
*& This program shows how to realize radiobuttons in ALV grid lists
*& using event HOTSPOT_CLICK.
*& Screen 100:
*& - Flow logic
*& PROCESS BEFORE OUTPUT.
*& MODULE PBO.
*& PROCESS AFTER INPUT.
*& MODULE PAI.
*& - Screen elements: none
*& - ok-code field -> gd_okcode
*& GUI Status MAIN100:
*& - F3 = 'BACK', Shift+F3 = 'EXIT', F12 = 'CANC'
PROGRAM zalvgrid_with_radiobuttons.
TYPE-POOLS: abap, icon. " INCLUDE . for releases < 6.20
TYPES: BEGIN OF ty_s_sflight.
INCLUDE TYPE sflight.
TYPES: button1 TYPE iconname.
TYPES: button2 TYPE iconname.
TYPES: button3 TYPE iconname.
TYPES: button4 TYPE iconname.
TYPES: END OF ty_s_sflight.
DATA:
gt_sflight TYPE STANDARD TABLE OF ty_s_sflight,
gs_layout TYPE lvc_s_layo,
gt_fcat TYPE lvc_t_fcat.
DATA:
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid TYPE REF TO cl_gui_alv_grid.
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
FIELD-SYMBOLS:
IS ASSIGNED ).
Set all radio buttons "unselected"
IS ASSIGNED ).
Set selected radio button "selected".
= icon_wd_radio_button.
ENDIF.
Force PAI followed by refresh of table display in PBO
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'REFRESH'
IMPORTING
RC =
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
MAIN *
START-OF-SELECTION.
PERFORM select_data.
PERFORM init_controls.
PERFORM build_fieldcatalog.
PERFORM set_layout.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING
it_fieldcatalog = gt_fcat
it_outtab = gt_sflight.
Link docking container to dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
CONTAINER =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
lifetime_dynpro_dynpro_link = 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 SCREEN 100.
END-OF-SELECTION.
MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
ENDMODULE. "PBO OUTPUT
MODULE PAI INPUT *
MODULE pai INPUT.
Leave report
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
Refresh table display
WHEN 'REFRESH'.
PERFORM refresh_display.
WHEN OTHERS.
do nothing
ENDCASE.
CLEAR gd_okcode.
ENDMODULE. "PAI INPUT
*& Form BUILD_FIELDCATALOG
text
--> p1 text
<-- p2 text
FORM build_fieldcatalog .
ALV List with Radio Buttons
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 7
define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = 'ICON'
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.
DELETE gt_fcat WHERE ( fieldname <> 'NAME' ).
NOTE: field ICON-NAME has data element ICONNAME.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = 'SFLIGHT'
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.
READ TABLE gt_fcat INTO ls_fcat
WITH KEY fieldname = 'NAME'.
IF ( syst-subrc = 0 ).
DELETE gt_fcat INDEX syst-tabix.
ENDIF.
ls_fcat-fieldname = 'BUTTON4'.
ls_fcat-coltext = ls_fcat-fieldname.
ls_fcat-icon = 'X'.
ls_fcat-hotspot = 'X'.
INSERT ls_fcat INTO gt_fcat INDEX 5.
ls_fcat-fieldname = 'BUTTON3'.
ls_fcat-coltext = ls_fcat-fieldname.
INSERT ls_fcat INTO gt_fcat INDEX 5.
ls_fcat-fieldname = 'BUTTON2'.
ls_fcat-coltext = ls_fcat-fieldname.
INSERT ls_fcat INTO gt_fcat INDEX 5.
ls_fcat-fieldname = 'BUTTON1'.
ls_fcat-coltext = ls_fcat-fieldname.
INSERT ls_fcat INTO gt_fcat INDEX 5.
Renumbering of the columns
LOOP AT gt_fcat INTO ls_fcat.
ls_fcat-col_pos = syst-tabix.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG
*& Form SELECT_DATA
text
--> p1 text
<-- p2 text
FORM select_data .
define local data
DATA:
ls_sflight TYPE ty_s_sflight.
SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_sflight.
ls_sflight-button1 = icon_wd_radio_button. " selected radiobutton
ls_sflight-button2 = icon_wd_radio_button_empty.
ls_sflight-button3 = icon_wd_radio_button_empty.
ls_sflight-button4 = icon_wd_radio_button_empty.
Alternatively: create icons using function module 'ICON_CREATE'
on SAP releases where these icons are not available.
MODIFY gt_sflight FROM ls_sflight
TRANSPORTING button1 button2 button3 button4
WHERE ( carrid IS NOT INITIAL ).
ENDFORM. " SELECT_DATA
*& Form INIT_CONTROLS
text
--> p1 text
<-- p2 text
FORM init_controls .
CHECK ( go_docking IS NOT BOUND ).
ALV List with Radio Buttons
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 9
Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
REPID =
DYNNR =
SIDE = DOCK_AT_LEFT
EXTENSION = 50
STYLE =
LIFETIME = lifetime_default
CAPTION =
METRIC = 0
ratio = 90
NO_AUTODEF_PROGID_DYNNR =
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.
Size of container = full screen size
CALL METHOD go_docking->set_extension
EXPORTING
extension = 99999
EXCEPTIONS
cntl_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.
Create ALV grid instance
CREATE OBJECT go_grid
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = go_docking
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
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.
Set event handler for event HOTSPOT_CLICK
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR go_grid.
ENDFORM. " INIT_CONTROLS
*& Form REFRESH_DISPLAY
Refresh table display after switching the radiobuttons
--> p1 text
<-- p2 text
FORM refresh_display .
define local data
DATA:
ls_stable TYPE lvc_s_stbl.
ls_stable-row = abap_true.
ls_stable-col = abap_true.
CALL METHOD go_grid->refresh_table_display
EXPORTING
is_stable = ls_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
*& Form SET_LAYOUT
Set layout for ALV list
--> p1 text
<-- p2 text
FORM set_layout .
CLEAR: gs_layout.
gs_layout-cwidth_opt = abap_true. " optimize column width
gs_layout-zebra = abap_true.
ENDFORM. " SET_LAYOUT
Regards,
Prasanth
Reward if helpful -
Filter Function problems on ALV report. [Resolved]
Hi,
I developed an ALV report by using function as below:
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
* I_CALLBACK_PF_STATUS_SET = status_set
* I_CALLBACK_USER_COMMAND = USER_COMMAND
I_STRUCTURE_NAME = 'T_BSIK'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
TABLES
T_OUTTAB = TAB_BSIK.
And this ALV custom report is referenced from standard function FBL5N.
After i completed this report, i made an comparision of FBL5N and my custom report.
When I apply the filter function, for example, on the document type, I cannot input 2 characters in the document type field under the filter function. The field length is only 1 character. Similar case results on the field document date.
While the standard function FBL5N works very nice.
What should i do to make the filter function of my own ALV report as the same as the standard function FBL5N do?
Thanks in advance.
Lala
Message was edited by:
Hoo lalaOh, i found where the problem is...
add below 2 statements, then the question is resolved.
LS_FIELDCAT-ref_fieldname = ****
LS_FIELDCAT-ref_tabname = ***
FORM FIELDCAT_INIT tables RT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COL_POS = 3.
LS_FIELDCAT-FIELDNAME = 'BLART'.
LS_FIELDCAT-TABNAME = 'TAB_BSIK'.
LS_FIELDCAT-SELTEXT_L = 'Document Type'.
LS_FIELDCAT-ref_fieldname = 'BLART'.
LS_FIELDCAT-ref_tabname = 'BSIK'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
endform.
Fine now.
Lala
Maybe you are looking for
-
Difference in UCCX historical reports
'Agent summary report' is showing average talk time "00:02:45" and when I manually calcuate the average talk time from the report "Agent state detail report" (by adding the total talk time and dividing it with total number of calls) it gives me avera
-
Question about photo slideshow
When you have a photo page, is there a way to eliminate being able to click on a photo to enlarge it? I'd just like to have people scroll down to look at my photos, instead of the option of clicking on one and going through a slideshow. I know you ca
-
Situation: -Customer has taken over an existing company. -New users where created in the domain. -Mail accounts where created and the .pst's imported. -Everything fine so far. Problem: When a user tries to edit a calendar item created in the past th
-
My A20m shuts down unexpectedly
A couple of years ago I inherited my sons A20m laptop and I've been using it to play music from internet radio on Media player through a FM transmitter to my stereo. Lately it shuts down after about an hour, it re boots but down again. I've taken it
-
3560 PBR from VLANs to Router and PIX each with ISP
I want to know is it possible to use a 3560, with Advanced IP Services, to policy based route from VLANs to different ISP's? Setup looks like: PIX to 3560 2821 to 3560 VLAN 100 on 3560 VLAN 200 on 3560 Is it possible to send VLAN 100 out the PIX and