FUNCTION 'REUSE_ALV_GRID_DISPLAY' with checkbox
Hello,
A short question.
I'm using the function 'REUSE_ALV_GRID_DISPLAY'. One of the columns is a character field which is displayed as a checkbox in the ALV by enabling the key "checkbox" and I also enable the "edit" key in the field catalog structure. So far so good.
But my question is the following:
When I set the key "edit" to false the ALV grid is displayed in a nice color grid. But when I enable the edit key the whole grid is showed in gray without the checkbox. Is it possible to set the checkbox to edit mode and also display the ALV grid in color?
An other question I have is the following:
Who could give me an example to use the grid in combination with special groups.
Kind regards,
Richard Meijn
I'll put the most important parts of my code here:
When I anable the line "ls_fieldcat-edit = abap_true."
for the field 'ATB_SEL' the grid is showed in gray?
REPORT YMM_ATB_LIJST_GOEDGEKEURD2 no standard page heading
message-id ycdg.
TYPE-POOLS: SLIS,
sdydo,
abap, "ABAP reporting types / constants
icon. "Possible icons
DATA: fieldcatalog TYPE slis_t_fieldcat_alv ,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
Internal tables, needed for ALV formatting
DATA: ta_comment TYPE slis_t_listheader. "Top of page of the ALV
INCLUDE <icon>.
$$----
*-- Constants
$$----
CONSTANTS:
co_background_alv TYPE sdydo_key VALUE 'ALV_WALLPAPER',
co_save TYPE c VALUE 'A',
co_msgty_inf TYPE symsgty VALUE 'I'.
Constants for interactive functions of an ALV
CONSTANTS:
co_double_click TYPE syucomm VALUE '&IC1', "CHOOSE / F2
Customer interactive functions for the ALV
co_sec_list
TYPE syucomm VALUE 'SEC_LIST'.
"Secundary list
Names of the routines to be called dynamically from the ALV function
CONSTANTS:
co_rout_pf_stat TYPE char30 VALUE 'R0_SET_PF_STATUS',
co_rout_ucomm TYPE char30 VALUE 'R1_PROCESS_USER_COMMAND',
co_rout_top_of_page TYPE char30 VALUE 'R2_SET_TOP_OF_PAGE',
co_rout_html_top TYPE char30 VALUE 'R3_SET_HTML_TOP_OF_PAGE',
co_rout_html_end TYPE char30 VALUE 'R4_SET_HTML_END_OF_LIST',
co_rout_pf_stat_sec TYPE char30 VALUE 'R5_SET_PF_STATUS_SEC',
co_rout_ucomm_sec TYPE char30 VALUE 'R6_PROCESS_UCOMM_SEC',
co_rout_top_page_sec TYPE char30 VALUE 'R7_SET_TOP_OF_PAGE_SEC'.
CONSTANTS:
co_struc TYPE tabname VALUE '/CTAC/S_ALV_STRUCTURE',
co_struc_sec TYPE tabname VALUE '/CTAC/S_ALV_STRUC_SEC'.
CONSTANTS: line_feed(2) TYPE x VALUE '0D0A'.
FIELD-SYMBOLS <crlf> TYPE x.
DATA: w_crlf(2) TYPE c.
ASSIGN w_crlf TO <crlf> CASTING.
<crlf> = line_feed.
DATA:
BEGIN OF IT_EBAN occurs 0,
ATB_SEL(1) TYPE C, " Selectie optie om geselecteerde
" ATB's uit te printen.
ATB_FORM(4), " ATB icon om ingevoerd ATB-formulier
" te tonen.
banfn LIKE EBAN-banfn, " Aanvraag-tot-bestellen-nummer
bnfpo LIKE EBAN-bnfpo, " Positienummer van
" aanvraag tot bestellen
txz01 LIKE EBAN-txz01, " Korte tekst
matkl LIKE MARA-matkl, " Goederengroep
lifnr LIKE EBAN-lifnr, " Gewenste leverancier
name1 LIKE lfa1-name1, " Gewenste leverancier
lfdat LIKE EBAN-lfdat, " Leveringsdatum van de positie
opm(1) TYPE C,
bijlage(1) TYPE C,
controle(1) TYPE C, " Advies geselecteerd
onvolledig(1) TYPE C, "Om aan te geven dat er
" ongekeurde regels
" zijn
c_koptekst(1) TYPE C, " Om aan te geven dat er
" kopteksten zijn
badat LIKE EBAN-badat, " Aanvraagdatum
kritisch(1) TYPE C, " Om aan te geven dat de bestelling
" kritisch is
workflow(1) TYPE C, "Om aan te geven dat er nog een WF
" voor loopt
wf_old(1) TYPE C, "Er is een afgesloten WF of lopende WF
wi_id TYPE sww_wiid,
ernam LIKE eban-ernam, " Naam van de medewerker die
" het object heeft toegevoegd
preis LIKE EBAN-preis, " Prijs in de aanvraag tot bestellen
peinh LIKE EBAN-peinh, " Prijseenheid
menge LIKE EBAN-menge, " ATB-hoeveelheid
totaal TYPE GSWRT,
waers LIKE EBAN-waers, " Valutacode
koptekst TYPE string,
END OF it_eban.
*DATA: it_eban TYPE TABLE OF t_eban ,
DATA: wa_eban like it_eban.
*TYPES: BEGIN OF T_EBAN2,
DATA:
BEGIN OF IT_EBAN2 occurs 0,
BANFN LIKE EBAN-BANFN, " Aanvraag-tot-bestellen-nummer
BNFPO LIKE EBAN-BNFPO, " Positienummer van
" aanvraag tot bestellen
TXZ01 LIKE EBAN-TXZ01, " Korte tekst
MATKL LIKE MARA-MATKL, " Goederengroep
LIFNR LIKE EBAN-LIFNR, " Gewenste leverancier
NAME1 LIKE LFA1-NAME1, " Gewenste leverancier
END OF it_eban2.
*DATA: IT_EBAN2 TYPE TABLE OF T_EBAN2 with header line.
DATA: wa_eban2 like it_eban2.
DATA voor uitprinten rapporten
DATA: PARAMS LIKE PRI_PARAMS,
DAYS(1) TYPE N VALUE 2,
COUNT(3) TYPE N VALUE 1,
VALID TYPE C,
E_USR01 LIKE USR01.
DATA: BEGIN OF kopteksten OCCURS 1.
INCLUDE STRUCTURE tline.
DATA: END OF kopteksten.
DATA: BEGIN OF atb_kopteksten OCCURS 1,
banfn TYPE banfn.
INCLUDE STRUCTURE tline.
DATA: END OF atb_kopteksten.
DATA: line(256) TYPE c,
text_tab LIKE STANDARD TABLE OF line.
DATA: BEGIN OF atb_nummers OCCURS 1,
banfn type thead-tdname,
END OF atb_nummers.
DATA: BEGIN OF tlinetab OCCURS 10.
INCLUDE STRUCTURE tline.
DATA: END OF tlinetab.
DATA: BEGIN OF teksten OCCURS 10,
id(1),
veld(25),
waarde(40).
DATA: END OF teksten.
******************Workflow********************************************
DATA: worklist TYPE TABLE OF swr_wihdr,
wa_worklist TYPE swr_wihdr,
ibf_object TYPE sibflporb.
DATA: prev_banfn type banfn.
DATA: theader LIKE thead,
name_atb LIKE thead-tdname,
bedrijfsnr LIKE pa0001-bukrs.
DATA: ok_code LIKE sy-ucomm,
save_ok LIKE sy-ucomm.
DATA: lpos TYPE I.
DATA: box(1) TYPE c.
DATA: lines TYPE I.
DATA: veld(20),
G_REPID LIKE SY-REPID,
init,
container TYPE REF TO cl_gui_custom_container,
editor TYPE REF TO cl_gui_textedit.
DATA: banfn_vorige TYPE banfn.
DATA: P_BANFN TYPE BANFN.
DATA: BUKRS LIKE PA0001-BUKRS.
DATA: Radio1, RADIO2, RADIO3.
Lijst kolomnamen
DATA: H1(6) VALUE 'ATB-nr',
H2(40) VALUE 'Omschrijving',
H3(2) VALUE 'GG',
H4(5) VALUE 'Levnr',
H5(35) VALUE 'Leverancier',
H6(10) VALUE 'Lev. Datum',
H7(6) VALUE '!BOCAT',
H8(10) VALUE 'Aanvr dat.',
H9(12) VALUE 'Invoerder',
H10(13) VALUE ' Totaal',
H11(3) VALUE 'Val'.
DATA: X TYPE I.
CALL screen 100.
INITIALIZATION.
PERFORM personeelsgegevens.
g_repid = sy-repid.
Part tor collect the data
*& Form BUILD_ALV_REPORT
text
FORM BUILD_ALV_REPORT.
perform build_field_cat CHANGING fieldcatalog[].
After building the field catalog (e.g., from a DDIC structure), we can
modify these settings in the following subroutine.
PERFORM modify_fieldcatalog CHANGING fieldcatalog[].
IF Not fieldcatalog is initial.
perform collect_data.
perform build_layout CHANGING gd_layout.
Table ta_comment is used to display header information in the
top-of-page of the ALV output.
PERFORM build_comment CHANGING ta_comment[].
Table gd_tab_group wordt gebruikt om een groepering op te bouwen.
PERFORM build_group CHANGING gd_tab_group[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = g_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = co_rout_ucomm
I_CALLBACK_TOP_OF_PAGE = co_rout_top_of_page
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = co_background_alv
I_GRID_TITLE = 'Lijst goedgekeurde ATBs'
I_GRID_SETTINGS =
IS_LAYOUT = gd_layout
IT_FIELDCAT = fieldcatalog
IT_EXCLUDING =
IT_SPECIAL_GROUPS = gd_tab_group[]
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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = it_eban
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.
ENDIF.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
ENDFORM. " BUILD_ALV_REPORT
*& Form build_field_cat
text
--> p1 text
<-- p2 text
FORM build_field_cat CHANGING cta_fcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
DATA: ls_fieldcat type slis_t_fieldcat_alv with header line.
refresh fieldcatalog.
clear fieldcatalog.
ls_fieldcat-fieldname = 'BANFN'.
ls_fieldcat-ref_tabname = 'eban'.
ls_fieldcat-ref_fieldname = 'banfn'.
ls_fieldcat-checkbox = abap_true.
fieldcatalog-seltext_m = 'Aanvr nr'.
ls_fieldcat-col_pos = 0.
fieldcatalog-outputlen = 8.
ls_fieldcat-emphasize = abap_true.
ls_fieldcat-key = abap_true.
append ls_fieldcat to fieldcatalog.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = g_repid
I_INTERNAL_TABNAME = 'IT_EBAN'
I_STRUCTURE_NAME = 'IT_EBAN2'
I_CLIENT_NEVER_DISPLAY = abap_true
I_INCLNAME = g_repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = fieldcatalog
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " build_field_cat
*& Form modify_fieldcatalog
Modify the field catalog for the primary list, if needed!
You can set attributes for every column in the ALV output by
selecting the fieldname belonging to the column.
For an overview of the attributes available, see the
online documentation of function module REUSE_ALV_GRID_DISPLAY.
FORM modify_fieldcatalog CHANGING cta_fcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
Modify the field catalog according to the requirements.
Some examples are shown below.
LOOP AT cta_fcat INTO ls_fieldcat.
CASE ls_fieldcat-fieldname.
WHEN 'ATB_SEL'.
ls_fieldcat-seltext_m = 'ATB check'.
ls_fieldcat-outputlen = 2.
ls_fieldcat-edit = abap_true.
ls_fieldcat-input = 'X'.
ls_fieldcat-checkbox = abap_true.
WHEN 'ATB_FORM'.
ls_fieldcat-seltext_m = 'ATB formulier'.
ls_fieldcat-hotspot = abap_true.
ls_fieldcat-seltext_s = icon_protocol.
ls_fieldcat-outputlen = 2.
ls_fieldcat-icon = abap_true.
WHEN 'BANFN'.
ls_fieldcat-hotspot = abap_true.
WHEN 'NAME1'.
ls_fieldcat-ddictxt = 'S'.
ls_fieldcat-emphasize = abap_true.
ls_fieldcat-key = abap_true.
WHEN 'OPM'.
ls_fieldcat-seltext_m = 'O'.
ls_fieldcat-outputlen = 1.
WHEN 'BIJLAGE'.
ls_fieldcat-seltext_m = 'B'.
ls_fieldcat-outputlen = 1.
WHEN 'CONTROLE'.
ls_fieldcat-seltext_m = 'C'.
ls_fieldcat-outputlen = 1.
WHEN 'ONVOLLEDIG'.
ls_fieldcat-seltext_m = abap_true.
ls_fieldcat-outputlen = 1.
WHEN 'C_KOPTEKST'.
ls_fieldcat-seltext_m = 'T'.
ls_fieldcat-hotspot = abap_true.
ls_fieldcat-outputlen = 1.
WHEN 'KRITISCH'.
ls_fieldcat-seltext_m = '!'.
ls_fieldcat-outputlen = 1.
WHEN 'WORKFLOW'.
ls_fieldcat-seltext_m = 'W'.
ls_fieldcat-outputlen = 1.
WHEN 'WF_OLD'.
ls_fieldcat-seltext_m = 'A'.
ls_fieldcat-hotspot = abap_true.
ls_fieldcat-sp_group = 'A'.
ls_fieldcat-outputlen = 1.
WHEN 'KOPTEKST'.
ls_fieldcat-seltext_m = 'Koptekst'.
ls_fieldcat-hotspot = abap_false.
ls_fieldcat-outputlen = 25.
ENDCASE.
MODIFY fieldcatalog from ls_fieldcat.
clear ls_fieldcat.
endloop.
ENDFORM. " modify_fieldcatalog
*& Module USER_COMMAND_0500 INPUT
text
MODULE USER_COMMAND_0500 INPUT.
IF 500 = 500.
ENDIF.
ENDMODULE. " USER_COMMAND_0500 INPUT
*& Module USER_COMMAND_0510 INPUT
text
MODULE USER_COMMAND_0510 INPUT.
IF 510 = 510.
ENDIF.
ENDMODULE. " USER_COMMAND_0510 INPUT
*& Form r1_process_user_command
This routine deals with the "non-standard" GUI-functions.
It enables you to do the following:
- Double-click or click on a hotspotted field
- Implement your own GUI-functions
You'll find some predefined examples in this routine.
FORM r1_process_user_command "#EC CALLED
USING utp_ucomm TYPE syucomm
utp_selfield TYPE slis_selfield.
DATA: lta_list_sec TYPE TABLE OF /ctac/s_alv_struc_sec.
DATA: ltp_repid TYPE syrepid.
DATA: ltp_ebeln_num(10) TYPE n.
DATA: ltp_ebeln TYPE ebeln.
DATA: ltp_matnr TYPE matnr.
DATA: ltp_matnr_char(18) TYPE c.
Handle the specific user-commands.
CASE utp_ucomm.
Handle double click or hotspot on a specific field. *
These are some examples *
WHEN co_double_click.
read table IT_EBAN index utp_selfield-tabindex.
CASE utp_selfield-fieldname.
WHEN 'ATB_FORM'.
SUBMIT ymm_atb_formulierprint AND RETURN
WITH sel_atb = it_eban-banfn. " utp_selfield-value.
WHEN 'BANFN'.
CHECK NOT wa_eban IS INITIAL.
SET PARAMETER ID 'BAN' FIELD it_eban-banfn.
CALL FUNCTION 'ENQUEUE_EMEBANE'
EXPORTING
banfn = it_eban-banfn
bnfpo = it_eban-bnfpo.
IF sy-subrc = 0.
CALL FUNCTION 'DEQUEUE_EMEBANE'
EXPORTING
banfn = it_eban-banfn
bnfpo = it_eban-bnfpo.
CALL TRANSACTION 'ME53N' AND SKIP FIRST SCREEN.
WAIT UP TO 1 SECONDS.
LEAVE TO TRANSACTION 'YME60_INK'.
ENDIF.
WHEN 'WF_OLD'.
ibf_object-catid = 'BO'.
ibf_object-typeid = 'ZBUS2105'.
ibf_object-instid(3) = '000'.
WRITE it_eban-banfn TO ibf_object-instid+3.
CALL FUNCTION 'SWI_WF_CONNECTIONS_DISPLAY'
EXPORTING
ibf_object = ibf_object
popup = space.
WHEN 'C_KOPTEKST'.
CALL SCREEN 510.
WHEN OTHERS.
ENDCASE.
Handle your own GUI functions here *
For example, handle a secondary ALV List *
WHEN co_sec_list.
PERFORM build_sec_list TABLES lta_list_sec.
PERFORM display_sec_list TABLES lta_list_sec
CHANGING utp_selfield.
Or some other GUI-functions *
WHEN 'OKCODE_01'.
Actions for this okcode
WHEN OTHERS.
ENDCASE.
ENDFORM. "R1_PROCESS_USER_COMMAND
*& Form build_comment
Create the internal table that is going to be the TOP-OF-PAGE
of the ALV grid or list.
FORM build_comment CHANGING cta_top_of_page TYPE slis_t_listheader.
DATA: lwa_line TYPE slis_listheader.
REFRESH cta_top_of_page.
LIST HEADING LINE: TYPE H
CLEAR lwa_line.
lwa_line-typ = 'H'.
LLINE-KEY: NOT USED FOR THIS TYPE
lwa_line-info = text-100.
APPEND lwa_line TO cta_top_of_page.
STATUS LINE: TYPE S
CLEAR lwa_line.
lwa_line-typ = 'S'.
lwa_line-key = text-101.
lwa_line-info = text-102.
APPEND lwa_line TO cta_top_of_page.
lwa_line-key = ' '.
lwa_line-key = text-103.
lwa_line-info = text-103.
APPEND lwa_line TO cta_top_of_page.
ACTION LINE: TYPE A
CLEAR lwa_line.
lwa_line-typ = 'A'.
LLINE-KEY: NOT USED FOR THIS TYPE
lwa_line-info = text-105.
APPEND lwa_line TO cta_top_of_page.
ENDFORM. " build_comment
FORM R2_SET_TOP_OF_PAGE *
Put the content of table TA_COMMENT on the top of the ALV *
FORM r2_set_top_of_page. "#EC CALLED
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = ta_comment
EXCEPTIONS
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. "R2_SET_TOP_OF_PAGE
*& Form build_group
text
<--P_TA_SP_GROUP[] text
FORM build_group CHANGING P_TA_SP_GROUP TYPE slis_t_sp_group_alv.
DATA: ls_sp_group TYPE slis_sp_group_alv.
clear ls_sp_group.
ls_sp_group-sp_group = 'A'.
ls_sp_group-text = 'ATBs ter goedkeuring bij adviseur'.
append ls_sp_group to P_TA_SP_GROUP.
ls_sp_group-sp_group = 'B'.
ls_sp_group-text = 'ATBs goedgekeurd'.
append ls_sp_group to P_TA_SP_GROUP.
ENDFORM. " build_group
*& Form BUILD_LAYOUT
Build layout for ALV grid report
form build_layout changing gd_layout type slis_layout_alv.
gd_layout-no_input = 'X'.
*gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_only = 'X'.
gd_layout-totals_text = 'Totaal'(201).
*gd_layout-group_change_edit = 'X'.
*gd_layout-GROUP_BUTTONS = 'A'.
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
I'll hope this is anough code?
Kind regards,
Richard Meijn
Similar Messages
-
Popup with the function 'Reuse_alv_grid_display'
Hello everyone,
I have a problem when I use the function module as pop_up where you can edit your input.
The table, after the function module was called, not always contains the values that the user typed.
An example is:
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZZBSEG'
CHANGING
ct_fieldcat = gt_fieldcat[].
READ TABLE gt_fieldcat WITH KEY fieldname = 'AUFNR'.
IF sy-subrc = 0.
gt_fieldcat-input = 'X'.
gt_fieldcat-edit = 'X'.
MODIFY gt_fieldcat INDEX sy-tabix.
ENDIF.
SELECT * INTO TABLE tab
FROM zzbseg
WHERE belnr = '0100000018'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
i_structure_name = 'ZZBSEG'
i_buffer_active = ' '
is_layout = l_layout
it_fieldcat = gt_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
i_save = space
IS_VARIANT = ' '
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
i_screen_start_column = 10
i_screen_start_line = 1
i_screen_end_column = 100
i_screen_end_line = 10
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = tab
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
BREAK-POINT.If anyone else is interested:
SAP resolved an error in the coding,
now the IT_ALV_GRAPHICS can also be used
in REUSE_ALV_GRID_DISPLAY.
As for the line feed:
Use the constant
cl_abap_char_utilities=>cr_lf
in the CONCATENATE command. -
I am trying to follow the example shown at the below link but it is not working. I am modifying some of the code since I am using version 1.6. Any ideas as to what I may be doing wrong. The checkbox appears and I can select and deselect items but I cannot get P6_HOLDER to hold any of the values of the selected items. Thanks!
http://apex-smb.blogspot.com/2009/01/apex-report-with-checkboxes-advanced.html
First I created a page item called P6_HOLDER.
Next I created a report region (sequence 40) with the below code.
select htmldb_item.checkbox (1, dev_obj_id, 'onchange="spCheckChange(this);"',
:P6_HOLDER, ':') checkbox, dev_id, dev_obj_desc from edm_dev_obj where
dev_id = :P6_TEMP_DEV_ID
**I then created a html region (sequence 1) with the below code**
<SCRIPT src="http://www.google.com/jsapi"></SCRIPT>
<SCRIPT>
// Load jQuery
google.load("jquery", "1.2.6", {uncompressed:true});
function spCheckChange(pThis){
var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=CHECKBOX_CHANGE',$v('pFlowStepId'));
get.addParam('f01',pThis.value); //Value that was checked
get.addParam('f02',pThis.checked ? 'Y':'N'); // Checked Flag
gReturn = get.get();
$f('checkListDisp').innerHTML=gReturn;
</SCRIPT>
CHECKBOX List:
<DIV id=checkListDisp>&P6_HOLDER.</DIV>
I then created an application process on Demand called CHECKBOX_CHANGE with the below code
DECLARE
v_item_val NUMBER := htmldb_application.g_f01;
v_checked_flag VARCHAR2 (1) := htmldb_application.g_f02;
BEGIN
IF v_checked_flag = 'Y' THEN
-- Add to the list
IF :P6_HOLDER IS NULL THEN
:P6_HOLDER := ':' || v_item_val || ':';
ELSE
:P6_HOLDER := :P6_HOLDER || v_item_val || ':';
END IF;
ELSE
-- Remove from the list
:P6_HOLDER := REPLACE (:P6_HOLDER, ':' || v_item_val || ':', ':');
END IF;
-- Just for testing
HTP.p (:P6_HOLDER);
END;Hi
Create a page level validation (fucntion returning boolean) and write code similar to following
DECLARE
v_count NUMBER := 0;
BEGIN
FOR i IN 1..APEX_APPLICATION.G_F01.COUNT LOOP
IF APEX_APPLICATION.G_F01(i) IS NOT NULL THEN
v_count := v_count + 1;
END IF;
END LOOP;
IF v_count = 0 THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;I take it your report query is similar to following
select apex_item.checkbox(1,"PK_CLMN") Tick, col2, col3 FROM tbl_nameCheers,
Hari -
REUSE_ALV_GRID_DISPLAY with editable field -- Recuperate new value
Hi everybody,
I try to explain my problem. I created an ALV grid with the function REUSE_ALV_GRID_DISPLAY and an internal table.
The user can change the value of one field and can save it. Indeed, in debbug mode, I can see in the internal table the new value entered by the user. So I can do all the actions with the launch of a routine.
But the user can forger to save his change. So, when he clicks on "Back" I want to propose him to save. THE PROBLEM : in debbug mode, when the routine is launched, the internal table does't have the new value..
So have you got an idea to recuperate the new value?
Thank you very much in advance.
Best regards.I had the same problem and solved it: I used SET_TABLE_FOR_FIRST_DISPLAY.
The MT_OUTPUT tab has the ALV data and the column in here must be modifed. Steps:
data: p_grid type ref to lcl_gui_alv_grid.
Step 1. Create a sub class for LCL_GUI_ALV_GRID_DEFINITION.
* class lcl_gui_alv_grid definitio
CLASS lcl_gui_alv_grid DEFINITION
INHERITING FROM cl_gui_alv_grid.
PUBLIC SECTION.
METHODS: update_outtab
IMPORTING i_good_cells TYPE lvc_t_modi.
** check_changed_data.
ENDCLASS. "lcl_gui_alv_grid DEFINITIO
Step2
Use event data_changed_finished of LCL_EVENT_RECEIVER
* CLASS lcl_event_receiver DEFINITION
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed,
handle_data_change_finished "****<----------
FOR EVENT data_changed_finished OF cl_gui_alv_grid
IMPORTING e_modified et_good_cells,
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column,
handle_after_refresh
FOR EVENT after_refresh OF cl_gui_alv_grid.
*Implementation
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_data_change_finished.
DATA: lt_goodcells TYPE lvc_t_modi.
CHECK NOT e_modified IS INITIAL AND NOT et_good_cells IS INITIAL.
lt_goodcells[] = et_good_cells[].
CALL METHOD p_grid->update_outtab
EXPORTING
i_good_cells = lt_goodcells.
CALL METHOD p_grid->refresh_table_display.
ENDMETHOD. "data_changed_finished
*-- ALV data updated in class implementation below
CLASS lcl_gui_alv_grid IMPLEMENTATION.
METHOD update_outtab.
FIELD-SYMBOLS: <tab1> TYPE STANDARD TABLE,
<good> TYPE lvc_s_modi,
<fs1> TYPE ANY,
<fs2> TYPE ANY.
DATA: ls_alv TYPE type_alv,
fldabgru(32) TYPE c VALUE '<TAB1>-ABGRU_NEW',
fldbezei(32) TYPE c VALUE '<TAB1>-BEZEI_NEW',
lv_bezei TYPE bezei40.
ASSIGN mt_outtab->* TO <tab1>. "ALV display table
LOOP AT i_good_cells ASSIGNING <good>.
READ TABLE <tab1> INTO ls_alv INDEX <good>-row_id.
IF sy-subrc EQ 0.
SELECT SINGLE bezei INTO ls_alv-bezei_new
FROM tvagt
WHERE spras = sy-langu
AND abgru = ls_alv-abgru_new.
IF sy-subrc EQ 0.
MODIFY <tab1> FROM ls_alv INDEX <good>-row_id.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD. "update_outtab -
How to handle multiple selection in the Spark List control with checkbox as itemrenderer?
Hi All,
I am using checkbox as an ItemRenderer in spark list.
I have a query.
how to handle multiple selection in the Spark List control with checkbox as itemrenderer?
how to retrieve the selected item label?
Thank you in advance.Hi there, I'll tweak your code a little bit to something like this:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical">
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
import mx.controls.CheckBox;
[Bindable]
private var mySelectedIndexes:ArrayCollection=new ArrayCollection();
private function onChange(e:ListEvent):void
if(CheckBox(e.itemRenderer).selected){
mySelectedIndexes.addItem(e.rowIndex);
}else{
mySelectedIndexes.removeItemAt(mySelectedIndexes.getItemIndex(e.rowIndex));
chkList.selectedIndices=mySelectedIndexes.toArray();
]]>
</mx:Script>
<mx:ArrayCollection id="collection">
<mx:Object label="Test A"/>
<mx:Object label="Test B"/>
<mx:Object label="Test C"/>
<mx:Object label="Test D"/>
<mx:Object label="Test E"/>
<mx:Object label="Test F"/>
<mx:Object label="Test G"/>
</mx:ArrayCollection>
<mx:List id="chkList" dataProvider="{collection}" itemRenderer="mx.controls.CheckBox" itemClick="onChange(event);" allowMultipleSelection="true"/>
</mx:Application> -
Replace REUSE_ALV function module with use of OO ALV(obect oriented)
HI,
I m using function module 'REUSE_ALV_GRID_DISPLAY' to disply the report but now client want to use object oriented ALV instead of REUSE_ALV function
pls help me.its very urgent
thanks!
Vipin
pls find the code below.
FORM f0001_get-select_data .
SELECT a~pernr
a~endda
a~begda
a~bukrs
a~werks
a~persg
a~persk
a~btrtl
a~abkrs
a~kostl
a~orgeh
a~plans
b~nachn
b~vorna
b~midnm
INTO CORRESPONDING FIELDS OF TABLE i_pa0001_pa0002
FROM pa0001 AS a INNER JOIN pa0002 AS b
ON apernr = bpernr
WHERE a~pernr IN s_pernr
AND a~werks IN s_werks
AND a~orgeh IN s_orgeh
AND a~plans IN s_plans.
SORT i_pa0001_pa0002 BY pernr .
IF NOT i_pa0001_pa0002[] IS INITIAL .
CLEAR: w_i_lines.
DESCRIBE TABLE i_pa0001_pa0002 LINES w_i_lines.
IF w_i_lines GT 0.
SELECT pernr
kostl
lstar
werks
lifnr
ebeln
ebelp
lstnr
FROM pa0315
INTO CORRESPONDING FIELDS OF TABLE i_pa0315
FOR ALL ENTRIES IN i_pa0001_pa0002
WHERE pernr = i_pa0001_pa0002-pernr
AND kostl = i_pa0001_pa0002-kostl
AND ebeln IN s_ebeln.
SORT i_pa0315 BY pernr kostl.
ENDIF.
CLEAR: w_i_lines.
DESCRIBE TABLE i_pa0001_pa0002 LINES w_i_lines.
IF w_i_lines GT 0.
SELECT pernr
endda
begda
schkz
FROM pa0007
INTO CORRESPONDING FIELDS OF TABLE i_pa0007
FOR ALL ENTRIES IN i_pa0001_pa0002
WHERE pernr = i_pa0001_pa0002-pernr
AND endda = i_pa0001_pa0002-endda
AND begda = i_pa0001_pa0002-begda.
SORT i_pa0007 BY pernr.
ENDIF.
CLEAR: w_i_lines.
DESCRIBE TABLE i_pa0001_pa0002 LINES w_i_lines.
IF w_i_lines GT 0.
SELECT orgeh
orgtx
FROM t527x
INTO CORRESPONDING FIELDS OF TABLE i_t527x
FOR ALL ENTRIES IN i_pa0001_pa0002
WHERE orgeh = i_pa0001_pa0002-orgeh.
SORT i_t527x BY orgeh.
ENDIF.
CLEAR: w_i_lines.
DESCRIBE TABLE i_pa0001_pa0002 LINES w_i_lines.
IF w_i_lines GT 0.
SELECT plans
plstx
FROM t528t
INTO CORRESPONDING FIELDS OF TABLE i_t528t
FOR ALL ENTRIES IN i_pa0001_pa0002
WHERE plans = i_pa0001_pa0002-plans.
SORT i_t528t BY plans.
ENDIF.
ENDIF.
Merging data of i_pa0001_pa0002,i_pa0315 & i_pa0007 into i_outtab.
LOOP AT i_pa0001_pa0002 INTO w_pa0001_pa0002 .
MOVE-CORRESPONDING w_pa0001_pa0002 TO w_final.
READ TABLE i_pa0315 INTO w_pa0315 WITH KEY pernr =
w_pa0001_pa0002-pernr
kostl = w_pa0001_pa0002-kostl BINARY SEARCH.
IF sy-subrc = 0.
w_final-kostl = w_pa0315-kostl.
w_final-lstar = w_pa0315-lstar.
w_final-werks_p = w_pa0315-werks.
w_final-lifnr = w_pa0315-lifnr.
w_final-ebeln = w_pa0315-ebeln.
w_final-ebelp = w_pa0315-ebelp.
w_final-lstnr = w_pa0315-lstnr.
ENDIF.
READ TABLE i_pa0007 INTO w_pa0007 WITH KEY pernr =
w_pa0001_pa0002-pernr BINARY SEARCH.
IF sy-subrc = 0.
w_final-schkz = w_pa0007-schkz.
ENDIF.
READ TABLE i_t527x INTO w_t527x WITH KEY orgeh = w_pa0001_pa0002-orgeh
BINARY SEARCH.
IF sy-subrc = 0.
w_final-orgtx = w_t527x-orgtx.
ENDIF.
READ TABLE i_t528t INTO w_t528t WITH KEY plans =
w_pa0001_pa0002-plans BINARY SEARCH.
IF sy-subrc = 0.
w_final-plstx = w_t528t-plstx.
ENDIF.
APPEND w_final to i_outtab.
ENDLOOP.
ENDFORM. "f001_get-select_data
*& Form f002_display_data
text
FORM f0002_display_data.
Build the field catalog
ls_fieldcat-col_pos = '1'.
ls_fieldcat-fieldname = 'PERNR'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0001'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '2'.
ls_fieldcat-fieldname = 'NACHN'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0002'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '3'.
ls_fieldcat-fieldname = 'VORNA'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0002'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '4'.
ls_fieldcat-fieldname = 'MIDNM'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0002'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '5'.
ls_fieldcat-fieldname = 'BUKRS'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0001'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '6'.
ls_fieldcat-fieldname = 'WERKS'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0001'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '7'.
ls_fieldcat-fieldname = 'PERSG'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0001'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '8'.
ls_fieldcat-fieldname = 'PERSK'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0001'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '9'.
ls_fieldcat-fieldname = 'BTRTL'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0001'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '10'.
ls_fieldcat-fieldname = 'ABKRS'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0001'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '11'.
ls_fieldcat-fieldname = 'ORGEH'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0001'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '12'.
ls_fieldcat-fieldname = 'ORGTX'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'T527X'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '13'.
ls_fieldcat-fieldname = 'PLANS'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0001'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '14'.
ls_fieldcat-fieldname = 'PLSTX'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'T528T'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '15'.
ls_fieldcat-fieldname = 'SCHKZ'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0007'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '16'.
ls_fieldcat-fieldname = 'KOSTL'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0315'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '17'.
ls_fieldcat-fieldname = 'LSTAR'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0315'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '18'.
ls_fieldcat-fieldname = 'WERKS'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0315'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '19'.
ls_fieldcat-fieldname = 'LIFNR'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0315'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '20'.
ls_fieldcat-fieldname = 'EBELN'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0315'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '21'.
ls_fieldcat-fieldname = 'EBELP'.
ls_fieldcat-tabname = 'i_outab'.
ls_fieldcat-ref_tabname = 'PA0315'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '22'.
ls_fieldcat-fieldname = 'LSTNR'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0315'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '23'.
ls_fieldcat-fieldname = 'BEGDA'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0001'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-col_pos = '24'.
ls_fieldcat-fieldname = 'ENDDA'.
ls_fieldcat-tabname = 'i_outtab'.
ls_fieldcat-ref_tabname = 'PA0001'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
Display the list
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = lt_fieldcat
TABLES
t_outtab = i_outtab.
ENDFORM. " F_DISPLAY_DATAHi,
check the system defined program BCALV_EDIT_05.
rgds,
bharat. -
Hello experts,
I'm working on an object where in I need to display an ALV List (using Funct Modules) with checkboxes.
When I select the checkboxes,and click on a button (Eg.Refresh Button) , I need to get all the details of the selected rows (checked rows) in a seperate ALV List (in a Dailog).
Could any one of u please suggest me about selecting the row which has been checked(Checkboxes in ALV ).
Thanks in advance.
SanghamitraHi sangha,
1. To get a taste of it,
just copy paste this program.
2. It will display alv (t001)
It will show CHECKBOXES (besides every row)
TICK some rows,
and DOUBLE-CLICK ON any row.
3. It will display all the row numbers which have been checked/ticked.
4.
report abc.
TYPE-POOLS : slis.
Data
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : flag tyPE c,
END OF itab.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvly TYPE slis_layout_alv.
Select Data
SELECT * FROM t001 INTO TABLE itab.
*------- Field Catalogue
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
Display
alvly-box_fieldname = 'FLAG'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid "<-------Important
i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important
is_layout = alvly
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
CALL BACK FORM
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.
data : msg(100) type c.
LOOP AT itab.
if itab-flag = 'X'.
msg = sy-tabix.
condense msg.
concatenate 'Row Number ' msg ' ' into msg
separated by space.
message msg type 'I'.
endif.
ENDLOOP.
ENDFORM. "ITAB_user_command
regards,
amit m. -
Displaying table using call function 'REUSE_ALV_GRID_DISPLAY'
I have created a table which has product code, product description, and product level. I am trying to display it using REUSE_ALV_GRID_DISPLAY. When I Check it, I get the following error message: "PVS2" is not an internal table - the "Occurs n" specification is missing.
Is it possible to copy PVS2 into another table, and then display that table using REUSE_ALV_GRID_DISPLAY?
I have patched together code from sdn, a client program, and my own code and I am starting to get confused. So, please help me.
Regards,
Al Lal
REPORT YABHINAV16.
* program to display products at chosen level *
Tables: T179, T179t.
types: begin of hierarchy,
prodh type t179-prodh,
vtext type t179t-vtext,
stufe type t179-stufe,
end of hierarchy.
types: begin of text,
prodh type t179t-prodh,
vtext type t179t-vtext,
end of text.
data: pvs type standard table of hierarchy initial size 0.
data: pvs2 type hierarchy.
data: it_text type standard table of text,
wa_text type text.
TYPE-POOLS:SLIS.
*For ALV
DATA: GT_FLD TYPE SLIS_T_FIELDCAT_ALV,
GT_EV TYPE SLIS_T_EVENT,
GT_HDR TYPE SLIS_T_LISTHEADER,
GT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: WA_FLD TYPE SLIS_FIELDCAT_ALV,
WA_EV TYPE SLIS_ALV_EVENT,
WA_HDR TYPE SLIS_LISTHEADER,
WA_SORT TYPE SLIS_SORTINFO_ALV,
WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
DEFINE FLD.
WA_FLD-FIELDNAME = &1.
WA_FLD-TABNAME = &2.
WA_FLD-OUTPUTLEN = &3.
WA_FLD-SELTEXT_L = &4.
WA_FLD-SELTEXT_M = &5.
WA_FLD-SELTEXT_S = &6.
WA_FLD-COL_POS = &7.
WA_FLD-FIX_COLUMN = &8.
WA_FLD-DO_SUM = &9.
APPEND WA_FLD TO GT_FLD.
CLEAR WA_FLD.
END-OF-DEFINITION.
CONSTANTS: C_TOP TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
C_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
DATA: MTRL LIKE SY-REPID,
TITLE LIKE SY-TITLE.
select-options level for t179-stufe no intervals.
start-of-selection.
Select prodh stufe from T179 into corresponding fields of table pvs where stufe in level.
select prodh vtext from t179t into corresponding fields of table it_text for all entries in pvs where prodh = pvs-prodh.
end-of-selection.
sort pvs by prodh.
sort it_text by prodh.
loop at pvs into pvs2.
read table it_text into wa_text with key prodh = pvs2-prodh.
if sy-subrc eq 0.
pvs2-vtext = wa_text-vtext.
write: / pvs2-prodh, pvs2-vtext, pvs2-stufe.
endif.
* modify pvs2.
endloop.
perform BUILD_FIELDCAT.
perform GRID_DISPLAY.
form BUILD_FIELDCAT .
FLD 'PRODH' 'PVS2' '20' 'Product Hierarchy' ' ' ' ' '1' '' '' .
FLD 'VTEXT' 'PVS2' '40' 'Description ' ' ' ' ' '3' '' '' .
FLD 'STUFE' 'PVS2' '5' 'Level' ' ' ' ' '2' '' '' .
endform. " BUILD_FIELDCAT
form GRID_DISPLAY .
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = MTRL
I_CALLBACK_USER_COMMAND = 'C_USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = C_TOP
I_STRUCTURE_NAME = 'PVS2'
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = GT_FLD
IT_SORT = GT_SORT
I_DEFAULT = 'X'
I_SAVE = 'U'
IT_EVENTS = GT_EV
TABLES
T_OUTTAB = PVS2[]
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. " GRID_DISPLAYTYPE-POOLS : SLIS.
DATA : BEGIN OF WA_T001,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
ORT01 LIKE T001-ORT01,
END OF WA_T001,
IT_T001 LIKE TABLE OF WA_T001.
DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT LIKE LINE OF IT_FCAT.
DATA : V_NAME LIKE SY-REPID.
SELECT BUKRS BUTXT ORT01 FROM T001 INTO TABLE IT_T001 UP TO 15 ROWS. V_NAME = SY-REPID.
CALL FUCTION MODULE 'REUSE_ALV_FIELDCATLOG_MERGE. EXPORTING I_CALBACK_PROGRAM =
V_NAME I_INTERAL_TABNAME = 'WA_T001' I_INCLNAME = V_NAME CHANGING CT_FIELDCAT =
IT_FCAT.
CALL FUNCTION MODULE "REUSE_ALV_GRID_DISPLAY"
EXPORTING
I_CALLBACK_PROGRAM = V_NAME
IT_FCAT = IT_FCAT.
TABLES
T_OUTTAB = IT_T001
SY-REPID IS THE SYSTEM VARIABLE WHICH IS HAVING THE ABAP PROGRAM
OR CURRENT MAIN PROGRAM.
----- Sample Progam -
***INCLUDE YRVR058_DEST_WISE_SUMMARY_DF01 .
*& Form DISPLAY_DATA
text *-- Rajesh Vasudeva
--> p1 text
<-- p2 text
FORM DISPLAY_DATA .
IF ITAB[] IS NOT INITIAL.
PERFORM F_APPEND_BLOCK.
ELSE.
MESSAGE 'Data not found for the selection
criteria' TYPE 'S'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " display_data
*& Form f_append_block
text
--> p1 text
<-- p2 text
FORM F_APPEND_BLOCK .
DATA : L_WA_SORT TYPE SLIS_SORTINFO_ALV, "For
sort
L_WA_EVENTS TYPE SLIS_ALV_EVENT. "For
events
Event (Top of List)
CLEAR L_WA_EVENTS.
L_WA_EVENTS-NAME = SLIS_EV_TOP_OF_LIST.
L_WA_EVENTS-FORM = C_TOPOFPAGE.
APPEND L_WA_EVENTS TO I_EVENTS_PART.
Event (Top of Page)
CLEAR L_WA_EVENTS.
L_WA_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
L_WA_EVENTS-FORM = 'F_DISPLAY_HEADER_PARTA'(031).
"f_display_header_part
APPEND L_WA_EVENTS TO I_EVENTS_PART.
Event (End of List)
CLEAR L_WA_EVENTS.
L_WA_EVENTS-NAME = SLIS_EV_END_OF_LIST.
L_WA_EVENTS-FORM = C_END_OF_LIST.
APPEND L_WA_EVENTS TO I_EVENTS_PART.
Set Layout Zebra
STRUCT_LAYOUT-ZEBRA = 'X'.
STRUCT_LAYOUT-NUMC_SUM = 'X'.
STRUCT_LAYOUT-TOTALS_TEXT = 'TOTAL:'(032).
set field catalog
PERFORM F_FIELD_CATALOG_PART.
ASSIGN ITAB[] TO <F_OUTTAB>.
V_PART = 'A'. "initiating list is A
PERFORM F_DISPLAY_BLOCK USING STRUCT_LAYOUT
I_FIELD_CAT_PART[]
C_TAB
I_EVENTS_PART[]
I_SORT_PART[].
ENDFORM. " f_append_block
*& Form f_field_catalog_part
text
--> p1 text
<-- p2 text
FORM F_FIELD_CATALOG_PART .
REFRESH I_FIELD_CAT_PART.
CLEAR I_FIELD_CAT_PART.
PERFORM F_CREATE_CATALOG USING :
*Month
C_TAB 'MONTH' 'MONTH' SPACE 'L' 7
I_FIELD_CAT_PART[],
*OBD
*C_TAB 'VBELN' 'Delivery' SPACE 'L' 12
I_FIELD_CAT_PART[],
*DATE
C_TAB 'WADAT_IST' 'Date' SPACE 'L' 10
I_FIELD_CAT_PART[],
*Destination
C_TAB 'CITY1' 'Destination' SPACE 'L' 25
I_FIELD_CAT_PART[],
*Qty By Road
C_TAB 'NTGEW_ROAD' 'Road Quantity' SPACE 'R' 16
I_FIELD_CAT_PART[],
*Rail Qty
C_TAB 'NTGEW_RAIL' 'Rail Quantity' SPACE 'R' 16 I_FIELD_CAT_PART[],
*Total Qty C_TAB 'TOT' 'Total Quantity' SPACE 'R' 16 I_FIELD_CAT_PART[], *RR/Trk No.
C_TAB 'EXTI2' 'Truck/RR No.' SPACE 'L' 17 I_FIELD_CAT_PART[].
ENDFORM. " f_field_catalog_part
*& Form f_DISPLAY_block
text
-->P_STRUCT_LAYOUT text
-->P_I_FIELD_CAT_PART[] text
-->P_C_TAB text
-->P_I_EVENTS_PART[] text
-->P_I_SORT_PART[] text
FORM F_DISPLAY_BLOCK USING FP_LAYOUT TYPE
SLIS_LAYOUT_ALV
FP_I_FCAT TYPE
SLIS_T_FIELDCAT_ALV
VALUE(FP_TABNAME) TYPE
ANY
FP_I_EVENTS TYPE
SLIS_T_EVENT
FP_I_SORT TYPE
SLIS_T_SORTINFO_ALV.
DATA: V_REPID TYPE SYREPID,
"current Program id
C_SAVE TYPE CHAR1 VALUE 'A'.
"variant save
V_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
*CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
IS_LAYOUT = FP_LAYOUT
IT_FIELDCAT = FP_I_FCAT[]
IT_SORT = FP_I_SORT[]
I_SAVE = C_SAVE "variant
save
IT_EVENTS = FP_I_EVENTS[]
TABLES
T_OUTTAB = <F_OUTTAB>
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. " f_DISPLAY_block
*& Form f_create_catalog
text
-->P_C_TAB text
-->P_0085 text
-->P_0086 text
-->P_SPACE text
-->P_0088 text
-->P_5 text
-->P_I_FIELD_CAT_PART[] text
FORM F_CREATE_CATALOG USING FP_I_TABNAME TYPE
SLIS_TABNAME
FP_I_FIELDNAME TYPE SLIS_FIELDNAME
FP_I_SELTEXT TYPE
SCRTEXT_L
FP_I_DOSUM TYPE
CHAR1
FP_I_JUST TYPE C
FP_I_OUTPUTLEN TYPE
OUTPUTLEN
FP_I_FCAT TYPE
SLIS_T_FIELDCAT_ALV.
Record for field catalog
DATA: L_REC_FCAT TYPE SLIS_FIELDCAT_ALV.
L_REC_FCAT-TABNAME = FP_I_TABNAME.
L_REC_FCAT-FIELDNAME = FP_I_FIELDNAME.
L_REC_FCAT-SELTEXT_L = FP_I_SELTEXT.
L_REC_FCAT-DO_SUM = 'X'.
*l_rec_fcat-do_sum = ' '.
L_REC_FCAT-JUST = FP_I_JUST.
L_REC_FCAT-OUTPUTLEN = FP_I_OUTPUTLEN.
L_REC_FCAT-DECIMALS_OUT = '2'.
L_REC_FCAT-KEY = '1'.
APPEND L_REC_FCAT TO FP_I_FCAT.
ENDFORM. " f_create_catalog
Subroutines for Headings
*& Form f_display_header_partA
Display header for report for Part A
*& Form top_of_page
text
--> p1 text
<-- p2 text
FORM TOP_OF_PAGE .
SKIP 1.
WRITE:/25 ' Name of Company ',80 'RUN DATE' ,
SY-DATUM.
SKIP 1.
WRITE:/60 'RUN DATE' , SY-DATUM.
SKIP 1.
DATA: YR(4) TYPE N,
FIN_PRD(10) TYPE C.
IF S_DTABF-LOW+4(2) LT '04'.
YR = S_DTABF-LOW+0(4) - 1.
CONCATENATE YR '-' S_DTABF-LOW+2(2) INTO FIN_PRD.
ELSE.
YR = S_DTABF-LOW+0(4) + 1.
CONCATENATE S_DTABF-LOW0(4) '-' YR2(2) INTO
FIN_PRD.
ENDIF.
WRITE:/5 'DETAILS OF THE MONTH/DATE WISE DESPATCHES
MADE BY ROAD/RAIL DURING THE YEAR ' , FIN_PRD .
SKIP 1.
WRITE :/ 'SALES OFFICE : ' , P_SALES,' ' , RNAME.
SKIP 1.
ENDFORM. " DISPLAY_DATA
Award Points If Useful... -
Function REUSE_ALV_GRID_DISPLAY
Hi !
I wanted to ask few questions concern a standard sap ALV report created by the function REUSE_ALV_GRID_DISPLAY :
1. How to make columns editable, and to enable the user to change values of the columns ?
2. How to make drop down list to a column ?
3. How to add a function code to the ALV toolbar ?
4. When i use the abap commands at event handler user_command_l :
READ TABLE object_tab INDEX p_selfield-tabindex INTO l_struct.
IF sy-subrc EQ 0.
SET PARAMETER ID: 'QPN' FIELD l_struct-field1 .
CALL TRANSACTION 'QPR2' AND SKIP FIRST SCREEN.
endif.
Then abap navigate to 'QPR2' transaction however i get the error mesage "field1 is already being processed by my user". My question is how to enable using field1 before the navigation ?
Please give additional material besides the documentation of the REUSE_ALV_GRID_DISPLAY function.
Thanks
MosheHi Mohse,
1.How to make columns editable, and to enable the user to change values of the columns
use layout.
layout-EDIT = 'X'.
and pass this layout while calling FM.
2. How to make drop down list to a column ?
If the field in the internal table
is assigned to table-field name,eg. t001-bukrs,
then ,probably, it will come automatically!
( i doubt)
3. How to add a function code to the ALV toolbar ?
a) from se80, function group salv,
copy the gui status 'STANDARD'
(by right clicking)
to your program
with the name say , 'STANDARD_COPY'
B) WRITE ONE FORM.
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD_COPY'.
ENDFORM. "SET_PF_STATUS
C) WHILE CALLING fm reuse_alv_list_display
also pass this parameter :
i_callback_pf_status_set = 'SET_PF_STATUS'
MAKE SURE YOUR GUI STATUS IS ACTIVE IN UR PROGRAM.
PS
4.
Then abap navigate to 'QPR2' transaction however i get the error mesage "field1 is already being processed by my user". My question is how to enable using field1 before the navigation ?
This is becuase, in another session,
u must have opened this tcode
with the same value.
Hence, it tries to tell that,
two users cannot access/modify it simulataenouslyy.
This is not alv problem, but general
security /locking maintained by r3.
Just close all other session of this tcode.
and try agin. it will work.
regards,
amit m.
Message was edited by: Amit Mittal
Message was edited by: Amit Mittal -
Refresh REUSE_ALV_GRID_DISPLAY with Field Catalog
Hi Gurus.
Basicly : How can I refresh my ALV grid via field catalog?
Detail : I want refresh my ALV Grid (I am using Reuse_Alv_Grid_Display) with field catalog. Our end users want show/hide some columns. I have been adding a button at toolbar. If user click this. My ALV grid going refresh and show/hide columns. I have a global variable for this. If user click this I set its value X or ''. I set my catalog
Wa_cat-No_out = p_show
p_show will be 'X' or ''.
Perform Create_Alv_Catalog.
Perform ALVDisplay Tables IRapor.
If I re execute this lines. It is open another grid. It is not working clearlyHi Mehmet,
1. Due to some reasons, this
technique DOES NOT WORK.
2. However, we have a WORKAROUND
and it works FANTASTIC.
3. the key is
slis_selfield-EXIT = 'X'.
(in the call back FORM)
4. In the call back form,
do the following things :
a) reconstruct field catalogue,
b) show alv AGAIN
c) slis_selfield-EXIT = 'X'.
5. just copy paste this code in new program
a) it will show t001 (company info)
b) on double-clicking,
it will HIDE company text.
6.
REPORT abc.
TYPE-POOLS : slis.
Data
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : END OF itab.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvwa TYPE slis_fieldcat_alv.
Select
SELECT * FROM t001 INTO TABLE itab.
*------- Field Catalogue
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
Display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid
i_callback_user_command = 'ITAB_USER_COMMAND'
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.
LOOP AT alvfc INTO alvwa.
IF alvwa-fieldname = 'BUTXT'.
alvwa-no_out = 'X'.
MODIFY alvfc FROM alvwa.
ENDIF.
ENDLOOP.
*------- Field Catalogue
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
Display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid
i_callback_user_command = 'ITAB_USER_COMMAND'
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IMPORTANT.
IMPORTANT.
whatrow-exit = 'X'.
ENDFORM. "itab_user_command
regards,
amit m. -
Hi,
I was wondering if anyone had a simple solution on using a TreeView control with checkboxes.
The only required functionality would be:
Clicking on the CheckBox beside an item that has children will result in all children also becoming selected/unselected.
Clicking on the CheckBox beside an item that has a parent will result in the parent also becoming selected.
Currently I'm just adding a checkbox and some other stuff to a hbox that goes into .setGraphic() in the cellfactory of the tree and then trying to code everthing that needs to be done in the action event of the added checkbox. This is problematic in many ways :)
I just know there is a clean solution for this out there!
Cheers,
NuwandaI implemented this a while ago using a custom TreeCell and also by extending TreeItem to have selected and indeterminate properties. This means you have to build the TreeView using CheckBoxTreeItem instances, and with the custom cell factory, but once you do that it works as expected. I've put up a screenshot at [1], and will have a download at [2] next week during my JavaOne talk.
[1] http://www.javafxdata.org/screenshots/CheckBoxCell-TreeView.PNG
[2] http://www.javafxdata.org
-- Jonathan -
How to adjust column length in function REUSE_ALV_GRID_DISPLAY
Hi,
I am using this function REUSE_ALV_GRID_DISPLAY to display .Please tell how to adjust the column length in this function, so that it is set to default field name size.
thanksHi anu,
The column width can be adjusted by using the following method:
-> define layout of the type.
data: it_layout type slis_layout_alv.
-> call the reuse alv... by using the is_layout field name with the above defined variable.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = <program that calls reuse>
I_CALLBACK_PF_STATUS_SET = < form to set pf-status>
I_CALLBACK_USER_COMMAND = <form to catch user command>
I_STRUCTURE_NAME = < structure to be passed>
I_GRID_TITLE = < any title to appear on top of the grid display>
IS_LAYOUT = it_layout
IT_FIELDCAT = IT_FIELDCAT[]
IT_EVENTS =
IT_EVENT_EXIT = I_EVENT_EXIT < to capture exit event>
I_SCREEN_START_COLUMN = 0 <screen settings>
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_INACT_OBJ
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.
-> write a form to set the layout of the grid...
*& Form build_layout
text
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
Set layout field for row attributes(i.e. color)
gd_layout-info_fieldname = 'LINE_COLOR'.
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for double click or "click(press f2)
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " build_layout
endform.
This will optimize the output of the grid display.
Hope this helps!!!
Revert if any queries!!!
regards,
Naveenan. -
Accessing Node Labels - TreeControl with CheckBoxes
Hello,
I have a Tree component that is loaded with CheckBoxes. Each node has a label associated with it, and I need to be able to collect the labels and display them on the right of the component - probably using a Label or Text control.
I can't seem to figure out how to access the names of the items that are checked. I'm including a complete, and simplified, mxml file. If anyone would like to take a look at it, I would appreciate it.
Thanks.
OH - And I am using the Tree CheckBox component from this site: http://www.sephiroth.it/file_detail.php?id=151
Sorry, but the forum will not allow me to upload the files directly.
You will probably need to add those classes to see the Tree CheckBox.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:controls1="it.sephiroth.controls.*">
<mx:Script>
<![CDATA[
import mx.events.DataGridEvent;
import mx.controls.dataGridClasses.DataGridColumn;
import mx.effects.easing.Bounce;
import mx.effects.easing.Elastic;
import components.MyPanel;
import mx.effects.easing.Bounce;
import mx.effects.easing.Elastic;
import mx.events.MenuEvent;
import mx.controls.Alert;
import mx.controls.Menu;
import mx.events.CloseEvent;
import mx.controls.*;
import mx.events.ListEvent;
import mx.events.TreeEvent;
import it.sephiroth.renderers.TreecheckboxItemRenderer;
//******************************* TREE CONTROL CHECKBOX ******************************************
* Called on checkbox click
* check and update for both parents and child nodes
* according to the checkbox status
private function onItemCheck( event: TreeEvent ): void
updateParents( event.item as XML, ( event.itemRenderer as TreecheckboxItemRenderer ).checkBox.checkState );
updateChilds( event.item as XML, ( event.itemRenderer as TreecheckboxItemRenderer ).checkBox.checkState );
* @see it.sephiroth.controls.CheckBoxExtended#checkState
private function updateChilds( item:XML, value: uint ):void
var middle: Boolean = ( value & 2 << 1 ) == ( 2 << 1 );
var selected: Boolean = ( value & 1 << 1 ) == ( 1 << 1 );
if( item.children( ).length( ) > 0 && !middle )
for each(var x: XML in item.node )
x.@checked = value == ( 1 << 1 | 2 << 1 ) ? "2" : value == ( 1 << 1 ) ? "1" : "0";
updateChilds( x, value );
private function updateParents( item: XML, value: uint ): void
var checkValue: String = ( value == ( 1 << 1 | 2 << 1 ) ? "2" : value == ( 1 << 1 ) ? "1" : "0" );
var parentNode: XML = item.parent( );
if( parentNode )
for each(var x: XML in parentNode.node )
if( x.@checked != checkValue )
checkValue = "2"
parentNode.@checked = checkValue;
updateParents( parentNode, value );
]]>
</mx:Script>
<!--********************* CHOOSE FUNCTIONAL AREAS/CAPABILITIES FOR SCENARIO TREE DATA ******************-->
<!--
Example of the xml used as dataprovider
for the treecheckbox component.
@label used for the item label
@checked used for the checked status:
0 = un-checked
1 = selected
2 = 3rd status selected
otherwise you can use the set the "checkField" attributes of the
treecheckbox component to specify which xml attribute to use for the
checked status
-->
<mx:XML xmlns="" id="treeSource">
<node label="home" checked="">
<node label="First Responder" checked="">
<node label="1RSP First Responder - Medical" checked=""/>
</node>
<node label="Battalion Aid Station/Sick Call" checked="">
<node label="Battalion Aid Station" checked=""/>
<node label="BAS - NBC" checked=""/>
<node label="Evac" checked=""/>
</node>
<node label="Forward Resuscitative Surgery (FRSS)" checked="">
<node label="Pre-Op" checked=""/>
<node label="Operating Room" checked=""/>
<node label="Post-Op" checked=""/>
<node label="Evac" checked=""/>
</node>
<node label="Surgical Company" checked="">
<node label="Triage/SST" checked=""/>
<node label="Triage Evac" checked=""/>
<node label="Operating Room" checked=""/>
<node label="OR Evac" checked=""/>
<node label="OR Evac" checked=""/>
<node label="Ward" checked=""/>
<node label="X-Ray" checked=""/>
<node label="Laboratory" checked=""/>
<node label="Pharmacy" checked=""/>
<node label="NBC Unit" checked=""/>
<node label="Dental" checked=""/>
<node label="PMO/EHO/PMT" checked=""/>
<node label="PM Entomology" checked=""/>
<node label="Occupational and Environmental Healty Sur" checked=""/>
</node>
</node>
</mx:XML>
<controls1:TreeCheckBox id="mytree"
showRoot="false"
width="345"
height="100%"
dataProvider="{treeSource}"
openItems="{treeSource..node}"
labelField="@label"
checkField="@checked"
itemCheck="onItemCheck( event )"
/>
<mx:Label x="455" y="48" text="Label" fontSize="16" color="#FFFFFF" id="tree_label1"/>
</mx:Application>Natasha,
Thanks for your reply.
I attempted the code:
public function get labelText():String
if (this.label != null)
return this.label.text
else
return "";
return "";
But when I try to access the code in the application I get the error "Call to possibley undefined method labelText."
I'm not sure I understand exactly how to implement this change within the application itself. Could you explain? Thanks. -
I need to have an ItemRenderer in the Grids that will combine a combobox with checkboxes. Any idea/sample?
ThanksFinally i used a double change:
<mx:Component>
<mx:CheckBox selectedField="selected" change="data.selected = selected; outerDocument.filtromeses()" />
</mx:Component>
Because this checkbox its inside a Component tag, if i want to access the filtromeses() function thats outside, need to add the OuterDocument.
Not sure if its the best way but it works.
Thanks -
I am new to flex and working on developing a UI . I have a textinput to enter an id and a search button.once the search button is clicked after the user enters the data, it will make a http call which will fetch the results in xml format and then populate the data in a datagrid.
once the data is populated, i have check boxes againt each row in the datagrid. Also I have two more buttons (say B1, B2) outside the datagrid but within the same panel.
The above part is working fine. I am struck with the below requirement.
Now my requirement is if I select any one checkbox and click on either B1 or B2 button,
1. I should be able to read the complete row details of the selected checbox
2. Should be able to make a http service call and pass one of the column value ( from the selected row) as a request parameter
3. Retrieve the result in an xml format. now this result had to be populated in a seperate datagrid as part of popup window
I am really struck on this and trying since a week , not able to proceed further.
Any help on this is greatly appreciated.In the following code you will find an completely itemRenderer as CheckBox. I used because of serveral reasons:
1. The checkbox should be in the middle of a table cell (use of VBox)
2. Encapsulate this renderer for further DataGrids
3. Data independency
// Begin of Renderer
<s:MXDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
focusEnabled="true" horizontalCenter="0"
implements="mx.managers.IFocusManagerComponent">
<fx:Script>
<![CDATA[
import mx.managers.IFocusManagerComponent;
[Bindable]
public var result:Boolean = false;
[Bindable]
private var _checked:Boolean = false;
public function get checked():Boolean
return _checked;
public function set checked(value:Boolean):void
_checked = value;
override public function setFocus():void
checkBox.setFocus();
]]>
</fx:Script>
<mx:VBox horizontalAlign="center" horizontalCenter="0">
<mx:CheckBox id="checkBox" selected="{_checked}" updateComplete="result=checkBox.selected" " />
</mx:VBox>
</s:MXDataGridItemRenderer>
//End of Renderer
Now you can use this renderer in a DataGrid, which you see in the following code:
<mx:DataGridColumn ... dataField="property of the Object" rendererIsEditor="true" editorDataField="result" itemRenderer="path to the Renderer (app.renderer.CheckBoxRender for example)" />
Maybe you are looking for
-
Enterprise search configuration in SharePoint 2013
hi friends i have SharePoint publishing site it is configured with enterprise search center. each page in pages library have different permissions. in my scenario there are two users and four pages user1 has permission to page-1 and page-2, User2 ha
-
SCC file creator application?
Hi everyone, could someone, please, recommend an application that creates the so called Source Safe Format files. I need to create closed captioning for broadcast (not subtitles) that your TV set will recognize from the signal on vertical line 21. It
-
Server.app 3.2.1 Failure/Issue summary
Hello everybody, since my Server broken down with the current update I read about so many problems with Server 3.2.1. I like to give everybody a list of discussed Problems. I hope Apple will fix all this issues soon as possible: 1. ProfileManager mig
-
Access Violation calling GetMethodId
Hi ! I'm getting an access violation on the jvm.dll when trying to execute a call from the native side. Well, in fact, the exception is raised when a try to get the method reference, by calling GetMethodId (). The _javaClass variable is a class attri
-
How Mathscrpt node can find m files in MATLAB
Hi, When trying to differentiate between MATLAB node and MATHSCRIPT node, I found that MATLAB node requires matlab to be installed as labview and matlabe are communicating via activex server technology. Very well. My question is if I have seve