Enable to select a check box in ALV while accessing it through portal
Hi All,
Currently I have given a link on portal to run a transaction code. The output of the program is ALV report, where user any select the check boxes.
Now when I try to select a check box, it is not getting selected. I click on the checkbox, the tick appear and then the screen refreshes itself and the tick goes off. This is happening only when accessing it through portal. If i run the program in R/3 directly, I am able to select the check box.
Please advice on this.
Thanks
Namit
Reported to SAP for the same.
Similar Messages
-
hi,
the first column of my alv grid display is check boxes. i want all the check boxes to be checked when the user clicks on the select all button present on the grid.it very urgently required.plz give me the code.
thanks & regards,
santoshHi santosh nayak ,
on the action method of select all button, read the the whole alv. Set the value of the first field as abap_true. Bind the itab back to the node.
Regards
Sarath -
How to print check box in ALV list display and how to pick selected ones
Hi
i am displaying one ALV list dispaly. for that im adding one check box fields by filling the fieldcat as below:
wa_fldcat-checkbox = 'X'.
wa_fldcat-edit = 'X'.
but the check box is showing disable mode only. i want to display that check box and if i select that check box i want pick that records. for ALV grid i found one FM to pick records of selectedones as below.
DATA ref_grid TYPE REF TO cl_gui_alv_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF ref_grid IS NOT INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
but how can i do for list display to pick those selected one records.
Can any one sugget regarding this.
Thanks in advance.
Rahul.Hi,
Thanks. now it's enabled. but how can we pick the records from that list whichever i selected through that check box.
i found this one for ALV grid:
DATA ref_grid TYPE REF TO cl_gui_alv_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF ref_grid IS NOT INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
but how for ALV normal list display.
Thanks.
rahul -
Check box in ALV selection screen
Hi to all
I like to know how to create a checkbox in the input screen of an ALV.What do you mean by ALV check box selection screen?
ALV and selection screen check box( you are mixing two cases in your Question).
You need use the Function moduel in the user command to get the updated data.
in fieldcatalog you have to use INPUT = 'X' and EDIT = 'X' for the columns which ever you want edit.
GET_GLOBALS_FROM_SLVC_FULLSCR
follow the sample code.
REPORT ZTEST_ALV_CHECK MESSAGE-ID ZZ .
TYPE-POOLS: SLIS.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
L_LAYOUT TYPE SLIS_LAYOUT_ALV,
X_EVENTS TYPE SLIS_ALV_EVENT,
IT_EVENTS TYPE SLIS_T_EVENT.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
CHK(1),
color(4),
END OF ITAB.
SELECT VBELN
POSNR
FROM VBAP
UP TO 20 ROWS
INTO TABLE ITAB.
X_FIELDCAT-FIELDNAME = 'CHK'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
X_FIELDCAT-INPUT = 'X'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-CHECKBOX = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-SELTEXT_L = 'VBELN'.
X_FIELDCAT-HOTSPOT = 'X'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 2.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-SELTEXT_L = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 3.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_LAYOUT-info_fieldname = 'COLOR'.
*L_LAYOUT-ZEBRA = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*& Form STATUS
text
-->P_EXTAB text
FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.
Pf status
SET PF-STATUS 'STATUS'.
ENDFORM. " STATUS
*& Form USER_COMMAND
text
-->R_UCOMM text
-->RS_SELFIELD text
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
DATA: GD_REPID LIKE SY-REPID, "Exists
REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
IF REF_GRID IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF_GRID.
ENDIF.
IF NOT REF_GRID IS INITIAL.
CALL METHOD REF_GRID->CHECK_CHANGED_DATA .
ENDIF.
loop at itab where chk = 'X'.
itab-color = 'C300'.
modify itab index sy-tabix transporting color.
endloop.
RS_SELFIELD-refresh = 'X'.
break-point.
ENDFORM. "USER_COMMAND
Regards
Vijay Babu Dudla -
hi
i am displaying list alv with check boxes, now i want to select few check boxes and doing some operation, after this operation i need to disable thoese check box.
can u pls guide me.
thanks.Hi,
using styles it is possible.
first you need to declare the one extra field in the internal table..
1. HANDLE_STYLE TYPE LVC_T_STYL.
DECLARE work area,and table
2. DATA: LS_EDIT TYPE LVC_S_STYL,
LT_EDIT TYPE LVC_T_STYL.
changing the style...
3.
LOOP AT IT_FINAL INTO LS_OUTTAB WHERE FLAG = 'X'.
V_INDEX = SY-TABIX.
LS_EDIT-FIELDNAME = 'MATNR'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 8.
INSERT LS_EDIT INTO TABLE LT_EDIT.
LS_EDIT-FIELDNAME = 'VBELN'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENAABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 8.
INSERT LS_EDIT INTO TABLE LT_EDIT.
LS_EDIT-FIELDNAME = 'POSNR'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 8.
INSERT LS_EDIT INTO TABLE LT_EDIT.
INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
MODIFY IT_FINAL INDEX V_INDEX FROM LS_OUTTAB TRANSPORTING
HANDLE_STYLE .
ENDLOOP.
assigning the style to Layout..
4. GS_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
REUSE_ALV_GRID_DISPLAY_LVC. you can do the same with CL_GUI_ALV_GRID also.
REPORT ZTESTALV.
TYPE-POOLS: SLIS.
*- Fieldcatalog
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV..
*- For Events
DATA:IT_EVENTS TYPE SLIS_T_EVENT.
DATA: X_FIELDCAT TYPE LVC_S_FCAT,
X_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.
DATA:X_LAYOUT TYPE LVC_S_LAYO.
"{ FOR DISABLE
DATA: LS_EDIT TYPE LVC_S_STYL,
LT_EDIT TYPE LVC_T_STYL.
"} FOR DISABLE
DATA: BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
HANDLE_STYLE TYPE LVC_T_STYL, "FOR DISABLE
BUTTON(10),
END OF IT_VBAP.
DATA: LS_OUTTAB LIKE LINE OF IT_VBAP.
SELECT VBELN
POSNR
UP TO 10 ROWS
INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
FROM VBAP.
DATA:L_POS TYPE I VALUE 1.
CLEAR: L_POS.
L_POS = L_POS + 1.
X_FIELDCAT-SELTEXT = 'VBELN'.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
*X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
x_fieldcat-ref_field = 'VBELN'.
x_fieldcat-ref_table = 'VBAK'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SELTEXT = 'POSNR'.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
*X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
"{FOR DISABLE HERE 6ROW IS DISABLED
SY-TABIX = 6.
LS_EDIT-FIELDNAME = 'VBELN'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 10.
INSERT LS_EDIT INTO TABLE LT_EDIT.
LS_EDIT-FIELDNAME = 'POSNR'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 6.
INSERT LS_EDIT INTO TABLE LT_EDIT.
INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
MODIFY IT_VBAP INDEX SY-TABIX FROM LS_OUTTAB TRANSPORTING
HANDLE_STYLE .
X_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
"} UP TO HERE
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT_LVC = X_LAYOUT
IT_FIELDCAT_LVC = IT_FIELDCAT
TABLES
T_OUTTAB = IT_VBAP[]
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.
The above code i am modifying the 6 record . you can place your condition.using loop and endloop. you can disable many records/check box also.
Follow the next steps:
1. Add the following fields in the internal table:
checkbox TYPE c,
celltab TYPE lvc_t_styl,
2. Define a table and a work-area:
DATA: wa_celltab TYPE lvc_s_styl,
ta_celltab TYPE lvc_t_styl.
3. Update the internal table BEFORE display :
LOOP AT ta_data INTO wa_data.
h_tabix = sy-tabix.
Update field CHECKBOX (enable/disable INPUT)
REFRESH ta_celltab.
wa_celltab-fieldname = 'CHECKBOX'.
IF NOT wa_data-xxxxx IS INITIAL.
wa_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
ELSE.
wa_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
ENDIF.
INSERT wa_celltab INTO TABLE ta_celltab.
INSERT LINES OF ta_celltab INTO TABLE wa_data-celltab.
Update internal table
MODIFY ta_data FROM wa_data INDEX h_tabix.
ENDLOOP.
4. Define CHECKBOX in fieldcatalog
CLEAR wa_catalog.
wa_catalog-fieldname = 'CHECKBOX'.
wa_catalog-col_pos = 9.
wa_catalog-coltext = 'Checkbox'.
wa_catalog-checkbox = 'X'.
wa_catalog-edit = 'X'.
APPEND wa_catalog TO ta_catalog.
5. Call ALV
CREATE OBJECT h_custom_container
EXPORTING container_name = h_container.
CREATE OBJECT h_grid
EXPORTING i_parent = h_custom_container.
CALL METHOD h_grid->set_table_for_first_display
EXPORTING
it_toolbar_excluding = wa_toolbar
is_layout = wa_layout
CHANGING
it_outtab = ta_kntkn
it_fieldcatalog = ta_catalog
it_sort = ta_sort.
CALL METHOD h_grid->set_ready_for_input
EXPORTING i_ready_for_input = 1.
Regards
vasu -
How to get check box in alv output
hi gurus
can anyone explian me how to get check box in alv output
it should not be a pop up window
i want to get in output itself
tahnk you
regards
kals.Hi
by using rs_selfield
ty to call dynamic subroutine..
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
read table rs-selfield with key cond = 'X'
endform.
see the below example
REPORT Z_GET_REFRESH no standard page heading.
type-pools : slis.
tables : makt,
mara.
data : i_fieldcat type slis_t_fieldcat_alv.
CONSTANTS :
gc_refresh TYPE syucomm VALUE '&REFRESH'.
data : begin of i_makt occurs 0,
matnr like makt-matnr,
maktx like makt-maktx,
end of i_makt.
data : v_repid like sy-repid,
g_user_command type slis_formname value 'USER_COMMAND',
g_status_set type slis_formname value 'SET_PF_STATUS',
lt_event_exit TYPE slis_t_event_exit,
ls_event_exit TYPE slis_event_exit.
DATA:LC_GLAY TYPE LVC_S_GLAY.
select-options s_matnr for mara-matnr .
start-of-selection.
select matnr maktx from makt into table i_makt
where matnr in s_matnr.
end-of-selection.
Fill the fieldcatlog
perform fill_field.
Call the FM
perform call_fm.
*& Form fill_field
text
--> p1 text
<-- p2 text
FORM fill_field.
data wa_fieldcat type slis_fieldcat_alv.
clear : wa_fieldcat.
wa_fieldcat-tabname = 'I_MAKT'.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-outputlen = '18'.
wa_fieldcat-seltext_l = 'Material #'.
wa_fieldcat-col_pos = '1'.
append wa_fieldcat to i_fieldcat.
clear : wa_fieldcat.
wa_fieldcat-tabname = 'I_MAKT'.
wa_fieldcat-fieldname = 'MAKTX'.
wa_fieldcat-outputlen = '40'.
wa_fieldcat-seltext_l = 'Material Desc'.
wa_fieldcat-col_pos = '2'.
append wa_fieldcat to i_fieldcat.
ENDFORM. " fill_field
*& Form call_fm
text
--> p1 text
<-- p2 text
FORM call_fm.
v_repid = sy-repid.
LC_GLAY-EDT_CLL_CB = 'X'.
CLEAR ls_event_exit.
ls_event_exit-ucomm = gc_refresh. " Refresh
ls_event_exit-after = 'X'.
APPEND ls_event_exit TO lt_event_exit.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = g_status_set
I_CALLBACK_USER_COMMAND = g_user_command
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS = LC_GLAY
IS_LAYOUT =
IT_FIELDCAT = i_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT = lt_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_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_makt
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " call_fm
FORM USER_COMMAND *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
data i_RSPARAMS like RSPARAMS occurs 0.
CASE R_UCOMM.
WHEN '&IC1'.
read table i_makt index rs_selfield-tabindex.
SET PARAMETER ID 'MAT' FIELD i_makt-matnr.
if not i_makt-matnr is initial.
call transaction 'MM02' and skip first screen.
endif.
when '&REFRESH'.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
CURR_REPORT = v_repid
IMPORTING
SP =
TABLES
SELECTION_TABLE = i_RSPARAMS
EXCEPTIONS
NOT_FOUND = 1
NO_REPORT = 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.
submit z_get_refresh with selection-table i_RSPARAMS.
rs_selfield-refresh = 'X'.
ENDCASE.
MOVE '&REFRESH' TO r_ucomm.
ENDFORM.
FORM set_pf_status *
FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
DELETE Rt_extab WHERE fcode = gc_refresh.
SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLKKBL'
EXCLUDING Rt_extab.
*SET PF-STATUS 'STANDARD' EXCLUDING rt_extab.
SET TITLEBAR sy-tcode.
ENDFORM. -
How to get check box in alv grid list output
hi gurus,
can anyone inform me
how to get check box in alv output it should not be a pop up window
thank you
regards
kals.or
hi go through the fallowing code.
code*&----
*& Report YGS_ALV_BOM *
REPORT YGS_ALV_BOM .
TABLES : MAST,STKO,STPO.
TYPE-POOLS: SLIS.
TYPES : BEGIN OF TY_MAST,
CHECK_BOX,
MATNR TYPE MAST-MATNR,
WERKS TYPE MAST-WERKS,
STLAN TYPE MAST-STLAN,
STLNR TYPE MAST-STLNR,
STLAL TYPE MAST-STLAL,
END OF TY_MAST.
TYPES : BEGIN OF TY_STKO,
STLTY TYPE STKO-STLTY,
STLNR TYPE STKO-STLNR,
STLAL TYPE STKO-STLAL,
STKOZ TYPE STKO-STKOZ,
BMENG TYPE STKO-BMENG,
BMEIN TYPE STKO-BMEIN,
END OF TY_STKO.
TYPES : BEGIN OF TY_STPO,
LIGHTS,
STLTY TYPE STPO-STLTY,
STLNR TYPE STPO-STLNR,
STLKN TYPE STPO-STLKN,
STPOZ TYPE STPO-STPOZ,
IDNRK TYPE STPO-IDNRK,
MENGE TYPE STPO-MENGE,
MEINS TYPE STPO-MEINS,
END OF TY_STPO.
DATA : IT_MAST TYPE TABLE OF TY_MAST,
WA_MAST TYPE TY_MAST,
IT_STKO TYPE TABLE OF TY_STKO,
WA_STKO TYPE TY_STKO,
IT_STPO TYPE TABLE OF TY_STPO,
WA_STPO TYPE TY_STPO.
DATA : lt_fieldcat TYPE slis_t_fieldcat_alv,
ls_layout TYPE slis_layout_alv,
ls_event TYPE slis_alv_event,
lt_event TYPE slis_t_event,
it_sortinfo type slis_t_sortinfo_alv,
ls_header TYPE slis_listheader,
lt_header TYPE slis_t_listHEADER.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
SELECT-OPTIONS : S_MATNR FOR MAST-MATNR.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM BUILD_FIELDCAT USING LT_FIELDCAT.
PERFORM BUILD_LAYOUT.
END-OF-SELECTION.
PERFORM DISPLAY_DATA.
*& Form GET_DATA
text
--> p1 text
<-- p2 text
form GET_DATA .
REFRESH : IT_MAST.
SELECT MATNR
WERKS
STLAN
STLNR
FROM MAST
INTO CORRESPONDING FIELDS OF TABLE IT_MAST
WHERE MATNR IN S_MATNR.
endform. " GET_DATA
*& Form BUILD_FIELDCAT
text
--> p1 text
<-- p2 text
form BUILD_FIELDCAT USING LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
REFRESH : LT_FIELDCAT.
L_FIELDCAT-COL_POS = 1.
L_FIELDCAT-FIELDNAME = 'MATNR'.
L_FIELDCAT-TABNAME = 'IT_MAST'.
L_FIELDCAT-REF_FIELDNAME = 'MATNR'.
L_FIELDCAT-REF_TABNAME = 'MAST'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 2.
L_FIELDCAT-FIELDNAME = 'WERKS'.
L_FIELDCAT-TABNAME = 'IT_MAST'.
L_FIELDCAT-REF_FIELDNAME = 'WERKS'.
L_FIELDCAT-REF_TABNAME = 'MAST'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 3.
L_FIELDCAT-FIELDNAME = 'STLNR'.
L_FIELDCAT-TABNAME = 'IT_MAST'.
L_FIELDCAT-REF_FIELDNAME = 'STLNR'.
L_FIELDCAT-REF_TABNAME = 'MAST'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
endform. " BUILD_FIELDCAT
*& Form BUILD_LAYOUT
text
--> p1 text
<-- p2 text
form BUILD_LAYOUT .
CLEAR LS_LAYOUT.
LS_LAYOUT-BOX_FIELDNAME = 'CHECK_BOX'.
LS_LAYOUT-BOX_TABNAME = 'IT_MAST'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_DATA
text
--> p1 text
<-- p2 text
form DISPLAY_DATA .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME =
IS_LAYOUT = LS_LAYOUT
IT_FIELDCAT = LT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_MAST
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " DISPLAY_DATA
FORM PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'YSTATUS' OF PROGRAM SY-REPID
EXCLUDING RT_EXTAB.
ENDFORM.
FORM USER_COMMAND USING RF_UCOMM TYPE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CASE RF_UCOMM.
WHEN '&NEXT'.
PERFORM GET_DATA_BOM .
PERFORM BUILD_FIELDCAT_BOM USING LT_FIELDCAT.
PERFORM BUILD_LAYOUT_BOM.
PERFORM DISPLAY_DATA_BOM.
ENDCASE.
ENDFORM.
*& Form GET_DATA_BOM
text
--> p1 text
<-- p2 text
form GET_DATA_BOM .
CLEAR : WA_STPO,
WA_MAST.
REFRESH : IT_STPO.
DATA : IT_CHECK TYPE TABLE OF TY_MAST.
LOOP AT IT_MAST INTO WA_MAST.
IF WA_MAST-CHECK_BOX EQ 'X'.
APPEND WA_MAST TO IT_CHECK.
ENDIF.
ENDLOOP.
SELECT STLTY
STLNR
STLKN
VGKNT
IDNRK
MENGE
MEINS
FROM STPO
INTO CORRESPONDING FIELDS OF TABLE IT_STPO
FOR ALL ENTRIES IN IT_CHECK
WHERE IDNRK EQ IT_CHECK-MATNR.
CLEAR WA_STPO.
LOOP AT IT_STPO INTO WA_STPO.
SELECT SINGLE * FROM MAST WHERE MATNR EQ WA_STPO-IDNRK.
IF SY-SUBRC = 0.
WA_STPO-LIGHTS = '2'.
ELSE.
WA_STPO-LIGHTS = '1'.
ENDIF.
MODIFY IT_STPO FROM WA_STPO.
ENDLOOP.
endform. " GET_DATA_BOM
*& Form BUILD_FIELDCAT_BOM
text
--> p1 text
<-- p2 text
form BUILD_FIELDCAT_BOM USING LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
REFRESH : LT_FIELDCAT.
L_FIELDCAT-COL_POS = 1.
L_FIELDCAT-FIELDNAME = 'STLTY'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'STLTY'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 2.
L_FIELDCAT-FIELDNAME = 'STLNR'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'STLNR'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 3.
L_FIELDCAT-FIELDNAME = 'STLKN'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'STLKN'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 4.
L_FIELDCAT-FIELDNAME = 'IDNRK'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'IDNRK'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 5.
L_FIELDCAT-FIELDNAME = 'MENGE'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'MENGE'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
endform. " BUILD_FIELDCAT_BOM
*& Form BUILD_LAYOUT_BOM
text
--> p1 text
*<-- p2 text
form BUILD_LAYOUT_BOM .
CLEAR : LS_LAYOUT.
LS_LAYOUT-LIGHTS_FIELDNAME = 'LIGHTS'.
LS_LAYOUT-LIGHTS_TABNAME = 'IT_STPO'.
endform. " BUILD_LAYOUT_BOM
*& Form DISPLAY_DATA_BOM
text
--> p1 text
<-- p2 text
form DISPLAY_DATA_BOM .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND_BOM'
I_CALLBACK_TOP_OF_PAGE = 'TOP9'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = LS_LAYOUT
IT_FIELDCAT = LT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
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_STPO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " DISPLAY_DATA_BOM
FORM TOP9 .
CLEAR LS_HEADER.
REFRESH LT_HEADER.
LS_HEADER-TYP = 'H'.
LS_HEADER-INFO = 'BILL OF MATERIALS'.
APPEND LS_HEADER TO LT_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = LT_HEADER
I_LOGO = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID =
ENDFORM.
FORM USER_COMMAND_BOM USING RF_UCOMM_BOM LIKE SY-UCOMM
SEL_FIELD TYPE SLIS_SELFIELD.
CASE RF_UCOMM_BOM.
WHEN '&IC1'.
SET PARAMETER ID 'MAT' FIELD WA_STPO-IDNRK.
SET PARAMETER ID 'WRK' FIELD WA_MAST-WERKS.
SET PARAMETER ID 'CSA' FIELD WA_MAST-STLAN.
CALL TRANSACTION 'CS03' AND SKIP FIRST SCREEN.
ENDCASE.[/code] -
How to create check box in ALV Reports?
how to create check box in ALV Reports?
Hi
check the report BCALV_TEST_GRID_EDITABLE
or
check this report
REPORT ZRFC346_TST.
TABLES:SFLIGHT,RL034.
TYPE-POOLS:SLIS.
INCLUDE:<ICON>,<SYMBOL>.
DATA: G_REPID LIKE SY-REPID,
G_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
G_IT_SORT TYPE SLIS_T_SORTINFO_ALV,
G_LAYOUT TYPE SLIS_LAYOUT_ALV,
G_TABNAME_HEADER TYPE SLIS_TABNAME,
G_TABNAME_ITEM TYPE SLIS_TABNAME,
G_KEYINFO TYPE SLIS_KEYINFO_ALV,
G_VARIANT LIKE DISVARIANT,
G_EXTAB TYPE SLIS_T_EXTAB,
I_SLIS_EXIT_BY_USER TYPE SLIS_EXIT_BY_USER.
DATA: XEVENT TYPE SLIS_T_EVENT,
AEVENT TYPE SLIS_ALV_EVENT,
VARIANT LIKE DISVARIANT,
LAYOUT TYPE SLIS_LAYOUT_ALV,
ASP_GROUP TYPE SLIS_SP_GROUP_ALV,
GT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV,
EXTAB TYPE SLIS_T_EXTAB WITH HEADER LINE,
XFIELD TYPE SLIS_T_FIELDCAT_ALV,
AFIELD TYPE SLIS_FIELDCAT_ALV,
G_SUCOMM LIKE SY-UCOMM,
G_SELFLD TYPE SLIS_SELFIELD.
DATA: SAV_SY_REPID LIKE SY-REPID.
CONSTANTS: CON_SFLIGHT TYPE LVC_FNAME VALUE 'SFLIGHT',
CON_DISPLAY_FULL TYPE I VALUE 3.
Data to be displayed
DATA: BEGIN OF GT_SFLIGHT OCCURS 0.
INCLUDE STRUCTURE SFLIGHT.
DATA:ACTIVATE(1).
DATA: END OF GT_SFLIGHT.
INITIALIZATION.
*........Initialisierung...............................................
PERFORM INITIALIZATION_RL034.
*........Field cata....................................................
PERFORM FIELD_CAT.
*........SPECIAL GROUP.................................................
PERFORM E07_SP_GROUP_BUILD USING GT_SP_GROUP[].
START-OF-SELECTION.
Selection
SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.
*........ALV CALL.......................................................
PERFORM ALV_CALL.
PERFORM USER_COMMAND_LOCAL USING G_SUCOMM G_SELFLD.
FORM USER_COMMAND_LOCAL *
--> G_UCOMM *
--> G_SELFIELD *
FORM USER_COMMAND_LOCAL USING G_UCOMM LIKE SY-UCOMM
G_SELFIELD TYPE SLIS_SELFIELD.
CASE G_UCOMM.
WHEN 'ACT'.
ENDCASE.
ENDFORM.
FORM ALV_CALL *
FORM ALV_CALL.
Call ABAP List Viewer (ALV)
G_LAYOUT-BOX_FIELDNAME = 'ACTIVATE'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_BYPASSING_BUFFER = SPACE
I_BUFFER_ACTIVE = SPACE
I_CALLBACK_PROGRAM = SAV_SY_REPID
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND_LOCAL'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME = 'SFLIGHT'
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = G_LAYOUT
IT_FIELDCAT = XFIELD[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS = GT_SP_GROUP[]
IT_SORT =
IT_FILTER =
IS_SEL_HIDE = 'X'
I_DEFAULT = 'X'
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS = XEVENT
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_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = GT_SFLIGHT
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.
FORM status *
--> EXTAB *
FORM STATUS USING EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STAT' EXCLUDING EXTAB.
ENDFORM. " STATUS
*& Form INITIALIZATION_RL034
text
--> p1 text
<-- p2 text
FORM INITIALIZATION_RL034.
SAV_SY_REPID = SY-REPID.
ENDFORM. " INITIALIZATION_RL034
*& Form DEFINE_EVENTS_RL034
text
--> p1 text
<-- p2 text
FORM DEFINE_EVENTS_RL034.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = XEVENT.
exceptions
list_type_wrong = 1
others = 2.
ENDFORM. " DEFINE_EVENTS_RL034
*& Form FIELD_CAT
text
--> p1 text
<-- p2 text
FORM FIELD_CAT.
DATA: LS_FCAT TYPE SLIS_FIELDCAT_ALV,
L_LIN TYPE I.
REFRESH XFIELD.
1. per Default eingeblendete Felder *
*........Ikone/Symbol..................................................
CLEAR AFIELD.
DATA: LS1_FCAT TYPE SLIS_FIELDCAT_ALV,
L_LIN1 TYPE I.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = CON_SFLIGHT
I_BYPASSING_BUFFER = SPACE
I_BUFFER_ACTIVE = SPACE
CHANGING
CT_FIELDCAT = XFIELD
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
DESCRIBE TABLE XFIELD LINES L_LIN1.
ADD 1 TO L_LIN1.
CLEAR LS_FCAT.
LS1_FCAT-FIELDNAME = 'ACTIVATE'.
LS1_FCAT-CHECKBOX = 'X'.
LS1_FCAT-KEY = 'X'.
LS1_FCAT-INPUT = 'X'.
LS1_FCAT-EDIT = 'X'.
LS1_FCAT-INTTYPE = 'C'.
LS1_FCAT-DATATYPE = 'CHAR'.
LS1_FCAT-INTLEN = 1.
LS1_FCAT-COL_POS = L_LIN1.
LS1_FCAT-SELTEXT_S = LS1_FCAT-FIELDNAME.
LS1_FCAT-SELTEXT_M = LS1_FCAT-FIELDNAME.
LS1_FCAT-SELTEXT_L = LS1_FCAT-FIELDNAME.
LS1_FCAT-SP_GROUP = 'A'.
APPEND LS1_FCAT TO XFIELD.
ADD 1 TO L_LIN.
ENDFORM. " FIELD_CAT
FORM E07_SP_GROUP_BUILD USING E07_LT_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 = 'SPECIAL'.
APPEND LS_SP_GROUP TO E07_LT_SP_GROUP.
ENDFORM.
Regards
Shiva -
How to disbale a group of checkboxes when i select one check box WEBDYNPRO
Hi Friends,
Can any body help me how to disbale a group of checkboxes when i select one check box WEBDYNPRO Abap
Also can any body tell me how to handle chain endchain type of scenario in WEBDYNPRO Abap
Thank you..
SaiHi
In the context tab , create 2 context attributes ca_attr1 and ca_attr2 of type WDY_BOOLEAN under a context node cn_node
now in ur Layout , bind the ENABLE property of CheckBoxGroup UI Element with this attribute ca_attr1
bind the ENABLE property of CheckBox UI Element with this attribute ca_attr2
create a action for ur Checkbox , for the OnToggle property of ur checkbox
in OnactionToggle , check if ca_attr2 is 'X' , set ca_attr2 to ' ' ( for disable)
this can be done by code wizard , press control +f7 and use read/set context attributes , use get_attribute and set_attribute methods
// if ca_attr2 is 'X'
DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
DATA ls_cn_node TYPE wd_this->element_cn_node .
DATA lv_attr LIKE ls_city-ca_attr2.
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_ca_attr).
* get element via lead selection
lo_el_cn_node = lo_nd_cn_node->get_element( ).
* get single attribute
lo_el_cn_node->get_attribute(
EXPORTING
name = `CA_ATTR2`
IMPORTING
value = lv_attr ).
// if lv_attr2 is 'X' , use set_attribute method for ca_attr1
IF lv_Attr EQ 'X' .
DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
DATA ls_cn_node TYPE wd_this->element_cn_node .
DATA lv_attr LIKE ls_city-ca_attr.
* navigate from <CONTEXT> to <CN_VISIBLE> via lead selection
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_ca_attr).
* get element via lead selection
lo_el_cn_node = lo_nd_cn_node->get_element( ).
* set single attribute
lo_el_cn_node->set_attribute(
EXPORTING
name = `CA_ATTR1`
value = ' ').
ENDIF.
regards,
amit -
Hi Experts,
I have a requirement to display check boxes as the first column of the ALV, now at any point of time if the user selects one check box i have to get all the corresponding data of that row and display it at a different location, Can you let me know how i can identify when the check box is checked and how can i identify the row that is selected?
Also when the standard select all button is pressed all the check boxes should be automatically checked , how do i handle this.
Thanks in Advance.Hi Anvesh,
At what particular point of time do you want to look out for checked checkboxes? You can say have a button which the user clicks up on to look out for changes in the ALV's data after checking his desired checkboxes.
Say suppose you have a button then within this buttons event handler you should call the DATA_CHECK method of the ALV. This method would scan the ALV for any changes in data. If anything has changed (any checkbox checked) then the system raises the event ON_DATA_CHECK.
Below is the coding inside my buttons action handler ONACTIONCHECK_ALV_DATA
method ONACTIONCHECK_ALV_DATA .
DATA: l_ref_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
l_ref_INTERFACECONTROLLER = wd_This->wd_CpIfc_My_Alv( ).
l_ref_INTERFACECONTROLLER->Data_Check( ).
endmethod.
So if the user has checked any checkboxes then the ALV's data would have changed & so the system would have raised the ON_DATA_CHECK event. So create an event handler method for the event ON_DATA_CHECK. The framework does pass a parameter WDEVENT as input to this particular method. If you check the properties of this WDEVENT parameter in debugging mode, you would see that it has a PARAMETERS table. Now within this table you have another parameter R_PARAM.
Double click on R_PARAM and you can see various attributes present among which you also have:
IF_SALV_WD_TABLE_DATA_CHECK~T_MODIFIED_CELLS
This table would contain the indexes of the rows in which the data has changed. (where the checkbox has been checked) So you can pass this index to read the data from the context node using a normal get_static_attributes call. -
Re: creating check boxes in ALV grid using web dynpro
Hi Techies,
I need to have a check box column in alv grid, and it should allow me to select the check box and the selected row has to be updated in the database.
Kindly assist me with the steps to handle the above mentioned scenario
Thanks in advance.Now to first make the last column of my ALV as a checkbox:
method BUILD_ALV .
data: l_ref_cmp_usage type ref to if_wd_component_usage.
" Instantiate the ALV usage
l_ref_cmp_usage = wd_This->wd_CpUse_My_Alv( ).
if l_ref_cmp_usage->has_active_component( ) is initial.
l_ref_cmp_usage->create_component( ).
endif.
" Get reference to the model
DATA: l_ref_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
l_ref_INTERFACECONTROLLER = wd_This->wd_CpIfc_My_Alv( ).
data: lr_config type ref to Cl_Salv_Wd_Config_Table.
lr_config = l_ref_INTERFACECONTROLLER->Get_Model( ).
|" Set read only mode to false (and display edit toolbar)
lr_config->if_salv_wd_table_settings~set_read_only( abap_false ).
data: lr_table_settings type ref to if_salv_wd_table_settings.
lr_table_settings ?= lr_config.
lr_table_settings->set_read_only( abap_false ).
data: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lt_columns TYPE salv_wd_t_column_ref,
lr_checkbox1 TYPE REF TO cl_salv_wd_uie_checkbox,
lr_checkbox2 TYPE REF TO cl_salv_wd_uie_checkbox.
FIELD-SYMBOLS <fs_column> LIKE LINE OF lt_columns.
" Embed the UI elements within the ALV
lr_column_settings ?= lr_config.
lt_columns = lr_column_settings->get_columns( ).
" Embed an checkbox within the column APPROVE
LOOP AT lt_columns ASSIGNING <fs_column>.
CASE <fs_column>-id.
WHEN 'APPROVE'.
CREATE OBJECT lr_checkbox1
EXPORTING
checked_fieldname = <fs_column>-id.
<fs_column>-r_column->set_cell_editor( lr_checkbox1 ).
FREE lr_checkbox1.
ENDCASE.
ENDLOOP.
ENDMETHOD. "BUILD_ALV -
Add check box in ALV output List.
Hi
I want to add check box in alv out put list . i m trying but not getting succsses .
please tell me the process .
thanks
chandraHi Chandra,
Types: begin of ty_output,
u201C Included these two types in your output structure.
celltab TYPE lvc_t_styl,
checkbox TYPE c,
end of ty_output.
Data: it_output type standard table of ty_output,
wa_output type ty_output.
Loop at it_output into wa_output.
* Initially, set all checkbox cells editable.
ls_celltab-fieldname = 'CHECKBOX'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
INSERT ls_celltab INTO TABLE lt_celltab.
INSERT LINES OF lt_celltab INTO TABLE wa_coupon-celltab.
MODIFY it_coupon FROM wa_coupon TRANSPORTING celltab.
Endloop.
Form build_field_catalog.
wa_fieldcat-fieldname = 'CHECKBOX'.
ADD 1 TO wf_pos.
wa_fieldcat-col_pos = wf_pos.
wa_fieldcat-datatype = 'C'.
wa_fieldcat-outputlen = '6'.
wa_fieldcat-reptext = 'Select'.
wa_fieldcat-coltext = 'Select'.
wa_fieldcat-seltext = 'Select'.
wa_fieldcat-tooltip = 'Select'.
wa_fieldcat-checkbox = 'X'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-key = ''.
wa_fieldcat-icon = ''.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
Endform.
Form display_alv.
ls_variant-report = sy-cprog..
gs_layout-stylefname = 'CELLTAB'. u201C Please do not forget to include this statement
gs_layout-zebra = 'X'.
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_outtab = it_output
it_fieldcatalog = it_fieldcat.
CLEAR gt_fieldcat.
Endform.
Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 4:31 PM -
Re- Single click in the check box ensure to select all check boxes
Hi All,
I have an issue to notify the urgency of the cart to the buyer while creating the cart.For that scenario we have a check box in the Basic data of shopping cart.I added the check box in the basic data. Now the quote check box is available for all the line items.
The requestor can select any check box in any line items,so whenever he selects the check box- automatically all the check box should get selected , if any of the check box get deselected then imediatelely all the check box in different line items also should get deselected.Hi Batchu,
Thanks for your reply, See if you add any custom field it will come one by one in the basic data section. Adding one more check box doesnot work for this case.
Moreover the problem is change to any particular line item can be captured in DOC_CHANGE_BADI but i cannot bring the same change to all line items (ie) If 3 rd line item check box is marked then immediately rest of the line item also should get marked.
In the case of DOC_CHECK_BADI to identify the line on which the change happens is tough.
SO thats is the problem for me to bring the logic in the code.
Please if any one come across similar kind of issue please give your suggestion.
Thanks,
Sibi -
"Always Use Selected Format" check box in line items report
Hi Experts,
I have an issue in ECC 6.0.
From the transaction code FBL1N (Vendor Line Items) I am trying to export the report to spreadsheet by selecting the option List> Export>Spreadsheet then I have selected "Always Use Selected Format" check box. But if I execute the same report again I am not getting this option "Always Use Selected Format". Please let me how can we retrieve that option. Is there any possibility to get that option again either functionally or technically. I would like to know all the possible ways to get this option again.
Please do the needful.Hello,
In one my thread Mr. Frank has replied as follows. I believe he has solved this.
Hope this may be really helpful.
The problem with the spreadsheet download is at one point, users have selected their default file type.
That said, SAPGUI is working as it should. (gui710)
Question though is how do we reset the values so they get the ?Select Spreadsheet Format? popup again.
The following steps should be performed :
- Call transaction SE38, enter program SALV_BS_ADMIN_MAINTAIN, and press F8.
- Follow the parameters below :
- Select ?DELETE? on the Actions Group
- Select ?DETAILED SELECTION? on the General Data :
- On Client - your number
- User : <user name>
-Hit EXECUTE.
-Press ENTER on the POPUP
- If there is an entry in the report that will need to be deleted. Also, make sure that the entry you will delete (for the user) has a value of GUI_ALV_XML_VER on field ?Parameter? .
- Select the line and hit the DELETE icon .
- Press ?Y? to continue delete. Press ENTER on the popup.
- Then EXIT all the way out of the program.
NOTE : When you run program SALV_BS_ADMIN_MAINTAIN, make sure they are out of any program that they are using for download.
Re: "Always Use Selected Format" check box in line items report
Regards,
Ravi
Edited by: Ravi Sankar Venna on May 15, 2009 2:31 PM -
Dynamic selection of check boxes on selecting a check box
Hi Friends,
I have to select the check boxes which are herarchically lower to a top check box,dynamically.
Eg:
Checkbox1
checkbox2
checkbox3
so if i select check box 1, on the screen both checkbox2 and checkbox3 have to be selected.
I did like below.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF P_ALL = 'X'.
P_VAT = 'X'.
P_NAME = 'X'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
but values are checked but on screen its not checked.
how to handle this.
Regards,
Simhahi
do like this
paramenter: check_1 type c as check box at user-command ,
check_2 type c as checkbox default X,
check_3 type c as checkbox default X.
At selection Sreen output
if check_1 = 'X'.
loop at screen .
if screen-name = 'check_2'.
screen-invisible = '0'.
endif.
endloop.
loop at screen .
if screen-name = 'check_3'.
screen-invisible = '0'.
endif.
endloop.
else
loop at screen .
if screen-name = 'check_2'.
screen-invisible = '1''.
endif.
endloop.
loop at screen .
if screen-name = 'check_3'.
screen-invisible = '1'.
endif.
endloop.
endif.
this solve ur problem
Cheers
Snehi
Maybe you are looking for
-
Windows 8.1 Driver For MSI 760GM-P21
My Motherboard is MSI 760GM-P21. My Motherboard has build in ATI Radeon 3000 Graphics Adapter. I Want Windows 8.1 Driver For ATI Radeon 3000. Is It possible To Get The Windows 8.1 Driver For ATI Radeon 3000 ?....
-
Oracle 9i Database and Developer Installation
I am a student going through the Oracle Developer Certification and I am hoping someone can help me with some troubleshooting. This has to do with installing 2 different services on 2 home directories. I installed the Oracle 9i database enterprise ed
-
875P BIOS 1.5 HyperThreading?
Does anyone on this list with Win XP and a C level processor have the second virtual processor after the BIOS 1.5 upgrade? My second virtual processor has disappeared with the 1.5 upgrade. Hyperthreading is enabled on the BIOS screen. Check the "My C
-
Wierd behaviour in 10.2.0.2
Hi Guys, I have this wierd behaviour. I have the parameter *.sessions=885 in my spfile. However few days back when i do a query in my db "show parameter sessions", the output is 1105. can advise? thanks
-
This happened when I first got my Ipad, and initially attempted to join my wireless network, and while I was waiting patiently with Apple tech support, it just "started workin". Not sure whats going on, it is not accepting my router password.