Events in REUSE_ALV_GRID_DISPLAY
Hi Gurus,
Does anyone know what events (I mean those passed by I_EVENTS parameter) are executed in this FM?
I've tried LIST_CHANGED, but it looks like it works only with REUSE_ALV_LIST_DISPLAY
hi,
it is use for different events like TOP_OF_PAGE,END_OF_PAGE,USER_COMMAND...
in ALV grid there is functionality of calling USER_COMMAND,TOP_OF_PAGE....
but ALV List if u want these then u need event parameter....
here is the example...
*& Report ZALV_LIST
REPORT zalv_list.
TABLES : mseg.
TYPE-POOLS : slis.
DATA : BEGIN OF itab OCCURS 0,
mblnr LIKE mseg-mblnr,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
menge LIKE mseg-menge,
line_color(4) TYPE c,
END OF itab.
DATA : BEGIN OF itab1 OCCURS 0,
mblnr LIKE mseg-mblnr,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
menge LIKE mseg-menge,
line_color(4) TYPE c,
END OF itab1.
DATA : t_fcat TYPE slis_t_fieldcat_alv,
t_eve TYPE slis_t_event,
t_subtot TYPE slis_t_sortinfo_alv,
subtot LIKE LINE OF t_subtot,
wa_fcat LIKE LINE OF t_fcat,
gd_layout TYPE slis_layout_alv.
DATA : gt_menge LIKE mseg-menge,
st_menge LIKE mseg-menge.
SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : doc FOR mseg-mblnr.
SELECTION-SCREEN : END OF BLOCK blk1.
INITIALIZATION.
PERFORM build_cat USING t_fcat.
PERFORM build_eve.
PERFORM build_layout.
START-OF-SELECTION.
PERFORM get_data.
PERFORM display.
*& Form build_cat
* text
* -->TEMP_FCAT text
FORM build_cat USING temp_fcat TYPE slis_t_fieldcat_alv.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MBLNR'.
wa_fcat-seltext_m = 'Material Doc.'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-seltext_m = 'Material'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'WERKS'.
wa_fcat-seltext_m = 'Plant'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MENGE'.
wa_fcat-seltext_m = 'Quantity'.
wa_fcat-do_sum = 'Y'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
subtot-spos = 1.
subtot-fieldname = 'MBLNR'.
subtot-tabname = 'ITAB'.
subtot-up = 'X'.
subtot-group = 'X'.
subtot-subtot = 'X'.
subtot-expa = 'X'.
APPEND subtot TO t_subtot.
ENDFORM. "build_cat
*& Form build_eve
* text
FORM build_eve.
DATA : wa_eve TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = t_eve
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 t_eve WITH KEY name = slis_ev_top_of_page
INTO wa_eve.
IF sy-subrc = 0.
MOVE 'TOP_OF_PAGE' TO wa_eve-form.
APPEND wa_eve TO t_eve.
ENDIF.
READ TABLE t_eve INTO wa_eve WITH KEY name = 'END_OF_LIST'.
IF sy-subrc = 0.
wa_eve-form = 'END_OF_PAGE'.
MODIFY t_eve FROM wa_eve INDEX sy-tabix.
ENDIF.
ENDFORM. "build_eve
*& Form build_layout
* text
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-info_fieldname = 'LINE_COLOR'.
gd_layout-subtotals_text = 'SUBTOTAL'.
gd_layout-totals_text = 'TOTAL'.
ENDFORM. " BUILD_LAYOUT
*& Form get_data
* text
FORM get_data.
SELECT mblnr matnr werks menge FROM mseg INTO CORRESPONDING FIELDS OF TABLE itab
WHERE mblnr IN doc.
SORT itab BY mblnr.
ENDFORM. "get_data
*& Form display
* text
FORM display.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = 'ZALV_LIST'
is_layout = gd_layout
it_fieldcat = t_fcat
it_sort = t_subtot
it_events = t_eve
TABLES
t_outtab = itab.
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
*& Form top_of_page
* text
FORM top_of_page.
WRITE:/ 'Material Info'.
ENDFORM. "top_of_page
*& Form end_of_page
* text
FORM end_of_page.
WRITE:/ 'Dhwani Shah'.
ENDFORM. "end_of_page
reward if usefull....
Similar Messages
-
How to use the ONF4 event in REUSE_ALV_GRID_DISPLAY?
I am able to use the methods for BUTTON_CLICK and HOTSPOT_CLICK for a report that outputs ALV Grid using REUSE_ALV_GRID_DISPLAY.
But I am not able to trigger the ONF4 event.
How to enable this?
Thanks,hi look at the code ...may be helpful for u..
TYPE-POOLS SLIS.
DATA: BEGIN OF T_OUT_FOR_F4 OCCURS 0,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
END OF T_OUT_FOR_F4.
PARAMETERS: P_BUKRS TYPE BUKRS.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BUKRS.
PERFORM F4_FOR_BUKRS.
*& Form F4_FOR_BUKRS
text
--> p1 text
<-- p2 text
FORM F4_FOR_BUKRS.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
IT_REPORT TYPE SY-REPID,
ES_SELFIELD TYPE SLIS_SELFIELD.
Get data
SELECT BUKRS BUTXT FROM T001 INTO TABLE T_OUT_FOR_F4
WHERE BUKRS = '0001' OR BUKRS = 'US01'.
Get field
IT_REPORT = SY-REPID.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = IT_REPORT
I_INTERNAL_TABNAME = 'T_OUT_FOR_F4'
I_INCLNAME = IT_REPORT
CHANGING
CT_FIELDCAT = IT_FIELDCAT[].
LOOP AT IT_FIELDCAT.
IT_FIELDCAT-KEY = SPACE.
IF IT_FIELDCAT-FIELDNAME = 'BUTXT'.
IT_FIELDCAT-KEY = 'X'.
ENDIF.
MODIFY IT_FIELDCAT.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE =
I_SELECTION = 'X'
I_ZEBRA = ' '
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_CHECKBOX_FIELDNAME =
I_LINEMARK_FIELDNAME =
I_SCROLL_TO_SEL_LINE = 'X'
I_TABNAME = 'T_OUT_FOR_F4'
I_STRUCTURE_NAME =
IT_FIELDCAT = IT_FIELDCAT[]
IT_EXCLUDING =
I_CALLBACK_PROGRAM =
I_CALLBACK_USER_COMMAND =
IS_PRIVATE =
IMPORTING
ES_SELFIELD = ES_SELFIELD
E_EXIT =
TABLES
T_OUTTAB = T_OUT_FOR_F4
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.
ELSE.
READ TABLE T_OUT_FOR_F4 INDEX ES_SELFIELD-TABINDEX.
P_BUKRS = T_OUT_FOR_F4-BUKRS.
ENDIF.
ENDFORM. " F4_FOR_BUKRS -
Checkbox event in REUSE_ALV_GRID_DISPLAY
Hi,
I have a report using REUSE_ALV_GRID_DISPLAY that a check box.. In the ALV have two quantity fields that have values not equal. then while user click on the checkbox i need to give message that quantity is not equal.
I need to give message once user click on the checkbox itself.
Please don't suggest that while saving the ALV we can give message use PF_STATUS_CALLBACK PROGRAM
Sa_RHi,
&ic1 is event code for doubleclick or click when we use hotspot
We can use it in ALV Program.
Check the follwing program
in this i used WHEN '&IC1'.
REPORT zs5.
TABLES:t001w, " plants / branches
mard. " Storage Location data for material
marc. " plant data for material
TYPE-POOLS:slis.
SELECT-OPTIONS:s_werks FOR mard-werks. "plant
DATA:BEGIN OF it_mard OCCURS 0,
werks LIKE mard-werks, " plant
matnr LIKE mard-matnr, " material number
lgort LIKE mard-lgort, " storage location
END OF it_mard.
DATA:BEGIN OF it_t001w OCCURS 0,
werks LIKE t001w-werks, "plant
name1 LIKE t001w-name1, "name
ort01 LIKE t001w-ort01, "city
END OF it_t001w.
DATA: temp_werks(4) TYPE c.
DATA: it_listheader TYPE slis_t_listheader .
DATA: hline TYPE slis_listheader.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA: it_fieldcat1 TYPE slis_t_fieldcat_alv,
wa_fieldcat1 TYPE slis_fieldcat_alv.
DATA: it_events TYPE slis_t_event,
wa_event TYPE slis_alv_event.
DATA: wa_layout TYPE slis_layout_alv.
START-OF-SELECTION.
PERFORM get_data_from_mard.
PERFORM populate_alv.
*& Form get_data_from_mard
FORM get_data_from_mard .
SELECT werks
matnr
lgort
FROM mard INTO TABLE it_mard WHERE werks IN s_werks.
ENDFORM. " get_data_from_mard
*& Form populate_alv
FORM populate_alv .
PERFORM populate_fieldcat.
PERFORM event_call.
PERFORM populate_event.
PERFORM build_listheader USING it_listheader.
PERFORM call_alv_grid_display.
ENDFORM. " populate_alv
*& Form populate_fieldcat
FORM populate_fieldcat .
wa_fieldcat-col_pos = 1.
wa_fieldcat-icon = 'X'.
wa_fieldcat-fieldname = 'WERKS'.
wa_fieldcat-seltext_l = 'plant'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = 2.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-seltext_l = 'Material no'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = 3.
wa_fieldcat-fieldname = 'LGORT'.
wa_fieldcat-seltext_l = 'Storage location'.
APPEND wa_fieldcat TO it_fieldcat.
wa_layout-zebra = 'X'.
wa_layout-colwidth_optimize = 'X'.
ENDFORM. " populate_fieldcat
*& Form event_call
FORM event_call .
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.
ENDFORM. " event_call
*& Form populate_event
FORM populate_event .
READ TABLE it_events INTO wa_event WITH KEY name = 'TOP_OF_PAGE'.
IF sy-subrc EQ 0.
wa_event-form = 'TOP_OF_PAGE'.
MODIFY it_events FROM wa_event TRANSPORTING form WHERE name =
wa_event-form.
ENDIF.
READ TABLE it_events INTO wa_event WITH KEY name = 'USER_COMMAND'.
IF sy-subrc EQ 0.
wa_event-form = 'USER_COMMAND'.
MODIFY it_events FROM wa_event TRANSPORTING form WHERE name =
wa_event-name.
ENDIF.
ENDFORM. " populate_event
*& Form build_listheader
FORM build_listheader USING p_it_listheader.
hline-info = 'PRIMARY LIST'.
hline-typ = 'H'.
APPEND hline TO it_listheader.
ENDFORM. " build_listheader
*& Form top-of-page
FORM top-of-page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader.
ENDFORM. "top-of-page
*& Form call_alv_grid_display
FORM call_alv_grid_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP-OF_PAGE'
i_grid_title = 'FIRST LIST'
is_layout = wa_layout
it_fieldcat = it_fieldcat
it_events = it_events
TABLES
t_outtab = it_mard
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. " call_alv_grid_display
*& Form user_command
FORM user_command USING r_ucomm TYPE sy-ucomm rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
IF rs_selfield-fieldname = 'WERKS'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = rs_selfield-value
IMPORTING
output = temp_werks.
temp_werks = rs_selfield-value.
PERFORM get_data_t001w.
PERFORM populate_fieldcat_t001w.
PERFORM event_call_t001w.
PERFORM populate_event_t001w.
PERFORM build_listheader_t001w USING it_listheader.
PERFORM alv_grid_display_t001w.
ENDIF.
ENDCASE.
ENDFORM. " user_command
*& Form get_data_t001w
FORM get_data_t001w .
SELECT werks
name1
ort01
FROM t001w INTO TABLE it_t001w WHERE werks = temp_werks.
ENDFORM. " get_data_t001w
*& Form populate_fieldcat_t001w
FORM populate_fieldcat_t001w .
wa_fieldcat1-col_pos = 1.
wa_fieldcat1-icon = 'X'.
wa_fieldcat1-fieldname = 'WERKS'.
wa_fieldcat1-seltext_l = 'plant'.
APPEND wa_fieldcat1 TO it_fieldcat1.
wa_fieldcat1-col_pos = 2.
wa_fieldcat1-fieldname = 'NAME1'.
wa_fieldcat1-seltext_l = 'Name'.
APPEND wa_fieldcat1 TO it_fieldcat1.
wa_fieldcat1-col_pos = 3.
wa_fieldcat1-fieldname = 'ORT01'.
wa_fieldcat1-seltext_l = 'City'.
APPEND wa_fieldcat1 TO it_fieldcat1.
wa_layout-zebra = 'X'.
wa_layout-colwidth_optimize = 'X'.
ENDFORM. " populate_fieldcat_t001w
*& Form event_call_t001w
text
--> p1 text
<-- p2 text
FORM event_call_t001w .
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.
ENDFORM. " event_call_t001w
*& Form populate_event_t001w
FORM populate_event_t001w .
READ TABLE it_events INTO wa_event WITH KEY name = 'TOP_OF_PAGE'.
IF sy-subrc EQ 0.
wa_event-form = 'TOP_OF_PAGE'.
MODIFY it_events FROM wa_event TRANSPORTING form WHERE name = wa_event-form.
ENDIF.
ENDFORM. " populate_event_t001w
*& Form build_listheader
FORM build_listheader_t001w USING p_it_listheader.
hline-info = 'SECONDARY LIST'.
hline-typ = 'H'.
APPEND hline TO it_listheader.
ENDFORM. " build_listheader
*& Form top-of-page_t001w
FORM top-of-page_t001w.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader.
ENDFORM. "top-of-page_t001w
*& Form alv_grid_display_t001w
FORM alv_grid_display_t001w .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_top_of_page = 'TOP_OF_PAGE'
i_grid_title = 'SECONDARY LIST'
is_layout = wa_layout
it_fieldcat = it_fieldcat1
it_events = it_events
TABLES
t_outtab = it_t001w
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_grid_display_t001w
<b>Reward if helpful.</b> -
Events with REUSE_ALV_GRID_DISPLAY
Hi, I would like to insert a "top of list" and "end of list" into an ALV GRID, is it possible? the problem is that the top is too big so we need to show it just in the first page and in the same time we need that an end of list should be showed.
Here we send our code, when we use the ALV List Works ok but with the ALV GRID, doesn't. It show us the end of list as a top of list and the top of list disapears.
perform event_form.
perform stampa_dati.
*& Form event_form
form event_form.
Imposta evento TOP_OF_PAGE e routine in cui viene gestito
ls_event-name = slis_ev_top_of_page.
ls_event-form = 'TESTATA_ALV'.
append ls_event to event_tab.
clear ls_event.
Imposta evento TOP_OF_LIST e routine in cui viene gestito
ls_event-name = slis_ev_top_of_list.
ls_event-form = 'XTOP_OF_LIST'.
ls_event-name = slis_ev_end_of_list .
ls_event-form = 'XEND_OF_LIST'.
append ls_event to event_tab.
clear ls_event .
endform. " event_form
*& Form stampa_dati
text
--> p1 text
<-- p2 text
form stampa_dati.
Messa a video dati con function-module
data: w_callback like sy-repid.
w_callback = sy-repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = w_callback
--------------" attivare se si vuole gestire una gui custom
i_callback_pf_status_set = 'MIO_STATO'
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'ZZPFIT00032'
i_background_id = ' '
is_layout = layout
it_fieldcat = tb_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = tb_u_sort[]
IT_FILTER =
IS_SEL_HIDE =
i_default = 'X'
i_save = 'A'
is_variant = variante
is_variant = 'X'
it_events = event_tab[]
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 1
I_SCREEN_START_LINE = 1
I_SCREEN_END_COLUMN = 64
I_SCREEN_END_LINE = 20
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = tb_print_esec
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. " stampa_dati
*& Form testata_alv
text
--> p1 text
<-- p2 text
form testata_alv.
if p_spool is initial.
exit.
endif.
data: w_datum like bapi_field-date.
data: w_uzeit(8) type c .
data : tb_ls_line type zzpbct00007 occurs 0 with header line.
data : tb_ls_line_sel type zzpbct00007 occurs 0 with header line.
data: ls_line type slis_listheader.
refresh tb_list_top_of_page.
clear ls_line.
write sy-datum to w_datum dd/mm/yyyy.
write sy-uzeit to w_uzeit using edit mask '__:__:__'.
inserisco data
ls_line-typ = 'S'.
ls_line-key = text-007 .
ls_line-info = w_datum.
append ls_line to tb_list_top_of_page.
inserisco ora
ls_line-typ = 'S'.
ls_line-key = text-008 .
ls_line-info = w_uzeit.
append ls_line to tb_list_top_of_page.
***List body comment block output
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'PMMN_LOGO'
it_list_commentary = tb_list_top_of_page.
endform. " testata_alv
*& Form XEND_OF_LIST
text
--> p1 text
<-- p2 text
form xend_of_list.
if p_spool is initial.
exit.
endif.
data: w_datum like bapi_field-date.
data: w_uzeit(8) type c .
data : vl_count(10) type n.
data: ls_line type slis_listheader.
data tb_list_top_of_page type slis_t_listheader.
data : tb_ls_line_sel type zzpbct00007 occurs 0 with header line.
refresh tb_list_top_of_page .
move tb_list_top_of_page[] to tb_ls_line_sel[] .
move sy-repid to w_report.
move sy-slset to w_variant .
perform variante changing w_variant.
inserisco nome variante
ls_line-typ = 'S'.
ls_line-key = text-009 .
ls_line-info = w_variant .
append ls_line to tb_ls_line_sel .
inserisco dati da select-options e parameter
call function 'ZZPBCF00007'
exporting
i_report = w_report
i_varian = w_variant
tables
io_tab_line = tb_ls_line_sel[].
move tb_ls_line_sel[] to tb_list_top_of_page[] .
Inserisco contatore
clear ls_line.
ls_line-typ = 'A'.
vl_count = vg_contatore.
Funzione creata per quando i contatori sono iguali a zero.
perform performance_contatori using text-002
vl_count
changing ls_line-info.
append ls_line to tb_list_top_of_page.
**List body comment block output
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'PMMN_LOGO'
it_list_commentary = tb_list_top_of_page .
endform. " XEND_OF_LIST
Thank you for your help !
Claudia & Jessica.Hi
it is possible in following way.......
REPORT ZALV1.
******************TABLE DECLARATION***********************************
TABLES : VBAP. " tables declaration
*****************TYPE POOLS*******************************************
TYPE-POOLS : SLIS. " slis type pool
*****************INTERNAL TABLE DECLARATION***************************
DATA : BEGIN OF IT_VBAP OCCURS 0,
" internal table for sales document item
VBELN LIKE VBAP-VBELN, " sales document
POSNR LIKE VBAP-POSNR, " document item
ERNAM LIKE VBAP-ERNAM,
" name of the person who created the object
ERDAT LIKE VBAP-ERDAT, " date on which the record was created
MATNR LIKE VBAP-MATNR. " material number
DATA : END OF IT_VBAP.
DATA : BEGIN OF IT_MARA OCCURS 0, " general material data
MATNR LIKE MARA-MATNR, " material number
ERNAM LIKE MARA-ERNAM,
" name of the person who created the object
MATKL LIKE MARA-MATKL, " material group
MEINS LIKE MARA-MEINS, " base unit of measure
PSTAT LIKE MARA-PSTAT. " maintainence status
DATA : END OF IT_MARA.
******************VARIABLE
DECLARATION**********************************
DATA : REPID LIKE SY-REPID. " program name
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
" field catalog table for vbap
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA : IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
" field catalog table for mara
WA_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: GT_XEVENTS TYPE SLIS_T_EVENT.
DATA: GT_YEVENTS TYPE SLIS_T_EVENT. " events table
DATA : XS_EVENT TYPE SLIS_ALV_EVENT. " events type
DATA : GT_PRINT TYPE SLIS_PRINT_ALV. " print table
*******************MULTIPLE SELECT INPUT
PARAMETERS**********************
SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
" multiple selection for sales document
******************INITIALIZATION**************************************
INITIALIZATION.
REPID = SY-REPID.
*******************START OF
SELECTION************************************
START-OF-SELECTION.
PERFORM POP_VBAP.
" populating the table with document item data
PERFORM POP_MARA.
" populating the table with general material data
PERFORM FIELD_CAT.
" mapping the fields for the field catalog
PERFORM EVENTS. " using the events
PERFORM BLOCK_LIST.
" displaying the data in blocked list
*& Form field_cat
text
--> p1 text
<-- p2 text
FORM FIELD_CAT .
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
WA_FIELDCAT-COL_POS = 1.
WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'POSNR'.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-SELTEXT_L = 'DOC ITEM'.
WA_FIELDCAT-COL_POS = 2.
WA_FIELDCAT-OUTPUTLEN = 6.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ERNAM'.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-SELTEXT_L = 'NAME'.
WA_FIELDCAT-COL_POS = 3.
WA_FIELDCAT-OUTPUTLEN = 12.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ERDAT'.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-SELTEXT_L = 'DATE'.
WA_FIELDCAT-COL_POS = 4.
WA_FIELDCAT-OUTPUTLEN = 8.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-SELTEXT_L = 'MAT NO'.
WA_FIELDCAT-COL_POS = 5.
WA_FIELDCAT-OUTPUTLEN = 18.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT1-FIELDNAME = 'MATNR'.
WA_FIELDCAT1-TABNAME = 'IT_MARA'.
WA_FIELDCAT1-SELTEXT_L = 'MAT NO'.
WA_FIELDCAT1-COL_POS = 1.
WA_FIELDCAT1-OUTPUTLEN = 18.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-FIELDNAME = 'ERNAM'.
WA_FIELDCAT1-TABNAME = 'IT_MARA'.
WA_FIELDCAT1-SELTEXT_L = 'NAME'.
WA_FIELDCAT1-COL_POS = 2.
WA_FIELDCAT1-OUTPUTLEN = 12.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-FIELDNAME = 'MATKL'.
WA_FIELDCAT1-TABNAME = 'IT_MARA'.
WA_FIELDCAT1-SELTEXT_L = 'MAT DESC'.
WA_FIELDCAT1-COL_POS = 3.
WA_FIELDCAT1-OUTPUTLEN = 9.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-FIELDNAME = 'MEINS'.
WA_FIELDCAT1-TABNAME = 'IT_MARA'.
WA_FIELDCAT1-SELTEXT_L = 'UNITS'.
WA_FIELDCAT1-COL_POS = 4.
WA_FIELDCAT1-OUTPUTLEN = 3.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-FIELDNAME = 'PSTAT'.
WA_FIELDCAT1-TABNAME = 'IT_MARA'.
WA_FIELDCAT1-SELTEXT_L = 'STATUS'.
WA_FIELDCAT1-COL_POS = 5.
WA_FIELDCAT1-OUTPUTLEN = 15.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
ENDFORM. " field_cat
*& Form events
text
--> p1 text
<-- p2 text
FORM EVENTS .
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_END_OF_PAGE.
XS_EVENT-FORM = 'XEND_OF_PAGE'.
APPEND XS_EVENT TO GT_XEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
XS_EVENT-FORM = 'XTOP_OF_PAGE'.
APPEND XS_EVENT TO GT_XEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_LIST.
XS_EVENT-FORM = 'XTOP_OF_LIST'.
APPEND XS_EVENT TO GT_XEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_END_OF_LIST.
XS_EVENT-FORM = 'XEND_OF_LIST'.
APPEND XS_EVENT TO GT_XEVENTS.
CLEAR XS_EVENT.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_END_OF_PAGE.
XS_EVENT-FORM = 'YEND_OF_PAGE'.
APPEND XS_EVENT TO GT_YEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
XS_EVENT-FORM = 'YTOP_OF_PAGE'.
APPEND XS_EVENT TO GT_YEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_LIST.
XS_EVENT-FORM = 'YTOP_OF_LIST'.
APPEND XS_EVENT TO GT_YEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_END_OF_LIST.
XS_EVENT-FORM = 'YEND_OF_LIST'.
APPEND XS_EVENT TO GT_YEVENTS.
ENDFORM. " events
*& Form XTOP_OF_PAGE
text
FORM XTOP_OF_PAGE.
BREAK-POINT.
WRITE: / 'X_TOP_OF_PAGE'.
ENDFORM. "XTOP_OF_PAGE
FORM XTOP_OF_LIST *
FORM XTOP_OF_LIST.
BREAK-POINT.
WRITE: / 'X_TOP_OF_LIST'.
ENDFORM. "XTOP_OF_LIST
FORM XEND_OF_PAGE *
FORM XEND_OF_PAGE.
BREAK-POINT.
WRITE: / 'X_END_OF_PAGE'.
ENDFORM. "XEND_OF_PAGE
FORM XEND_OF_LIST *
FORM XEND_OF_LIST.
BREAK-POINT.
WRITE: / 'X_END_OF_LIST'.
ENDFORM. "XEND_OF_LIST
FORM YTOP_OF_PAGE.
BREAK-POINT.
WRITE: / 'Y_TOP_OF_PAGE'.
ENDFORM. "YTOP_OF_PAGE
FORM YTOP_OF_LIST *
FORM YTOP_OF_LIST.
BREAK-POINT.
WRITE: / 'Y_TOP_OF_LIST'.
ENDFORM. "YTOP_OF_LIST
FORM YEND_OF_PAGE *
FORM YEND_OF_PAGE.
BREAK-POINT.
WRITE: / 'Y_END_OF_PAGE'.
ENDFORM. "YEND_OF_PAGE
FORM YEND_OF_LIST *
FORM YEND_OF_LIST.
BREAK-POINT.
WRITE: / 'Y_END_OF_LIST'.
ENDFORM. "YEND_OF_LIST
*& Form POP_VBAP
text
--> p1 text
<-- p2 text
FORM POP_VBAP .
SELECT VBELN
POSNR
ERNAM
ERDAT
MATNR
FROM VBAP
INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
WHERE VBELN IN S_VBELN.
ENDFORM. " POP_VBAP
*& Form POP_MARA
text
--> p1 text
<-- p2 text
FORM POP_MARA .
LOOP AT IT_VBAP.
SELECT SINGLE MATNR
ERNAM
MATKL
MEINS
PSTAT
FROM MARA
INTO CORRESPONDING FIELDS OF IT_MARA
WHERE MATNR = IT_VBAP-MATNR.
APPEND IT_MARA.
ENDLOOP.
ENDFORM. " POP_MARA
*& Form BLOCK_LIST
text
--> p1 text
<-- p2 text
FORM BLOCK_LIST .
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'user_command'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
I_TABNAME = 'IT_VBAP'
IT_EVENTS = GT_XEVENTS
IT_SORT =
I_TEXT = ' '
TABLES
T_OUTTAB = IT_VBAP
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT1
I_TABNAME = 'IT_MARA'
IT_EVENTS = GT_YEVENTS
IT_SORT =
I_TEXT = ' '
TABLES
T_OUTTAB = IT_MARA
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
IS_PRINT = GT_PRINT
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
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. " BLOCK_LIST
Regards
Vasu -
Function REUSE_ALV_GRID_DISPLAY, events and global variables
Hi everybody,
in a report I use FM REUSE_ALV_GRID_DISPLAY with a registered callback for event 'USER_COMMAND'.
In the callback-form I want to change the internal table, which I provided for displaying to REUSE_ALV_GRID_DISPLAY.
How can I access the internal table in the callback-form without using global variables?.
Kind regards,
Hubert
Edited by: Hubert Heitzer on Feb 23, 2011 4:13 PM
This is not the solution I asked for, but I found a workaround.
I created a function group, which encapsulates the internal table.
A function provides the service for colleting data for the internal table and displays the ALV.
The callback-form is also a member of my function group and is therefore able to access the internal table.Hi everybody,
in a report I use FM REUSE_ALV_GRID_DISPLAY with a registered callback for event 'USER_COMMAND'.
In the callback-form I want to change the internal table, which I provided for displaying to REUSE_ALV_GRID_DISPLAY.
How can I access the internal table in the callback-form without using global variables?.
Kind regards,
Hubert
Edited by: Hubert Heitzer on Feb 23, 2011 4:13 PM
This is not the solution I asked for, but I found a workaround.
I created a function group, which encapsulates the internal table.
A function provides the service for colleting data for the internal table and displays the ALV.
The callback-form is also a member of my function group and is therefore able to access the internal table. -
End-of-page event in alv report
Hi all,
I want to create end-of-page in alv report i have used event also
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' * "
EXPORTING *
i_callback_program = sy-repid * "
i_callback_user_command = 'USER_COMMAND' * "
i_callback_top_of_page = 'TOP_OF_PAGE' * "
I_STRUCTURE_NAME = * "
it_fieldcat = fcat[] * "
it_events = it_event[] * "
TABLES
t_outtab = gtbl_pohead * "
EXCEPTIONS
program_error = 1 * "
OTHERS = 2 "
FORM end_of_page. *
DATA: listwidth TYPE i, *
ld_pagepos(10) TYPE c, *
ld_page(10) TYPE c. *
WRITE: sy-uline(50). "
SKIP 3.
WRITE:/40 'Page No',sy-pagno. "
ENDFORM. "END_OF_PAGE "hi
Search in SDN.You can find the solution for this.Before posting please search in SDN.
You have to use this FM 'REUSE_ALV_EVENTS_GET'
[End-Of-Page|http://www.sapdev.co.uk/reporting/alv/alvgrid_events.htm]
[Endo Of Page|http://www.sdn.sap.com/irj/scn/advancedsearch?query=alvend-of-pageevent+] -
How to Display Page Numbers in ALV Report HTML End of page Event
hai Gurus
Greetings
Please tell me how to get current page noumber and total number of pages in ALV Report (in HTML End of Page Event)
i tried with sy-pagno system field but it is not working
so please guide me
Thanks
Rameshcheck below code....
*Work area for Layout
gf_layout type slis_layout_alv,
*Work area for HEADER FOOTER
gf_header type slis_listheader,
*Work area for Field catalogue
gf_fieldcat type slis_fieldcat_alv.
it_top_page type slis_t_listheader,
*Internal table for Field catalogue
it_fcat type slis_t_fieldcat_alv.
perform:fill_layout,
prepare_header,
field_catlog,
display_report.
Form fill_layout
form fill_layout .
gf_layout-colwidth_optimize = 'X'.
endform. " fill_layout
Form field_catlog
form field_catlog .
data : lf_fcat type line of slis_t_fieldcat_alv,
l_cnt type i.
clear : lf_fcat, l_cnt.
Employee Number
add 1 to l_cnt.
lf_fcat-fieldname = 'EMPLID'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 8.
lf_fcat-seltext_l = text-003.
append lf_fcat to it_fcat.
clear lf_fcat.
*Last Name
add 1 to l_cnt.
lf_fcat-fieldname = 'USERNAME'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 20.
lf_fcat-seltext_l = text-004.
append lf_fcat to it_fcat.
*First Name
add 1 to l_cnt.
lf_fcat-fieldname = 'EMPMAIL'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 40.
lf_fcat-seltext_l = text-005.
append lf_fcat to it_fcat.
*Known As
clear lf_fcat.
add 1 to l_cnt.
lf_fcat-fieldname = 'EMPSTATUS'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 10.
lf_fcat-seltext_l = text-006.
append lf_fcat to it_fcat.
clear lf_fcat.
*System UserID
add 1 to l_cnt.
lf_fcat-fieldname = 'COSTCENTER'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 10.
lf_fcat-seltext_l = text-007.
append lf_fcat to it_fcat.
clear lf_fcat.
*EMail ID
add 1 to l_cnt.
lf_fcat-fieldname = 'DEPTDESC'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 8.
lf_fcat-seltext_l = text-008.
append lf_fcat to it_fcat.
clear lf_fcat.
*Employment Status
add 1 to l_cnt.
lf_fcat-fieldname = 'LOC'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 20.
lf_fcat-seltext_l = text-009.
append lf_fcat to it_fcat.
clear lf_fcat.
*Personnel Area
add 1 to l_cnt.
lf_fcat-fieldname = 'TITLE'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 40.
lf_fcat-seltext_l = text-010.
append lf_fcat to it_fcat.
clear lf_fcat.
*Personnel Area Text
clear lf_fcat.
add 1 to l_cnt.
lf_fcat-fieldname = 'HDATE'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 10.
lf_fcat-seltext_l = text-011.
append lf_fcat to it_fcat.
clear lf_fcat.
*Country Grouping text
add 1 to l_cnt.
lf_fcat-fieldname = 'MGRID'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 10.
lf_fcat-seltext_l = text-012.
append lf_fcat to it_fcat.
clear lf_fcat.
*Cost Center
add 1 to l_cnt.
lf_fcat-fieldname = 'MGRNAME'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 20.
lf_fcat-seltext_l = text-013.
append lf_fcat to it_fcat.
clear lf_fcat.
*Employee Group
add 1 to l_cnt.
lf_fcat-fieldname = 'MGMAIL'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 40.
lf_fcat-seltext_l = text-014.
append lf_fcat to it_fcat.
clear lf_fcat.
*Organizational Unit
add 1 to l_cnt.
lf_fcat-fieldname = 'DIV'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 25.
lf_fcat-seltext_l = text-015.
append lf_fcat to it_fcat.
clear lf_fcat.
*Supervisor
add 1 to l_cnt.
lf_fcat-fieldname = 'BUSUNIT'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 25.
lf_fcat-seltext_l = text-016.
append lf_fcat to it_fcat.
clear lf_fcat.
endform. " field_catlog
Form display_report
form display_report .
data : l_repid type sy-repid.
clear l_repid.
l_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = l_repid
is_layout = gf_layout
it_fieldcat = it_fcat
i_callback_top_of_page = 'TOP-OF-PAGE'
tables
t_outtab = it_employee
exceptions
program_error = 1
others = 2.
endform. " display_report
Form PREPARE_HEADER
form prepare_header.
data:l_header1(20),
l_header2(60).
data:l_header3(20),
l_header4(60).
l_header1 = 'Met Life Census Data'.
l_header2+40(8) = 'Run Date'.
write sy-datum to l_header2+50(10).
header
gf_header-typ = 'S'.
gf_header-key = l_header1.
gf_header-info = l_header2.
append gf_header to it_top_page.
clear gf_header.
endform. " PREPARE_HEADER
form top-of-page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = it_top_page.
endform. "TOP-OF-PAGE
*& Form end_of_list_html
output at the end of the list - not in printed output *
FORM END_OF_LIST_HTML USING END TYPE REF TO CL_DD_DOCUMENT.
DATA: LS_TEXT TYPE SDYDO_TEXT_ELEMENT,
L_GRID TYPE REF TO CL_GUI_ALV_GRID,
F(14) TYPE C VALUE 'SET_ROW_HEIGHT'.
LS_TEXT+0(20) = 'Total Employees'.
LS_TEXT+40(10) = g_count.
CALL METHOD END->ADD_TEXT
EXPORTING
TEXT = LS_TEXT
SAP_EMPHASIS = 'STRONG'.
*adds new line (start new line)
CALL METHOD END->NEW_LINE.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = l_grid.
CALL METHOD l_grid->parent->parent->(f)
EXPORTING
id = 3
height = 10.
ENDFORM. -
Checkbox field in ALV for REUSE_ALV_GRID_DISPLAY
how to handle Checkbox field in ALV for REUSE_ALV_GRID_DISPLAY????
For example Alv has displayed 400 entries if user checks 4 entries and wants to donwload only those 4 entries from ALV using Copy to local file option then how should it be done. please provide some help...REPORT YHRMR_LTC_TAXABLE NO STANDARD PAGE HEADING LINE-SIZE 120.
TYPE-POOLS: SLIS.
Start of Data Declaration *
DATA: G_PLVAR TYPE PLVAR.
DATA: P_MONTH TYPE TFMATAGE.
DATA: TOTAL_NO TYPE I.
DATA: TOTAL_NO_SUM TYPE I.
DATA: COUNT_15 TYPE I.
DATA: COUNT_15_SUM TYPE I.
DATA: COUNT_LTC TYPE I.
DATA: COUNT_LTC_SUM TYPE I.
DATA: COUNT_ERROR_IT15 TYPE I.
DATA: COUNT_ERROR_IT15_SUM TYPE I.
DATA: COUNT_ERROR_LTC TYPE I.
DATA: COUNT_ERROR_LTC_SUM TYPE I.
DATA: COUNT_ENTRY_IT15 TYPE I.
DATA: COUNT_ENTRY_IT15_SUM TYPE I.
--LOCAL TABLE TYPE--
DATA: T_DATA_LTC LIKE YHRMT_LTC OCCURS 0 WITH HEADER LINE.
DATA: T_DATA_LTC_NEW LIKE YHRMT_LTC OCCURS 0 WITH HEADER LINE.
DATA: T_PA0015 LIKE PA0015 OCCURS 0 WITH HEADER LINE.
DATA: T_P0015 LIKE PA0015 OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF T_FINAL OCCURS 0,
CHECK_BOX(1),
MANDT TYPE MANDT,
PERNR TYPE PERSNO,
ABKRS TYPE ABKRS,
PERSK TYPE PERSK,
WAGETYPE TYPE LGART,
LTCSTART TYPE YAJAHR,
LTCEND TYPE YYAJAHR,
FLAG TYPE YCHAR1,
SEQNR TYPE SEQNR,
LEVSTART TYPE URBEG,
LEVEND TYPE BDATU_052R,
PAYDATE TYPE YBEGDA,
AMOUNTPAY TYPE AMUNT,
TAXYR TYPE PHK_TAXYR,
DOCUNO TYPE YCHAR20,
DOCUDATE TYPE YENDDA,
VOUCHNO TYPE YCHAR20,
APDATE TYPE BPS_APPDA,
CANCEL_MOD TYPE YCANCELMOD,
LTC_IND TYPE ATZH1,
APPL_TAG TYPE YAPPTAG,
CANCEL_DATE TYPE AEDTM,
CANCEL_USER TYPE AENAM,
LASTCHANGE TYPE AEDTM,
USERNAME TYPE AENAM,
END OF T_FINAL.
DATA: BEGIN OF T_PA0001 OCCURS 0,
PERNR LIKE PA0001-PERNR,
ABKRS LIKE PA0001-ABKRS,
END OF T_PA0001.
--Message Part Declaration--
DATA: BEGIN OF T_SUCCESS OCCURS 0,
PERNR TYPE PERSNO,
MESSAGE(50) TYPE C,
END OF T_SUCCESS.
DATA: BEGIN OF T_ERROR OCCURS 0,
PERNR TYPE PERSNO,
MESSAGE(50) TYPE C,
END OF T_ERROR.
--TABLE TYPE OF SLIS TYPE-GROUP--
DATA: G_FLD TYPE SLIS_T_FIELDCAT_ALV,
G_EV TYPE SLIS_T_EVENT,
G_SORT TYPE SLIS_T_SORTINFO_ALV,
G_LST TYPE SLIS_T_LISTHEADER.
DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
I_EVENTS TYPE SLIS_T_EVENT,
GD_REPID LIKE SY-REPID.
--STRUCTURE TYPE OF SLIS TYPE-GROUP--
DATA: L_EV TYPE SLIS_ALV_EVENT.
CONSTANTS : C_PF TYPE SLIS_FORMNAME VALUE 'PF_STATUS_SET',
C_UCOM TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
*---- Start Change by Bibek/Shankar Dated : 12-03-2008 via cmr no : J/08/03/062/1.
DATA: L_ENDDATE LIKE SY-DATUM.
*---- End Change by Bibek/Shankar Dated : 12-03-2008 via cmr no : J/08/03/062/1.
End of Data Declaration *
Start of Selection screen Parameters *
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-002.
*START CHANGE BY SHAYARI ON 18.02.2008, CMR No.:- J/08/02/323
PARAMETERS:P_ABKRS LIKE PA0001-ABKRS OBLIGATORY.
*END CHANGE BY SHAYARI ON 18.02.2008, CMR No.:- J/08/02/323
*START CHANGE BY BIBEk Dt : 06.03.2008, CMR No.:- J/08/03/062/1
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT 1(78) TEXT-006 FOR FIELD P_LES.
PARAMETER P_LES RADIOBUTTON GROUP RB1.
SELECTION-SCREEN END OF LINE.
*END CHANGE BY BIBEk Dt : 06.03.2008, CMR No.:- J/08/03/062/1
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT 1(78) TEXT-003 FOR FIELD P_ONE.
PARAMETER P_ONE RADIOBUTTON GROUP RB1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT 1(78) TEXT-004 FOR FIELD P_TWO.
PARAMETER P_TWO RADIOBUTTON GROUP RB1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT 1(78) TEXT-005 FOR FIELD P_MORE.
PARAMETER P_MORE RADIOBUTTON GROUP RB1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK A.
End of Selection screen Parameters *
*Get Plan Version
CALL FUNCTION 'RH_GET_PLVAR'
IMPORTING
PLVAR = G_PLVAR.
PERFORM CLEAR.
CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
EXPORTING
IV_DATE = SY-DATUM
IMPORTING
EV_MONTH_BEGIN_DATE =
EV_MONTH_END_DATE = L_ENDDATE.
SELECT *
FROM YHRMT_LTC
INTO TABLE T_DATA_LTC
WHERE FLAG = '1'
AND WAGETYPE = '1640'
AND LEVEND LE L_ENDDATE
AND PAYDATE GE '20080101'.
If SY-SUBRC <> 0.
MESSAGE I398(00) with 'No Records to display '.
ENDIF.
DELETE T_DATA_LTC WHERE LEVEND = '00000000'.
*START CHANGE BY BIBEk Dt : 06.03.2008, CMR No.:- J/08/03/062/1
*For Less Than One Month from Leave End Date
IF P_LES = 'X'.
LOOP AT T_DATA_LTC.
CLEAR P_MONTH.
CALL FUNCTION 'HR_AUPBS_MONTH_DAY'
EXPORTING
BEG_DA = T_DATA_LTC-LEVEND
END_DA = SY-DATUM
IMPORTING
NO_MONTH = P_MONTH.
IF P_MONTH LT '1'.
T_FINAL-MANDT = T_DATA_LTC-MANDT.
T_FINAL-PERNR = T_DATA_LTC-PERSONNELNO.
T_FINAL-PERSK = T_DATA_LTC-PERSK.
T_FINAL-WAGETYPE = T_DATA_LTC-WAGETYPE.
T_FINAL-LTCSTART = T_DATA_LTC-LTCSTART.
T_FINAL-LTCEND = T_DATA_LTC-LTCEND.
T_FINAL-FLAG = T_DATA_LTC-FLAG.
T_FINAL-SEQNR = T_DATA_LTC-SEQNR.
T_FINAL-LEVSTART = T_DATA_LTC-LEVSTART.
T_FINAL-LEVEND = T_DATA_LTC-LEVEND.
T_FINAL-PAYDATE = T_DATA_LTC-PAYDATE.
T_FINAL-AMOUNTPAY = T_DATA_LTC-AMOUNTPAY.
T_FINAL-TAXYR = T_DATA_LTC-TAXYR.
T_FINAL-DOCUNO = T_DATA_LTC-DOCUNO.
T_FINAL-DOCUDATE = T_DATA_LTC-DOCUDATE.
T_FINAL-VOUCHNO = T_DATA_LTC-VOUCHNO.
T_FINAL-APDATE = T_DATA_LTC-APDATE.
T_FINAL-CANCEL_MOD = T_DATA_LTC-CANCEL_MOD.
T_FINAL-LTC_IND = T_DATA_LTC-LTC_IND.
T_FINAL-APPL_TAG = T_DATA_LTC-APPL_TAG.
T_FINAL-CANCEL_DATE = T_DATA_LTC-CANCEL_DATE.
T_FINAL-CANCEL_USER = T_DATA_LTC-CANCEL_USER.
T_FINAL-LASTCHANGE = T_DATA_LTC-LASTCHANGE.
T_FINAL-USERNAME = T_DATA_LTC-USERNAME.
APPEND T_FINAL.
CLEAR T_FINAL.
ENDIF.
ENDLOOP.
*For One Month from Leave End Date
ELSEIF P_ONE = 'X'.
LOOP AT T_DATA_LTC.
CLEAR P_MONTH.
CALL FUNCTION 'HR_AUPBS_MONTH_DAY'
EXPORTING
BEG_DA = T_DATA_LTC-LEVEND
END_DA = SY-DATUM
IMPORTING
NO_MONTH = P_MONTH.
IF P_MONTH EQ '1' AND P_MONTH LT '2'.
T_FINAL-MANDT = T_DATA_LTC-MANDT.
T_FINAL-PERNR = T_DATA_LTC-PERSONNELNO.
T_FINAL-PERSK = T_DATA_LTC-PERSK.
T_FINAL-WAGETYPE = T_DATA_LTC-WAGETYPE.
T_FINAL-LTCSTART = T_DATA_LTC-LTCSTART.
T_FINAL-LTCEND = T_DATA_LTC-LTCEND.
T_FINAL-FLAG = T_DATA_LTC-FLAG.
T_FINAL-SEQNR = T_DATA_LTC-SEQNR.
T_FINAL-LEVSTART = T_DATA_LTC-LEVSTART.
T_FINAL-LEVEND = T_DATA_LTC-LEVEND.
T_FINAL-PAYDATE = T_DATA_LTC-PAYDATE.
T_FINAL-AMOUNTPAY = T_DATA_LTC-AMOUNTPAY.
T_FINAL-TAXYR = T_DATA_LTC-TAXYR.
T_FINAL-DOCUNO = T_DATA_LTC-DOCUNO.
T_FINAL-DOCUDATE = T_DATA_LTC-DOCUDATE.
T_FINAL-VOUCHNO = T_DATA_LTC-VOUCHNO.
T_FINAL-APDATE = T_DATA_LTC-APDATE.
T_FINAL-CANCEL_MOD = T_DATA_LTC-CANCEL_MOD.
T_FINAL-LTC_IND = T_DATA_LTC-LTC_IND.
T_FINAL-APPL_TAG = T_DATA_LTC-APPL_TAG.
T_FINAL-CANCEL_DATE = T_DATA_LTC-CANCEL_DATE.
T_FINAL-CANCEL_USER = T_DATA_LTC-CANCEL_USER.
T_FINAL-LASTCHANGE = T_DATA_LTC-LASTCHANGE.
T_FINAL-USERNAME = T_DATA_LTC-USERNAME.
APPEND T_FINAL.
CLEAR T_FINAL.
ENDIF.
ENDLOOP.
*For Two Month from Leave End Date
ELSEIF P_TWO = 'X'.
LOOP AT T_DATA_LTC.
CLEAR P_MONTH.
CALL FUNCTION 'HR_AUPBS_MONTH_DAY'
EXPORTING
BEG_DA = T_DATA_LTC-LEVEND
END_DA = SY-DATUM
IMPORTING
NO_MONTH = P_MONTH.
IF P_MONTH EQ '2' AND P_MONTH LT '3'.
T_FINAL-MANDT = T_DATA_LTC-MANDT.
T_FINAL-PERNR = T_DATA_LTC-PERSONNELNO.
T_FINAL-PERSK = T_DATA_LTC-PERSK.
T_FINAL-WAGETYPE = T_DATA_LTC-WAGETYPE.
T_FINAL-LTCSTART = T_DATA_LTC-LTCSTART.
T_FINAL-LTCEND = T_DATA_LTC-LTCEND.
T_FINAL-FLAG = T_DATA_LTC-FLAG.
T_FINAL-SEQNR = T_DATA_LTC-SEQNR.
T_FINAL-LEVSTART = T_DATA_LTC-LEVSTART.
T_FINAL-LEVEND = T_DATA_LTC-LEVEND.
T_FINAL-PAYDATE = T_DATA_LTC-PAYDATE.
T_FINAL-AMOUNTPAY = T_DATA_LTC-AMOUNTPAY.
T_FINAL-TAXYR = T_DATA_LTC-TAXYR.
T_FINAL-DOCUNO = T_DATA_LTC-DOCUNO.
T_FINAL-DOCUDATE = T_DATA_LTC-DOCUDATE.
T_FINAL-VOUCHNO = T_DATA_LTC-VOUCHNO.
T_FINAL-APDATE = T_DATA_LTC-APDATE.
T_FINAL-CANCEL_MOD = T_DATA_LTC-CANCEL_MOD.
T_FINAL-LTC_IND = T_DATA_LTC-LTC_IND.
T_FINAL-APPL_TAG = T_DATA_LTC-APPL_TAG.
T_FINAL-CANCEL_DATE = T_DATA_LTC-CANCEL_DATE.
T_FINAL-CANCEL_USER = T_DATA_LTC-CANCEL_USER.
T_FINAL-LASTCHANGE = T_DATA_LTC-LASTCHANGE.
T_FINAL-USERNAME = T_DATA_LTC-USERNAME.
APPEND T_FINAL.
CLEAR T_FINAL.
ENDIF.
ENDLOOP.
*For More than Two Month from Leave End Date
ELSEIF P_MORE = 'X'.
LOOP AT T_DATA_LTC.
CLEAR P_MONTH.
CALL FUNCTION 'HR_AUPBS_MONTH_DAY'
EXPORTING
BEG_DA = T_DATA_LTC-LEVEND
END_DA = SY-DATUM
IMPORTING
NO_MONTH = P_MONTH.
IF P_MONTH GT '2' .
T_FINAL-MANDT = T_DATA_LTC-MANDT.
T_FINAL-PERNR = T_DATA_LTC-PERSONNELNO.
T_FINAL-PERSK = T_DATA_LTC-PERSK.
T_FINAL-WAGETYPE = T_DATA_LTC-WAGETYPE.
T_FINAL-LTCSTART = T_DATA_LTC-LTCSTART.
T_FINAL-LTCEND = T_DATA_LTC-LTCEND.
T_FINAL-FLAG = T_DATA_LTC-FLAG.
T_FINAL-SEQNR = T_DATA_LTC-SEQNR.
T_FINAL-LEVSTART = T_DATA_LTC-LEVSTART.
T_FINAL-LEVEND = T_DATA_LTC-LEVEND.
T_FINAL-PAYDATE = T_DATA_LTC-PAYDATE.
T_FINAL-AMOUNTPAY = T_DATA_LTC-AMOUNTPAY.
T_FINAL-TAXYR = T_DATA_LTC-TAXYR.
T_FINAL-DOCUNO = T_DATA_LTC-DOCUNO.
T_FINAL-DOCUDATE = T_DATA_LTC-DOCUDATE.
T_FINAL-VOUCHNO = T_DATA_LTC-VOUCHNO.
T_FINAL-APDATE = T_DATA_LTC-APDATE.
T_FINAL-CANCEL_MOD = T_DATA_LTC-CANCEL_MOD.
T_FINAL-LTC_IND = T_DATA_LTC-LTC_IND.
T_FINAL-APPL_TAG = T_DATA_LTC-APPL_TAG.
T_FINAL-CANCEL_DATE = T_DATA_LTC-CANCEL_DATE.
T_FINAL-CANCEL_USER = T_DATA_LTC-CANCEL_USER.
T_FINAL-LASTCHANGE = T_DATA_LTC-LASTCHANGE.
T_FINAL-USERNAME = T_DATA_LTC-USERNAME.
APPEND T_FINAL.
CLEAR T_FINAL.
ENDIF.
ENDLOOP.
ENDIF.
****Payroll Area Put
SELECT PERNR ABKRS FROM PA0001
INTO CORRESPONDING FIELDS OF TABLE T_PA0001
FOR ALL ENTRIES IN T_FINAL
WHERE PERNR = T_FINAL-PERNR
AND ABKRS = P_ABKRS
AND BEGDA LE SY-DATUM
AND ENDDA GE SY-DATUM.
LOOP AT T_FINAL.
READ TABLE T_PA0001 WITH KEY PERNR = T_FINAL-PERNR.
IF SY-SUBRC = 0.
T_FINAL-ABKRS = T_PA0001-ABKRS.
MODIFY T_FINAL.
CLEAR T_FINAL.
ENDIF.
ENDLOOP.
CLEAR T_FINAL.
DELETE T_FINAL WHERE ABKRS = ''.
*Output Form ALV List
PERFORM ALV.
*& Form ALV
FORM ALV .
PERFORM BUILD_FIELDCATALOG.
PERFORM BUILD_EVENT.
PERFORM DISPLAY_DATA.
ENDFORM. " ALV
*& Form BUILD_FIELDCATALOG
FORM BUILD_FIELDCATALOG .
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'PERNR'.
FIELDCATALOG-SELTEXT_M = 'Personnel number'.
FIELDCATALOG-COL_POS = 1.
FIELDCATALOG-OUTPUTLEN = 17.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'ABKRS'.
FIELDCATALOG-SELTEXT_M = 'Payroll Area'.
FIELDCATALOG-COL_POS = 2.
FIELDCATALOG-OUTPUTLEN = 17.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'LTCSTART'.
FIELDCATALOG-SELTEXT_M = 'LTC Start year'.
FIELDCATALOG-COL_POS = 3.
FIELDCATALOG-OUTPUTLEN = 15.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'LTCEND'.
FIELDCATALOG-SELTEXT_M = 'LTC End year'.
FIELDCATALOG-COL_POS = 4.
FIELDCATALOG-OUTPUTLEN = 15.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'LEVSTART'.
FIELDCATALOG-SELTEXT_M = 'Start of leave'.
FIELDCATALOG-COL_POS = 5.
FIELDCATALOG-OUTPUTLEN = 15.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'LEVEND'.
FIELDCATALOG-SELTEXT_M = 'End of leave'.
FIELDCATALOG-COL_POS = 6.
FIELDCATALOG-OUTPUTLEN = 15.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'AMOUNTPAY'.
FIELDCATALOG-SELTEXT_M = 'Amount'.
FIELDCATALOG-DO_SUM = 'X'.
FIELDCATALOG-COL_POS = 7.
FIELDCATALOG-OUTPUTLEN = 13.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'PAYDATE'.
FIELDCATALOG-SELTEXT_M = 'Payment Date'.
FIELDCATALOG-COL_POS = 8.
FIELDCATALOG-OUTPUTLEN = 15.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'APPL_TAG'.
FIELDCATALOG-SELTEXT_M = 'Application Tag '.
FIELDCATALOG-COL_POS = 9.
FIELDCATALOG-OUTPUTLEN = 15.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
*Check Box Field Add
CLEAR GD_LAYOUT.
GD_LAYOUT-BOX_FIELDNAME = 'CHECK_BOX'.
GD_LAYOUT-BOX_TABNAME = 'T_FINAL'.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_EVENT
FORM BUILD_EVENT .
*Event Handler
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = G_EV
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
ELSE.
READ TABLE G_EV INTO L_EV WITH KEY NAME = SLIS_EV_PF_STATUS_SET.
IF SY-SUBRC = 0.
MOVE C_PF TO L_EV-FORM.
MODIFY G_EV FROM L_EV INDEX SY-TABIX TRANSPORTING FORM.
ENDIF.
READ TABLE G_EV INTO L_EV WITH KEY NAME = SLIS_EV_USER_COMMAND.
IF SY-SUBRC = 0.
MOVE C_UCOM TO L_EV-FORM.
MODIFY G_EV FROM L_EV INDEX SY-TABIX TRANSPORTING FORM.
ENDIF.
ENDIF.
ENDFORM. " BUILD_EVENT
*& Form DISPLAY_DATA
FORM DISPLAY_DATA .
GD_REPID = SY-REPID.
CLEAR I_EVENTS. REFRESH I_EVENTS.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
I_CALLBACK_PF_STATUS_SET = C_PF
I_CALLBACK_USER_COMMAND = C_UCOM
IS_LAYOUT = GD_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
IT_EVENTS = G_EV
TABLES
T_OUTTAB = T_FINAL.
ENDFORM. " DISPLAY_DATA
FORM PF_STATUS_SET *
FORM PF_STATUS_SET USING RX_TAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'LTC'.
ENDFORM. "PF_STATUS_SET
FORM USER_COMMAND *
FORM USER_COMMAND USING R_UCOM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOM.
WHEN 'POST'.
PERFORM POST_IT15_LTC_TABLE.
ENDCASE.
ENDFORM. "USER_COMMAND
*& Form POST_IT15_LTC_TABLE
FORM POST_IT15_LTC_TABLE .
ENDFORM. " POST_IT15_LTC_TABLE
*& Form clear
FORM CLEAR .
CLEAR T_DATA_LTC.
REFRESH T_DATA_LTC.
CLEAR T_DATA_LTC_NEW.
REFRESH T_DATA_LTC_NEW.
CLEAR T_FINAL.
REFRESH T_FINAL.
CLEAR T_PA0015.
REFRESH T_PA0015.
CLEAR T_SUCCESS.
REFRESH T_SUCCESS.
CLEAR T_ERROR.
REFRESH T_ERROR.
CLEAR G_PLVAR.
CLEAR P_MONTH.
CLEAR COUNT_15.
CLEAR COUNT_15_SUM.
CLEAR COUNT_LTC.
CLEAR COUNT_LTC_SUM.
CLEAR TOTAL_NO.
CLEAR TOTAL_NO_SUM.
CLEAR COUNT_ERROR_IT15.
CLEAR COUNT_ERROR_IT15_SUM.
CLEAR COUNT_ERROR_LTC.
CLEAR COUNT_ERROR_LTC_SUM.
CLEAR COUNT_ENTRY_IT15.
CLEAR COUNT_ENTRY_IT15_SUM.
ENDFORM. " clear -
Hi experts,
Can anyone brief me about events which appears in an ALV report.
I want the events only for Alv report not for any report program.
Thanks
Sanket sethi.Hi Sanket,
<b>ALV is Application List viewer.</b>
Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length.
In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output.
The report output can contain up to 90 columns in the display with the wide array of display options.
The commonly used ALV functions used for this purpose are;
<b>1. REUSE_ALV_VARIANT_DEFAULT_GET
2. REUSE_ALV_VARIANT_F4
3. REUSE_ALV_VARIANT_EXISTENCE
4. REUSE_ALV_EVENTS_GET
5. REUSE_ALV_COMMENTARY_WRITE
6. REUSE_ALV_FIELDCATALOG_MERGE
7. REUSE_ALV_LIST_DISPLAY
8. REUSE_ALV_GRID_DISPLAY
9. REUSE_ALV_POPUP_TO_SELECT</b>
Purpose of the above Functions are differ not all the functions are required in all the ALV Report.
But either no.7 or No.8 is there in the Program.
How you call this function in your report?
After completion of all the data fetching from the database and append this data into an Internal Table. say I_ITAB.
Then use follwing function module.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'Prog.name'
I_STRUCTURE_NAME = 'I_ITAB'
I_DEFAULT = 'X'
I_SAVE = 'A'
TABLES
T_OUTTAB = I_ITAB.
IF SY-SUBRC <> 0.
WRITE: 'SY-SUBRC: ', SY-SUBRC .
ENDIF.
ENDFORM. " GET_FINAL_DATA
Sample ALV1:
REPORT Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB .
*Simple example to use ALV and to define the ALV data in an internal
*table
Martin Schlegel, BearingPoint, December 2004
Thanks to Madhusudhan Sonee and Rama Krishna Kommineni for testing
and feedback
*For a very long time, people gave me the feeling that ALV is a
*complicated tool that is difficult to understand and to use.
*Lately I had to use it and I discovered that ALV is easy to use and
*saves a lot of work:
*ALV will generate the column headings on its own, so one does not need
*to work on headlines and transalation.
*ALV allows the user to select the columns he wants to see, so the user
*does not need to contact a developer for every change he likes to have.
*ALV allows the user to create his own sums, so
*ALV has a simple way to work with internal tables.
*If you really want to save time, use ALV instead of write!
*Please take 30 minutes to explore the following example and see how
*easy it is to use ALV!
*data definition
tables:
marav. "Table MARA and table MAKT
Data to be displayed in ALV
Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
matically determine the fieldstructure from this source program
Data:
begin of imat occurs 100,
matnr like marav-matnr, "Material number
maktx like marav-maktx, "Material short text
matkl like marav-matkl, "Material group (so you can test to make
" intermediate sums)
ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
"make sums)
gewei like marav-gewei, "weight unit (just to be complete)
end of imat.
Other data needed
field to store report name
data i_repid like sy-repid.
field to check table length
data i_lines like sy-tabix.
Data for ALV display
TYPE-POOLS: SLIS.
data int_fcat type SLIS_T_FIELDCAT_ALV.
select-options:
s_matnr for marav-matnr matchcode object MAT1.
start-of-selection.
read data into table imat
select * from marav
into corresponding fields of table imat
where
matnr in s_matnr.
Check if material was found
clear i_lines.
describe table imat lines i_lines.
if i_lines lt 1.
Using hardcoded write here for easy upload
write: /
'No materials found.'.
exit.
endif.
end-of-selection.
Now, we start with ALV
To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
The fieldcatalouge can be generated by FUNCTION
'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
report source, including this report.
The only problem one might have is that the report and table names
need to be in capital letters. (I had it )
Store report name
i_repid = sy-repid.
Create Fieldcatalogue from internal table
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = i_repid
I_INTERNAL_TABNAME = 'IMAT' "capital letters!
I_INCLNAME = i_repid
CHANGING
CT_FIELDCAT = int_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
*explanations:
I_PROGRAM_NAME is the program which calls this function
I_INTERNAL_TABNAME is the name of the internal table which you want
to display in ALV
I_INCLNAME is the ABAP-source where the internal table is defined
(DATA....)
CT_FIELDCAT contains the Fieldcatalouge that we need later for
ALV display
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
*This was the fieldcatlogue
And now, we are ready to display our list
Call for ALV list display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'
I_CALLBACK_PROGRAM = i_repid
IT_FIELDCAT = int_fcat
I_SAVE = 'A'
TABLES
T_OUTTAB = imat
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*explanations:
I_CALLBACK_PROGRAM is the program which calls this function
IT_FIELDCAT (just made by REUSE_ALV_FIELDCATALOG_MERGE) contains
now the data definition needed for display
I_SAVE allows the user to save his own layouts
T_OUTTAB contains the data to be displayed in ALV
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
ENDIF.
Samle ALV2:
*& 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.
<b>Reward Points if Useful</b>
Regards
Gokul -
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 -
About double click event in ALV report
Hi all,
I want to program a double-click event in ALV reprot.
I am not suppose to use module pool approach for the same.
If a user double clicks on the any of the row of ALV report, the transaction should get called.
Again, I am using function 'REUSE_ALV_GRID_DISPLAY' for displaying ALV.
Can you please help me to solve this?
Thanks,
-SiddhiHi Sidhi,
You can do it easily by using Reuse_ALV_GRID_DISPALY.
The User Command subroutine which you pass to this function module in that you can check which field is selected and what is the value of that and also you can get the table index.
I am giving you a code example where interactivity of ALV report is done .
*& Report ZRAIL_LOT_REPORT
REPORT zrail_lot_report.
TABLES :qals,aufk.
TYPE-POOLS:slis.
TYPES:BEGIN OF x_lot,
sel(1) TYPE c, "SELECTION
prueflos TYPE qals-prueflos, "INSPECTION LOT NUMBER
werk TYPE qals-werk, "PLANT
losmenge TYPE qals-losmenge, "LOT QUANTITY
mengeneinh TYPE qals-mengeneinh, "BASE UNIT OF MEASURE FOR THE INSPECTION LOT QUANTITY
matnr TYPE qals-matnr, " MATERIAL NO. ATTACHED TO ORDER
zzequnr TYPE qals-zzequnr, "EQUIPMENT NO.
zzassembly TYPE qals-zzassembly, "ASSEMBLY
herkunft TYPE qals-herkunft, "INSPECTION LOT ORIGIN
aufnr TYPE qals-aufnr, "ORDER NO.
sttxt TYPE qals_d02-sttxt, "LOT STATUS
objnr TYPE qals-objnr, "OBJECT NUMBER
enstehdat TYPE qals-enstehdat, "lot creation date
pruefer TYPE qamr-pruefer, "Name of the Inspector
END OF x_lot.
TYPES:BEGIN OF x_ordmat,
aufnr TYPE aufk-aufnr, "Order No.
equnr TYPE afih-equnr, "Equipment No. attached to Order
zmatnr TYPE aufk-zmatnr, "Material No. attached to Order
bautl TYPE afih-bautl, "Assembly attached to Order
END OF x_ordmat.
TYPES:BEGIN OF x_status,
objnr TYPE jest-objnr,
stat TYPE jest-stat,
txt04 TYPE tj02t-txt04,
END OF x_status.
DATA:it_qals TYPE STANDARD TABLE OF x_lot,
wa_qals TYPE x_lot.
DATA:it_ordmat TYPE TABLE OF x_ordmat,
wa_ordmat TYPE x_ordmat.
DATA:it_status TYPE STANDARD TABLE OF x_status,
wa_status TYPE x_status.
DATA:mytabix TYPE sy-tabix.
DATA: wa_layout TYPE slis_layout_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
it_fieldcat TYPE TABLE OF slis_fieldcat_alv,
it_fcat TYPE TABLE OF slis_fieldcat_alv.
DATA:mytabix1 TYPE sy-tabix.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_werks FOR qals-werk,
s_zmatnr FOR aufk-zmatnr,
s_assbly FOR qals-zzassembly,
s_equnr FOR qals-zzequnr,
s_lotor FOR qals-herkunft,
s_lotdat FOR qals-enstehdat.
SELECTION-SCREEN END OF BLOCK b1.
INITIALIZATION.
s_lotdat-low = sy-datum - 7.
s_lotdat-high = sy-datum.
APPEND s_lotdat.
START-OF-SELECTION.
PERFORM get_data_qals.
PERFORM build_fieldcat.
PERFORM display_data.
EXIT.
END-OF-SELECTION.
*& Form get_data_qals
text
--> p1 text
<-- p2 text
FORM get_data_qals .
IF it_qals[] IS INITIAL.
SELECT a~prueflos
a~werk
a~losmenge
a~mengeneinh
a~zzequnr
a~zzassembly
a~herkunft
a~aufnr
a~objnr
a~matnr
a~enstehdat
b~pruefer
FROM qals AS a INNER JOIN qamr AS b
ON aprueflos = bprueflos
INTO CORRESPONDING FIELDS OF TABLE it_qals
WHERE werk IN s_werks
AND zzassembly IN s_assbly
AND zzequnr IN s_equnr
AND herkunft IN s_lotor
AND enstehdat IN s_lotdat.
ENDIF.
IF it_ordmat[] IS INITIAL.
SELECT a~aufnr
a~zmatnr
b~bautl
b~equnr
FROM aufk AS a INNER JOIN afih AS b
ON aaufnr = baufnr
INTO CORRESPONDING FIELDS OF TABLE it_ordmat FOR ALL ENTRIES IN it_qals
WHERE a~aufnr = it_qals-aufnr
AND zmatnr IN s_zmatnr.
ENDIF.
IF it_status[] IS INITIAL.
SELECT a~objnr
a~stat
b~txt04
FROM tj02t AS b
INNER JOIN jest AS a ON bistat = astat
INTO CORRESPONDING FIELDS OF TABLE it_status FOR ALL ENTRIES IN it_qals
WHERE a~objnr = it_qals-objnr
AND b~spras = sy-langu
AND a~inact = space.
ENDIF.
LOOP AT it_qals INTO wa_qals.
mytabix = sy-tabix.
READ TABLE it_ordmat INTO wa_ordmat WITH KEY aufnr = wa_qals-aufnr.
IF sy-subrc = 0.
IF wa_qals-herkunft = '14'.
wa_qals-matnr = wa_ordmat-zmatnr.
wa_qals-zzequnr = wa_ordmat-equnr.
wa_qals-zzassembly = wa_ordmat-bautl.
MODIFY it_qals FROM wa_qals INDEX mytabix TRANSPORTING matnr zzassembly zzequnr.
ENDIF.
ENDIF.
LOOP AT it_status INTO wa_status WHERE objnr = wa_qals-objnr.
CONCATENATE wa_qals-sttxt wa_status-txt04 INTO wa_qals-sttxt SEPARATED BY space.
CLEAR :wa_status.
ENDLOOP.
MODIFY it_qals FROM wa_qals INDEX mytabix TRANSPORTING sttxt.
CLEAR :wa_qals,wa_ordmat,mytabix.
ENDLOOP.
IF s_zmatnr[] IS NOT INITIAL.
DELETE it_qals WHERE matnr IS INITIAL.
ENDIF.
ENDFORM. " get_data_qals
*& Form build_fieldcat
text
--> p1 text
<-- p2 text
FORM build_fieldcat .
wa_layout-zebra = 'X'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-box_fieldname = 'SEL'.
wa_layout-box_tabname = 'IT_QALS'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME =
i_internal_tabname = 'IT_QALS'
i_structure_name = 'QALS_D02'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = it_fieldcat
IF sy-subrc = 0.
LOOP AT it_fieldcat INTO wa_fieldcat.
CASE wa_fieldcat-fieldname .
WHEN 'PRUEFLOS'.
wa_fieldcat-col_pos = 1.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO it_fcat.
WHEN 'WERK'.
wa_fieldcat-col_pos = 3.
APPEND wa_fieldcat TO it_fcat.
WHEN 'LOSMENGE'.
wa_fieldcat-col_pos = 4.
wa_fieldcat-no_out = ''.
APPEND wa_fieldcat TO it_fcat.
WHEN 'MENGENEINH'.
wa_fieldcat-col_pos = 5.
wa_fieldcat-no_out = ''.
APPEND wa_fieldcat TO it_fcat.
WHEN 'ZZEQUNR'.
wa_fieldcat-col_pos = 6.
wa_fieldcat-no_out = ''.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO it_fcat.
WHEN 'ZZASSEMBLY'.
wa_fieldcat-col_pos = 7.
wa_fieldcat-no_out = ''.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO it_fcat.
WHEN 'HERKUNFT'.
wa_fieldcat-col_pos = 8.
APPEND wa_fieldcat TO it_fcat.
WHEN 'AUFNR'.
wa_fieldcat-col_pos = 9.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO it_fcat.
WHEN 'ENSTEHDAT'."enstehdat
wa_fieldcat-col_pos = 10.
APPEND wa_fieldcat TO it_fcat.
WHEN 'STTXT'.
wa_fieldcat-col_pos = 12.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO it_fcat.
WHEN OTHERS.
ENDCASE.
CLEAR wa_fieldcat.
ENDLOOP.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'IT_QALS'.
wa_fieldcat-col_pos = 2.
wa_fieldcat-ref_tabname = 'AUFK'.
wa_fieldcat-hotspot = 'X'.
wa_fieldcat-seltext_l = 'Material No.'.
APPEND wa_fieldcat TO it_fcat.
wa_fieldcat-fieldname = 'PRUEFER'.
wa_fieldcat-tabname = 'IT_QALS'.
wa_fieldcat-col_pos = 11.
wa_fieldcat-ref_tabname = 'QAMR'.
wa_fieldcat-seltext_l = 'Name of the Inspector'.
APPEND wa_fieldcat TO it_fcat.
ENDIF.
ENDFORM. " build_fieldcat
*& Form display_data
text
--> p1 text
<-- p2 text
FORM display_data .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZRAIL_LOT_REPORT'
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USER_COMMAND'
is_layout = wa_layout
it_fieldcat = it_fcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
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 =
TABLES
t_outtab = it_qals
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_data
*& Form USER_COMMAND
text
-->R_UCOMM text
-->RS_SELFIELD text
FORM user_command USING r_ucomm TYPE sy-ucomm rs_selfield TYPE slis_selfield.
CASE rs_selfield-fieldname .
WHEN 'PRUEFLOS'.
SET PARAMETER ID 'QLS' FIELD rs_selfield-value.
CALL TRANSACTION 'QA03' AND SKIP FIRST SCREEN.
WHEN 'ZZEQUNR'.
SET PARAMETER ID 'EQN' FIELD rs_selfield-value.
CALL TRANSACTION 'IE03' AND SKIP FIRST SCREEN.
WHEN 'ZMATNR'.
SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
WHEN 'ZZASSEMBLY'.
SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
WHEN 'AUFNR'.
SET PARAMETER ID 'ANR' FIELD rs_selfield-value.
CALL TRANSACTION 'IW33' AND SKIP FIRST SCREEN.
WHEN 'STTXT'.
MOVE rs_selfield-tabindex TO mytabix1.
PERFORM show_status.
ENDCASE.
ENDFORM. "USER_COMMAND
*& Form show_status
text
--> p1 text
<-- p2 text
FORM show_status .
DATA:it_systat TYPE TABLE OF bapi2045ss,
wa_sysstat TYPE bapi2045ss,
it_bapi2045us TYPE TABLE OF bapi2045us.
DATA:it_fsys TYPE TABLE OF slis_fieldcat_alv.
DATA:insplot TYPE bapi2045d_il0-insplot.
DATA:language TYPE bapi2045la.
CLEAR wa_qals.
READ TABLE it_qals INTO wa_qals INDEX mytabix1.
insplot = wa_qals-prueflos.
language-langu = sy-langu.
CALL FUNCTION 'BAPI_INSPLOT_GETSTATUS'
EXPORTING
number = insplot
language = language
TABLES
system_status = it_systat
user_status = it_bapi2045us.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'ZRAIL_LOT_REPORT'
i_internal_tabname = 'IT_SYSTAT'
i_structure_name = 'BAPI2045SS'
CHANGING
ct_fieldcat = it_fsys.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZRAIL_LOT_REPORT'
it_fieldcat = it_fsys
TABLES
t_outtab = it_systat.
ENDFORM. " show_status
IIn the subrouitne the User command the Parameter rs_selfield will give you the selected or clicked field and its value its record no .
I hope this will help you. -
Set pf_status in REUSE_ALV_GRID_DISPLAY
Hi All,
I am using the 'i_callback_pf_status_set' from the FUNCTION 'REUSE_ALV_GRID_DISPLAY' and I see the output but the pf_status is not working. I donot see the buttin I created not even basic BACK and SAvE are working. When I activate the program I am getting the warning like '
when you pass SY-REPID DIRECTLY, "I_CALLBACK_PROGRAM" is set to the name ot the function group "REUSE_ALV_GRID_DISPLAY"'.
Please help me how to set the pf_status in the ALV.
Thanks,
Neelu.
REPORT zppprice1 .
TABLES: zppprice, kna1.
* ALV Type-Pools *
TYPE-POOLS: slis. "Global types
* ALV Structures *
* ALV layout catalog
DATA: s_alv_layout_cat TYPE slis_layout_alv.
* ALV Tables *
* ALV field catalog
DATA: it_alv_field_cat TYPE slis_t_fieldcat_alv,
*occurs 0 with header line,
i_fieldcat TYPE slis_fieldcat_alv OCCURS 0 WITH HEADER LINE,
w_fieldcat LIKE LINE OF i_fieldcat. "ALV FieldCat WorkArea
* ALV sort catalog
DATA: it_alv_sort_cat TYPE slis_sortinfo_alv OCCURS 0 WITH HEADER LINE.
* ALV event catalog
*data: it_alv_event_cat type slis_alv_event occurs 0 with header line.
DATA: it_alv_event_cat TYPE slis_t_event,
ls_alv_event TYPE slis_alv_event.
DATA: t_list_top_of_page TYPE slis_t_listheader.
TYPES: BEGIN OF slis_layout_alv.
INCLUDE TYPE slis_layout_main.
INCLUDE TYPE slis_layout_alv_spec.
TYPES: END OF slis_layout_alv.
DATA: gt_zprice TYPE TABLE OF zprice_struct,
gs_zprice TYPE zprice_struct.
DATA: chbox(1) TYPE c VALUE ' '.
*SET PF-STATUS 'LIST'.
*NEW-PAGE LINE-SIZE 158.
SELECT kunnr matnr crdate efdate sprice
eprice eohqty aohqty crmemo
FROM zppprice
INTO TABLE gt_zprice.
PERFORM field_catalog.
* Populate the layout catalog for alv
PERFORM alv_layout.
* Populate the event catalog for alv
PERFORM alv_events.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'HANDLE_USER_COMMAND'
is_layout = s_alv_layout_cat
it_fieldcat = it_alv_field_cat
i_default = 'X'
i_save = 'A'
it_events = it_alv_event_cat
TABLES
t_outtab = gt_zprice
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
FORM field_catalog.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
ls_fieldcat-fieldname = 'CHBOX'.
ls_fieldcat-checkbox = 'X'.
ls_fieldcat-input = 'X'.
ls_fieldcat-edit = 'X'.
ls_fieldcat-seltext_s = 'BOX'.
ls_fieldcat-seltext_l = 'BOX'.
APPEND ls_fieldcat TO it_alv_field_cat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'KUNNR'.
ls_fieldcat-seltext_s = 'Customer'.
ls_fieldcat-seltext_l = 'Customer'.
APPEND ls_fieldcat TO it_alv_field_cat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-seltext_s = 'Material'.
ls_fieldcat-seltext_l = 'Material'.
APPEND ls_fieldcat TO it_alv_field_cat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'CRDATE'.
ls_fieldcat-seltext_s = 'Creation date'.
ls_fieldcat-seltext_l = 'Creation date'.
APPEND ls_fieldcat TO it_alv_field_cat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'EFDATE'.
ls_fieldcat-seltext_s = 'Effective date'.
ls_fieldcat-seltext_l = 'Effective date'.
APPEND ls_fieldcat TO it_alv_field_cat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'SPRICE'.
ls_fieldcat-seltext_s = 'Old Price'.
ls_fieldcat-seltext_l = 'Old Price'.
APPEND ls_fieldcat TO it_alv_field_cat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'EPRICE'.
ls_fieldcat-seltext_s = 'New Price'.
ls_fieldcat-seltext_l = 'New Price'.
APPEND ls_fieldcat TO it_alv_field_cat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'EOHQTY'.
ls_fieldcat-seltext_s = 'Est. Qty'.
ls_fieldcat-seltext_l = 'Est. Qty'.
APPEND ls_fieldcat TO it_alv_field_cat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'AOHQTY'.
ls_fieldcat-seltext_s = 'Act. Qty'.
ls_fieldcat-seltext_l = 'Act. Qty'.
APPEND ls_fieldcat TO it_alv_field_cat.
CLEAR ls_fieldcat.
ENDFORM. " field_catalog
*& Form alv_layout
* text
* --> p1 text
* <-- p2 text
FORM alv_layout.
* Enable striped output display if user wants
s_alv_layout_cat-zebra = 'X'.
* Optimize column width if user wants
s_alv_layout_cat-colwidth_optimize = 'X'.
s_alv_layout_cat-box_fieldname = space.
s_alv_layout_cat-no_input = 'X'.
ENDFORM. " alv_layout
* FORM SET_PFSTATUS *
* --> EXTAB *
FORM pf_status USING extab TYPE slis_t_extab.
SET PF-STATUS 'LIST'.
ENDFORM.
* FORM HANDLE_USER_COMMAND *
* --> I_UCOM *
* --> IS_SELFIELD *
FORM handle_user_command USING i_ucom TYPE sy-ucomm
is_selfield TYPE slis_selfield.
CASE i_ucom.
WHEN 'CMEMO'.
LOOP AT gt_zprice INTO gs_zprice WHERE chbox = 'X'.
ENDLOOP.
ENDCASE.
ENDFORM.
*& Form alv_events
* text
* --> p1 text
* <-- p2 text
FORM alv_events.
* Declare event catalog for page headers
REFRESH: it_alv_event_cat.
CLEAR ls_alv_event.
ls_alv_event-name = 'PF_STATUS_SET'.
ls_alv_event-form = 'PF_STATUS'.
APPEND ls_alv_event TO it_alv_event_cat.
* Declare event catalog for report footers
CLEAR ls_alv_event.
ls_alv_event-name = 'USER_COMMAND'.
ls_alv_event-form = 'HANDLE_USER_COMMAND'.
APPEND ls_alv_event TO it_alv_event_cat.
ENDFORM. " alv_eventsYes, do not pass SY-REPID directly, first move to a variable.
data: repid type sy-repid.
repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'HANDLE_USER_COMMAND'
is_layout = s_alv_layout_cat
it_fieldcat = it_alv_field_cat
i_default = 'X'
i_save = 'A'
it_events = it_alv_event_cat
TABLES
t_outtab = gt_zprice
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
Regards,
Rich Heilman -
HI ALL
JUST WANT TO KNOW CAN WE HANDLE USER DEFINED EVENTS BY SETTING USER DEFINED PF -STATUS IN ALV
FOR EG :
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = gd_repid
I_CALLBACK_PF_STATUS_SET = K_STATUS
I_CALLBACK_PF_STATUS_SET = 'ZTEST1'
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_u ser_command = 'USER_COMMAND'
I_CALLBACK_USER_COMMAND = K_USER_COMMAND
IS_LAYOUT = GD_LAYOUT
IT_SPECIAL_GROUPS = KR_SP_GROUP
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
IS_VARIANT = K_VARIANT
IT_EVENTS = KR_EVENTS[]
is_variant = z_template
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
I HAVE MY OWN PF-STATUS IN WHICH I HAVE CREATED 1 BUTTON WHEN I GET THE OUT PUT AND CLICK ON THAT BUTTON THAN IT GOES TO STANDARD PROGRAM ....I WANT WHEN IT CLICK ON THAT BUTTON IT GOES TO MY Z PROGRAM HOW CAN I DO THAT ...
IF POSSIBLE PLZ PROVIDE CODE OR SOME EXAMPLE .
THANKS
TARANU can have button on application toolbar.
You just have to use the new pf status in your report program.
You should copy the 'STANDARD' GUI status from program SAPLKKBL using transaction SE90 >Programming SubObjects> Gui Status.
Execute this transaction to get to next screen. select status using checkbox. click on GUI Status --> Copy.
Enter your Z program name and the name you what for this status - you can keep it as 'STANDARD' to be simple.
Then you can edit the new status to add or delete buttons. This will also bring in the standard SAP ALV functionality.
Have a look at below code for using the new status.
TYPE-POOLS: slis.
DATA: i_qmel LIKE qmel OCCURS 0.
data v_repid type repid.
SELECT * FROM qmel INTO TABLE i_qmel.
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = v_repid
<b>I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'</b>
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
i_structure_name = 'QMEL'
TABLES
t_outtab = i_qmel
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.
<b>form set_pf_status using rt_extab type slis_t_extab.
set pf-status 'TEST'.
endform.</b>
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
data lv_ucomm type sy-ucomm.
lv_ucomm
= sy-ucomm.
CASE lv_ucomm.
WHEN 'BUTTON'. "Double Click line Item
**Write ur functinality here
endcase.
endform.
Also have a look at below links.
http://www.sap-basis-abap.com/abap/add-button-to-alv-toolbar-with-reuse-alv-list-display.htm
ALV report
I hope it helps.
Best Regards,
Vibha
*Please mark all the helpful answers -
How to Trigger SY-UCOMM User Event in ALV
Hi Folks,
Currently I have a classic ALV report where I need to remove all the standard ALV buttons and replace it with one custom button. Given that, there is a parameter in REUSE_ALV_GRID_DISPLAY that deals with the user command event. But during the debug/execution of the custom button, the value of sy-ucomm(R_UCOMM in my example below), is always blank.
Moreover, I did some relevant search here in SDN also before I paste my F1 here. If you're going to take a look at my code below, it's exactly the same as what the other relevant topic in user event in ALV.
PERFORM pf_status_kanban USING rt_extab.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
i_callback_top_of_page = 'F_TOPOF_PAGE'
i_callback_pf_status_set = 'PF_STATUS_KANBAN' "Exclude ALV standard buttons
i_callback_user_command = 'F_USER_COMMAND' "Subroutine for SY-UCOMM
* i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = t_alv_layout
it_fieldcat = t_alv_fcat[]
it_sort = t_alv_sort
is_variant = t_gs_variant
it_events = t_events "Events for AT USER-COMMAND
* IT_EVENT_EXIT = 'AT USER-COMMAND'
TABLES
t_outtab = t_output.
FORM F_USER_COMMAND USING p_r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN 'DOWNLOAD'.
PERFORM f_generate_col USING t_output.
WHEN OTHERS.
ENDCASE.
ENDFORM. " F_USER_COMMAND
FORM F_USER_COMMAND USING p_r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
* WHEN 'EXCEL'.
* PERFORM f_generate_col USING t_output.
WHEN 'DOWNLOAD'.
PERFORM f_generate_col USING t_output.
WHEN OTHERS.
ENDCASE.
ENDFORM. " F_USER_COMMAND
Thanks and regards,
JaimeHi Martin,
Yes, I ensure that the function code in my custom button is exactly the same as the condition for the sy-ucomm.
The call routine for the PF_STATUS_KANBAN is just a test since it seems like Iu2019m chasing a phantom issue here.
Yes, w_repid is set correctly.
DATA:
w_repid LIKE sy-repid. "Report ID.
INITIALIZATION.
w_repid = sy-repid.
It seems like the documentation im reading
Parameter R_UCOMM contains the function code triggered. is not happening as expected...
Thanks.
Jaime
Edited by: Jaime Cabanban on May 7, 2009 10:16 AM -
Top-of-page event is not triggered
Hi,
I have a problem with top-of-page event. I have a report that shows the results in ALV grid display. But I use "REUSE_ALV_GRID_DISPLAY" not OO alv and there is only one screen with number 1000. On the menu toolbar there is a button that prints the data of ALV in a list using "write" statement. While writing , "top of page" event is not triggered. I expect that it is triggered at the first "write" statement but isn't. Is there anyone who knows the cause of this problem?
The code is below.
Thanks.
Tables ...
TABLES : mara , makt , ekko , ekpo , zzith_yukh , lfa1 , t001w , lips ,
eket .
global variables
DATA : BEGIN OF list OCCURS 1,
zztahsk LIKE ekko-zztahsk ,
zterm LIKE ekko-zterm ,
txz01 LIKE ekpo-txz01 ,
name1 LIKE lfa1-name1 ,
menge LIKE ekpo-menge ,
meins LIKE ekpo-meins ,
fyukl LIKE zzith_yukh-zzdel_flag ,
" Yüklenmiş miktar var göstergesi ...
inco1 LIKE ekko-inco1 ,
netwr LIKE ekpo-netwr ,
waers LIKE ekko-waers ,
bedat LIKE ekko-bedat ,
zzontar LIKE ekko-zzontar ,
slfdt LIKE eket-slfdt ,
tname1 LIKE t001w-name1 ,
banfn LIKE ekpo-banfn ,
ebeln LIKE ekko-ebeln ,
ebelp LIKE ekpo-ebelp ,
lifnr LIKE ekko-lifnr ,
mtart LIKE mara-mtart ,
matkl LIKE mara-matkl ,
ekgrp LIKE ekko-ekgrp ,
matnr LIKE mara-matnr ,
eknam LIKE t024-eknam,
bukrs LIKE ekko-bukrs,
zzbltur LIKE ekko-zzbltur,
END OF list .
DATA temp LIKE list OCCURS 1 WITH HEADER LINE .
DATA total LIKE list OCCURS 1 WITH HEADER LINE .
ALV fields
TYPE-POOLS : slis.
DATA : gt_fields TYPE slis_fieldcat_alv OCCURS 1 WITH HEADER LINE .
DATA : gt_events TYPE slis_t_event.
DATA : gs_layout TYPE slis_layout_alv.
DATA : gv_title TYPE lvc_title VALUE 'Günlük Depo Sayım Miktarları'.
DATA : gt_top_of_page TYPE slis_t_listheader.
selection screen
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001 .
*Satınalma organizasyonu
*Satınalma grubu
*Satıcı
*Tarih
*SAS no
*Dosya no
SELECT-OPTIONS:
s_bukrs FOR ekko-bukrs .
SELECTION-SCREEN SKIP .
SELECT-OPTIONS:
s_ekorg FOR ekko-ekorg OBLIGATORY MEMORY ID eko ,
s_ekgrp FOR ekko-ekgrp ,
s_lifnr FOR ekko-lifnr ,
s_ebeln FOR ekko-ebeln .
SELECTION-SCREEN END OF BLOCK a .
Define Katalog
DEFINE fill_catalog .
gt_fields-fieldname = &1.
gt_fields-tabname = &2.
gt_fields-seltext_l = &3.
gt_fields-seltext_m = &3.
gt_fields-seltext_s = &3.
gt_fields-checkbox = &4.
gt_fields-cfieldname = &5.
gt_fields-ref_tabname = &6.
gt_fields-ref_fieldname = &7.
gt_fields-edit = &8.
append gt_fields .
clear gt_fields .
END-OF-DEFINITION.
Modify Catalog
DEFINE modify_catalog .
gt_fields-seltext_m = &1 .
modify gt_fields transporting seltext_m where fieldname = &2 .
END-OF-DEFINITION .
TOP-OF-PAGE.
write 'top of page'.
PERFORM top-of-page.
start-of-selection
START-OF-SELECTION .
PERFORM get_data.
PERFORM listele .
*& Form listele .
FORM listele .
PERFORM get_events .
PERFORM alv_list_header.
PERFORM get_field_catalog USING 'LIST' .
PERFORM display_alv .
ENDFORM. " listele.
*& Form getfield_Catalog
FORM get_field_catalog USING p_tabname .
fill_catalog :
'EBELN' 'LIST' '' '' '' 'EKPO' 'EBELN' '' ,
'ZZTAHSK' 'LIST' '' '' '' 'EKKO' 'ZZTAHSK' '' ,
'ZZBLTUR' 'LIST' '' '' '' 'EKKO' 'ZZBLTUR' '' ,
'MATNR' 'LIST' '' '' '' 'MARA' 'MATNR' '' ,
'MATKL' 'LIST' '' '' '' 'MARA' 'MATKL' '' ,
'TXZ01' 'LIST' '' '' '' 'EKPO' 'TXZ01' '' ,
'NAME1' 'LIST' '' '' '' 'LFA1' 'NAME1' '' ,
'MENGE' 'LIST' '' '' '' 'EKPO' 'MENGE' '' ,
'MEINS' 'LIST' '' '' '' 'EKPO' 'MENGE' '' ,
'FYUKL' 'LIST' '' '' '' 'ZZITH_YUKH' 'ZZDEL_FLAG' '' ,
'INCO1' 'LIST' '' '' '' 'EKKO' 'INCO1' '' ,
'NETWR' 'LIST' '' '' '' 'EKPO' 'NETWR' '' ,
'WAERS' 'LIST' '' '' '' 'EKKO' 'WAERS' '' ,
'BEDAT' 'LIST' '' '' '' 'EKKO' 'BEDAT' '' ,
'ZZONTAR' 'LIST' '' '' '' 'EKKO' 'ZZONTAR' '' ,
'SLFDT' 'LIST' '' '' '' 'EKET' 'SLFDT' '' ,
'TNAME1' 'LIST' '' '' '' 'T001W' 'NAME1' '' ,
'BANFN' 'LIST' '' '' '' 'EKPO' 'BANFN' '' ,
'EKNAM' 'LIST' '' '' '' 'T024' 'EKNAM' '' .
gt_fields-ddictxt = 'M' .
MODIFY gt_fields TRANSPORTING ddictxt WHERE fieldname NE space.
modify_catalog 'Yükleme No' 'VBELN' .
modify_catalog 'Malzeme Türü' 'ZZBLTUR' .
modify_catalog 'Malzeme Tanımı' 'TXZ01' .
modify_catalog 'Satıcı' 'NAME1' .
modify_catalog 'Teslim Şekli' 'INCO1' .
modify_catalog 'Döviz Tutarı' 'ZZTOPLAM'.
modify_catalog 'Döviz Kodu' 'WAERS' .
modify_catalog 'Siparişi Veren' 'TNAME1' .
modify_catalog 'Tahmini İthalat Trh.' 'SLFDT' .
modify_catalog 'İthalata İntikal Trh.' 'BEDAT' .
modify_catalog 'Dosya Onay Tarihi' 'ZZONTAR' .
modify_catalog 'Talep No' 'BANFN' .
modify_catalog 'Dosya Sorumlusu' 'EKNAM' .
modify_catalog 'Yük.Göstergesi' 'FYUKL' .
ENDFORM. " getfield_Catalog
*& Form display_alv
text
--> p1 text
<-- p2 text
FORM display_alv .
DATA lv_repid LIKE sy-repid .
lv_repid = sy-repid .
CLEAR gs_layout.
gs_layout-zebra = 'X'.
gs_layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = lv_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = gt_fields[]
it_events = gt_events[]
TABLES
t_outtab = list[].
ENDFORM. " display_alv
FORM set_pf_status USING iv_nodisplay TYPE slis_t_extab.
SET PF-STATUS 'STANDARD' ."excluding iv_nodisplay.
ENDFORM. " SET_PF_STATUS
FORM user_command USING iv_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE iv_ucomm .
WHEN 'PRINT' . PERFORM print_data .
ENDCASE .
ENDFORM. "USER_COMMAND
FORM get_events .
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gt_events.
READ TABLE gt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE 'ALV_TOP_OF_PAGE' TO ls_event-form.
APPEND ls_event TO gt_events.
ENDIF.
ENDFORM. " getevents
FORM alv_list_header .
DATA: ls_line TYPE slis_listheader.
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-key = 'Satınalma Org.:'.
CONCATENATE s_ekorg-low s_ekorg-high
INTO ls_line-info SEPARATED BY '/'.
APPEND ls_line TO gt_top_of_page.
ls_line-key = 'Satınalma Grubu.:'.
CONCATENATE s_ekgrp-low s_ekgrp-high
INTO ls_line-info SEPARATED BY '/'.
APPEND ls_line TO gt_top_of_page.
ls_line-key = 'Satıcı.:'.
CONCATENATE s_lifnr-low s_lifnr-high
INTO ls_line-info SEPARATED BY '/'.
APPEND ls_line TO gt_top_of_page.
ls_line-key = 'SAS No.:'.
CONCATENATE s_ebeln-low s_ebeln-high
INTO ls_line-info SEPARATED BY '/'.
APPEND ls_line TO gt_top_of_page.
ENDFORM. " alv_list_header
FORM alv_top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_top_of_page.
ENDFORM. "TOP_OF_PAGE
FORM get_data .
DATA : BEGIN OF tr ,
menge LIKE eket-menge ,
dabmg LIKE eket-dabmg ,
END OF tr ,
zzfiilytar LIKE zzith_yukh-zzfiilytar .
*- Get data ...
SELECT *
INTO CORRESPONDING FIELDS OF TABLE list
FROM ekpo AS a
INNER JOIN ekko AS b ON bebeln = aebeln
WHERE b~ebeln IN s_ebeln AND
b~bukrs IN s_bukrs AND
b~loekz EQ space AND
b~lifnr IN s_lifnr AND
b~ekorg IN s_ekorg AND
b~ekgrp IN s_ekgrp AND
a~loekz EQ space AND
a~elikz EQ space .
LOOP AT list .
CLEAR tr .
SELECT menge dabmg
INTO tr
FROM eket
WHERE ebeln = list-ebeln AND
ebelp = list-ebelp.
tr-menge = tr-menge - tr-dabmg .
ENDSELECT.
IF tr-menge LE 0 .
DELETE list .
ELSE .
list-menge = tr-menge .
IF tr-dabmg GT 0 .
list-fyukl = '*' .
ENDIF .
SELECT SINGLE butxt INTO list-tname1 FROM t001
WHERE bukrs = list-bukrs .
SELECT SINGLE slfdt INTO list-slfdt FROM eket
WHERE ebeln = list-ebeln AND
ebelp = list-ebelp .
SELECT SINGLE name1 INTO list-name1 FROM lfa1 WHERE lifnr = list-lifnr.
SELECT SINGLE mtart matkl INTO (list-mtart,list-matkl)
FROM mara WHERE matnr = list-matnr .
SELECT SINGLE eknam INTO list-eknam FROM t024 WHERE ekgrp = list-ekgrp .
MODIFY list .
ENDIF .
ENDLOOP .
ENDFORM. " get_data
FORM print_data .
LEAVE TO LIST-PROCESSING .
NEW-PAGE NO-HEADING NO-TITLE LINE-SIZE 229 .
SET PF-STATUS SPACE .
PERFORM top-of-page .
malzeme türü 1005 ler yazdırılır
PERFORM yazdir_1005 .
malzeme türü 1005 olmayanlar yazdırılır
PERFORM yazdir_ne_1005 .
Satınalama grupları bilgisi yazdırılır
PERFORM yazdir_ekgrp .
ENDFORM. " print_data
FORM top-of-page .
WRITE : 'ÜLKER GRUBU KONSOLİDE' .
WRITE AT 40 'Sevkiyat Bekleyen Malzemeler' COLOR COL_HEADING .
WRITE : 180 sy-uname , sy-datum , sy-uzeit.
NEW-LINE .
ULINE 0(229) .
WRITE :/2 'Rapor Kodu..............:' , (10) sy-tcode .
WRITE :/2 'Satınalma Organizasyonu.:' , (10) s_ekorg-low, '/', (10) s_ekorg-high .
WRITE :/2 'Satınalma Grubu.........:' , (10) s_ekgrp-low, '/', (10) s_ekgrp-high .
WRITE :/2 'Satıcı..................:' , (10) s_lifnr-low, '/', (10) s_lifnr-high .
WRITE :/2 'Satınalma Sipariş No....:' , (10) s_ebeln-low, '/', (10) s_ebeln-high .
NEW-LINE .
ULINE 0(229) .
Başlıklar yazılır
FORMAT COLOR COL_HEADING .
WRITE :
/(10) 'SAS NO.' CENTERED,
(6) 'TAHSİS' CENTERED,
(5) 'ÖDEME' CENTERED,
(5) 'Bel.T' CENTERED,
(25) 'MALZEME' CENTERED,
(25) 'SATICI' CENTERED,
(12) 'MİKTAR' CENTERED,
(3) 'BRM' CENTERED,
(3) 'G' ,
(7) 'TES.ŞK.' CENTERED,
(16) 'DÖVİZ TUTARI' CENTERED,
(3) 'DB.' CENTERED,
(13) 'İTH.İNTK.TRH.' CENTERED,
(13) 'DOSYA ON.TRH.' CENTERED,
(10) 'TAHMİN.İTH.TRH.' CENTERED,
(20) 'SİPARİŞ VEREN' CENTERED,
(10) 'TALEP NO.' CENTERED,
(18) 'DOSYA SORUMLUSU' CENTERED.
ULINE 0(229) .
FORMAT RESET .
ENDFORM. " top-of-page
FORM yazdir_1005 .
DATA ebeln LIKE list-ebeln .
SORT list BY zzbltur matnr .
temp[] = list[] .
DELETE temp WHERE mtart <> '1005' .
LOOP AT list WHERE mtart = '1005' .
CLEAR list-netwr .
IF ebeln NE list-ebeln OR ebeln EQ space .
REFRESH total . CLEAR total .
ebeln = list-ebeln .
LOOP AT temp WHERE ebeln = list-ebeln .
list-netwr = list-netwr + temp-netwr .
CLEAR total .
total-txz01 = '*** TKNK.MLZ. TOPLAMI ****' .
total-meins = temp-meins .
total-menge = temp-menge .
COLLECT total .
ENDLOOP .
PERFORM write_list USING '1' .
LOOP AT total .
PERFORM write_list USING '2' .
ENDLOOP .
AT END OF zzbltur .
ULINE 0(229) .
ENDAT .
ENDIF .
ENDLOOP .
ENDFORM. " yazdir_1005
FORM write_list USING flag .
flag 1 1005 için yazdırma
flag 2 ise ara toplam
IF flag = '1' .
FORMAT COLOR COL_NORMAL .
WRITE :
/(10) list-ebeln ,
(6) list-zztahsk,
(5) list-zterm,
(5) list-zzbltur ,
(25) list-txz01,
(25) list-name1,
(12) list-menge,
(3) list-meins,
(3) list-fyukl,
(7) list-inco1,
(16) list-netwr,
(3) list-waers,
(13) list-bedat,
(13) list-zzontar,
(10) list-slfdt ,
(20) list-tname1,
(10) list-banfn ,
(18) list-eknam .
FORMAT RESET .
ELSEIF flag = '2' .
FORMAT COLOR COL_TOTAL .
WRITE :
/(10) '' ,
(6) '' ,
(5) '' ,
(5) '' ,
(25) total-txz01,
(25) '' ,
(12) total-menge,
(3) total-meins,
(3) '' ,
(7) '' ,
(16) '' ,
(3) '' ,
(13) '' ,
(13) '' ,
(10) '' ,
(20) '' ,
(10) '' ,
(18) '' .
FORMAT RESET .
ELSEIF flag = '3' .
FORMAT COLOR COL_TOTAL .
WRITE :
/(10) '' ,
(6) '' ,
(5) '' ,
(5) '' ,
(25) total-txz01,
(25) '' ,
(12) total-menge,
(3) '' ,
(3) '' ,
(7) '' ,
(16) total-netwr ,
(3) '' ,
(13) '' ,
(13) '' ,
(10) '' ,
(20) '' ,
(10) '' ,
(18) '' .
FORMAT RESET .
ENDIF .
ENDFORM. " write_list
FORM yazdir_ne_1005 .
DATA matnr LIKE list-matnr .
SORT list BY zzbltur matkl matnr .
temp[] = list[] .
DELETE temp WHERE mtart = '1005' .
LOOP AT list WHERE mtart <> '1005' .
Her yeni Malzeme için ara toplam yazılır
IF matnr NE list-matnr AND matnr NE space .
REFRESH total . CLEAR total .
Toplamlar alınır
LOOP AT temp WHERE matnr = matnr .
CLEAR total .
total-netwr = temp-netwr .
total-menge = temp-menge .
total-txz01 = '*** TOPLAM ****' .
COLLECT total .
ENDLOOP .
LOOP AT total . .
PERFORM write_list USING '3' .
ENDLOOP .
ULINE 0(229) .
ENDIF .
PERFORM write_list USING '1' .
matnr = list-matnr .
ENDLOOP .
Toplamlar alınır
LOOP AT temp WHERE matnr = matnr .
REFRESH total . CLEAR total .
total-netwr = temp-netwr .
total-menge = temp-menge .
total-txz01 = '*** TOPLAM ****' .
COLLECT total .
ENDLOOP .
LOOP AT total .
PERFORM write_list USING '3' .
ENDLOOP .
ULINE 0(229) .
ENDFORM. " yazdir_ne_1005
FORM yazdir_ekgrp .
DATA: BEGIN OF total OCCURS 1 ,
eknam LIKE list-eknam ,
zzbltur LIKE list-zzbltur ,
sayi TYPE i ,
END OF total .
DATA: BEGIN OF gtotal OCCURS 1 ,
eknam LIKE list-eknam ,
zzbltur LIKE list-zzbltur ,
sayi TYPE i ,
END OF gtotal .
DATA: bltur LIKE zzith_bltur OCCURS 1 WITH HEADER LINE .
DATA: len TYPE i .
DATA: wa LIKE total.
REFRESH temp .
SELECT * INTO TABLE bltur FROM zzith_bltur .
CLEAR bltur .
MOVE : 'ZZZZ' TO bltur-zzbltur , " Satır toplamı için ...
text-002 TO bltur-zztanim .
APPEND bltur .
CLEAR list .
SORT list BY eknam ebeln .
DELETE ADJACENT DUPLICATES FROM list COMPARING eknam ebeln .
LOOP AT list .
CLEAR : total, gtotal .
total-eknam = list-eknam .
total-zzbltur = list-zzbltur .
total-sayi = 1 .
COLLECT total .
total-eknam = list-eknam .
total-zzbltur = 'ZZZZ' .
total-sayi = 1 .
COLLECT total .
gtotal-eknam = text-001 .
gtotal-zzbltur = list-zzbltur .
gtotal-sayi = 1 .
COLLECT gtotal .
gtotal-eknam = text-001 .
gtotal-zzbltur = 'ZZZZ' .
gtotal-sayi = 1 .
COLLECT gtotal .
ENDLOOP .
FORMAT COLOR COL_HEADING.
ULINE AT /1(145).
WRITE :/
sy-vline , (15) 'Dosya Sorumlusu' , sy-vline .
LOOP AT bltur .
WRITE :(15) bltur-zztanim , sy-vline .
ENDLOOP .
ULINE AT /1(145).
FORMAT RESET .
total-zzbltur = '0001' .
MODIFY total TRANSPORTING zzbltur WHERE zzbltur = space .
gtotal-zzbltur = '0001' .
MODIFY gtotal TRANSPORTING zzbltur WHERE zzbltur = space .
SORT total BY eknam .
LOOP AT total .
AT NEW eknam .
WRITE :/
sy-vline , (15) total-eknam COLOR COL_HEADING ,
sy-vline .
LOOP AT bltur .
len = sy-tabix * 18 .
len = len + 3 .
CLEAR wa .
READ TABLE total INTO wa WITH KEY zzbltur = bltur-zzbltur
eknam = total-eknam .
WRITE AT len(15) wa-sayi NO-ZERO.
WRITE sy-vline .
ENDLOOP .
ENDAT .
ENDLOOP .
LOOP AT gtotal .
AT NEW eknam .
FORMAT COLOR COL_TOTAL .
WRITE :/
sy-vline , (15) gtotal-eknam ,
sy-vline .
LOOP AT bltur .
len = sy-tabix * 18 .
len = len + 3 .
CLEAR wa .
READ TABLE gtotal INTO wa WITH KEY zzbltur = bltur-zzbltur
eknam = text-001 .
WRITE AT len(15) wa-sayi NO-ZERO.
WRITE sy-vline .
ENDLOOP .
ENDAT .
ENDLOOP .
ULINE AT /1(145).
FORMAT RESET .
ENDFORM. " yazdir_ekgrpHi,
In the function use the top-of-page event as follows:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = 'ZRPMSLM'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
<b> I_CALLBACK_TOP_OF_PAGE = 'TOP'</b>
Define whatever to appear in top-of page in a subroutine named TOP.
Hope this helps.
Reward if helpful.
Regards,
Sipra
Maybe you are looking for
-
How can I run a picture slide show continuously on my playbook?
I would like to run a picture slide show on a continuous loop but I cannot find any settings to accomplish that. Does anyone know how or if I can do that? Thank you.
-
I purchased my IPad in June and it keeps losing the GPS signal why is this?
I purchased my IPad 3 in June and it keeps losing its GPS signal why is this please? I have not been able to use the NavFree or SatVav applications or search google whilst travelling
-
Pavilion m7-1015 dx Windows 7 Flash Player
I seem to be having a problem with the, Adobe Flash Player. When I go to a news item and it has a video, I click on the play button and get, "You need to download the Adobe Flash Player. I have the player already, but it seems that it works, sometime
-
I have added a song to replace the Revolution's theme music. Is ther a way to set a specific section of the song to play instead of the entire song?
-
Not long time ago I was trying to send an email from within Forte using SMTP. And believe it or not it works just fine. From what I can tell, Keith, you know the steps to send it, but missingfew concepts in how the SMTP works. It is simple, but not t