LIST output and event handling in OO ALV and
Hi,
I am creating an ALV Report.
How can i Display the Grid as a List. I am abke to change the view from the first grid that is created. but i need to show it as a list output from beginning.
Also i have created a hotspot in and it works when the ALV is displayed in Grid Format but it does not work when i switch the view to list output.
Any suggestions.
Regards,
Tarun Bahal
*& Report ZFI_TRIAL_BALANCE
REPORT zfi_trial_balance LINE-SIZE 275 LINE-COUNT 3(2) NO STANDARD PAGE HEADING.
TABLES: bseg.
TYPES: BEGIN OF ty_bkpf ,
bukrs TYPE bkpf-bukrs,
belnr TYPE bkpf-belnr,
gjahr TYPE bkpf-gjahr,
budat TYPE bkpf-budat,
END OF ty_bkpf.
TYPES: BEGIN OF ty_bseg ,
bukrs TYPE bseg-bukrs,
belnr TYPE bseg-belnr,
gjahr TYPE bseg-gjahr,
hkont TYPE bseg-hkont,
END OF ty_bseg.
TYPES: BEGIN OF ty_bank,
hkont TYPE bseg-hkont,
txt50 TYPE skat-txt50,
open_dmbtr_dr TYPE p,
open_dmbtr_cr TYPE p,
trans_dmbtr_dr TYPE p,
trans_dmbtr_cr TYPE p,
close_dmbtr_dr TYPE p,
close_dmbtr_cr TYPE p,
END OF ty_bank.
TYPES: BEGIN OF ty_breakup,
bukrs TYPE bseg-bukrs,
blart TYPE bkpf-blart,
belnr TYPE bseg-belnr,
budat TYPE bkpf-budat,
umskz TYPE bseg-umskz,
rebzg TYPE bseg-rebzg,
lifnr TYPE bseg-lifnr,
kunnr TYPE bseg-kunnr,
name1 TYPE lfa1-name1,
dmbtr TYPE p,
END OF ty_breakup.
INITIALIZATION.
* CLASS handler DEFINITION
CLASS handler DEFINITION.
PUBLIC SECTION .
METHODS:handle_hotspot_click "handler definition for hotspot_click
FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id
e_column_id
es_row_no,
handle_top_of_page
FOR EVENT print_top_of_page OF cl_gui_alv_grid
IMPORTING table_index,
handle_subtotal_text
FOR EVENT subtotal_text OF cl_gui_alv_grid
IMPORTING es_subtottxt_info
ep_subtot_line
e_event_data.
ENDCLASS. "handler DEFINITION
* CLASS handler IMPLEMENTATION
CLASS handler IMPLEMENTATION.
METHOD handle_hotspot_click. "handler implementation for hotspot_click
PERFORM handle_hotspot_click USING e_row_id
e_column_id
es_row_no .
ENDMETHOD. "handle_hotspot_click
METHOD handle_top_of_page.
PERFORM handle_print_top_of_page.
ENDMETHOD. "handle_hotspot_click
METHOD handle_subtotal_text.
PERFORM handle_subtotal_text USING es_subtottxt_info
ep_subtot_line
e_event_data.
ENDMETHOD. "Subtotal_text
ENDCLASS. "handler IMPLEMENTATION
DATA: i_set_values TYPE TABLE OF rgsb4,
wa_set_values LIKE LINE OF i_set_values,
l_dmbtr TYPE dmbtr,
l_dmbtr2 TYPE dmbtr,
l_dmbtr3 TYPE dmbtr,
l_dmbtr4 TYPE dmbtr,
l_dmbtr_total TYPE dmbtr,
l_shkzg TYPE shkzg,
i_bkpf TYPE STANDARD TABLE OF ty_bkpf,
i_bseg TYPE STANDARD TABLE OF ty_bseg,
i_bank TYPE STANDARD TABLE OF ty_bank,
i_breakup TYPE STANDARD TABLE OF ty_breakup,
wa_bkpf LIKE LINE OF i_bkpf,
wa_bseg LIKE LINE OF i_bseg,
wa_bank LIKE LINE OF i_bank,
wa_breakup LIKE LINE OF i_breakup,
ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm,
l_ktopl TYPE ktopl.
DATA: gr_alvgrid TYPE REF TO cl_gui_alv_grid,
gr_alvgrid_0200 TYPE REF TO cl_gui_alv_grid,
gr_ccontainer TYPE REF TO cl_gui_custom_container,
gr_ccontainer_0200 TYPE REF TO cl_gui_custom_container,
gt_fieldcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo,
gt_sort TYPE lvc_t_sort,
gt_roid TYPE lvc_t_roid,
gt_exclude TYPE ui_functions,
g_scrstatus TYPE i,
gs_variant TYPE disvariant,
o_handler TYPE REF TO handler.
CONSTANTS: c_doctype(22) TYPE c VALUE 'ZINFITR01_TRIALBALANCE'.
DATA gs_stbl TYPE lvc_s_stbl.
SELECTION-SCREEN: BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: l_date FOR sy-datum.
PARAMETERS : l_bukrs TYPE bukrs,
l_segent TYPE fb_segment.
SELECTION-SCREEN: END OF BLOCK block1.
START-OF-SELECTION.
gs_stbl-row = 'X'.
gs_stbl-col = 'X'.
CALL FUNCTION 'G_SET_GET_ALL_VALUES'
EXPORTING
setnr = c_doctype
table = 'SKA1'
class = '0000'
TABLES
set_values = i_set_values
EXCEPTIONS
set_not_found = 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.
CLEAR i_bank.
LOOP AT i_set_values INTO wa_set_values.
CLEAR: l_dmbtr, l_dmbtr2, l_dmbtr3, l_dmbtr4, i_bkpf, i_bseg.
wa_bank-hkont = wa_set_values-from.
SELECT bukrs belnr budat gjahr FROM bkpf
INTO CORRESPONDING FIELDS OF TABLE i_bkpf
WHERE bukrs = l_bukrs
AND budat < l_date-low.
LOOP AT i_bkpf INTO wa_bkpf.
SELECT dmbtr shkzg FROM bseg INTO (l_dmbtr, l_shkzg)
WHERE bukrs = wa_bkpf-bukrs
AND belnr = wa_bkpf-belnr
AND gjahr = wa_bkpf-gjahr
AND hkont = wa_set_values-from.
IF l_shkzg = 'S'.
l_dmbtr2 = l_dmbtr2 + l_dmbtr.
ELSE.
l_dmbtr2 = l_dmbtr2 - l_dmbtr.
ENDIF.
CLEAR: l_dmbtr, l_shkzg.
ENDSELECT.
ENDLOOP.
IF l_dmbtr2 > 0.
wa_bank-open_dmbtr_dr = l_dmbtr2.
ELSE.
wa_bank-open_dmbtr_cr = l_dmbtr2.
ENDIF.
CLEAR: l_dmbtr, i_bkpf, i_bseg.
SELECT bukrs belnr budat gjahr FROM bkpf
INTO CORRESPONDING FIELDS OF TABLE i_bkpf
WHERE bukrs = l_bukrs
AND budat IN l_date.
LOOP AT i_bkpf INTO wa_bkpf.
SELECT dmbtr shkzg FROM bseg INTO (l_dmbtr, l_shkzg)
WHERE bukrs = wa_bkpf-bukrs
AND belnr = wa_bkpf-belnr
AND gjahr = wa_bkpf-gjahr
AND hkont = wa_set_values-from.
IF l_shkzg = 'S'.
l_dmbtr3 = l_dmbtr3 + l_dmbtr.
ELSE.
l_dmbtr4 = l_dmbtr4 - l_dmbtr.
ENDIF.
CLEAR: l_dmbtr, l_shkzg.
ENDSELECT.
ENDLOOP.
* IF l_dmbtr3 > 0.
wa_bank-trans_dmbtr_dr = l_dmbtr3.
* ELSE.
wa_bank-trans_dmbtr_cr = l_dmbtr4.
* ENDIF.
l_dmbtr = l_dmbtr2 + l_dmbtr3 + l_dmbtr4.
IF l_dmbtr > 0.
wa_bank-close_dmbtr_dr = l_dmbtr.
ELSE.
wa_bank-close_dmbtr_cr = l_dmbtr.
ENDIF.
CLEAR: l_dmbtr.
SELECT SINGLE ktopl FROM t001 INTO l_ktopl WHERE bukrs = l_bukrs.
SELECT SINGLE txt50 FROM skat INTO wa_bank-txt50
WHERE spras = sy-langu "( SELECT spras FROM t002 WHERE laiso = sy-langu )
AND ktopl = l_ktopl
AND saknr = wa_set_values-from.
APPEND wa_bank TO i_bank.
CLEAR wa_bank.
ENDLOOP.
LOOP AT i_bank INTO wa_bank.
* IF wa_bank-open_dmbtr_cr < 0.
wa_bank-open_dmbtr_cr = wa_bank-open_dmbtr_cr * -1.
* ENDIF.
* IF wa_bank-trans_dmbtr_cr < 0.
wa_bank-trans_dmbtr_cr = wa_bank-trans_dmbtr_cr * -1.
* ENDIF.
* IF wa_bank-close_dmbtr_cr < 0.
wa_bank-close_dmbtr_cr = wa_bank-close_dmbtr_cr * -1.
* ENDIF.
MODIFY i_bank FROM wa_bank.
ENDLOOP.
SORT i_bank ASCENDING BY hkont.
END-OF-SELECTION.
* SET SCREEN 100.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS01'.
SET TITLEBAR 'TITLE1'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module save_ok INPUT
* text
MODULE save_ok INPUT.
save_ok = ok_code.
CLEAR ok_code.
ENDMODULE. " save_ok INPUT
*& Module create_alv OUTPUT
* text
MODULE create_alv OUTPUT.
IF gr_alvgrid IS INITIAL.
CREATE OBJECT gr_ccontainer
EXPORTING
* PARENT =
container_name = 'CUSTOM_CONTAINER'
repid = sy-repid
dynnr = '0100'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT gr_alvgrid
EXPORTING
i_parent = gr_ccontainer
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM prepare_field_catalog CHANGING gt_fieldcat .
PERFORM prepare_layout CHANGING gs_layout .
PERFORM prepare_sort CHANGING gt_sort.
gs_variant-report = sy-repid.
gs_variant-variant = 'ABC'.
gs_variant-handle = '1'.
* IF sy-dynnr = '0100'.
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* is_variant = gs_variant
* i_save = 'A'
* i_default = 'X'
is_layout = gs_layout
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
* IR_SALV_ADAPTER =
CHANGING
it_outtab = i_bank
it_fieldcatalog = gt_fieldcat
* it_sort = gt_sort
* IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
CALL METHOD gr_alvgrid->refresh_table_display
EXPORTING
is_stable = gs_stbl
* i_soft_refresh = 'X'
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CREATE OBJECT o_handler.
SET HANDLER o_handler->handle_hotspot_click FOR gr_alvgrid.
SET HANDLER o_handler->handle_top_of_page FOR gr_alvgrid.
SET HANDLER o_handler->handle_subtotal_text FOR gr_alvgrid.
* ENDIF.
ENDMODULE. " create_alv OUTPUT
*& Form prepare_field_catalog
* text
* <--P_GT_FIELDCAT text
FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA: ls_fcat TYPE lvc_s_fcat.
CLEAR pt_fieldcat.
CLEAR gt_fieldcat.
* IF sy-dynnr = '0100'.
ls_fcat-fieldname = 'HKONT' .
ls_fcat-ref_field = 'HKONT'.
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '15' .
ls_fcat-ref_table = 'BSEG' .
ls_fcat-coltext = 'G/L Account' .
ls_fcat-seltext = 'G/L Account' .
ls_fcat-hotspot = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'TXT50' .
ls_fcat-ref_field = 'TXT50'.
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '20' .
ls_fcat-ref_table = 'SKAT' .
ls_fcat-coltext = 'Description' .
ls_fcat-seltext = 'Description' .
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'OPEN_DMBTR_DR' .
ls_fcat-ref_field = 'DMBTR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '20' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Opening Balance: Debit' .
ls_fcat-seltext = 'Opening Balance: Debit'.
ls_fcat-no_sign = 'X'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'OPEN_DMBTR_CR' .
ls_fcat-ref_field = 'DMBTR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '20' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Opening Balance: Credit' .
ls_fcat-seltext = 'Opening Balance: Credit'.
ls_fcat-no_sign = 'X'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'TRANS_DMBTR_DR' .
ls_fcat-ref_field = 'DMBTR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '20' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Trans Balance: Debit' .
ls_fcat-seltext = 'Trans Balance: Debit'.
ls_fcat-no_sign = 'X'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'TRANS_DMBTR_CR' .
ls_fcat-ref_field = 'DMBTR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '20' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Trans Balance: Credit' .
ls_fcat-seltext = 'Trans Balance: Credit'.
ls_fcat-no_sign = 'X'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'CLOSE_DMBTR_DR' .
ls_fcat-ref_field = 'DMBTR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '20' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Closing Balance: Debit' .
ls_fcat-seltext = 'Closing Balance: Debit'.
ls_fcat-no_sign = 'X'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'CLOSE_DMBTR_CR' .
ls_fcat-ref_field = 'DMBTR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '20' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Closing Balance: Credit' .
ls_fcat-seltext = 'Closing Balance: Credit'.
ls_fcat-no_sign = 'X'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
* ELSE.
* ENDIF.
ENDFORM. " prepare_field_catalog
*& Form prepare_layout
* text
* <--P_GS_LAYOUT text
FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo.
DATA l_title(50) TYPE c.
CONCATENATE 'Trial Balance: ' l_date-low+6(2) '-' l_date-low+4(2) '-'l_date-low(4) ' to ' l_date-high+6(2) '-' l_date-high+4(2) '-'l_date-high(4) INTO l_title RESPECTING BLANKS.
* ps_layout-zebra = 'X' .
ps_layout-grid_title = l_title.
ps_layout-cwidth_opt = 'X' .
ps_layout-sel_mode = 'A'.
* ps_layout-no_toolbar = 'X'.
ps_layout-no_headers = 'X'.
ps_layout-frontend = 'L'.
ENDFORM. " prepare_layout
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE save_ok.
WHEN 'BACK'.
SET SCREEN 0.
LEAVE SCREEN.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form prepare_sort
* text
* <--P_GT_SORT text
FORM prepare_sort CHANGING pt_sort TYPE lvc_t_sort.
CLEAR: pt_sort, gt_sort.
DATA ls_sort TYPE lvc_s_sort .
IF sy-dynnr = '0100'.
ls_sort-spos = '1' .
ls_sort-fieldname = 'HKONT' .
ls_sort-up = 'X' . "A to Z
ls_sort-down = space .
APPEND ls_sort TO pt_sort .
ELSE.
ls_sort-spos = '1' .
ls_sort-fieldname = 'BELNR' .
ls_sort-up = 'X' . "A to Z
ls_sort-down = space .
APPEND ls_sort TO pt_sort .
* ls_sort-spos = '2' .
* ls_sort-fieldname = 'BELNR' .
** ls_sort-up = 'X' . "A to Z
** ls_sort-down = space .
* ls_sort-subtot = 'X'.
* APPEND ls_sort TO pt_sort .
ENDIF.
ENDFORM. " prepare_sort
*& Form handle_hotspot_click
* text
* -->P_E_ROW_ID text
* -->P_E_COLUMN_ID text
* -->P_ES_ROW_NO text
FORM handle_hotspot_click USING i_row_id TYPE lvc_s_row
i_column_id TYPE lvc_s_col
is_row_no TYPE lvc_s_roid.
CLEAR: wa_bank, i_breakup.
READ TABLE i_bank INTO wa_bank INDEX is_row_no-row_id.
*TYPES: BEGIN OF ty_breakup,
* bukrs TYPE bseg-bukrs,
* blart TYPE bkpf-blart,
* belnr TYPE bseg-belnr,
* budat TYPE bkpf-budat,
* umskz TYPE bseg-umskz,
* rebzg TYPE bseg-rebzg,
* lifnr TYPE bseg-lifnr,
* name1 TYPE lfa1-name1,
* dmbtr TYPE p,
* END OF ty_breakup.
SELECT bukrs belnr budat gjahr FROM bkpf
INTO CORRESPONDING FIELDS OF TABLE i_bkpf
WHERE bukrs = l_bukrs
AND budat IN l_date.
LOOP AT i_bkpf INTO wa_bkpf.
SELECT bukrs belnr umskz rebzg lifnr kunnr dmbtr shkzg FROM bseg
INTO (wa_breakup-bukrs, wa_breakup-belnr, wa_breakup-umskz, wa_breakup-rebzg, wa_breakup-lifnr, wa_breakup-kunnr, wa_breakup-dmbtr, l_shkzg)
WHERE bukrs = l_bukrs
AND belnr = wa_bkpf-belnr
AND gjahr = wa_bkpf-gjahr
AND hkont = wa_bank-hkont.
SELECT SINGLE blart budat FROM bkpf INTO (wa_breakup-blart, wa_breakup-budat)
WHERE bukrs = l_bukrs
AND belnr = wa_bkpf-belnr
AND gjahr = wa_bkpf-gjahr.
IF wa_breakup-lifnr IS NOT INITIAL.
SELECT SINGLE name1 FROM lfa1 INTO wa_breakup-name1
WHERE lifnr = wa_breakup-lifnr.
ELSE.
SELECT SINGLE name1 FROM kna1 INTO wa_breakup-name1
WHERE lifnr = wa_breakup-kunnr.
wa_breakup-lifnr = wa_breakup-kunnr.
ENDIF.
ENDSELECT.
IF l_shkzg = 'H'.
wa_breakup-dmbtr = wa_breakup-dmbtr * -1.
ENDIF.
IF wa_breakup IS NOT INITIAL.
APPEND wa_breakup TO i_breakup.
ENDIF.
CLEAR wa_breakup.
ENDLOOP.
SET SCREEN 200.
LEAVE SCREEN.
ENDFORM. " handle_hotspot_click
*& Module STATUS_0200 OUTPUT
* text
MODULE status_0200 OUTPUT.
SET PF-STATUS 'STATUS01'.
SET TITLEBAR 'TITLE2'.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
* text
MODULE user_command_0200 INPUT.
CASE save_ok.
WHEN 'BACK'.
* CLEAR: gr_alvgrid, gr_ccontainer.
SET SCREEN 100.
LEAVE SCREEN .
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Module create_alv_0200 OUTPUT
* text
MODULE create_alv_0200 OUTPUT.
IF gr_alvgrid_0200 IS INITIAL.
CREATE OBJECT gr_ccontainer_0200
EXPORTING
* PARENT =
container_name = 'CUSTOM_CONTAINER'
repid = sy-repid
dynnr = '0200'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT gr_alvgrid_0200
EXPORTING
i_parent = gr_ccontainer_0200
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM prepare_field_catalog_0200 CHANGING gt_fieldcat .
* PERFORM prepare_layout CHANGING gs_layout .
PERFORM prepare_sort CHANGING gt_sort.
CALL METHOD gr_alvgrid_0200->set_table_for_first_display
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
is_layout = gs_layout
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
* IR_SALV_ADAPTER =
CHANGING
it_outtab = i_breakup
it_fieldcatalog = gt_fieldcat
it_sort = gt_sort
* IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
CALL METHOD gr_alvgrid_0200->refresh_table_display
EXPORTING
is_stable = gs_stbl
* i_soft_refresh = 'X'
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
* SET SCREEN 100.
ENDMODULE. " create_alv_0200 OUTPUT
*& Form prepare_field_catalog_0200
* text
* <--P_GT_FIELDCAT text
FORM prepare_field_catalog_0200 CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA: ls_fcat TYPE lvc_s_fcat.
CLEAR: pt_fieldcat, gs_layout.
ls_fcat-fieldname = 'BUKRS' .
ls_fcat-ref_field = 'BUKRS'.
ls_fcat-inttype = 'c' .
ls_fcat-outputlen = '5' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Co' .
ls_fcat-seltext = 'Company Code'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'BLART' .
ls_fcat-ref_field = 'BLART'.
ls_fcat-inttype = 'c' .
ls_fcat-outputlen = '5' .
ls_fcat-ref_table = 'BKPF'.
ls_fcat-coltext = 'Doc Typ' .
ls_fcat-seltext = 'Document Type'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'BELNR' .
ls_fcat-ref_field = 'BELNR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '12' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Doc Num' .
ls_fcat-seltext = 'Document Number'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'BUDAT' .
ls_fcat-ref_field = 'BUDAT'.
ls_fcat-inttype = 'DATS' .
ls_fcat-outputlen = '13' .
ls_fcat-ref_table = 'BKPF'.
ls_fcat-coltext = 'G/L Date' .
ls_fcat-seltext = 'G/L Posting Date'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'UMSKZ' .
ls_fcat-ref_field = 'UMSKZ'.
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '5' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'G/L Indicator' .
ls_fcat-seltext = 'Special G/L Indicator'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'REBZG' .
ls_fcat-ref_field = 'REBZG'.
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '13' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Reference' .
ls_fcat-seltext = 'Invoice Number'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'LIFNR' .
ls_fcat-ref_field = 'LIFNR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '13' .
ls_fcat-ref_table = 'LFA1'.
ls_fcat-coltext = 'Vendor/Customer' .
ls_fcat-seltext = 'Vendor/Customer Number'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'NAME1' .
ls_fcat-ref_field = 'NAME1'.
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '50' .
ls_fcat-ref_table = 'LFA1'.
ls_fcat-coltext = 'Description' .
ls_fcat-seltext = 'Description'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'DMBTR' .
ls_fcat-ref_field = 'DMBTR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '25' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Amount' .
ls_fcat-seltext = 'Amount'.
ls_fcat-no_sign = 'X'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ENDFORM. " prepare_field_catalog_0200
*& Form handle_print_top_of_page
* text
* --> p1 text
* <-- p2 text
FORM handle_print_top_of_page .
WRITE: sy-uline.
WRITE: /(255)'Tecnimont ICB' CENTERED.
WRITE: /(255)'Trial Balance' CENTERED.
WRITE: 'Trial Balance for ', l_bukrs, ': From Period - ', l_date-low, 'To Period - ', l_date-high. "LEFT-JUSTIFIED .
WRITE: /.
WRITE: / sy-uline.
FORMAT COLOR 1.
WRITE: sy-vline, AT 2(59)'Account Code and Name'CENTERED, AT 60 sy-vline, AT 61(45) 'Opening Balance' CENTERED, AT 107 sy-vline, AT 108(41) 'Transactions' CENTERED , AT 150 sy-vline, AT 155(41) 'Closing Balance' CENTERED, AT 197 sy-vline.
FORMAT COLOR 4.
WRITE: sy-vline,'GL Account'LEFT-JUSTIFIED, AT 16(50)'Description'CENTERED, AT 60 sy-vline, AT 61(23) 'Debits'CENTERED, AT 85(23) 'Credits.'CENTERED, AT 107 sy-vline, AT 108(23) 'Debits'CENTERED, AT 128(23)'Credits'CENTERED, AT 150 sy-vline, AT 151(23)
'Debits'CENTERED, AT 174(23) 'Credits'CENTERED, AT 197 sy-vline.
FORMAT COLOR OFF.
* WRITE: sy-uline.
ENDFORM. " handle_print_top_of_page
*& Form handle_subtotal_text
* text
* --> p1 text
* <-- p2 text
FORM handle_subtotal_text USING es_subtottxt_info TYPE lvc_s_stxt
ep_subtot_line TYPE REF TO data
e_event_data TYPE REF TO
cl_alv_event_data.
DATA l_bank LIKE wa_bank.
FIELD-SYMBOLS: <fs1> STRUCTURE wa_bank DEFAULT l_bank,
<fs2>.
IF es_subtottxt_info-criteria = 'TXT50'.
ASSIGN ep_subtot_line->* TO <fs1>.
ASSIGN e_event_data->m_data->* TO <fs2>.
CONCATENATE es_subtottxt_info-keyword 'Grand Summary: '
INTO <fs2>.
ENDIF.
ENDFORM. " handle_subtotal_text
This is the Code............... this code creates a Grid and not list and hotspot event wors on grid and not on list.
Regards,
Tarun Bahal
Similar Messages
-
LIST output and event handling in OO ALV
Hi Guys,
I am creating an ALV Report using cl_gui_alv_grid.
after the list is displayed i can change the display t output list from the ALV toolbar.
1. how can i shot list output by default.
2. why does hotspot event not work when the display is switched to list output.
3. how can i display the subtotal on all pages of the list.
Regards,
Tarun BahalHi,
for your questions
1. To shortlist thefields in output
In the fieldcatalog merge,select the fields which are to be populated in the outputlist.There standard list you can display.
On that you can select the fields in ALV toolbar.
2.To which field you need to HOTSPOT click, for that field in fieldcatalogue merge
select the hotspot = 'X'.
for example
If gs_fieldcat-fieldname = 'MATNR'.
gs_fieldcat-table_name = 'MARA'.
gs_fieldcat-ref_field = 'MATNR'.
Gs_fieldcat-hotspot = 'X'.
append gs_fieldcat to gt_fieldcat.
endif.
this will hotspot on the field material number.
After declaring this you need to maintain the hotspot click event.
~~~~~~~~~
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_hotspot_click
FOR EVENT HOTSPOT_CLICK OF cl_gui_alv_grid
IMPORTING e_row e_column.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD hotspot_click.
DATA: ls_sflight LIKE LINE OF gt_sflight.
read selected row from internal table gt_sflight
READ TABLE gt_sflight INDEX e_row-index INTO ls_sflight.
select corresponding lines of table sbook
PERFORM select_table_sbook USING ls_sflight
CHANGING gt_sbook.
call dialog screen and display new alv control
CALL SCREEN 101 STARTING AT 10 5.
ENDMETHOD. "handle_double_click
ENDCLASS.
This is very important after defining the events,you need to set the event before calling grid display.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_double_click FOR grid1.
for your reference you check the standard program BCALV_GRID_03**
There they have declared Double click, in your case you maintain with
HOTSPOT CLICK **.
3. If you want subtotal on the field, sort that filed for sort structure.
and for which field do you need total, for that field do-sum = 'X'
in the fieldcatalogue merge.
gs_sort-fieldname ='MATNR'
gs_sort-up = 'X'.
gs_sort-subtot = 'X'.
append gs_sort to gt_sort.
for calculating the total to the field
gs_fieldcat-table_name = 'MARA'.
gs_fieldcat-ref_field = 'NTGEW'.(Gross weight)
Gs_fieldcat-dosum = 'X'.
append gs_fieldcat to gt_fieldcat.
endif.
For every new material
it calculates the subtotal on Gross weight.(because for NTGEW is gross weight).
and also it will show the grand total too.
Hope this will solve your problem
Dont forget to Reward pointsHi,
for your questions
1. To shortlist thefields in output
In the fieldcatalog merge,select the fields which are to be populated in the outputlist.There standard list you can display.
On that you can select the fields in ALV toolbar.
2.To which field you need to HOTSPOT click, for that field in fieldcatalogue merge
select the hotspot = 'X'.
for example
If gs_fieldcat-fieldname = 'MATNR'.
gs_fieldcat-table_name = 'MARA'.
gs_fieldcat-ref_field = 'MATNR'.
Gs_fieldcat-hotspot = 'X'.
append gs_fieldcat to gt_fieldcat.
endif.
this will hotspot on thefield material number.
3. If you want subtotal on the field, sort that filed for sort structure.
and for which field do you need total, for that field do-sum = 'X'
in the fieldcatalogue merge.
gs_sort-fieldname ='MATNR'
gs_sort-up = 'X'.
gs_sort-subtot = 'X'.
append gs_sort to gt_sort.
for calculating the total to the field
gs_fieldcat-table_name = 'MARA'.
gs_fieldcat-ref_field = 'NTGEW'.(Gross weight)
Gs_fieldcat-dosum = 'X'.
append gs_fieldcat to gt_fieldcat.
endif.
For every new material
it calculates the subtotal on Gross weight.(because for NTGEW is gross weight).
and also it will show the grand total too.
Hope this will solve your problem
Dont forget to Reward points
Edited by: varisetty madhavi on Mar 7, 2008 6:48 AM -
How to handling ecxeptions on alv and how to write subrotiens on scripts
Hi abapers..
tell me how to handle ecxeptions on ALV, and how many exceptions are there ,which exception i have to use.
AND is it possible to write subrotiens on script, if it is possible tell to me how to writeThere are already enough Exceptions provided for ALV .
yes you can write sub-routines in scripts , search SDN and you will get answer for the same -
itunes will not sync photos to my New iPad, I run all current software. Itunes show 0 photos in all albums and events. Why is this and how do I get iTunes to recognise my photo library?
Select you device from the left sidebar of iTunes and navigate to the Photos tab at the top. Do you have the Sync Photos With checkbox checked and set to iPhoto?
-
How do I define Field-Catalog and Event-Catalog in OOPs ALV
Hi All,
This is the piece of the code on which I'm working upon. This program is giving an exception "No Field-Catalog Found".
I'm new to OOPs ALV. Could anybody please tell me how to define the field-catalog and event-catalog in this.
module PBO output.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container EXPORTING CONTAINER_NAME = 'CCCONTAINER'.
CREATE OBJECT g_grid EXPORTING I_PARENT = g_custom_container.
CALL METHOD g_grid->set_table_for_first_display
EXPORTING I_STRUCTURE_NAME = 'IT_MATERIAL'
is_layout = layout
CHANGING IT_OUTTAB = gt_it_material.
ENDIF.
endmodule.
Regards,
Saurabhhi,
chk this sampl ceode.
TYPE-POOLS: slis.
CLASS lcl_event_receiver DEFINITION DEFERRED.
TABLES : zmpets_shipactiv, zmpets_chargebk, zmpets_shiphdr.
DATA : BEGIN OF int_crb OCCURS 0,
sel TYPE char1,
icon TYPE icon_d,
pernr LIKE zmpets_cil-pernr,
vorna LIKE pa0002-vorna,
movreason LIKE zmpets_shiphdr-movreason,
shipdocnum LIKE zmpets_chargebk-shipdocnum,
createdon LIKE zmpets_chargebk-createdon,
chargeamount LIKE zmpets_chargebk-chargeamount,
version LIKE zmpets_shipactiv-version,
activity LIKE zmpets_shipactiv-activity,
vendor LIKE zmpets_shiphdr-vendor,
smtp_addr LIKE adr6-smtp_addr,
empperid LIKE zmpets_167doc-empperid,
celltab TYPE lvc_t_styl,
END OF int_crb.
DATA : int_crb_ver LIKE int_crb OCCURS 0 WITH HEADER LINE.
DATA : int_crb_mail LIKE int_crb OCCURS 0 WITH HEADER LINE.
DATA : int_shipactiv LIKE zmpets_shipactiv OCCURS 0 WITH HEADER LINE.
DATA: gt_fieldcatalog TYPE lvc_t_fcat.
DATA : wf_flag TYPE i.
DATA : wf_res TYPE c.
DATA : wf_tabix TYPE sy-tabix.
DATA: BEGIN OF int_sin OCCURS 0,
shipdocnum LIKE zmpets_chargebk-shipdocnum,
shipdocnum LIKE zmpets_shipactiv-petsdocnumber,
END OF int_sin.
DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: doc_chng LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
DATA l_num(3).
DATA: ok_code LIKE sy-ucomm,
w_repid LIKE sy-repid,
wl_sno TYPE i VALUE 0,
w_max TYPE i VALUE 100,
wf_layout TYPE lvc_s_layo,
cont_on_main TYPE scrfname VALUE 'GRID_CONTROL',
cont_on_dialog TYPE scrfname VALUE 'GRID_CONTROL',
grid1 TYPE REF TO cl_gui_alv_grid,
grid2 TYPE REF TO cl_gui_alv_grid,
custom_container1 TYPE REF TO cl_gui_custom_container,
custom_container2 TYPE REF TO cl_gui_custom_container,
event_receiver TYPE REF TO lcl_event_receiver,
lt_exclude TYPE ui_functions,
ls_celltab TYPE lvc_s_styl,
lt_celltab TYPE lvc_t_styl.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-001.
PARAMETERS : p_cash AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b3.
PERFORM fieldcatalog_init USING gt_fieldcatalog[].
Selection-Screen----
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
SELECT-OPTIONS:s_chdate FOR zmpets_chargebk-createdon,
s_pernr FOR zmpets_shiphdr-pernr,
s_mvrsn FOR zmpets_shiphdr-movreason,
s_sin FOR zmpets_chargebk-shipdocnum NO INTERVALS
NO-EXTENSION.
SELECTION-SCREEN END OF BLOCK b1.
PERFORM f_clear_fields.
CALL SCREEN 100.
CLASS lcl_event_receiver DEFINITION
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
PRIVATE SECTION.
ENDCLASS. "lcl_event_receiver DEFINITION
CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
§ 2.In event handler method for event TOOLBAR: Append own functions
by using event parameter E_OBJECT.
DATA: ls_toolbar TYPE stb_button.
append a separator to normal toolbar
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
new button -
MOVE 'PROCESSED' TO ls_toolbar-function.
MOVE icon_execute_object TO ls_toolbar-icon.
MOVE 'Process the Record'(110) TO ls_toolbar-quickinfo.
MOVE ' Process '(200) TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
METHOD handle_user_command.
§ 3.In event handler method for event USER_COMMAND: Query your
function codes defined in step 2 and react accordingly.
DATA: lt_rows TYPE lvc_t_row.
CASE e_ucomm.
WHEN 'PROCESSED'.
CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
EXPORTING
defaultoption = 'N'
textline1 = 'Do you want to process the selected documents?'
TEXTLINE2 = ' '
titel = 'Process Documents'
START_COLUMN = 25
START_ROW = 6
CANCEL_DISPLAY = 'X'
IMPORTING
answer = wf_res.
*--IF THE USER CONFIRMS 'YES',
IF wf_res = 'J'.
PERFORM f_modify_activity.
CALL METHOD grid1->refresh_table_display.
PERFORM SENDINGMAIL.
ENDIF.
ENDCASE.
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
MODULE pbo_100 OUTPUT
MODULE pbo_100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
w_repid = sy-repid.
IF custom_container1 IS INITIAL.
*get the data from charge back table
PERFORM select_table_chb.
create a custom container control for our ALV Control
CREATE OBJECT custom_container1
EXPORTING
container_name = cont_on_main
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = w_repid
txt2 = sy-subrc
txt1 = 'The control could not be created'(510).
ENDIF.
CREATE OBJECT grid1
EXPORTING i_parent = custom_container1.
Set a titlebar for the grid control
wf_layout-grid_title = 'Charge Back'(100).
allow to select multiple lines
wf_layout-sel_mode = 'C'.
wf_layout-stylefname = 'CELLTAB'.
Exclude all edit functions in this example since we do not need them:
PERFORM exclude_tb_functions CHANGING lt_exclude.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
is_layout = wf_layout
IS_PRINT =
IT_SPECIAL_GROUPS =
it_toolbar_excluding = lt_exclude
IT_HYPERLINK =
IT_ALV_GRAPHICS =
CHANGING
it_outtab = int_crb[]
it_fieldcatalog = gt_fieldcatalog.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_user_command FOR grid1.
SET HANDLER event_receiver->handle_toolbar FOR grid1.
CALL METHOD grid1->set_toolbar_interactive.
ENDIF. "IF grid1 IS INITIAL
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid1.
ENDMODULE. "pbo_100 OUTPUT
MODULE pai_100 INPUT
MODULE pai_100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
PERFORM f_clear_fields.
LEAVE PROGRAM.
WHEN 'CANCEL'.
PERFORM f_clear_fields.
LEAVE TO SCREEN 0.
WHEN 'BACK'.
PERFORM f_clear_fields.
LEAVE TO SCREEN 0.
ENDCASE.
CLEAR ok_code.
ENDMODULE. "pai_100 INPUT
**& Form select_table_chb
text
FORM select_table_chb.
IF p_cash = 'X'.
*Consider the pending documents also.
*get the documents which are not processed yet,
*Doctype -> 06 = Charge Back document type.
SELECT zmpets_shiphdrpernr pa0002vorna
zmpets_shiphdrmovreason zmpets_chargebkshipdocnum
zmpets_chargebkcreatedon zmpets_chargebkchargeamount
zmpets_shipactivversion zmpets_shipactivactivity
zmpets_shiphdr~vendor
adr6~smtp_addr
zmpets_167doc~empperid
INTO CORRESPONDING FIELDS OF TABLE int_crb_ver
FROM zmpets_chargebk
JOIN zmpets_shiphdr
ON zmpets_chargebkshipdocnum = zmpets_shiphdrshipdocno
JOIN zmpets_shipactiv
ON zmpets_chargebkshipdocnum = zmpets_shipactivpetsdocnumber
JOIN pa0002
ON zmpets_shiphdrpernr = pa0002pernr
JOIN lfa1
ON lfa1lifnr = zmpets_shiphdrvendor
JOIN adr6
ON adr6addrnumber = lfa1adrnr
JOIN zmpets_167doc
ON zmpets_167docpernr = pa0002pernr
WHERE zmpets_shipactiv~doctype = '06'
zmpets_shipactiv~activity NE '30'
ZMPETS_CHARGEBK~CREATEDON IN s_chdate
AND ZMPETS_SHIPHDR~pernr IN s_pernr
AND ZMPETS_SHIPHDR~MOVREASON IN s_mvrsn
AND ZMPETS_CHARGEBK~SHIPDOCNUM IN s_sin
AND zmpets_chargebk~loekz NE 'X'
AND zmpets_shipactiv~loekz NE 'X'
AND zmpets_shiphdr~loekz NE 'X'.
IF sy-subrc <> 0.
*Message is 'No Pending Documents Available.'.
MESSAGE s196(zm050).
ELSE.
LOOP AT int_crb_ver.
*Not yet processed. set to red
int_crb_ver-icon = '@0A@'.
MODIFY int_crb_ver.
ENDLOOP.
PERFORM f_filter_data_pending.
ENDIF.
ELSE.
*Get the document details from pa0002,zmpets_shipactiv,ZMPETS_CHARGEBK
*table.
*Consider document type as '01' during the selection.
*Doctype -> 06 = Charge Back document type.
SELECT zmpets_shiphdrpernr pa0002vorna zmpets_shiphdr~movreason
zmpets_chargebkshipdocnum zmpets_chargebkcreatedon
zmpets_chargebkchargeamount zmpets_shipactivversion
zmpets_shipactivactivity zmpets_shiphdrvendor
*adr6~smtp_addr
zmpets_167doc~empperid
INTO CORRESPONDING FIELDS OF TABLE int_crb_ver
FROM zmpets_chargebk
JOIN zmpets_shiphdr
ON zmpets_chargebkshipdocnum = zmpets_shiphdrshipdocno
JOIN zmpets_shipactiv
ON zmpets_chargebkshipdocnum = zmpets_shipactivpetsdocnumber
JOIN pa0002
ON zmpets_shiphdrpernr = pa0002pernr
JOIN lfa1
ON lfa1lifnr = zmpets_shiphdrvendor
JOIN adr6
ON adr6addrnumber = lfa1adrnr
JOIN zmpets_167doc
ON zmpets_167docpernr = pa0002pernr
WHERE zmpets_chargebk~createdon IN s_chdate
AND zmpets_shiphdr~pernr IN s_pernr
AND zmpets_shiphdr~movreason IN s_mvrsn
AND zmpets_chargebk~shipdocnum IN s_sin
AND zmpets_shipactiv~activity NE '30'
AND zmpets_shipactiv~doctype = '06'
AND zmpets_chargebk~loekz NE 'X'
AND zmpets_shipactiv~loekz NE 'X'
AND zmpets_shiphdr~loekz NE 'X'.
IF sy-subrc <> 0.
*Message is 'No Charge Back Documents Available.'.
MESSAGE s201(zm050).
ELSE.
PERFORM f_filter_data.
ENDIF.
ENDIF.
ENDFORM. "select_table_chb
*& Form UPDATE_RECORDS
text
--> p1 text
<-- p2 text
FORM update_records TABLES p_et_index_rows
STRUCTURE lvc_s_row.
DATA: ls_selected_line LIKE lvc_s_row,
lf_row_index TYPE lvc_index.
LOOP AT p_et_index_rows INTO ls_selected_line.
lf_row_index = ls_selected_line-index.
ENDLOOP.
ENDFORM. " UPDATE_RECORDS
**& Form fieldcatalog_init
text
-->P_GT_FIELDCATALOG[] text
FORM fieldcatalog_init USING lt_fieldcatalog TYPE lvc_t_fcat.
DATA: ls_fieldcatalog TYPE lvc_s_fcat.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'SEL'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-datatype = 'C'.
ls_fieldcatalog-col_pos = 1.
ls_fieldcatalog-edit = 'X'.
ls_fieldcatalog-reptext = 'Select for Processing'.
ls_fieldcatalog-coltext = 'Select for Processing'.
ls_fieldcatalog-seltext = 'Select for Processing'.
ls_fieldcatalog-tooltip = 'Select for Processing'.
ls_fieldcatalog-checkbox = 'X'.
ls_fieldcatalog-key = 'X'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'ICON'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-datatype = 'CHAR'.
ls_fieldcatalog-col_pos = 2.
ls_fieldcatalog-intlen = '4'.
ls_fieldcatalog-reptext = 'Status'.
ls_fieldcatalog-coltext = 'Status'.
ls_fieldcatalog-seltext = 'Status'.
ls_fieldcatalog-tooltip = 'Status'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'PERNR'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-datatype = 'NUMC'.
ls_fieldcatalog-col_pos = 2.
ls_fieldcatalog-intlen = '8'.
ls_fieldcatalog-reptext = 'Employee Number'.
ls_fieldcatalog-coltext = 'Employee Number'.
ls_fieldcatalog-seltext = 'Employee Number'.
ls_fieldcatalog-tooltip = 'Employee Number'.
ls_fieldcatalog-key = 'X'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'VORNA'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-col_pos = 3 .
ls_fieldcatalog-datatype = 'CHAR'.
ls_fieldcatalog-outputlen = '20'.
ls_fieldcatalog-reptext = 'Employee Name'.
ls_fieldcatalog-coltext = 'Employee Name'.
ls_fieldcatalog-seltext = 'Employee Name'.
ls_fieldcatalog-tooltip = 'Employee Name'.
ls_fieldcatalog-key = 'X'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'MOVREASON'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-col_pos = 4.
ls_fieldcatalog-datatype = 'NUMC'.
ls_fieldcatalog-outputlen = '10'.
ls_fieldcatalog-reptext = 'Move Reason'.
ls_fieldcatalog-coltext = 'Move Reason'.
ls_fieldcatalog-seltext = 'Move Reason'.
ls_fieldcatalog-tooltip = 'Move Reason'.
ls_fieldcatalog-key = 'X'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'SHIPDOCNUM'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-datatype = 'NUMC'.
ls_fieldcatalog-outputlen = '10'.
ls_fieldcatalog-col_pos = 5.
ls_fieldcatalog-reptext = 'Shipping Document Number'.
ls_fieldcatalog-coltext = 'Shipping Document Number'.
ls_fieldcatalog-seltext = 'Shipping Document Number'.
ls_fieldcatalog-tooltip = 'Shipping Document Number'.
ls_fieldcatalog-key = 'X'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'CREATEDON'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-col_pos = 6.
ls_fieldcatalog-datatype = 'DATS'.
ls_fieldcatalog-outputlen = '8'.
ls_fieldcatalog-reptext = 'Created On'.
ls_fieldcatalog-coltext = 'Created On'.
ls_fieldcatalog-seltext = 'Created On'.
ls_fieldcatalog-tooltip = 'Created On'.
ls_fieldcatalog-DO_sum = 'X'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'CHARGEAMOUNT'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-col_pos = 7.
ls_fieldcatalog-datatype = 'CURR'.
ls_fieldcatalog-outputlen = '13'.
ls_fieldcatalog-reptext = 'Charge Back Amount'.
ls_fieldcatalog-coltext = 'Charge Back Amount'.
ls_fieldcatalog-seltext = 'Charge Back Amount'.
ls_fieldcatalog-tooltip = 'Charge Back Amount'.
ls_fieldcatalog-DO_sum = 'X'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ENDFORM. "fieldcatalog_init
*& Form f_modify_activity
Modify the activity to 79 in zmpets_shipaciv table.
--> p1 text
<-- p2 text
FORM f_modify_activity .
REFRESH int_crb_mail.
int_crb_mail[] = int_crb[].
*All the document number which is to be processed is stored in
*the internel table 'INT_SIN'.
LOOP AT int_crb INTO int_crb.
IF int_crb-sel ='X'.
MOVE int_crb-shipdocnum TO int_sin.
APPEND int_sin.
CLEAR int_sin.
*Removing the processed documents.
DELETE int_crb.
ENDIF.
CLEAR int_crb.
ENDLOOP.
*Get the details from shipactiv table.
IF int_sin[] IS NOT INITIAL.
SELECT * FROM zmpets_shipactiv
INTO TABLE int_shipactiv
FOR ALL ENTRIES IN int_sin
WHERE petsdocnumber = int_sin-shipdocnum.
*Modify the activity code, version, actual date and last changed date.
SORT int_shipactiv BY petsdocnumber version DESCENDING.
CLEAR wf_tabix.
LOOP AT int_shipactiv.
wf_tabix = sy-tabix.
AT NEW petsdocnumber.
READ TABLE int_shipactiv INDEX wf_tabix.
int_shipactiv-activity = '030'.
int_shipactiv-version = int_shipactiv-version + 1.
int_shipactiv-actdate = sy-datum.
int_shipactiv-lastchangedby = sy-uname.
int_shipactiv-lastchangedt = sy-datum.
*Modify the data base table
MODIFY zmpets_shipactiv FROM int_shipactiv.
ENDAT.
CLEAR int_shipactiv.
AT LAST.
*Message is 'Data Processed Successfully.'.
MESSAGE s203(zm050).
ENDAT.
ENDLOOP.
*-send mail to the vendor and employee that the shipment is cleared for
LOOP AT int_crb_mail WHERE sel = 'X'.
PERFORM f_send_mail.
ENDLOOP.
REFRESH int_crb_mail.
CALL SELECTION-SCREEN 1000.
ELSE.
*Message is 'No Data Selected for Processing.'.
MESSAGE s200(zm050).
ENDIF.
ENDFORM. " f_modify_activity
*& Form f_clear_fields
text
--> p1 text
<-- p2 text
FORM f_clear_fields .
CLEAR int_crb.
CLEAR int_crb_ver.
CLEAR int_sin.
REFRESH int_crb.
REFRESH int_crb_ver.
REFRESH int_sin.
CLEAR int_shipactiv.
REFRESH int_shipactiv.
CLEAR wf_flag.
CLEAR wf_tabix.
ENDFORM. " f_clear_fields
*& Form f_filter_data
text
--> p1 text
<-- p2 text
FORM f_filter_data .
*Take the latest Version Data.
*take all the activities, including the activity '30'.
then put the details in internal table 'INT_CRB'.
SORT int_crb_ver BY shipdocnum version DESCENDING.
CLEAR wf_tabix.
CLEAR int_crb.
REFRESH int_crb.
LOOP AT int_crb_ver.
wf_tabix = sy-tabix.
AT NEW shipdocnum.
READ TABLE int_crb_ver INDEX wf_tabix.
MOVE-CORRESPONDING int_crb_ver TO int_crb.
APPEND int_crb.
CLEAR int_crb.
ENDAT.
ENDLOOP.
IF int_crb[] IS INITIAL.
*Message is 'No Records Available.'.
MESSAGE s202(zm050).
ELSE.
CLEAR wf_tabix.
LOOP AT int_crb.
wf_tabix = sy-tabix.
REFRESH lt_celltab.
ls_celltab-fieldname = 'SEL'.
IF int_crb-activity = '030'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
*status becomes green. ie processed
int_crb-icon = '@08@'. "Green
ELSE.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
*status set to red. ie not yet processed
int_crb-icon = '@0A@'. "Red
ENDIF.
INSERT ls_celltab INTO TABLE lt_celltab.
INSERT LINES OF lt_celltab INTO TABLE int_crb-celltab.
MODIFY int_crb INDEX wf_tabix.
ENDLOOP.
ENDIF.
ENDFORM. " f_filter_data
*& Form f_filter_data
text
--> p1 text
<-- p2 text
FORM f_filter_data_pending.
*Take the latest Version Data.
*take all the activities, including the activity '30'.
*then filter it with out the activities '30' and having the lastest
*version. then put the details in internal table 'INT_CRB'.
SORT int_crb_ver BY shipdocnum version DESCENDING.
CLEAR wf_tabix.
CLEAR int_crb.
REFRESH int_crb.
LOOP AT int_crb_ver.
wf_tabix = sy-tabix.
AT NEW shipdocnum.
READ TABLE int_crb_ver INDEX wf_tabix.
IF int_crb_ver-activity NE '030'.
MOVE-CORRESPONDING int_crb_ver TO int_crb.
APPEND int_crb.
CLEAR int_crb.
ENDIF.
ENDAT.
ENDLOOP.
IF int_crb[] IS INITIAL.
*Message is 'No Records Available.'.
MESSAGE s202(zm050).
ENDIF.
ENDFORM. " f_filter_data_pending
*& Form EXCLUDE_TB_FUNCTIONS
text
<--P_LT_EXCLUDE text
FORM exclude_tb_functions CHANGING pt_exclude TYPE ui_functions.
DATA ls_exclude TYPE ui_func.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
APPEND ls_exclude TO pt_exclude.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
*& Form f_send_mail
text
--> p1 text
<-- p2 text
FORM f_send_mail .
*store the vendor name, vendor email id , employee name and employee
*email id in the internal table int_crb
Creation of the document to be sent
CLEAR doc_chng.
REFRESH objpack.
REFRESH objhead.
REFRESH reclist.
REFRESH objtxt.
File Name
doc_chng-obj_name = 'SHIPMENT'.
Mail Subject
CONCATENATE 'Shipment Document No.' int_crb_mail-shipdocnum
'Cleared.'
INTO doc_chng-obj_descr SEPARATED BY ' '.
Mail Contents
objtxt-line = 'Hi,'.
APPEND objtxt.
objtxt-line = ' '.
APPEND objtxt.
CONCATENATE 'Shipment Document Number ' int_crb_mail-shipdocnum
' cleared for move.' INTO objtxt-line SEPARATED BY ' '.
APPEND objtxt.
objtxt-line = ' '.
APPEND objtxt.
CLEAR objtxt.
objtxt-line = 'Regards '.
APPEND objtxt.
objtxt-line = ' '.
APPEND objtxt.
objtxt-line = 'SAP '.
APPEND objtxt.
CLEAR objtxt.
APPEND objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN(
objtxt ).
Creation of the entry for the compressed document
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
APPEND objpack.
Completing the recipient list
target recipent
CLEAR reclist.
reclist-receiver = int_crb_mail-empperid. "employee email ID
"wf_empperid.
reclist-express = 'X'.
reclist-rec_type = 'U'.
APPEND reclist.
copy recipents
CLEAR reclist.
reclist-receiver = 'anversha.shahul@'."int_crb_mail-smtp_addr
reclist-express = 'X'.
reclist-rec_type = 'U'.
reclist-copy = 'X'.
APPEND reclist.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
COMMIT WORK.
SUBMIT rsconn01
WITH mode = 'INT'
WITH output = ' '
AND RETURN.
ENDFORM. " f_send_mail
rgds
anver
pls mark hlpful answers -
hi experts,
event double click.
when double click on vbeln it should go to va03 transaction . how would i do that in oops alv.hai,
you can go through code below .
*& Report Z_CLARIFY *
REPORT Z_CLARIFY .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_VALID TYPE C,
V_FLAG,
V_DATA_CHANGE,
V_ROW TYPE LVC_S_ROW,
V_COLUMN TYPE LVC_S_COL,
V_ROW_NUM TYPE LVC_S_ROID.
DATA: IT_ROW_NO TYPE LVC_T_ROID,
X_ROW_NO TYPE LVC_S_ROID.
DATA:BEGIN OF ITAB OCCURS 0,
VBELN LIKE LIKP-VBELN,
POSNR LIKE LIPS-POSNR,
CELLCOLOR TYPE LVC_T_SCOL, "required for color
DROP(10),
END OF ITAB.
*The Below Definitions Must.....
DATA:
Reference to document
DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT,
Reference to split container
DG_SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
Reference to grid container
DG_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER,
Reference to html container
DG_HTML_CNTRL TYPE REF TO CL_GUI_HTML_VIEWER,
Reference to html container
DG_PARENT_HTML TYPE REF TO CL_GUI_CONTAINER.
"up to here
CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
**Hot spot Handler
HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Double Click Handler
HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN ES_ROW_NO,
TOP_OF_PAGE FOR EVENT TOP_OF_PAGE "event handler
OF CL_GUI_ALV_GRID
IMPORTING E_DYNDOC_ID.
END_OF_LIST FOR EVENT end_of_list "event handler
OF CL_GUI_ALV_GRID
IMPORTING E_DYNDOC_ID.
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
METHOD HANDLE_HOTSPOT_CLICK .
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW_ID.
V_COLUMN = E_COLUMN_ID.
V_ROW_NUM = ES_ROW_NO.
MESSAGE I000 WITH V_ROW 'clicked'.
CLEAR IT_ROW_NO[].
X_ROW_NO-ROW_ID = V_ROW.
APPEND X_ROW_NO TO IT_ROW_NO .
CALL METHOD G_GRID->SET_SELECTED_ROWS
EXPORTING
IT_ROW_NO = IT_ROW_NO.
ENDMETHOD. "lcl_event_handler
*Handle Double Click
METHOD HANDLE_DOUBLE_CLICK.
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW.
V_COLUMN = E_COLUMN.
V_ROW_NUM = ES_ROW_NO.
IF E_COLUMN = 'VBELN'.
SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
ENDIF.
IF E_COLUMN = 'POSNR'.
SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN."
ENDIF.
ENDMETHOD. "handle_double_click
METHOD END_OF_LIST. "implementation
Top-of-page event
PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
ENDMETHOD. "top_of_page
METHOD TOP_OF_PAGE. "implementation
Top-of-page event
PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
ENDMETHOD. "top_of_page
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
*& Global Definitions
DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
"Container1
G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM,
G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
GS_LAYOUT TYPE LVC_S_LAYO.
data: v_lines type i.
data: v_line(3) type c.
*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
X_FIELDCAT TYPE LVC_S_FCAT,
LS_VARI TYPE DISVARIANT.
START-OF_SELECTION
START-OF-SELECTION.
SELECT VBELN
POSNR
FROM LIPS
UP TO 20 ROWS
INTO CORRESPONDING FIELDS OF TABLE ITAB.
describe table itab lines v_lines.
END-OF-SELECTION.
IF NOT ITAB[] IS INITIAL.
CALL SCREEN 100.
ELSE.
MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
ENDIF.
*& Form CREATE_AND_INIT_ALV
text
FORM CREATE_AND_INIT_ALV .
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
"attention.....from here
"split your container here...into two parts
"create the container
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = 'SCR100_CUST'.
"this is for top of page
Create TOP-Document
CREATE OBJECT DG_DYNDOC_ID
EXPORTING STYLE = 'ALV_GRID'.
Create Splitter for custom_container
CREATE OBJECT DG_SPLITTER
EXPORTING PARENT = G_CUSTOM_CONTAINER
ROWS = 2
COLUMNS = 1.
Split the custom_container to two containers and move the reference
to receiving containers g_parent_html and g_parent_grid
"i am allocating the space for grid and top of page
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_HTML.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_GRID.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_HTML.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_GRID.
"you can set the height of it
Set height for g_parent_html
CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT
EXPORTING
ID = 1
HEIGHT = 5.
"from here as usual..you need to specify parent as splitter part
"which we alloted for grid
CREATE OBJECT G_GRID
EXPORTING I_PARENT = DG_PARENT_GRID.
Set a titlebar for the grid control
CLEAR GS_LAYOUT.
GS_LAYOUT-GRID_TITLE = TEXT-003.
GS_LAYOUT-ZEBRA = SPACE.
GS_LAYOUT-CWIDTH_OPT = 'X'.
GS_LAYOUT-NO_ROWMARK = 'X'.
GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->END_OF_LIST FOR G_GRID.
SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
DATA: L_INDEX TYPE SY-TABIX.
"Here i am changing the color of line 1,5,10...
"so you can change the color of font conditionally
LOOP AT ITAB.
L_INDEX = SY-TABIX.
IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
LS_CELLCOLOR-FNAME = 'VBELN'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
LS_CELLCOLOR-FNAME = 'POSNR'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
ENDIF.
ENDLOOP.
setting focus for created grid control
CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
EXPORTING
CONTROL = G_GRID.
Build fieldcat and set editable for date and reason code
edit enabled. Assign a handle for the dropdown listbox.
PERFORM BUILD_FIELDCAT.
PERFORM SET_DRDN_TABLE.
Optionally restrict generic functions to 'change only'.
(The user shall not be able to add new lines).
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
LS_VARI-REPORT = SY-REPID.
LS_VARI-HANDLE = SPACE.
LS_VARI-LOG_GROUP = SPACE.
LS_VARI-USERNAME = SPACE.
LS_VARI-VARIANT = SPACE.
LS_VARI-TEXT = SPACE.
LS_VARI-DEPENDVARS = SPACE.
**Calling the Method for ALV output
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
IS_VARIANT = LS_VARI
IS_LAYOUT = GS_LAYOUT
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = ITAB[].
"do these..{
Initializing document
CALL METHOD DG_DYNDOC_ID->INITIALIZE_DOCUMENT.
Processing events
CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
EXPORTING
I_EVENT_NAME = 'TOP_OF_PAGE'
I_DYNDOC_ID = DG_DYNDOC_ID.
"end }
Set editable cells to ready for input initially
CALL METHOD G_GRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ENDFORM. "CREATE_AND_INIT_ALV
*& Form EXCLUDE_TB_FUNCTIONS
text
-->PT_EXCLUDE text
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
Only allow to change data not to create new entries (exclude
generic functions).
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
*& Form build_fieldcat
Fieldcatalog
FORM BUILD_FIELDCAT .
DATA: L_POS TYPE I.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
X_FIELDCAT-HOTSPOT = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Item'(025).
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
X_FIELDCAT-FIELDNAME = 'DROP'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-DRDN_HNDL = '1'.
X_FIELDCAT-DRDN_ALIAS = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
ENDFORM. " build_fieldcat
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
PERFORM CREATE_AND_INIT_ALV.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
there are many such examples
goto->se38->type bcalv* and press f4, u can see many examples.
Reward points if helpful.
Thanks and regards
Swetha Singh. -
Event Handling in Editable ALV
Hi all,
I am having 4 to 5 fields in my module pool screen and at the same time i am having a custom container wherein, there is editable ALV [using OOPS Editable ALV inside a custom container].
Here in editable ALV, i am having an editable field called dealer code.When i enter dealer code in editable ALV and press enter
my dealer name and dealer address in editable ALV inside Custom Container should get populated.
But when the cursor is inside the custom container in that editable field none of my screen eventsModule pool events
are getting triggered [Hence my values are not getting populated.When the cursor is outside the custom container all my module pool events are working fine, hence values are getting populated....
*I am handling the event in my program.But i don't know where exactly i should create object and handle this as
nothing is getting triggered[pai or pbo] when my cursor is inside the custom container.
Could you suggest me anything...*
Waiting for your repiles...Hi
First of all you need to creat object in PBO.
You must be calling method SET_TABLE_FOR_FIRST_DISPLAY.After this call method REGISTER_EDIT_EVENT.And then REFRESH_TABLE_DISPLAY.
In OK code create an OK code with name "OK".This is for ENTER key.
And in that call method CHECK_CHANGED_DATA.
Sample code for REGISTER_EDIT_EVENT is given below:
*--event to detect if data gets edited
CALL METHOD OBJ_ALV2->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED
EXCEPTIONS
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.
Sample code for CHECK_CHANGED_DATA
*--when alv is edited and ENTER button is clicked then data
*will be saved in internal table and edited data will
*be displayed on alv
IF V_OK_CODE = 'OK'.
*--metohd to detect if data was changed in oops alv
CALL METHOD OBJ_ALV2->CHECK_CHANGED_DATA
IMPORTING
E_VALID =
CHANGING
C_REFRESH = 'X'
ENDIF.
Hope this solves your problem.
Thanks
Khushboo -
UIX with XSQL as XML data provider and event handler
Hello ,
I would like to bind XML data to messageinput elements of a form element
as values to be presented before entering (data provider)
as well as input values to be persisted after completing the form (event handler).
My impression (as a newbee) is that only for BC4J integration there is a bidirectional binding with view objects.
Can i use 'include' to bind a static xml file as data source for output?
How can i use XSQL to be bound as data for input as well as for output of a form?
A last question concerning a page with 3 tabs:
do i need 3 different pages and requests to get the data of the 3 tabs
or is it possible to get the whole data of the page in one request
and distribute it over the 3 tabs.
Any help appreciated
Thanks
Klaus DreistadtYou could do this, but we don't provide any tools to make this easy.
You'd have to write an implement of the DataObject interface
that gives your UI access to the XML document, and write custom
event handlers to perform the "set" side of things. The Data Binding
and UIX Controller chapters of the UIX developer's guide will give you
a high-level view of how to accomplish this, but nothing specifically
about reading or writing to XML documents. -
Query about event and event handling
hi,
how exactly events are bieng generated. And how they are transmitted and how they
are caught and handled at low level. I want to trigger my own event whcih can be listen
by my own listener or some existing listener (obviously implemented from some java listener).
so help me out.
TIA
bhupsWell, first you create an interface such as FooListener where you define methods, such as foo().
Now you can make classes that have the method addFooListener(FooListener foo). Then in that class, you can for example decide that doing a certain thing (or based on the time of day or whatever) the class calls all the foo()'s of it's FooListeners and there you go.
Example code:
public interface FooListener {
public void foo(FooEvent evt);
public class FooEvent {
private String reason;
public FooEvent(String reason) {
this.reason = reason;
public String getReason() {
return reason;
public class Bar {
List listeners = new LinkedList();
public void addFooListener(FooListener foo) {
listeners.add(foo);
protected void fireFooEvent(String reason) {
Iterator itr = listeners.iterator();
FooEvent evt = new FooEvent(reason);
while(itr.hasNext())
((FooListener)itr.next()).foo(evt);
public void doBar() {
// code omitted
fireFooEvent("Bar done");
}Howzat? -
User Recon and Event Handler Issue in OIM11g
Hello Experts,
I am developing a Trusted Source Recon (User) for a proprietary application. I have devloped two java classes and put them into a jar file and placed the same jar in both ScheduleTask and EventHandlers directory of OIM.
1.UserRecon class -- for User Recon
2. EventHandler class -- update user's password after reconciling the user using API.
In the User Recon class , I have defined a static HashMap variable to store the user and user's password as a class variable. The flow will be like this,
1. Query trsuted source
2. Reconcile user (except password because password can not be)
3. Update the map with userid (key) and password.
4. After reconciling , In the event handler use the same map to read user's password and set the password in OIM using API. (setXelleratePassword).
5.After successful password set remove the entry from Map.
The idea is to avoid making additional call to trusted source to retrieve the user's password.
This worked in OIM9102. But when I tested the same in 11g it did not work.... Though the User Recon class updates the record into the HashMap , In the eventhandler , the HashMap is always coming as "empty".
I did the below changes for 11g,
1. Modified the EventHandler class to suite for 11g.
2. Deployed the event handler as a plugin
3. Placed the same jar file in Schedule task directory of OIM 11g
I am unable find out where it is going wrong?? and tired of troubleshooting. Can you assist me ?
Thanks and Regards
INIYAINIYA wrote:
Hello Experts,
I am developing a Trusted Source Recon (User) for a proprietary application. I have devloped two java classes and put them into a jar file and placed the same jar in both ScheduleTask and EventHandlers directory of OIM.
1.UserRecon class -- for User Recon
2. EventHandler class -- update user's password after reconciling the user using API.
In the User Recon class , I have defined a static HashMap variable to store the user and user's password as a class variable. The flow will be like this,
1. Query trsuted source
2. Reconcile user (except password because password can not be)
3. Update the map with userid (key) and password.
4. After reconciling , In the event handler use the same map to read user's password and set the password in OIM using API. (setXelleratePassword).
5.After successful password set remove the entry from Map.
The idea is to avoid making additional call to trusted source to retrieve the user's password.
This worked in OIM9102. But when I tested the same in 11g it did not work.... Though the User Recon class updates the record into the HashMap , In the eventhandler , the HashMap is always coming as "empty".
I did the below changes for 11g,
1. Modified the EventHandler class to suite for 11g.
2. Deployed the event handler as a plugin
3. Placed the same jar file in Schedule task directory of OIM 11gHope there are two jars, if this is the case place the secondary jar in lib folder, than make it as plugin.
>
I am unable find out where it is going wrong?? and tired of troubleshooting. Can you assist me ?
put the printstacktrace, so that problem can be identify
sample code
HashMap hash= null;
try{
hash = get map from other class
//class be load at this point, if class is not loaded than you will get exception.
}catch(Throwable t){
// hope you will get some error or exception here
t.printstacktrace();
>
Thanks and Regards
INIYAPaste you sample code, if it couldn't help. -
Beginners Questions about Multiple JPanels in JFrame and event handling
I am a newbie with SWING, and even a newerbie in Event Handling. So here goes.
I am writing a maze program. I am placing a maze JPanel (MazePanel) at the center of a JFrame, and a JPanel of buttons (ButtonPanel) on the SOUTH pane. I want the buttons to be able to re-randomize the maze, solve the maze, and also ouput statistics (for percolation theory purposes). I have the backbone all done already, I am just creating the GUI now. I am just figuring out EventHandlers and such through the tutorials, but I have a question. I am adding an ActionListener to the buttons which are on the ButtonPanel which are on JFrame (SOUTH) Panel. But who do I make the ActionListener--Basically the one doing the work when the button is pressed. Do I make the JFrame the ActionListener or the MazePanel the ActionListener. I need something which has access to the maze data (the backbone), and which can call the Maze.randomize() function. I'm trying to make a good design and not just slop too.
Also I was wondering if I do this
JButton.addActionListener(MazePanel), and lets say public MazePanel implments ActionListenerdoesn't adding this whole big object to another object (namely the button actionlistener) seem really inefficient? And how does something that is nested in a JPanel on JFrame x get information from something nested in another JPanel on a JFrame x.
Basically how is the Buttons going to talk to the maze when the maze is so far away?I'm not an expert, but here's what I'd do....
You already have your business logic (the Maze classes), you said. I'm assuming you have some kind of public interface to this business logic. I would create a new class like "MazeGui" that extends JFrame, and then create the GUI using this class. Add buttons and panels as needed to get it to look the way you want. Then for each button that does a specific thing, add an anonymous ActionListener class to it and put whatever code you need inside the ActionListener that accesses the business logic classes and does what it needs to.
This is the idea, though my code is totally unchecked and won't compile:
import deadseasquirrels.mazestuff.*;
public class MazeGui extends JFrame {
JPanel buttonPanel = new JPanel();
JPanel mazePanel = new JPanel();
JButton randomizeB = new JButton();
JButton solveB = new JButton();
JButton statsB = new JButton();
// create instanc(es) of your Maze business logic class(es)
myMaze = new MazeClass();
// add the components to the MazeGui content pane
Component cp = getContentPane();
cp.add(); // this doesn't do anything, but in your code you'd add
// all of your components to the MazeGui's contentpane
randomizeB.addActionListener(new ActionListener {
void actionPerformed() {
Maze newMaze = myMaze.getRandomMazeLayout();
mazePanel.setContents(newMaze); // this is not a real method!
// it's just to give you the idea
// of how to manipulate the JPanel
// representing your Maze diagram,
// you will probably be changing a
// subcomponent of the JPanel
solveB.addActionListener(new ActionListener {
void actionPerformed() {
Solution mySolution = myMaze.getSolution();
mazePanel.setContents(mySolution); // again, this is not a real
// method but it shows you how
// the ActionListener can
// access your GUI
// repeat with any other buttons you need
public static void main(String[] args) {
MazeGui mg = new MazeGui();
mg.setVisible(true);
// etc...
} -
HttpContext in itemDeleting Event Handler (works on itemUpdating and itemAdding)
Hello
How can I redirect to a custom page in the itemDeleting event handler.
I don´t know why but the HttpContext is not available in the event handlers.
My objective is to redirect to some page in the itemDeleting after setting the properties.Cancel = true event handlers and replace/avoid the standard sharepoint error page. For that i need the HttpContext.
One thing curious is that the following solution works for the itemAdding and itemUpdating and I can access the HttpContext.
Code Snippet
public class MyEventHandler: SPItemEventReceiver
private HttpContext current;
public MyEventHandler() : base()
current = HttpContext.Current;
I hope you can help me solve this problem.
Thanks for the help.
Regards,
AndréHello all
The following solved my problem.
About getting the current httpcontext inside the event handler itemdeleting i have found here (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3120467&SiteID=1) a way to get it.
In my scenario I want to cancel the event handler and redirect the user to a custom page or just avoid the sharepoint error page and return to source page.
Code Snippet
public override void ItemDeleting(SPItemEventProperties properties)
base.ItemDeleting(properties);
//event handler code
properties.Cancel = true;
properties.Status = SPEventReceiverStatus.CancelNoError;
SPSite site = new SPSite(http://mysiteurl);
SPWeb web = site.OpenWeb("mywebapplication");
if (HttpContext.Current == null)
HttpRequest request = new HttpRequest("", web.Url, "");
HttpContext.Current = new HttpContext(request, new HttpResponse(new StringWriter()));
HttpContext.Current.Items["HttpHandlerSPWeb"] = web;
//to redirect to a custom url just replace the web.Url for a custom one
SPUtility.Redirect(web.Url, SPRedirectFlags.UseSource, HttpContext.Current);
Hope this helps,
Regards,
André Cunha
Hello Andre,
I am trying to add a code on Item Updating event.
I am unable to redirect my page to a custom Url. Please help me I tried to set values for Context object still I was unable to redirect to another page. -
NullPointerException and event handling
In this forum I want to know why my program doesn't work. In my program, I want to show the text in JTextfield (Swing) if the user click Jbutton, but the rusult show this comment: java.lang.NullPointerException
Why can this happen in my programm?
The Scrypt of my program:
//event handling
itemBuka.addActionListener((ActionListener) this);//itemBuka is JButton
public void actionPerformed(ActionEvent e){
String perintah = e.getActionCommand();
if (perintah.equals("Buka...")){
f1.setText("bisa"); // f1 is a JTextfield and want to shoe the word "bisa"
}public void actionPerformed(ActionEvent e){
String perintah = e.getActionCommand();
if (perintah.equals("Buka...")){
f1.setText("bisa"); // f1 is a JTextfield and
d and want to shoe the word "bisa"
}A NullPointerException is indicative of a method call invoked on a null reference.
This piece of code is insufficient to tell you why it is occuring, annd you didn't even mention the line where the exception is thrown.
A good guess is that f1 is somehow appearing as null... might be a problem with the scope or something that your code does!
So, post the complete code. -
Navigation control and event handling in jsf rc1
afternoon folk,
i am using the rc1 release of jsf, and am sorting down through some things. i have a question on the proper way to do the following:
i have a page that gathers some user parameters to be used to submit in generating a report. this report will take around 15 minutes to complete. once i submit the parameters from this page, i have a managed bean stored in session scope that will issue a Thread.run() to run the report as a thread, and allow the page to return without timing out. when the report is complete, it sets a flag in the managed bean i can use to determine that the report is complete. from the user's standpoint, i have a page with the refresh attribute set, that uses the jstl conditional operators to check if the report thread is complete or not. this all works fine. what happens though, is that when the report thread is complete and the page that checks the flag indicating this runs, i haven't found a good way to call the page that i have that will display the results of the operation. my 'monitor' page has the following code snippet in it:
<c:if test="${MyReport.reportThread.reportRunning}">
<h:outputText id = "spl" value="#{bundle.stillProcessingLabel}" />
</c:if>
<c:if test="${MyReport.reportThread.reportRunning == false}">
<h:commandLink id="done" action="displayResults">
<h:outputText id = "vrl" value="#{bundle.viewReportsLabel}" />
</h:outputLink>
</c:if>
in my faces-config.xml file, i have a navigation rule that says to go to the results page on a value of displayResults coming from the monitor page.
<navigation-rule >
<from-view-id>/monitor.jsp</from-view-id>
<navigation-case>
<description>
Holding page for the user till the reports are completed
</description>
<from-outcome>displayResults</from-outcome>
<to-view-id>/displayResults.jsp</to-view-id>
</navigation-case>
</navigation-rule>
what happens is that the stillProcessingLabel message displays for each refresh cycle of the page (that is set using the <meta http-equiv="refresh" content="60"> until the report thread is complete, but once that occurs, i do not see the command link output, and the page that called this monitor page is displayed without any user interaction, not the results page.
any suggestions as to how to handle this, and why it is occurring would be appreciated.
thanks
tomI had a similar issue in a project I am working on. I'm not sure if I did this the "Best Practices" way or not, but it works perfectly.
In the head area of my JSP I include the following:
<f:view>
<h:outputText id="refresher1" rendered="#{queryHandler.queryRunning}">
<f:verbatim escape="false">
<meta http-equiv="refresh"
content="5,<%=response.encodeURL(request.getContextPath()+
"/queryStatus.jsf")%>">
</f:verbatim>
</h:outputText>
<h:outputText id="refresher1" rendered="#{queryHandler.queryFinishedRunning}">
<f:verbatim escape="false">
<meta http-equiv="refresh"
content="5,<%=response.encodeURL(request.getContextPath()+
"/queryResults.jsf")%>">
</f:verbatim>
</h:outputText>This puts a 5 second refresh meta in the header to direct the browser to the correct page based on the status of the query thread.
There are many ways to accomplish the effect you want. I suggest putting all the controls into the JSP and making use of the rendered attributes instead of the JSTL conditionals to show the controls you want for the state of the application.
-jeffhoward -
Problem with releater and event handling
Hi Flex genius,
I have been struggling for the whole day with a problem connected to repeater.
I have a text field:
<mx:Text id="shortText" width="300" text="{newTeaser.currentItem.shortDescription}" styleName="Scandinavian" fontSize="12" />
and a label:
<mx:Label id="readMoreLabel" x="13" text="{newTeaser.currentItem.readMore}" color="#3C4593" />
both inside a Repeater which fetches from an XML:
<mx:Repeater id="newTeaser" dataProvider="{eventsData}">
The Repeater works fine, but I need to add a click on the label id="readMoreLabel" that replace the shortText.text with {newTeaser.currentItem.longDescription} instead of {newTeaser.currentItem.shortDescription}.
i am quite new in Flex, so I guess I miss some fundamentals.
Thanks for your help.
MaxThis code works, and notice the trace(), you CAN have IDs for the controls in the repeater, and you can access them as an array, though I do not make use of this capability in my solution.
If this post answers your question or helps, please mark it as such.
Greg Lafrance - Flex 2 and 3 ACE certified
www.ChikaraDev.com
Flex / AIR Development, Training, and Support Services
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="dataService.send();">
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.collections.XMLListCollection;
import mx.controls.Text;
[Bindable] private var eventsData:XMLListCollection;
private function dataHandler(evt:ResultEvent):void{
eventsData = new XMLListCollection(evt.result..item as XMLList);
private function clickHandler(evt:MouseEvent):void{
var txt:Text = VBox(evt.currentTarget.parent).getChildAt(0) as Text;
for each(var xml:XML in eventsData){
if(xml.shortDescription == txt.text){
txt.text = xml.longDescription;
for each(var obj1:Text in shortText){
trace("shortText: " + obj1.text);
]]>
</mx:Script>
<mx:HTTPService id="dataService" url="data.xml" resultFormat="e4x" result="dataHandler(event);"/>
<mx:Repeater id="newTeaser" dataProvider="{eventsData}">
<mx:VBox width="100%">
<mx:Text id="shortText" width="100%" text="{newTeaser.currentItem.shortDescription}"/>
<mx:Label id="readMoreLabel" text="{newTeaser.currentItem.readMore}" color="#3C4593"
click="clickHandler(event);"/>
</mx:VBox>
</mx:Repeater>
</mx:Application>
<?xml version="1.0" encoding="utf-8"?>
<teasers>
<item>
<shortDescription>This is short desc one.</shortDescription>
<readMore>Read More One</readMore>
<longDescription>This is long desc one.</longDescription>
</item>
<item>
<shortDescription>This is short desc two.</shortDescription>
<readMore>Read More two</readMore>
<longDescription>This is long desc two.</longDescription>
</item>
<item>
<shortDescription>This is short desc three.</shortDescription>
<readMore>Read More three</readMore>
<longDescription>This is long desc three.</longDescription>
</item>
</teasers>
Maybe you are looking for
-
Loading java file in a java file
Hi everyone, Sorry this is probably a really simple question, but i'm getting a bit stuck and i can't find anywhere that helps explain how to do it. I've got two files that represent two questionnaires (questionaire 1 and questionnaire 2), depending
-
Access download link in an Interactive Report
I've built an interactive report and one of the columns, File, is a download link. I assume the I can create a trigger to log when/who clicks on that link, because I have a trigger that runs when they first upload a file to the table that automatical
-
Error after applying post budget note 1361644
Hi all, Our basis team applied the patch for post budget note and also made changes in V_T7INI7, V_T7INI9, T596F, V_T7INT1, V_T7INT3 tables but still when i run PC00_M40_CALC its giving me error. " No entry in table T596F for key
-
Creation of outbound idoc using BAPI
Hi, How can I create outbound IDOC using BAPI. If I go to BD64 and add the message type PREQCR,it gives the message that 'add this message type using BAPI'.I have added with the option ADD BABI.After that I dont know how to trigger?.Please give me th
-
Attempting to load Quicken on WIN 7 64 bit machine. Message, "load 64 bit version". Where is the 64 bit version? No distinction is made in the download choices. I did attempt to download the version for WIN 7.