Exclude buttons from ALV
Hi All,
I want to exclude pushbuttons from ALV. Can any body suggest me how to do this. I am using classes to display ALV.
Regards,
Venkat.
in the pbo of your screen, before displaying your alv grid write in the following way:-
data: g_alv_grid type ref to cl_gui_alv_grid,
g_exclude type ui_func,
g_t_tlbr_excl type ui_functions.
*PBO if used container or screen ,
start of selection - if working with selection screen but before displaying alv.
Exclude ICONS
perform form_exculde_icons.
call method g_alv_grid->set_table_for_first_display
EXPORTING
is_variant = VARIANT
is_layout = LAYOUT
is_print = PRINT
it_toolbar_excluding = g_t_tlbr_excl
CHANGING
it_outtab = ITAB
it_fieldcatalog = FIELDCATALOG[]
if sy-subrc <> 0.
write: 'Method call ''Set_table_for_first_display'' failed.'.
exit.
endif.
form form_exculde_icons .
Exclude alv sum button
g_exclude = cl_gui_alv_grid=>mc_fc_sum.
append g_exclude to g_t_tlbr_excl.
Exclude alv count button
g_exclude = cl_gui_alv_grid=>mc_fc_count.
append g_exclude to g_t_tlbr_excl.
Exclude alv average button
g_exclude = cl_gui_alv_grid=>mc_fc_average.
append g_exclude to g_t_tlbr_excl.
Exclude alv maximum button
g_exclude = cl_gui_alv_grid=>mc_fc_maximum.
append g_exclude to g_t_tlbr_excl.
Exclude alv manimum button
g_exclude = cl_gui_alv_grid=>mc_fc_minimum.
append g_exclude to g_t_tlbr_excl.
Exclude alv subtotal button
g_exclude = cl_gui_alv_grid=>mc_fc_subtot.
append g_exclude to g_t_tlbr_excl.
Exclude alv auf button
g_exclude = cl_gui_alv_grid=>mc_fc_auf.
append g_exclude to g_t_tlbr_excl.
Exclude alv locpaste button
g_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
append g_exclude to g_t_tlbr_excl.
Exclude alv new_row button
g_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
append g_exclude to g_t_tlbr_excl.
Exclude alv mb_view button
g_exclude = cl_gui_alv_grid=>mc_mb_view.
append g_exclude to g_t_tlbr_excl.
Exclude alv fc_view button
g_exclude = cl_gui_alv_grid=>mc_fc_views.
append g_exclude to g_t_tlbr_excl.
Exclude alv print_prev button
g_exclude = cl_gui_alv_grid=>mc_fc_print_prev.
append g_exclude to g_t_tlbr_excl.
Exclude alv viewgrid button
g_exclude = cl_gui_alv_grid=>mc_fc_view_grid.
append g_exclude to g_t_tlbr_excl.
Exclude alv view_excel button
g_exclude = cl_gui_alv_grid=>mc_fc_view_excel.
append g_exclude to g_t_tlbr_excl.
Exclude alv view_crystal button
g_exclude = cl_gui_alv_grid=>mc_fc_view_crystal.
append g_exclude to g_t_tlbr_excl.
Exclude alv view_lotus button
g_exclude = cl_gui_alv_grid=>mc_fc_view_lotus.
append g_exclude to g_t_tlbr_excl.
Exclude alv send button
g_exclude = cl_gui_alv_grid=>mc_fc_send.
append g_exclude to g_t_tlbr_excl.
Exclude alv call_abc button
g_exclude = cl_gui_alv_grid=>mc_fc_call_abc.
append g_exclude to g_t_tlbr_excl.
Exclude alv call_xint button
g_exclude = cl_gui_alv_grid=>mc_fc_call_xint.
append g_exclude to g_t_tlbr_excl.
Exclude alv fc_expcrdesig button
g_exclude = cl_gui_alv_grid=>mc_fc_expcrdesig.
append g_exclude to g_t_tlbr_excl.
Exclude alv fc_expcrtempl button
g_exclude = cl_gui_alv_grid=>mc_fc_expcrtempl.
append g_exclude to g_t_tlbr_excl.
Exclude alv mb_paste button
g_exclude = cl_gui_alv_grid=>mc_mb_paste.
append g_exclude to g_t_tlbr_excl.
Exclude alv load_variant button
g_exclude = cl_gui_alv_grid=>mc_fc_load_variant.
append g_exclude to g_t_tlbr_excl.
Exclude alv current_variant button
g_exclude = cl_gui_alv_grid=>mc_fc_current_variant.
append g_exclude to g_t_tlbr_excl.
Exclude alv maintain_variant button
g_exclude = cl_gui_alv_grid=>mc_fc_maintain_variant.
append g_exclude to g_t_tlbr_excl.
Exclude alv save_variant button
g_exclude = cl_gui_alv_grid=>mc_fc_save_variant.
append g_exclude to g_t_tlbr_excl.
Exclude alv select_all button
g_exclude = cl_gui_alv_grid=>mc_fc_select_all.
append g_exclude to g_t_tlbr_excl.
Exclude alv deselect_all button
g_exclude = cl_gui_alv_grid=>mc_fc_deselect_all.
append g_exclude to g_t_tlbr_excl.
Exclude alv graph button
g_exclude = cl_gui_alv_grid=>mc_fc_graph.
append g_exclude to g_t_tlbr_excl.
Exclude alv info button
g_exclude = cl_gui_alv_grid=>mc_fc_info.
append g_exclude to g_t_tlbr_excl.
Exclude alv f4 button
g_exclude = cl_gui_alv_grid=>mc_fc_f4.
append g_exclude to g_t_tlbr_excl.
Exclude alv call_report button
g_exclude = cl_gui_alv_grid=>mc_fc_call_report.
append g_exclude to g_t_tlbr_excl.
Exclude alv fc_check button
g_exclude = cl_gui_alv_grid=>mc_fc_check.
append g_exclude to g_t_tlbr_excl.
Exclude alv fc_refresh button
g_exclude = cl_gui_alv_grid=>mc_fc_refresh.
append g_exclude to g_t_tlbr_excl.
Exclude alv loc_cut button
g_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
append g_exclude to g_t_tlbr_excl.
Exclude alv loc_copy button
g_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
append g_exclude to g_t_tlbr_excl.
Exclude alv loc_undo button
g_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
append g_exclude to g_t_tlbr_excl.
Exclude alv append_row button
g_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
append g_exclude to g_t_tlbr_excl.
Exclude alv insert_row button
g_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
append g_exclude to g_t_tlbr_excl.
Exclude alv delete_row button
g_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
append g_exclude to g_t_tlbr_excl.
Exclude alv copy_row button
g_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
append g_exclude to g_t_tlbr_excl.
Exclude alv reprep button
g_exclude = cl_gui_alv_grid=>mc_fc_reprep.
append g_exclude to g_t_tlbr_excl.
Exclude alv call_chain button
g_exclude = cl_gui_alv_grid=>mc_fc_call_chain.
append g_exclude to g_t_tlbr_excl.
Exclude alv call_more button
g_exclude = cl_gui_alv_grid=>mc_fc_call_more.
append g_exclude to g_t_tlbr_excl.
Exclude alv call_master_data button
g_exclude = cl_gui_alv_grid=>mc_fc_call_master_data.
append g_exclude to g_t_tlbr_excl.
endform.
Similar Messages
-
Hide 'Change Layout' button from alv toolbar
Hello All,
can anyone let me know how can we hide the change layout button or exclude the change layout button from the ALV tool bar using OOPS . what's the fcode for it.
Thank You !
RaviHi Ravi,
Please refer to this [Program|http://www.saptechies.com/disable-some-standard-buttons-from-alv-display/].
Hope this helps.
Regards,
Chandravadan -
Disable some standard buttons from ALV display
Hello All,
I am creating an ALV display using object oriented approach. I know how to exclude some of the standard function buttons from the list.
But suppose instead of deleting, the requirement is to disable (I mean grayed out)
some standard buttons from ALV. Could anyone please comment on how to do this.
Many thanks in advance.
Regards
IndrajitHello Indrajit
The following sample reports shows how to disable toolbar functions. Run the report and the push the ENTER button repeatedly.
*& Report ZUS_SDN_ALV_EVT_TOOLBAR
*& This sample report explains the handling of event TOOLBAR in order
*% to activate or inactive buttons of the ALV toolbar.
*& Based on: BCALV_GRID_DEMO
*& Procedure: Copy BCALV_GRID_DEMO and replace entire coding OR
copy screen '0100' and GUI status 'MAIN100' from
BCALV_GRID_DEMO to this report.
REPORT zus_sdn_alv_evt_toolbar.
TYPE-POOLS: abap, cntb, icon.
DATA:
ok_code TYPE ui_func,
gt_sflight TYPE TABLE OF sflight,
g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
g_grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
PARAMETERS:
p_inact RADIOBUTTON GROUP grp1 DEFAULT 'X', " delete buttons
p_dele RADIOBUTTON GROUP grp1. " inactivate buttons
PARAMETERS:
p_newbut AS CHECKBOX DEFAULT ' ', " add new button
p_newddm AS CHECKBOX DEFAULT 'X'. " add dropdown menu
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_cnt TYPE i.
CLASS-METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object
e_interactive
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_toolbar.
§ 2.In event handler method for event TOOLBAR: Append own functions
by using event parameter E_OBJECT.
DATA:
ls_toolbar TYPE stb_button,
ls_menu type STB_BTNMNU.
E_OBJECT of event TOOLBAR is of type REF TO CL_ALV_EVENT_TOOLBAR_SET.
This class has got one attribute, namly MT_TOOLBAR, which
is a table of type TTB_BUTTON. One line of this table is
defined by the Structure STB_BUTTON (see data deklaration above).
A remark to the flag E_INTERACTIVE:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'e_interactive' is set, if this event is raised due to
the call of 'set_toolbar_interactive' by the user.
You can distinguish this way if the event was raised
by yourself or by ALV
(e.g. in method 'refresh_table_display').
An application of this feature is still unknown...
ADD 1 TO md_cnt. " a simple counter
(1.a) Inactivate toolbar buttons
IF ( p_inact = abap_true ).
LOOP AT e_object->mt_toolbar INTO ls_toolbar FROM 1 TO md_cnt.
ls_toolbar-disabled = 'X'.
MODIFY e_object->mt_toolbar FROM ls_toolbar.
ENDLOOP.
(1.b) Delete toolbar buttons
ELSE.
DO md_cnt TIMES.
DELETE e_object->mt_toolbar INDEX 1.
ENDDO.
ENDIF.
(2) Add new button
IF ( p_newbut = abap_true ).
Add separator to separate default and new buttons
CLEAR: ls_toolbar.
ls_toolbar-butn_type = cntb_btype_sep. " separator
APPEND ls_toolbar TO e_object->mt_toolbar.
Add new button "DETAIL"
CLEAR: ls_toolbar.
ls_toolbar-function = 'DETAIL'.
ls_toolbar-icon = icon_detail.
ls_toolbar-quickinfo = 'QuickInfo'.
ls_toolbar-butn_type = cntb_btype_button.
ls_toolbar-disabled = abap_false.
ls_toolbar-text = 'Details'.
ls_toolbar-checked = ' '.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDIF.
(3) Add new dropdown menu
IF ( p_newddm = abap_true ).
Add separator to separate default and new buttons
CLEAR: ls_toolbar.
ls_toolbar-butn_type = cntb_btype_sep. " separator
APPEND ls_toolbar TO e_object->mt_toolbar.
Add new dropdown menu "DETAIL"
CLEAR: ls_toolbar.
ls_toolbar-function = 'DDMENU'.
ls_toolbar-icon = icon_detail.
ls_toolbar-quickinfo = 'QuickInfo'.
ls_toolbar-butn_type = cntb_btype_dropdown.
ls_toolbar-disabled = abap_false.
ls_toolbar-text = 'DD-Menu'.
ls_toolbar-checked = ' '.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDIF.
ENDMETHOD. "handle_toolbar
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
MAIN *
SELECT * FROM sflight INTO TABLE gt_sflight.
CALL SCREEN 100.
END-OF-SELECTION.
MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
Instantiate ALV grid control
CREATE OBJECT g_grid1
EXPORTING i_parent = g_custom_container.
CALL METHOD g_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_outtab = gt_sflight.
Set event handler for event TOOLBAR
SET HANDLER:
lcl_eventhandler=>handle_toolbar FOR g_grid1.
ENDIF.
$Comment: Toolbar can be modified on-the-fly
g_grid1->set_toolbar_interactive( ).
ENDMODULE. "PBO OUTPUT
MODULE PAI INPUT *
MODULE pai INPUT.
to react on oi_custom_events:
CALL METHOD cl_gui_cfw=>dispatch.
CASE ok_code.
WHEN 'EXIT'.
PERFORM exit_program.
WHEN OTHERS.
do nothing
ENDCASE.
CLEAR ok_code.
ENDMODULE. "PAI INPUT
FORM EXIT_PROGRAM *
FORM exit_program.
CALL METHOD G_CUSTOM_CONTAINER->FREE.
CALL METHOD CL_GUI_CFW=>FLUSH.
LEAVE PROGRAM.
ENDFORM. "EXIT_PROGRAM[/code]
Regards
Uwe -
Excluding buttons from tabbing
Is is possible to exclude button from tabbing order and just tab between check boxes, radio buttons and text fields for example?
Thanks.
Another question about tabbing. How do I get tabbing from the last field on a page to the next or first field on a following page? I have tried but can't figure it out. -
How to remove a Sort button from ALV List
Hi Experts,
How to remove sort button from ALV List.
I have requirement where I need to remove the sort button from ALV list.
Kindly give me useful clues.
Higher points will be awarded for the useful inputs.
Thanks in Advance,
DharaniHi dharani,
1. UP and Down Sort Button will get removed.
2. Important code is marked in bold
3. Just copy paste.
4.
report abc.
TYPE-POOLS : slis.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvfcwa TYPE slis_fieldcat_alv.
<b>data : excl type SLIS_T_EXTAB.
data : exclwa type SLIS_EXTAB.</b>
data : begin of itab occurs 0.
include structure usr02.
data : end of itab.
START-OF-SELECTION.
select * from usr02
into table itab.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
<b>*----
IMPORTANT
fcodes to remove
Up and Down Sort Button
exclwa-fcode = '&OUP'.
append exclwa to excl.
exclwa-fcode = '&ODN'.
append exclwa to excl.</b>
Display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
<b>IT_EXCLUDING = excl</b>
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
regards,
amit m. -
How to disable self defined button from ALV Toolbar when ok_code ='BACK'
here is the code
CLASS Z_CL_6_U_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS:
HANDLE_TOOLBAR
FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT E_INTERACTIVE,
HANDLE_USER_COMMAND
FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM.
ENDCLASS.
CLASS Z_CL_6_U_EVENT_RECEIVER IMPLEMENTATION.
METHOD HANDLE_TOOLBAR.
DATA: LS_TOOLBAR TYPE STB_BUTTON.
IF G_FLAG = 'X' and ok_code = space.
CLEAR LS_TOOLBAR.
MOVE 0 TO LS_TOOLBAR-BUTN_TYPE.
MOVE 'UPDATE' TO LS_TOOLBAR-FUNCTION.
MOVE ICON_MODIFY TO LS_TOOLBAR-ICON.
MOVE 'Update Records'(111) TO LS_TOOLBAR-QUICKINFO.
MOVE ''(112) TO LS_TOOLBAR-TEXT.
MOVE ' ' TO LS_TOOLBAR-DISABLED.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
elseif ok_code = 'BACK'.
CLEAR LS_TOOLBAR.
LS_TOOLBAR-function = 'UPDATE'.
LS_TOOLBAR-butn_type = 0.
LS_TOOLBAR-icon = ICON_MODIFY.
LS_TOOLBAR-quickinfo = 'Update Records'.
LS_TOOLBAR-disabled = 'X'.
append LS_TOOLBAR TO <i><b>E_OBJECT</b></i>->MT_TOOLBAR.
ENDIF.
ENDMETHOD.
<i><b>ERROR COMES when ok_code is 'BACK'.
at this point E_OBJECT has null reference instead of ref to Class cl_ALV_EVENT_TOOLBAR_SET.</b></i>
tell me why this error coming.
pls helpHello Neetu
To give you an example I have copied sample report BCALV_GRID_DEMO, added some code (search for <b>$Comment</b>) and modified the GUI-status <b>MAIN100</b> (replace function code EXIT with <b>BACK</b> for the F3 function).
Run the program and push several times the BACK button: one toolbar function after the other will be inactivated.
PROGRAM test.
DATA: ok_code LIKE sy-ucomm,
gt_sflight TYPE TABLE OF sflight,
g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
<b>----
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_cnt TYPE i.
CLASS-METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object
e_interactive
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_toolbar.
DATA:
ls_button TYPE stb_button.
ADD 1 TO md_cnt. " a simple counter
LOOP AT e_object->mt_toolbar INTO ls_button FROM 1 TO md_cnt.
ls_button-disabled = 'X'.
MODIFY e_object->mt_toolbar FROM ls_button.
ENDLOOP.
ENDMETHOD. "handle_toolbar
ENDCLASS. "lcl_eventhandler IMPLEMENTATION</b>
START-OF-SELECTION.
* MAIN *
SELECT * FROM sflight INTO TABLE gt_sflight.
CALL SCREEN 100.
* MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
* Instantiate ALV grid control
CREATE OBJECT grid1
EXPORTING i_parent = g_custom_container.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_outtab = gt_sflight.
<b>*$Comment: Set event handler for event TOOLBAR
SET HANDLER:
lcl_eventhandler=>handle_toolbar FOR grid1.
ENDIF.</b>
ENDMODULE. "PBO OUTPUT
* MODULE PAI INPUT *
MODULE pai INPUT.
* to react on oi_custom_events:
CALL METHOD cl_gui_cfw=>dispatch.
CASE ok_code.
WHEN 'EXIT'.
PERFORM exit_program.
<b> WHEN 'BACK'.
$Comment: Toolbar can be modified on-the-fly
grid1->set_toolbar_interactive( ).</b>
WHEN OTHERS.
* do nothing
ENDCASE.
CLEAR ok_code.
ENDMODULE. "PAI INPUT
* FORM EXIT_PROGRAM *
FORM exit_program.
* CALL METHOD G_CUSTOM_CONTAINER->FREE.
* CALL METHOD CL_GUI_CFW=>FLUSH.
LEAVE PROGRAM.
ENDFORM. "EXIT_PROGRAM
Regards
Uwe -
Going back to selection screen from ALV
Hi there,
I have scenario: program -> selection screen -> ALV
In the 'BACK' button I have put: LEAVE TO SCREEN 0. It should go back to selection screen. But it does not and exits the program. I also tried to call the selection screen like CALL SELECTION-SCREEN 1000. But in this case if I hit BACK on selection screen, it goes back to previous screen, the ALV not the program. Can you please assist any other way to use the back button from
ALV -> Selection screen. Thanks.
Regards,Hi Johnny
Previously i got the same requirement according to that i had developed a report just go through this hope it may helpfull very much
*& Report ZALVDEMO *
REPORT ZALVDEMO.
TABLES : J_1IEXCHDR, " header table
J_1IEXCDTL, " item table
J_1IPART2, " Excise Part II details
LFA1, " vendor master table
J_1IMOVEND, " vendor excise details table
MSEG, " Document Segment: Material
MKPF, " Header: Material Document
DD07T, " domain text table
T001W. " Plant and Branch Details
DATA : BEGIN OF IT_CHDR OCCURS 100,
DOCNO LIKE J_1IEXCHDR-DOCNO,
DOCYR LIKE J_1IEXCHDR-DOCYR,
EXNUM LIKE J_1IEXCHDR-EXNUM,
EXDAT LIKE J_1IEXCHDR-EXDAT,
WERKS LIKE J_1IEXCHDR-WERKS,
EXBED LIKE J_1IEXCHDR-EXBED,
EXCCD LIKE J_1IEXCHDR-EXCCD,
ECS LIKE J_1IEXCHDR-ECS,
END OF IT_CHDR.
DATA : BEGIN OF IT_CDTL OCCURS 100,
DOCYR LIKE J_1IEXCDTL-DOCYR,
DOCNO LIKE J_1IEXCDTL-DOCNO,
EXNUM LIKE J_1IEXCDTL-EXNUM,
EXDAT LIKE J_1IEXCDTL-EXDAT,
LIFNR LIKE J_1IEXCDTL-LIFNR,
MATNR LIKE J_1IEXCDTL-MATNR,
MAKTX LIKE J_1IEXCDTL-MAKTX,
CHAPID LIKE J_1IEXCDTL-CHAPID,
EXBAS LIKE J_1IEXCDTL-EXBAS,
EXBED LIKE J_1IEXCDTL-EXBED,
ECS LIKE J_1IEXCDTL-ECS,
MENGE LIKE J_1IEXCDTL-MENGE,
MEINS LIKE J_1IEXCDTL-MEINS,
RDOC2 LIKE J_1IEXCDTL-RDOC2,
END OF IT_CDTL.
DATA TEXT(10).
DATA : BEGIN OF IT_OUT OCCURS 0,
SERIALNO LIKE J_1IPART2-SERIALNO,
TEXT1 LIKE TEXT,
EXNUM LIKE J_1IEXCDTL-EXNUM,
EXDAT LIKE J_1IEXCDTL-EXDAT,
NAME LIKE LFA1-NAME1,
DDTEXT LIKE DD07T-DDTEXT,
EXCCD LIKE J_1IEXCHDR-EXCCD,
BUDAT LIKE MKPF-BUDAT,
EXBAS LIKE IT_CDTL-EXBAS,
EXBED LIKE IT_CDTL-EXBED,
ECS LIKE IT_CDTL-ECS,
MATNR LIKE IT_CDTL-MATNR,
MAKTX LIKE IT_CDTL-MAKTX,
CHAPID LIKE IT_CDTL-CHAPID,
MENGE LIKE IT_CDTL-MENGE,
MEINS LIKE IT_CDTL-MEINS,
DEL_IND(1),
END OF IT_OUT.
DATA IT_PART2 LIKE J_1IPART2 OCCURS 0 WITH HEADER LINE.
DATA S_NO(4) .
DATA DB_CNT LIKE SY-TABIX.
DATA EBELN_T LIKE MSEG-EBELN .
TYPE-POOLS : SLIS.
DATA : AFIELD TYPE SLIS_FIELDCAT_ALV.
DATA : LIST_HEADER TYPE SLIS_T_LISTHEADER,
FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
LS_FTCAT TYPE LVC_S_FCAT,
SORTCAT TYPE SLIS_T_SORTINFO_ALV,
SORTCAT_LN LIKE LINE OF SORTCAT,
G_REPID LIKE SY-REPID,
G_BACK_GROUND(70), "like bapibds01-objkey,
GS_VARIANT LIKE DISVARIANT,
G_SAVE ,
GT_EVENTS TYPE SLIS_T_EVENT,
ALV_EVENT TYPE SLIS_ALV_EVENT,
EVENTCAT TYPE SLIS_T_EVENT,
EVENTCAT_LN LIKE LINE OF EVENTCAT,
LAYOUT_IN TYPE SLIS_LAYOUT_ALV,
LAYOUT_IN1 TYPE SLIS_LAYOUT_ALV.
CONSTANTS : GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE
'TOP_OF_PAGE',
GC_FORMNAME_USER_COMMAND TYPE SLIS_FORMNAME VALUE
'USER_COMMAND',
GC_FORMNAME_BEFORE_OUTPUT TYPE SLIS_FORMNAME VALUE
'BEFORE_OUTPUT'.
* ALV_EVENT TYPE SLIS_ALV_EVENT,
DATA EX_NO LIKE IT_CHDR-EXNUM VALUE 0.
DATA REGTYP_1 LIKE J_1IPART2-REGTYP.
SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME.
PARAMETERS WERKS TYPE J_1IEXCHDR-WERKS.
SELECT-OPTIONS : BUDAT FOR J_1IEXCHDR-EXDAT.
PARAMETERS : R1 RADIOBUTTON GROUP GRP DEFAULT 'X',
R2 RADIOBUTTON GROUP GRP.
SELECTION-SCREEN END OF BLOCK B.
INITIALIZATION.
G_REPID = SY-REPID.
G_SAVE = 'A'.
* PERFORM BUILD_EVENT USING GT_EVENTS[].
PERFORM ALV_EVENT_INIT.
AT SELECTION-SCREEN.
REFRESH LIST_HEADER.
PERFORM TOP_OF_PAGE_LIST_HEADER USING LIST_HEADER.
START-OF-SELECTION.
* PERFORM ALV_EVENT_INIT.
G_REPID = SY-REPID.
G_BACK_GROUND = ' ' .
IF R1 = 'X'.
CLEAR R2. CLEAR : REGTYP_1.
REGTYP_1 = 'A'.
* set titlebar 'BALAJI' with DB_CNT.
ELSEIF R2 = 'X'.
CLEAR R1.CLEAR : REGTYP_1.
REGTYP_1 = 'C'.
* set titlebar 'BALAJI1' with DB_CNT.
ENDIF.
SELECT * FROM J_1IPART2
INTO CORRESPONDING FIELDS OF TABLE IT_PART2
WHERE REGTYP = REGTYP_1 AND
TRNTYP = 'GRPO' AND
BUDAT IN BUDAT.
* DOCYR = IT_CDTL-DOCYR AND
* DOCNO = IT_CDTL-DOCNO.
LOOP AT IT_PART2.
SELECT SINGLE * FROM J_1IEXCHDR
INTO CORRESPONDING FIELDS OF IT_CHDR
WHERE TRNTYP = 'GRPO' AND
DOCYR = IT_PART2-DOCYR AND
DOCNO = IT_PART2-DOCNO AND
WERKS = WERKS AND
exdat IN BUDAT.
* ORDER BY EXDAT.
IF SY-SUBRC = 0.
APPEND IT_CHDR.
ELSE.
CONTINUE.
ENDIF.
* IF SY-SUBRC <> 0.
* MESSAGE E084.
* ENDIF.
ENDLOOP.
LOOP AT IT_CHDR.
SELECT * FROM J_1IEXCDTL
INTO CORRESPONDING FIELDS OF IT_CDTL
* FOR ALL ENTRIES IN IT_CHDR
WHERE
TRNTYP = 'GRPO' AND
DOCNO = IT_CHDR-DOCNO AND
DOCYR = IT_CHDR-DOCYR AND
EXNUM = IT_CHDR-EXNUM AND
EXDAT = IT_CHDR-EXDAT AND
WERKS = IT_CHDR-WERKS.
IF SY-SUBRC = 0.
APPEND IT_CDTL.
ELSE.
CONTINUE.
ENDIF.
ENDSELECT.
ENDLOOP.
LOOP AT IT_CDTL.
CLEAR TEXT.
DB_CNT = DB_CNT + 1.
READ TABLE IT_CHDR WITH KEY EXNUM = IT_CDTL-EXNUM.
READ TABLE IT_PART2 WITH KEY DOCNO = IT_CDTL-DOCNO .
IT_OUT-SERIALNO = IT_PART2-SERIALNO.
SELECT SINGLE NAME1 FROM LFA1
INTO IT_OUT-NAME
WHERE LIFNR = IT_CDTL-LIFNR.
SELECT SINGLE * FROM LFA1
WHERE LIFNR = IT_CDTL-LIFNR.
IF LFA1-LAND1 EQ 'IN'.
TEXT = 'INVOICE'.
IT_OUT-TEXT1 = TEXT.
ELSE.
TEXT = 'BOE'.
IT_OUT-TEXT1 = TEXT.
ENDIF.
SELECT SINGLE * FROM J_1IMOVEND
WHERE LIFNR = IT_CDTL-LIFNR.
SELECT SINGLE * FROM DD07T
* INTO IT_OUT-DDTEXT
WHERE DOMNAME = 'J_1IVTYP' AND
DDLANGUAGE = 'EN' AND
DOMVALUE_L = J_1IMOVEND-J_1IVTYP.
IF DD07T-DDTEXT = 'First Stage Dealer of indigenous excisable goods'
OR
DD07T-DDTEXT = 'Second Stage Dealer of indigenous excisablegoods'.
DD07T-DDTEXT = 'Dealer'.
ENDIF.
IT_OUT-DDTEXT = DD07T-DDTEXT.
* ELSEIF DD07T-DDTEXT = 'Second Stage Dealer of indigenous excisable
*goods'.
* DD07T-DDTEXT =
CLEAR EBELN_T.
SELECT SINGLE LFBNR FROM MSEG
INTO EBELN_T
WHERE MBLNR = IT_CDTL-RDOC2 .
SELECT SINGLE * FROM MSEG
WHERE BWART = '106' AND
LFBNR = EBELN_T ."and
* ebeln = ebeln_t.
IF SY-SUBRC = 0.
IT_OUT-DEL_IND = 'X'.
ELSE.
IT_OUT-DEL_IND = ' '.
ENDIF.
SELECT SINGLE BUDAT FROM MKPF
INTO IT_OUT-BUDAT
WHERE MBLNR = EBELN_T ."MSEG-LFBNR.
IT_OUT-EXNUM = IT_CDTL-EXNUM.
IT_OUT-EXDAT = IT_CDTL-EXDAT.
IT_OUT-EXCCD = IT_CHDR-EXCCD.
IT_OUT-EXBAS = IT_CDTL-EXBAS.
IT_OUT-EXBED = IT_CDTL-EXBED.
IT_OUT-ECS = IT_CDTL-ECS.
IT_OUT-MATNR = IT_CDTL-MATNR.
IT_OUT-MAKTX = IT_CDTL-MAKTX.
IT_OUT-CHAPID = IT_CDTL-CHAPID.
IT_OUT-MENGE = IT_CDTL-MENGE.
IT_OUT-MEINS = IT_CDTL-MEINS.
APPEND IT_OUT.
* EX_NO = IT_CDTL-EXNUM.
ENDLOOP.
* Title Portion
IF REGTYP_1 = 'A'.
SET TITLEBAR 'BALAJI' WITH DB_CNT.
ELSEIF REGTYP_1 = 'C'.
SET TITLEBAR 'BALAJI1' WITH DB_CNT.
ENDIF.
AFIELD-COL_POS = 1.
AFIELD-FIELDNAME = 'SERIALNO'.
AFIELD-SELTEXT_L = 'INPUTS'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 2.
AFIELD-FIELDNAME = 'TEXT1'.
AFIELD-SELTEXT_L = 'TYPE OF DOC'.
AFIELD-JUST = 'L'.
AFIELD-DECIMALS_OUT = '0'.
AFIELD-NO_ZERO = 'X'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 3.
AFIELD-FIELDNAME = 'EXNUM'.
AFIELD-SELTEXT_L = 'DOC.NO'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 4.
AFIELD-FIELDNAME = 'EXDAT'.
AFIELD-SELTEXT_L = 'DOC.DATE'.
AFIELD-JUST = 'C'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 5.
AFIELD-FIELDNAME = 'NAME'.
AFIELD-SELTEXT_L = 'NAME OF THE SUPPLIER'.
AFIELD-NO_ZERO = 'X'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 6.
AFIELD-FIELDNAME = 'DDTEXT'.
AFIELD-SELTEXT_L = 'TYPE-OF-SUPPLIER'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 7.
AFIELD-FIELDNAME = 'EXCCD'.
AFIELD-SELTEXT_L = 'ECC OF THE SUPPLIER'.
AFIELD-NO_ZERO = 'X'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 8.
AFIELD-FIELDNAME = 'BUDAT'.
AFIELD-SELTEXT_L = 'INPUT RECV DATE'.
AFIELD-JUST = 'C'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 9.
AFIELD-FIELDNAME = 'EXBAS'.
AFIELD-SELTEXT_L = 'ASSESSABLE-VALUE'.
AFIELD-DO_SUM = 'X'.
AFIELD-JUST = 'R'.
AFIELD-DECIMALS_OUT = '2'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 10.
AFIELD-FIELDNAME = 'EXBED'.
AFIELD-SELTEXT_L = 'DET OF CREDIT TAKEN CENVAT'.
AFIELD-JUST = 'R'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 11.
AFIELD-FIELDNAME = 'ECS'.
AFIELD-SELTEXT_L = 'DET OF CREDIT TAKEN E-CESS'.
AFIELD-JUST = 'R'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 12.
AFIELD-FIELDNAME = 'MATNR'.
AFIELD-SELTEXT_L = 'MATERIAL-CODE'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 13.
AFIELD-FIELDNAME = 'MAKTX'.
AFIELD-SELTEXT_L = 'DESCRIPTION'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 14.
AFIELD-FIELDNAME = 'CHAPID'.
AFIELD-SELTEXT_L = 'TARIFF-ID'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 15.
AFIELD-FIELDNAME = 'MENGE'.
AFIELD-SELTEXT_L = 'QUANTITY'.
AFIELD-JUST = 'R'.
AFIELD-DO_SUM = ' '.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 16.
AFIELD-FIELDNAME = 'MEINS'.
AFIELD-SELTEXT_L = 'UOM'.
AFIELD-JUST = 'C'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 17.
AFIELD-FIELDNAME = 'DEL_IND'.
AFIELD-SELTEXT_L = 'Deleted'.
AFIELD-JUST = 'C'.
APPEND AFIELD TO FIELDCAT.
* * LAYOUT FOR ZEBRA CATLOG
LAYOUT_IN-COLWIDTH_OPTIMIZE = 'X'.
LAYOUT_IN-ZEBRA = 'X'.
LAYOUT_IN-GET_SELINFOS = 'X'.
LAYOUT_IN-CONFIRMATION_PROMPT = 'X'.
LAYOUT_IN-DETAIL_POPUP = 'X' .
* SORTCAT-decimals = '0'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_SAVE = G_SAVE
IS_VARIANT = GS_VARIANT
IT_FIELDCAT = FIELDCAT
IT_SORT = SORTCAT
IS_LAYOUT = LAYOUT_IN
IT_EVENTS = EVENTCAT
* I_BACKGROUND_ID = g_back_ground
TABLES
T_OUTTAB = IT_OUT.
*& Form TOP_OF_PAGE_LIST_HEADER
* text
* -->LIST_HEADERtext
FORM TOP_OF_PAGE_LIST_HEADER USING LIST_HEADER TYPE SLIS_T_LISTHEADER.
DATA : HLINE TYPE SLIS_LISTHEADER,
TEXT(60) TYPE C.
CLEAR : HLINE,TEXT.
HLINE-TYP = 'H'.
* WRITE 'ROOTS INDUSTRIES LTD' TO TEXT.
HLINE-INFO = TEXT.
APPEND HLINE TO LIST_HEADER.
SELECT SINGLE * FROM T001W WHERE WERKS = WERKS.
CLEAR : HLINE,TEXT.
HLINE-TYP = 'H'.
WRITE 'PLANT :' TO TEXT.
WRITE WERKS TO TEXT+8.
HLINE-INFO = TEXT.
APPEND HLINE TO LIST_HEADER.
CLEAR : HLINE,TEXT.
HLINE-TYP = 'H'.
WRITE T001W-NAME1 TO TEXT.
HLINE-INFO = TEXT.
APPEND HLINE TO LIST_HEADER.
CLEAR : HLINE,TEXT.
HLINE-TYP = 'H'.
WRITE T001W-STRAS TO TEXT.
HLINE-INFO = TEXT.
APPEND HLINE TO LIST_HEADER.
CLEAR : HLINE,TEXT.
HLINE-TYP = 'H'.
WRITE T001W-ORT01 TO TEXT.
HLINE-INFO = TEXT.
APPEND HLINE TO LIST_HEADER.
CLEAR : HLINE,TEXT.
HLINE-TYP = 'H'.
WRITE 'DATE :' TO TEXT.
WRITE BUDAT-LOW TO TEXT+7.
IF BUDAT-HIGH NE ''.
WRITE 'TO' TO TEXT+18.
WRITE BUDAT-HIGH TO TEXT+22.
ENDIF.
HLINE-INFO = TEXT.
APPEND HLINE TO LIST_HEADER.
ENDFORM. "TOP_OF_PAGE_LIST_HEADER
*& Form ALV_EVENT_INIT
* text
FORM ALV_EVENT_INIT .
CLEAR ALV_EVENT.
ALV_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
ALV_EVENT-FORM = 'ALV_TOP_OF_PAGE'.
APPEND ALV_EVENT TO EVENTCAT.
CLEAR ALV_EVENT.
ALV_EVENT-NAME = SLIS_EV_TOP_OF_LIST.
ALV_EVENT-FORM = 'ALV_TOP_OF_LIST'.
APPEND ALV_EVENT TO EVENTCAT.
* CLEAR ALV_EVENT.
* ALV_EVENT-NAME = SLIS_EV_END_OF_LIST.
* ALV_EVENT-FORM = 'ALV_END_OF_LIST'.
* APPEND ALV_EVENT TO GT_EVENTS.
* CLEAR ALV_EVENT.
* ALV_EVENT-NAME = SLIS_EV_END_OF_PAGE.
* ALV_EVENT-FORM = 'ALV_END_OF_PAGE'.
* APPEND ALV_EVENT TO GT_EVENTS.
ENDFORM. "ALV_EVENT_INIT
*& Form ALV_TOP_OF_PAGE
* text
FORM ALV_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = LIST_HEADER
I_LOGO = 'ENJOYSAP_LOGO'.
ENDFORM. "ALV_TOP_OF_PAGE
*& Form BUILD_EVENT
* text
* -->P_GT_EVENTS[] text
FORM BUILD_EVENT USING P_EVENTS TYPE SLIS_T_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = P_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2.
READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND INTO
ALV_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_USER_COMMAND TO ALV_EVENT-FORM.
APPEND ALV_EVENT TO P_EVENTS.
ENDIF.
READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV_BEFORE_LINE_OUTPUT INTO
ALV_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_BEFORE_OUTPUT TO ALV_EVENT-FORM.
APPEND ALV_EVENT TO P_EVENTS.
ENDIF.
ENDFORM. " BUILD_EVENT
Reward if helpfull
Regards
Pavan -
Remove delete option from button 'Layout' ALV grid
The ALV grid displays the button to change the layout (global/user specific).
The user can create his/her own layout variant or change it. However, I would like to hide/remove the option 'Delete layout' from the possible options.
Is this possible?
Regards,
HenryHenry,
Since Layout DELETE button is part of another program, you can't simply exclude it from your ALV grid display.
But, I suppose that layout deletion is possible only from the menu bar using 'Layout Management' and is not possible from the Application toolbar buttons of ALV grid. Also, all other functionalities for layout (new creation, change layout etc ) are possible without using this 'Layout Management' option from menu bar.
So, I think you can meet your requirement hiding the 'Layout Management' option itself simply by excluding it from the grid.
gs_excluding-fcode = '&ERW'.
APPEND gs_excluding TO gt_excluding.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
it_excluding = gt_excluding
BR,
Diwakar -
How to remove the select button from the alv grid
Hi,
I am using the Function modules for alv report,
My 1st field in the list is checkbox,
User can select the checkbox for further process.
My problem is I want to remove the standards select option from alv.
I have searched in slis_layout_alv for any option, but I could not.
Please help me.
Regards
RajanHI
Exclude process options from ALV
PERFORM alv_excl. ( g_r_excl TYPE ui_functions . )
FORM alv_excl.
APPEND cl_gui_alv_grid=>mc_mb_sum TO g_r_excl.
APPEND cl_gui_alv_grid=>mc_mb_subtot TO g_r_excl.
APPEND cl_gui_alv_grid=>mc_fc_graph TO g_r_excl.
APPEND cl_gui_alv_grid=>mc_fc_info TO g_r_excl.
APPEND cl_gui_alv_grid=>mc_fc_print_back TO g_r_excl.
ENDFORM. " alv_excl
CALL METHOD g_r_grid->set_table_for_first_display
EXPORTING
is_layout = g_r_layo
is_variant = g_r_variant
it_toolbar_excluding = g_r_excl
i_save = 'X'
CHANGING
it_outtab = g_t_yetprint[]
it_fieldcatalog = g_t_fieldcat.
Options appended in g_r_excl, will be excluded from ALV
Praveen -
Hi All,
I want to know how to create a button in alv report .
Please respond to my query.
Thanks and Regards,
Amanhi aman,
u can try this example:
where i have a created a button:
*& Report Z_GURU_ALV_EVENT01 *
report z_guru_alv_event01 .
tables: mara, makt.
type-pools slis.
data: begin of imara occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
ersda like mara-ersda,
end of imara.
data: begin of imakt occurs 0,
matnr like mara-matnr,
spras like makt-spras,
maktx like makt-maktx,
end of imakt.
data: ffc type slis_t_fieldcat_alv,
ievents type slis_t_event with header line,
iievent type slis_t_event with header line.
select-options: s_matnr for mara-matnr.
initialization.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = ievents[]
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 ievents with key name = slis_ev_top_of_page.
ievents-form = 'TOPP'.
modify ievents transporting form where name = slis_ev_top_of_page.
clear ievents.
read table ievents with key name = slis_ev_user_command.
ievents-form = 'USR_COM'.
modify ievents transporting form where name = slis_ev_user_command.
clear ievents.
read table ievents with key name = slis_ev_pf_status_set.
ievents-form = 'PFSTAT'.
modify ievents transporting form where name = slis_ev_pf_status_set.
clear ievents.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = iievent[]
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 iievent with key name = slis_ev_pf_status_set.
iievent-form = 'PFSTAT'.
modify iievent transporting form where name = slis_ev_pf_status_set.
clear iievent.
read table iievent with key name = slis_ev_user_command.
iievent-form = 'USERCOM'.
modify iievent transporting form where name = slis_ev_user_command.
clear iievent.
start-of-selection.
select matnr ernam ersda from mara into table imara where matnr
in s_matnr.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = sy-repid
i_internal_tabname = 'IMARA'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = sy-repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = ffc
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_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 = 'ALV_BACKGROUND'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
i_callback_html_end_of_list = 'ALV_BACKGROUND'
I_STRUCTURE_NAME =
i_background_id = 'ALV_BACKGROUND'
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = ffc
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = ievents[]
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 = imara
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 topp.
data: it_top type slis_t_listheader,"having s , h ,a
wa type slis_listheader.
IT_SPEC TYPE SLIS_T_SPECIALCOL_ALV,
WA1 TYPE SLIS_SPECIALCOL_ALV.
wa-typ = 'H'.
wa-info = 'RELIANCE GLOBAL SERVICES' .
append wa to it_top.
clear wa.
wa-typ = 'S'.wa-key = 'NO:23'.
wa-info = 'TRIPLICANE HIGH ROAD'.
append wa to it_top.
clear wa.
wa-typ = 'S'.
wa-info = 'TRIPLICANE'.
append wa to it_top.
clear wa.
wa-typ = 'A'.
wa-info = 'sample'.
append wa to it_top.
clear wa.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = it_top
i_logo = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID =
I_ALV_FORM =
endform.
form usr_com using r_ucomm type sy-ucomm r_selfield type slis_selfield.
case r_ucomm.
when 'CANC'.
leave to screen 0.
endcase.
data: ff type slis_t_fieldcat_alv.
data: v_vbeln(18) type n.
v_vbeln = r_selfield-value.
select matnr spras maktx
from makt into table imakt
up to 10 rows
where matnr = v_vbeln.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = sy-repid
i_internal_tabname = 'IMAKT'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = sy-repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = ff
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_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 = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = ff
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = iievent[]
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
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = imakt
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. "USR_COM
form pfstat using extab type slis_t_extab.
set pf-status 'STD' excluding extab.
endform. " pfstat
form usercom using rucom type sy-ucomm rselfield type slis_selfield.
case rucom.
when 'CANC'.
leave to screen 0.
endcase.
data: ffc type slis_t_fieldcat_alv,
v_matnr(18) type n.
v_matnr = rselfield-value.
select matnr ernam ersda from mara into table imara
where matnr = v_matnr.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = sy-repid
i_internal_tabname = 'IMARA'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = sy-repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = ffc
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_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 = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = ffc
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = iievent[]
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 = imara
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. -
Button in alv grid cell using REUSE_ALV_GRID_DISPLAY
Hi all,
I want to make the contents of 2 columns of my alv grid as push button with values as text on it. I am not using classes or methods but alv grid fm. On clicking the button one dialog box has to pop up which gives edit option for the values in that coloumn, my question is how to introduce button in alv grid cell? if i can use t_fieldcatalog-icon, then please give me the complete steps for that.
Thanks.this may helps u
u need to copy stadard screen elemetn to MARATAB1(at PF -STATUS)
You should copy the 'STANDARD' GUI status from program <b>SAPLSLVC_FULLSCREEN</b>
type this one in SE41 program name is:<b>SAPLSLVC_FULLSCREEN</b>
status : <b>STANDARD_FULLSCREEN</b>
and copy it ...
Type-pool
type-pools slis.
Tables
tables: mara,sscrfields.
Selection screen
select-options: s_matnr for mara-matnr.
PARAMETERS: p_email TYPE somlreci1-receiver.
TYPES: BEGIN OF t_charmara,
matnr(18) TYPE c, " Material Number
ernam(12) TYPE c, " Person Credited
aenam(12) TYPE c, " Person Changed Object
pstat(15) TYPE c, " Maintenance Status
END OF t_charmara.
Data Declarations
data: rt_extab type slis_t_extab, " Table of inactive function
codes
wa_charmara TYPE t_charmara, " work area of mara Table
fs_fieldcat type slis_t_fieldcat_alv,
" Field catalog with field
descriptions
t_fieldcat like line of fs_fieldcat,
" Table of Field catalog
r_ucomm like sy-ucomm, " User Command
rs_selfield TYPE slis_selfield. " cursor position ALV
data: filedlayout type slis_layout_alv,
heading type slis_t_listheader with header line,
t_event type slis_t_event.
data: fs_event like line of t_event.
data: fs_sort type slis_sortinfo_alv,
t_sort type slis_t_sortinfo_alv.
data: w_char(200) type c,
w_matnr type mara-matnr.
fs_sort-fieldname = 'MATNR'.
fs_sort-up = 'X'.
fs_sort-group = '*'.
append fs_sort to t_sort.
clear fS_sort.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
Internal Tables
data: begin of it_mara occurs 0,
matnr like mara-matnr, " Material Number
ernam like mara-ernam, " Person Credited
aenam like mara-aenam, " Person Changed Object
pstat like mara-pstat, " Maintenance Status
end of it_mara.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
*at selection-screen on field event
AT SELECTION-SCREEN on s_matnr.
PERFORM f0100_VALIDATE_MATERIAL_NUMBER.
start-of-selection.
retrive Data from the data base table Mara
perform retrive_data_from_mara.
end-of-selection.
*Field catalog with field descriptions
perform fieldcat.
*perform top_of_page.
PERFORM EVENT_LIST.
*ALV Grid Display
perform alv_display.
Creating one Push button ENTER
perform maratab1 USING RT_EXTAB.
*& Form f0100_VALIDATE_MATERIAL_NUMBER
text
There are no interface parameters to be passed to this subroutine
FORM F0100_VALIDATE_MATERIAL_NUMBER .
select matnr " Material Number
from mara
up to 1 rows
into mara-matnr
where matnr in s_matnr.
endselect.
IF sy-subrc NE 0.
clear sscrfields-ucomm.
MESSAGE e000 WITH 'Enter valid Material number'(003).
ENDIF. " IF sy-subrc NE 0
ENDFORM. " f0100_VALIDATE_MATERIAL_NUMBER
*& Form retrive_data_from_mara
text
*There are no interface parameters to be passed to this subroutine
FORM retrive_data_from_mara .
select matnr " Material Number
ernam " Person Credited
aenam " Person Changed Object
pstat " Maintenance Status
from mara
into table It_mara
where matnr in s_matnr.
IF sy-subrc NE 0.
MESSAGE i001 WITH 'Records are not found'.
exit.
stop.
ENDIF. " IF sy-subrc NE 0
ENDFORM. " retrive_data_from_mara
*& Form fieldcat
text
*There are no interface parameters to be passed to this subroutine
FORM fieldcat .
*field catalog for MATNR
t_FIELDCAT-REF_TABNAME = 'MARA'.
t_fieldcat-fieldname = 'MATNR'.
t_fieldcat-col_pos = 1.
append t_fieldcat to fs_fieldcat.
clear t_fieldcat.
*field catalog for ERNAM
t_FIELDCAT-REF_TABNAME = 'MARA'.
t_fieldcat-fieldname = 'ERNAM'.
t_fieldcat-col_pos = 2.
append t_fieldcat to fs_fieldcat.
clear t_fieldcat.
*field catalog for AENAM
t_FIELDCAT-REF_TABNAME = 'MARA'.
t_fieldcat-fieldname = 'AENAM'.
t_fieldcat-col_pos = 3.
append t_fieldcat to fs_fieldcat.
clear t_fieldcat.
*field catalog for PSTAT
t_FIELDCAT-REF_TABNAME = 'MARA'.
t_fieldcat-fieldname = 'PSTAT'.
t_fieldcat-col_pos = 4.
append t_fieldcat to fs_fieldcat.
clear t_fieldcat.
ENDFORM. " fieldcat
*& Form EVENT_LIST
text
*There are no interface parameters to be passed to this subroutine
FORM EVENT_LIST .
fs_event-name ='TOP_OF_PAGE'.
fs_event-form = 'TOP_PAGE'.
append fs_event TO t_EVENT.
CLEAR FS_EVENT.
fs_event-name ='END_OF_PAGE'.
fs_event-form = 'END_PAGE'.
append fs_event TO t_EVENT.
CLEAR FS_EVENT.
fs_event-name ='END_OF_LIST'.
fs_event-form = 'LIST_END'.
append fs_event TO t_EVENT.
CLEAR FS_EVENT.
ENDFORM. " EVENT_LIST
*& Form alv_display
text
*There are no interface parameters to be passed to this subroutine
FORM alv_display .
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 = 'MARATAB1'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME =
IS_LAYOUT =
IT_FIELDCAT = FS_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = T_SORT
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = T_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
IR_SALV_LIST_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_MARA[]
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. " alv_display
form TOP_PAGE.
data:tbl_listheader type slis_t_listheader,
wa_listheader type slis_listheader .
wa_listheader-typ = 'S'.
wa_listheader-info = 'Created by : Vijay Pawar'.
append wa_listheader to tbl_listheader.
wa_listheader-typ = 'S'.
concatenate ' Date ' sy-datum into
wa_listheader-info separated by space.
append wa_listheader to tbl_listheader.
wa_listheader-typ = 'S'.
concatenate ' From ' s_matnr-low ' To ' s_matnr-high into
wa_listheader-info separated by space.
append wa_listheader to tbl_listheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = tbl_listheader
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
endform. " form TOP_PAGE.
form END_PAGE.
STATICS W_PAGE TYPE I .
data:tbl_listheader type slis_t_listheader,
wa_listheader type slis_listheader .
wa_listheader-typ = 'S'.
wa_listheader-info = W_PAGE.
append wa_listheader to tbl_listheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = tbl_listheader
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
add 1 to w_page.
endform. " form END_PAGE.
form list_end.
data:tbl_listheader type slis_t_listheader,
wa_listheader type slis_listheader .
wa_listheader-typ = 'S'.
wa_listheader-info = '......................................Last Page'
append wa_listheader to tbl_listheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = tbl_listheader
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
endform. " form list_end.
*& Form maratab1
text
-->P_RT_EXTAB text
FORM maratab1 USING P_RT_EXTAB.
SET PF-STATUS 'MARATAB1' EXCLUDING rt_extab.
ENDFORM. " maratab1
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
case r_ucomm.
when 'ENTER'.
perform bulid_xls_data_table.
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email "'[email protected]'
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
perform populate_email_message_body.
PERFORM initiate_mail_execute_program.
endcase. " case r_ucomm.
endform. " FORM user_command
perform populate_email_message_body.
PERFORM initiate_mail_execute_program.
CALL FUNCTION 'RH_START_EXCEL_WITH_DATA'
EXPORTING
DATA_FILENAME = 'MARA.XLS'
DATA_PATH_FLAG = 'W'
DATA_ENVIRONMENT =
DATA_TABLE = ITAB[]
MACRO_FILENAME =
MACRO_PATH_FLAG = 'E'
MACRO_ENVIRONMENT =
WAIT = 'X'
DELETE_FILE = 'X'
EXCEPTIONS
NO_BATCH = 1
EXCEL_NOT_INSTALLED = 2
INTERNAL_ERROR = 3
CANCELLED = 4
DOWNLOAD_ERROR = 5
NO_AUTHORITY = 6
FILE_NOT_DELETED = 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.
leave to list-processing.
endcase.
*& Form bulid_xls_data_table
text
*There are no interface parameters to be passed to this subroutine
FORM bulid_xls_data_table .
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'matnr' 'ernam' 'aenam' 'pstat'
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT It_mara INTO wa_charmara.
CONCATENATE wa_charmara-matnr wa_charmara-ernam
wa_charmara-aenam wa_charmara-pstat
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP. " LOOP AT it_mara INTO...
ENDFORM. " bulid_xls_data_table
*& Form send_file_as_email_attachment
Send email
-->P_IT_MESSAGE text
-->P_IT_ATTACH text
-->P_P_EMAIL text
-->P_0387 text
-->P_0388 text
-->P_0389 text
-->P_0390 text
-->P_0391 text
-->P_0392 text
<--P_GD_ERROR text
<--P_GD_RECIEVER text
FORM send_file_as_email_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM. " send_file_as_email_attachment
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test mara records'.
APPEND it_message.
endform. "form populate_email_message_bod
rewards if it helps u -
im displaying button in ALV using these statements.
form set_pf_status using rt_extab type slis_t_extab.
SET PF-STATUS 'STANDARD' excluding rt_extab.
endform. "set_pf_status
When that button is clicked shuld display a secondary list.
i tried to get this using this code. But its not navigating to the seco list.
FORM USER_COMMAND USING w_ucomm LIKE sy-ucomm
wa_selfield TYPE slis_selfield.
CASE w_ucomm.
WHEN 'UI'.
write:'sfdjhsfh'.
ENDCASE.
ENDFORM. " user_command
wat i need to do ,to display the secondary list when cliks the button in alv.Anu,
See teh below simple code...
An Interactive ALV Report
*& Report ZZ_22038_22098_002 *
*& This is an Interactive ALV report, where on line slection we can see
*& the secondry list
REPORT ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650
MESSAGE-ID ZZ_9838 .
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 I_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.
Don't forget to reward if useful.... -
To disable the Application tool bar button in ALV report
Hi Everyone,
Iam using REUSE_ALV_GRID_DISPLAY to display ALV report.
Now my requirement is to disable(I mean grey out) a application tool bar button.
Thanks in advance
Moderator message: please search for available information and try yourself before asking.
locked by: Thomas Zloch on Sep 23, 2010 11:38 AMWe can disable the buttons on the application toolbar as below.
*To Exclude a few buttons from the Application tool bar
data: it_excluding type slis_t_extab.
data: wa_excluding type slis_extab.
wa_excluding-fcode = '&OUP'.
append wa_excluding to it_excluding.
wa_excluding-fcode = '&ILT'.
append wa_excluding to it_excluding.
wa_excluding-fcode = '&ODN'.
append wa_excluding to it_excluding.
and in the FM.....
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
i_callback_pf_status_set = 'ZPICK'
is_layout = itlayout
i_callback_user_command = 'LIST1'
i_grid_title = <fs>
* i_callback_top_of_page = ' '
it_fieldcat = itfieldcat[]
it_excluding = it_excluding
But,no idea on how to disable the whole application tool bar itself ?
K.Kiran. -
Query on retrieving data back to the program from ALV List
Hi Group,
I have a requirement to send the details of the selected data as an ALV list to the user.
Then, the user selects either 1 or 2 or all or none back to the program from the ALV.
Thing is that,
1) when the user selects ( Icon ) to choose all the fields, they were not getting checked and in turn, I was not been able to read the records as checked in the program ( this is for All selection records ).
2) And also, I am not able to get the records checked ( incase of the user selects all fields ).
In short, I should be able to read the records which were checked and process only that records.
please let me know if you have any queries on the same.
Thank you very much in advance for the help.
Regards,
Vishnu.hi,
try like this
TABLES: ekko.
TYPE-POOLS: slis.
TYPES: BEGIN OF t_ekko,
sel, "stores which row user has selected
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.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
fieldcatalog1 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
DATA : BEGIN OF det_tab OCCURS 0,
ebeln LIKE ekpo-ebeln,
END OF det_tab.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
gd_layout-box_fieldname = 'SEL'.
"set field name to store row selection
gd_layout-edit = 'X'. "makes whole ALV table editable
gd_layout-zebra = 'X'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
FORM display_alv_report.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_STAT'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
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 DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO CORRESPONDING FIELDS OF TABLE it_ekko.
ENDFORM. " DATA_RETRIEVAL
FORM USER_COMMAND *
--> R_UCOMM *
--> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
IF rs_selfield-fieldname = 'EBELN'.
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
WHEN 'DET'. "user presses SAVE
CLEAR det_tab.
REFRESH det_tab.
LOOP AT it_ekko INTO wa_ekko WHERE sel = 'X'.
MOVE-CORRESPONDING wa_ekko TO det_tab.
APPEND det_tab.
ENDLOOP.
PERFORM build_cat.
PERFORM dis_data.
ENDCASE.
ENDFORM. "user_command
*& Form set_stat
text
-->RT_EXTAB text
FORM set_stat USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTAT' EXCLUDING rt_extab.
ENDFORM. "set_stat
*& Form build_cat
text
FORM build_cat.
CLEAR fieldcatalog1.
REFRESH fieldcatalog1.
fieldcatalog1-fieldname = 'EBELN'.
fieldcatalog1-tabname = 'DET_TAB'.
fieldcatalog1-seltext_m = 'Order No.'.
fieldcatalog1-outputlen = 10.
APPEND fieldcatalog1 TO fieldcatalog1.
CLEAR fieldcatalog1.
ENDFORM. "build_cat
*& Form dis_data
text
FORM dis_data.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZTEST_DS'
it_fieldcat = fieldcatalog1[]
i_save = 'X'
TABLES
t_outtab = det_tab.
ENDFORM. "dis_data
here i have created one button(DET) in toolbar along with all the buttons of ALV..
when i click on this i am getting detail list....
reward if usefull.... -
Deactivate buttons in ALV GRID being called in subscreen
Hi,
In a screen, when a specific tab is selected (tab strip), the subscreen area is filled with ALV GRID. I need to deactivate few buttons on the ALV GRID. How can that be done??
Advance ThanksHi Aadarsh,
Check out the following program.
Global data definitions for ALV
To allow the declaration of gr_event_handler before the
lcl_event_receiver class is defined, decale it as deferred in the
start of the program
CLASS lcl_event_handler DEFINITION DEFERRED.
Object reference
ALV Grid instance reference
DATA: gr_alvgrid TYPE REF TO cl_gui_alv_grid,
Custom container instance reference
gr_ccontainer TYPE REF TO cl_gui_custom_container,
Event class reference
gr_event_handler TYPE REF TO lcl_event_handler. "IC210507+
Internal Table
Field catalog table
DATA: gt_fieldcat TYPE lvc_t_fcat,
Internal table holding list data
gt_list TYPE STANDARD TABLE OF sflight,
Table to be filled up for excluding some of the standard function
buttons
gt_exclude TYPE ui_functions. "IC210507+
Work area
Layout structure
DATA: gs_layout TYPE lvc_s_layo,
Field catalog structure
gs_fcat TYPE lvc_s_fcat,
Exclude button structure
gs_exclude TYPE ui_func, "IC210507+
Structure to add button in the ALV toolbar
gs_toolbar TYPE stb_button. "IC210507+
Variables
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm,
Name of the custom control added on the screen
gv_custom_control_name TYPE scrfname VALUE 'CC_ALV'.
Begin of IC210507
Local classes
CLASS lcl_event_handler DEFINITION .
PUBLIC SECTION.
METHODS:
To add new functional buttons to the ALV toolbar
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
To implement user commands
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS. "lcl_event_handler DEFINITION
End of IC210507
Calling the screen where ALV output is displayed
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
PBO
MODULE status_0100 OUTPUT.
ALV display
PERFORM display_alv.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
PAI
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
IF save_ok EQ 'EXIT'.
LEAVE PROGRAM.
ENDIF.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form display_alv
ALV display
FORM display_alv.
PERFORM get_data.
PERFORM create_alv.
ENDFORM. " display_alv
*& Form get_data
Fetch data to be displayed in the list
FORM get_data.
SELECT * FROM sflight
INTO TABLE gt_list.
ENDFORM. " get_data
*& Form create_alv
Create and set or Refresh ALV
FORM create_alv.
Checking whether an instance of the container (or ALV Grid) exists.
IF gr_alvgrid IS INITIAL.
If not, creating and setting ALV for the first display.
Creating custom container instance
CREATE OBJECT gr_ccontainer
EXPORTING
container_name = gv_custom_control_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
Creating ALV Grid 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.
Begin of IC210507
Creating an instance for the event handler
CREATE OBJECT gr_event_handler.
Registering handler methods to handle ALV Grid events
SET HANDLER gr_event_handler->handle_user_command FOR gr_alvgrid.
SET HANDLER gr_event_handler->handle_toolbar FOR gr_alvgrid.
End of IC210507
Preparing field catalog.
PERFORM prepare_field_catalog CHANGING gt_fieldcat.
Preparing layout structure
PERFORM prepare_layout CHANGING gs_layout.
Excluding Unwanted Standard Function Buttons
PERFORM exclude_tb_functions CHANGING gt_exclude. "IC210507+
Method to display ALV grid
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
To exclude buttons the exclusion table must be passed to the following
field
it_toolbar_excluding = gt_exclude "IC210507+
CHANGING
it_outtab = gt_list
it_fieldcatalog = gt_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
To make ALV show our additional buttons, we must call the method
set_toolbar_interactive for the ALV Grid instance after the instance
is created.
CALL METHOD gr_alvgrid->set_toolbar_interactive. "IC210507+
ELSE.
If an instance of the container (or ALV Grid) exists, refreshing it.
CALL METHOD gr_alvgrid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
ENDIF.
ENDFORM. " create_alv
*& Form prepare_field_catalog
Subroutine to populate field catalog
<--P_GT_FIELDCAT Table to describe the field catalog
FORM prepare_field_catalog CHANGING p_gt_fieldcat TYPE lvc_t_fcat.
Generating the field catalog semi automatically
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
ct_fieldcat = p_gt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
LOOP AT p_gt_fieldcat INTO gs_fcat.
CASE gs_fcat-fieldname.
WHEN 'CARRID'.
gs_fcat-outputlen = '10'.
gs_fcat-coltext = 'Airline Carrier ID'.
MODIFY p_gt_fieldcat FROM gs_fcat.
WHEN 'FLDATE'.
gs_fcat-just = 'C'.
gs_fcat-hotspot = 'X'.
MODIFY p_gt_fieldcat FROM gs_fcat.
ENDCASE.
ENDLOOP.
ENDFORM. " prepare_field_catalog
*& Form prepare_layout
Preparing layout structure
<--P_GS_LAYOUT Layout structure
FORM prepare_layout CHANGING p_gs_layout TYPE lvc_s_layo.
p_gs_layout-zebra = 'X' .
p_gs_layout-grid_title = 'Flight Info System'.
p_gs_layout-smalltitle = 'X'.
ENDFORM. " prepare_layout
Begin of IC210507
*& Form exclude_tb_functions
Excluding Unwanted Standard Function Buttons
<--P_GT_EXCLUDE Table to be filled up to exclude buttons
FORM exclude_tb_functions CHANGING p_gt_exclude TYPE ui_functions.
MC_FC_ are names for functions directly and the names beginning with
MC_MB_ are for the function menus including some subfunctions as menu
entries.
In this case 'Maximum' and 'Minimum' options under 'Sum' button & 'Print'
button are excluded
gs_exclude = cl_gui_alv_grid=>mc_fc_maximum.
APPEND gs_exclude TO p_gt_exclude.
gs_exclude = cl_gui_alv_grid=>mc_fc_minimum.
APPEND gs_exclude TO p_gt_exclude.
gs_exclude = cl_gui_alv_grid=>mc_fc_print.
APPEND gs_exclude TO p_gt_exclude.
ENDFORM. " exclude_tb_functions
*& Class (Implementation) lcl_event_handler
Event handler for the ALV Grid instance.
CLASS lcl_event_handler IMPLEMENTATION.
Handle Toolbar
METHOD handle_toolbar.
PERFORM handle_toolbar USING e_object e_interactive .
ENDMETHOD . "handle_toolbar
Handle User Command
METHOD handle_user_command .
PERFORM handle_user_command USING e_ucomm .
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_handler
*& Form handle_toolbar
Subroutine called from event handler method for event toolbar.
This is to add a new button in the ALV application toolbar
-->P_E_OBJECT
-->P_E_INTERACTIVE
FORM handle_toolbar USING p_e_object TYPE REF TO cl_alv_event_toolbar_set
p_e_interactive.
Begin of 'Adding a new Button'
CLEAR gs_toolbar.
Function code
MOVE 'EXIT' TO gs_toolbar-function.
Button type that will be added to the toolbar
gs_toolbar-butn_type = 0.
Icon for the button
From the type group ICON in SE11, we can get the value to be passed
for icon
gs_toolbar-icon = '@2N@'.
Quick info for the button
MOVE 'Exit' TO gs_toolbar-quickinfo.
Text for the button
MOVE 'Exit' TO gs_toolbar-text.
Adds the button as disabled if set to X
MOVE ' ' TO gs_toolbar-disabled.
Appending the structure to the table attribute mt_toolbar of the object
APPEND gs_toolbar TO p_e_object->mt_toolbar.
End of 'Adding a new Button'
Begin of 'Disabling an existing standard Button'
LOOP AT p_e_object->mt_toolbar
INTO gs_toolbar
Identify which button to disable from the function code
In this case disabling the 'Filter' button
WHERE function = '&MB_FILTER'.
Set the 'DISABLED' field to disable a button
gs_toolbar-disabled = 'X'.
MODIFY p_e_object->mt_toolbar FROM gs_toolbar.
ENDLOOP.
End of 'Disabling an existing standard Button'
ENDFORM. " handle_toolbar
*& Form handle_user_command
Implement any new function
-->P_E_UCOMM text
FORM handle_user_command USING p_e_ucomm TYPE syucomm.
IF p_e_ucomm EQ 'EXIT'.
LEAVE PROGRAM.
ENDIF.
ENDFORM. " handle_user_command
End of IC210507
Award points if found useful.
Regards
Indrajit.
Maybe you are looking for
-
I bought an Eprinter yet I cannot use apps? whats with that?
I just bought a HP LaserJet Pro 100 color MFP M175nw Color Laser MFP for petes sake said Supports ePrint technology For direct printing from most mobile devices. Well how come I cannot get firmware updates, it says my printer is not listed??? nor a
-
Provision for Approval process
Dear Experts, I have a requirement "To be able to provision for Approval process by FInance, when role of business partner upgraded from prospect to customer" I guess this is done through Workflow concept. but I don't have Idea in detail. Looking fo
-
Can webgui Iviews use ITS Themes generated by ITS Theme generator
Hi, Can only IAC Components such as ESS etc be modified using ITS Theme genrator. I selected sap_preview service in the ITS Theme Generator wizard, and generated the theme.If I select webgui as the service, then it does not reflect any changes. I hav
-
Sort Servic contract Quaotations search result table by new field (country)
Dear Experts, I have enhanced the Service contact quotations search, by adding 'country' field in both search screen and result screeen. I added the 'country' field as model attribute by taking reference of 'BuilHeaderSearch'
-
Hi! I am making my firms website using Adobe Muse. In Norway all websites have to be sertified in WCAG 2.0. My site including all pages are getting the same problem. Se this picture: I have tried to plave the correct code: <html lang="no"> by clickin