Problem in Checkbox on/off in ALV using OO method
Hi,
I am working on an ALV display using OO method.The first field is check box in the display.
I declared the internal table type as
TYPES: BEGIN OF ty_output,
chk_box(1) TYPE c,
id_rech TYPE yyeft1200-id_rech,
bprefnr TYPE yyeft1201-bprefnr,
lfdat TYPE yyeft1201-lfdat,
artnr_bp TYPE yyeft1201-artnr_bp,
end of ty_output.
and in fieldcatalog i have used
Check Box
CLEAR ls_fcat.
ls_fcat-fieldname = 'CHK_BOX'.
ls_fcat-datatype = 'CHAR'.
ls_fcat-intlen = '1'.
ls_fcat-edit = kc_x.
ls_fcat-coltext = text-014.
ls_fcat-checkbox = kc_x.
ls_fcat-outputlen = '5'.
APPEND ls_fcat TO pit_fieldcat.
All the check boxes are in editable mode.
Now the requirement is that for some records of the internal table it should be editable and for some records it should be non-editable.
can you please help me how to do it.
Hi,
You might want to look at the example programs. Any program which begins with <b>BCALV_EDIT*</b>
You can find the code in this program 'BCALV_FIELDCAT_TEST'
*& Report BCALV_FIELDCAT_TEST *
This report allows to modify the fieldcatalog of a corresponding
output table and to view the effects of your changes directly.
Note that for some changes you need to newly display the whole
ALV Grid Control, e.g., DDIC-Fields are read only the first time
you call SET_READY_FOR_FIRST_DISPLAY.
Note also that not all scenarios can be tested since the output
table does not comprise all fields to test available features
of the fieldcatalog. Copy this program and extend the output
table accordingly if you want to test such a special feature.
(The field CARRNAME in 'gt_sflight' was added to test field REF_FIELD
and TXT_FIELD of the fieldcatalog - see what happens if you
calculate subtotals by carrier-id).
report bcalvt_fieldcatalog .
data: ok_code type sy-ucomm,
save_ok_code type sy-ucomm,
fieldcatalog for output table
gt_fieldcat type lvc_t_fcat,
fieldcatalog for fieldcatalog itself:
gt_fcatfcat type lvc_t_fcat,
gs_fcatlayo type lvc_s_layo.
Output table
data: begin of gt_sflight occurs 0.
data: carrname type s_carrname.
include structure sflight.
data: end of gt_sflight.
data: g_max type i value 100.
data: g_all type c value SPACE.
Controls to display gt_sflight and corresponding fieldcatalog
data: g_docking type ref to cl_gui_docking_container,
g_alv type ref to cl_gui_alv_grid.
data: g_custom_container type ref to cl_gui_custom_container,
g_editable_alv type ref to cl_gui_alv_grid.
LOCAL CLASS 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.
endclass.
class lcl_event_receiver implementation.
method handle_data_changed.
at the time being, no checks are made...
endmethod.
endclass.
data: event_receiver type ref to lcl_event_receiver.
end-of-selection.
set screen 100.
*& Module STATUS_0100 OUTPUT
text
module status_0100 output.
set pf-status 'BASIC'.
set titlebar 'BASICTITLE'.
create ALV Grid Control in the first run
if g_docking is initial.
perform create_and_init_controls.
endif.
endmodule. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
module user_command_0100 input.
save_ok_code = ok_code.
clear ok_code.
case save_ok_code.
when 'SUBMIT'.
set the frontend fieldcatalog
ATTENTION: DDIC-Fields are not updated using this method!
(see 'RESTART')
call method g_alv->set_frontend_fieldcatalog
exporting
it_fieldcatalog = gt_fieldcat.
call method g_alv->refresh_table_display.
call method cl_gui_cfw=>flush.
when 'RESTART'.
Destroy the control currently visible and display it again
using the changed fieldcatalog.
perform restart_sflight.
when '&ALL'.
perform switch_visibility.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
*& Form CREATE_AND_INIT_CONTROLS
text
--> p1 text
<-- p2 text
form create_and_init_controls.
create object g_docking
exporting
dynnr = '100'
extension = 150
side = cl_gui_docking_container=>dock_at_bottom.
create object g_alv
exporting
i_parent = g_docking.
create object g_custom_container
exporting
container_name = 'CC_0100_FIELDCAT'.
create object g_editable_alv
exporting
i_parent = g_custom_container.
register events
create object event_receiver.
set handler event_receiver->handle_data_changed for g_editable_alv.
call method g_editable_alv->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
perform build_fieldcatalogs changing gt_fieldcat gt_fcatfcat.
perform modify_fieldcatalog changing gt_fcatfcat.
perform select_data. "CHANGING gt_sflight
call method g_alv->set_table_for_first_display
changing
it_outtab = gt_sflight[]
it_fieldcatalog = gt_fieldcat[].
optimize column width of grid displaying fieldcatalog
gs_fcatlayo-cwidth_opt = 'X'.
Get fieldcatalog of table sflight - alv might have
modified it after passing.
call method g_alv->get_frontend_fieldcatalog
importing et_fieldcatalog = gt_fieldcat[].
call method cl_gui_cfw=>flush.
Display fieldcatalog of table sflight:
call method g_editable_alv->set_table_for_first_display
exporting
is_layout = gs_fcatlayo
changing
it_outtab = gt_fieldcat[]
it_fieldcatalog = gt_fcatfcat[].
register events
create object event_receiver.
set handler event_receiver->handle_data_changed for g_editable_alv.
endform. " CREATE_AND_INIT_CONTROLS
*& Form restart_sflight
text
--> p1 text
<-- p2 text
form restart_sflight.
data: ls_fieldcat type lvc_s_fcat.
free g_docking and thus g_alv
call method g_docking->free.
clear g_docking.
clear g_alv.
create new instances
create object g_docking
exporting
dynnr = '100'
extension = 150
side = cl_gui_docking_container=>dock_at_bottom.
create object g_alv
exporting
i_parent = g_docking.
This is an internal method to invalidate all fields in the fieldcat
loop at gt_fieldcat into ls_fieldcat.
clear ls_fieldcat-tech_comp.
modify gt_fieldcat from ls_fieldcat.
endloop.
Newly display the list with current fieldcatalog.
call method g_alv->set_table_for_first_display
changing
it_outtab = gt_sflight[]
it_fieldcatalog = gt_fieldcat.
Get fieldcatalog - it might be changed by ALV in the last call
call method g_alv->get_frontend_fieldcatalog
importing
et_fieldcatalog = gt_fieldcat[].
call method g_editable_alv->refresh_table_display.
call method cl_gui_cfw=>flush.
endform. " restart_sflight
*& Form select_data
text
--> p1 text
<-- p2 text
form select_data.
data: lt_sflight type table of sflight with header line,
ls_scarr type scarr.
select data of sflight
select * from sflight into table lt_sflight up to g_max rows.
copy data to gt_sflight and update CARRNAME
loop at lt_sflight.
move-corresponding lt_sflight to gt_sflight.
select single * from scarr into ls_scarr
where carrid = gt_sflight-carrid.
gt_sflight-carrname = ls_scarr-carrname.
append gt_sflight.
endloop.
endform. " select_data
*& Form BUILD_FIELDCATALOGS
text
<--P_GT_FIELDCAT text
<--P_GT_FCATFCAT text
form build_fieldcatalogs changing p_fieldcat type lvc_t_fcat
p_fcatfcat type lvc_t_fcat.
data: ls_fcat type lvc_s_fcat.
Fieldcatalog for table SFLIGHT: p_fieldcat
generate fieldcatalog automatically
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'SFLIGHT'
I_CLIENT_NEVER_DISPLAY = 'X'
changing
ct_fieldcat = p_fieldcat[]
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.
shift all column positions to the right except for MANDT
loop at p_fieldcat into ls_fcat.
if ls_fcat-fieldname ne 'MANDT'.
add 1 to ls_fcat-col_pos.
if ls_fcat-fieldname = 'CARRID'.
ls_fcat-txt_field = 'CARRNAME'."link CARRNAME to CARRID
endif.
modify p_fieldcat from ls_fcat.
endif.
endloop.
create a new line for CARRNAME in p_fieldcat
clear ls_fcat.
ls_fcat-fieldname = 'CARRNAME'.
ls_fcat-ref_table = 'SCARR'.
ls_fcat-col_pos = 1.
insert new line before CARRID (do not forget MANDT!).
insert ls_fcat into p_fieldcat index 1.
Fieldcatalog for table LVC_T_FCAT:p_fcatfcat
Generate fieldcatalog of fieldcatalog structure.
This fieldcatalog is used to display fieldcatalog 'p_fieldcat'
on the top of the screen.
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'LVC_S_FCAT'
I_CLIENT_NEVER_DISPLAY = 'X'
changing
ct_fieldcat = p_fcatfcat[]
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.
Hide all fields that are not documented (valid for release 4.6A)
perform hide_fields changing p_fcatfcat.
endform. " BUILD_FIELDCATALOGS
*& Module EXIT_PROGRAM INPUT
text
module exit_program input.
leave program.
endmodule. " EXIT_PROGRAM INPUT
*& Form MODIFY_FIELDCATALOG
text
<--P_GT_FCATFCAT text
form modify_fieldcatalog changing p_fcatfcat type lvc_t_fcat.
data ls_fcat type lvc_s_fcat.
loop at p_fcatfcat into ls_fcat.
ls_fcat-coltext = ls_fcat-fieldname.
ls_fcat-edit = 'X'.
if ls_fcat-fieldname = 'COL_POS' or ls_fcat-fieldname = 'FIELDNAME'.
ls_fcat-key = 'X'.
endif.
modify p_fcatfcat from ls_fcat.
endloop.
endform. " MODIFY_FIELDCATALOG
form hide_fields changing p_fieldcat type lvc_t_fcat.
data: ls_fcat type lvc_s_fcat.
Only show documented fields of fieldcatalog.
For a documentation choose "Help->Application Help" in the menu.
loop at p_fieldcat into ls_fcat.
if not (
ls_fcat-fieldname eq 'CFIELDNAME'
or ls_fcat-fieldname eq 'COL_POS'
or ls_fcat-fieldname eq 'COLDDICTXT'
or ls_fcat-fieldname eq 'COLTEXT'
or ls_fcat-fieldname eq 'CURRENCY'
or ls_fcat-fieldname eq 'DD_OUTLEN'
or ls_fcat-fieldname eq 'DECIMALS_O'
or ls_fcat-fieldname eq 'DECMLFIELD'
or ls_fcat-fieldname eq 'DO_SUM'
or ls_fcat-fieldname eq 'DRAGDROPID'
or ls_fcat-fieldname eq 'EDIT_MASK'
or ls_fcat-fieldname eq 'EMPHASIZE'
or ls_fcat-fieldname eq 'EXPONENT'
or ls_fcat-fieldname eq 'FIELDNAME'
or ls_fcat-fieldname eq 'HOTSPOT'
or ls_fcat-fieldname eq 'ICON'
or ls_fcat-fieldname eq 'INTLEN'
or ls_fcat-fieldname eq 'INTTYPE'
or ls_fcat-fieldname eq 'JUST'
or ls_fcat-fieldname eq 'KEY'
or ls_fcat-fieldname eq 'LOWERCASE'
or ls_fcat-fieldname eq 'LZERO'
or ls_fcat-fieldname eq 'NO_OUT'
or ls_fcat-fieldname eq 'NO_SIGN'
or ls_fcat-fieldname eq 'NO_SUM'
or ls_fcat-fieldname eq 'NO_ZERO'
or ls_fcat-fieldname eq 'OUTPUTLEN'
or ls_fcat-fieldname eq 'QFIELDNAME'
or ls_fcat-fieldname eq 'QUANTITY'
or ls_fcat-fieldname eq 'REF_FIELD'
or ls_fcat-fieldname eq 'REF_TABLE'
or ls_fcat-fieldname eq 'REPREP'
or ls_fcat-fieldname eq 'REPTEXT'
or ls_fcat-fieldname eq 'ROLLNAME'
or ls_fcat-fieldname eq 'ROUND'
or ls_fcat-fieldname eq 'ROUNDFIELD'
or ls_fcat-fieldname eq 'SCRTEXT_L'
or ls_fcat-fieldname eq 'SCRTEXT_M'
or ls_fcat-fieldname eq 'SCRTEXT_S'
or ls_fcat-fieldname eq 'SELDDICTXT'
or ls_fcat-fieldname eq 'SELTEXT'
or ls_fcat-fieldname eq 'SP_GROUP'
or ls_fcat-fieldname eq 'SYMBOL'
or ls_fcat-fieldname eq 'TECH'
or ls_fcat-fieldname eq 'TIPDDICTXT'
or ls_fcat-fieldname eq 'TOOLTIP'
or ls_fcat-fieldname eq 'TXT_FIELD' ).
ls_fcat-tech = 'X'.
endif.
modify p_fieldcat from ls_fcat.
endloop.
endform.
form switch_visibility.
data: lt_fcatfcat type lvc_t_fcat,
ls_fcat type lvc_s_fcat.
call method g_editable_alv->get_frontend_fieldcatalog
importing ET_FIELDCATALOG = lt_fcatfcat.
if not g_all is initial.
perform hide_fields changing lt_fcatfcat.
g_all = SPACE.
else.
loop at lt_fcatfcat into ls_fcat.
if ls_fcat-tech eq 'X'.
ls_fcat-tech = SPACE.
ls_fcat-no_out = 'X'.
modify lt_fcatfcat from ls_fcat.
endif.
endloop.
g_all = 'X'.
endif.
call method g_editable_alv->set_frontend_fieldcatalog
exporting it_fieldcatalog = lt_fcatfcat.
call method g_editable_alv->refresh_table_display.
endform.
<b>Reward points</b>
Regards
Similar Messages
-
How to add a new button in an ALV using factory method
im using factory method to creat an ALV
The reason why I'm doing this is because I want the ALV and the selection screen in the same screen like exemplified here http://help-abap.blogspot.com/2008/10/dispaly-alv-report-output-in-same.html
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display = if_salv_c_bool_sap=>false
r_container = lo_cont
container_name = 'DOCK_CONT'
IMPORTING
r_salv_table = lo_alv
CHANGING
t_table = me->t_data.
The above code already uses every parameter that method as to offer.
Is it possible to add extra buttons to an ALV using that method?Hi Ann,
The reason you are not able to see any of the new columns as a option to select in your web service block is because when you have published that block, they were not present. Add these two new objects in your block and publish it again. You will be prompted for duplication content. Select the highlighted block for duplicate and now you can see the new added objects in the filter option. Update and this will overwrite your published block. Please note, web services do appear to behave weirdly when used with dashboards so I request you to please try it in a separate test report first.
Hope that helps.
Regards,
Tanisha -
I have a problem in formatting cells in Excel while using OLE method.
Hi All,
I have a problem in formatting cells in Excel while using OLE method.
My requirement is to have certain fields of a cell as text and amount fields should be in number format.
How to format a cell in Excel in OLE method of downloading data to excel.
For example I have plant field whose value is 0002 in internal table while coming to excel it is showing as 2 .
I want that field to be shown as 0002.(text format)
Material field whose value in internal table is 000000000000000051 is shown as 51 which has to be shown as
000000000000000051.(text format).
Amount field should be in number format so that totalling is possible .
So I need some cells in text format and some in number format.
Please suggest a sloution.
Thanks in advance,
Regards,
vidyulatha.Uhttps://forums.sdn.sap.com/click.jspa?searchID=21931962&messageID=6852860
hope this helps. -
Coloring an single field of an ALV using factory method
how can we color just a single field in ALV using factory method.
Hello Regi you may want to check this sample code, basically what you need is to use the lvc_s_colo structure and the set_color method of the class cl_salv_column_table.
METHOD set_colors.
*.....Color for COLUMN.....
DATA: lo_cols_tab TYPE REF TO cl_salv_columns_table,
lo_col_tab TYPE REF TO cl_salv_column_table.
DATA: ls_color TYPE lvc_s_colo. " Colors strucutre
* get Columns object
lo_cols_tab = co_alv->get_columns( ).
INCLUDE <color>.
* Get ERDAT column & set the yellow Color fot it
TRY.
lo_col_tab ?= lo_cols_tab->get_column( 'ERDAT' ).
ls_color-col = col_total.
lo_col_tab->set_color( ls_color ).
CATCH cx_salv_not_found.
ENDTRY.
*.......Color for Specific Cell & Rows.................
* Applying color on the 3rd Row and Column AUART
* Applying color on the Entire 5th Row
DATA: lt_s_color TYPE lvc_t_scol,
ls_s_color TYPE lvc_s_scol,
la_vbak LIKE LINE OF ct_vbak,
l_count TYPE i.
LOOP AT ct_vbak INTO la_vbak.
l_count = l_count + 1.
CASE l_count.
* Apply RED color to the AUART Cell of the 3rd Column
WHEN 3.
ls_s_color-fname = 'AUART'.
ls_s_color-color-col = col_negative.
ls_s_color-color-int = 0.
ls_s_color-color-inv = 0.
APPEND ls_s_color TO lt_s_color.
CLEAR ls_s_color.
* Apply GREEN color to the entire row # 5
* For entire row, we don't pass the Fieldname
WHEN 5.
ls_s_color-color-col = col_positive.
ls_s_color-color-int = 0.
ls_s_color-color-inv = 0.
APPEND ls_s_color TO lt_s_color.
CLEAR ls_s_color.
ENDCASE.
* Modify that data back to the output table
la_vbak-t_color = lt_s_color.
MODIFY ct_vbak FROM la_vbak.
CLEAR la_vbak.
CLEAR lt_s_color.
ENDLOOP.
* We will set this COLOR table field name of the internal table to
* COLUMNS tab reference for the specific colors
TRY.
lo_cols_tab->set_color_column( 'T_COLOR' ).
CATCH cx_salv_data_error. "#EC NO_HANDLER
ENDTRY.
ENDMETHOD. "set_colors -
ALV using OO method is giving problem
Hello Experts,
I am populating button in one ALV column conditionally. that button is coming fine... but i see the text on button taken from the previous column value... i want it blank otherwise... my custom text... how can I achieve that ?
pls help..
thanksHello Clemens,
Thanks for your inputs.
Would you please let me know which text field?
I believe I have cleared the fields before populating the internal table displayed in output. Also I have cleared fields while populating field catalog for the button column.
Kumail -
Sub Total Text in an ALV using FACTORY Method
Hi Gurus,
My requirement is simple, but I couldn't find any answers under SDN or any other forums. Some of you may ask me to check for the SCN posts, but I almost checked everything.
My requirement is - When I get the Sub-total in my ALV, it should print a text other than the field which has got sub-total value.
My ALV Schema:
Field1 | Field2 | Field 3 |
____ |______ |______ |
| | |
| | |
Tot. Qty | 1000.00|
I have sorted and added the subtotal = 'X' for the field which I need the Subtotal. Added Aggregations to Field3. But where and how to the field 'Tot. Qty', so that it should appear at the Sub-Total Level.
Please guide me if I've missed any of the forums. Again my requirement is to print the Field Name.
Regards,
-Wahid Hussain Syed.Hi,
You can view this thread for example Display constant text in intermediate results column of SALV as it says that this is a limitation in SALV that "The output of totals and subtotals is handled solely by ALV. You can neither pass the results to your application nor manipulate them in any way.". But you can see a work around done for this problem, to be frank that I have not done that and I am only providing this link for your reference. -
Calling Transaction from ALV using OO Method
Hi,
My requirement is as follows....
I have an ALV grid with columns such as month wise Total of a GL account say JAN, feb etc...
When I double click on any of these cells it should take me to the respective Transaction (say FBL3n for the GL account and the company code) . I am able to track the GL account for which the total is displayed and company code is one of my selection criteria. In the main screen of the FBL3N we have to enter the posting date and i also want the Radio button against "all items', presently default is against 'Open Items'. So how can i proceed.
Thanks and Regards,
NamitDATA gr_event_handler TYPE REF TO lcl_event_handler . .. ..
*--Creating an instance for the event handler
CREATE OBJECT gr_event_handler .
*--Registering handler methods to handle ALV Grid events
SET HANDLER gr_event_handler->handle_double_click FOR gr_alvgrid .
CLASS lcl_event_handler IMPLEMENTATION .
*Handle Double Click
METHOD handle_double_click .
PERFORM handle_double_click USING e_row e_column es_row_no .
ENDMETHOD .
CLASS lcl_event_handler DEFINITION
*Double-click control
Methods:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column
i_fieldrows TYPE lvc_t_row.
w_fieldrows LIKE LINE OF i_fieldrows,
CALL METHOD o_alvgrid->get_selected_rows
IMPORTING
et_index_rows = i_fieldrows.
LOOP AT i_fieldrows INTO w_fieldrows.
READ TABLE i_batch INTO w_block INDEX w_fieldrows-index.
if sy-subrc = 0.
* CLASS LCL_EVENT_RECEIVER DEFINITION
CLASS LCL_EVENT_RECEIVER DEFINITION.
* Event receiver definitions for ALV actions
PUBLIC SECTION.
CLASS-METHODS:
* Row Double click for dirll down.
HANDLE_DOUBLE_CLICK
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW
E_COLUMN
ES_ROW_NO.
ENDCLASS.
* Implementation
* Every event handler that is specified below should also be set after
* the object has been created. This is done in the PBO processing.
* with the following command
* SET HANDLER oEventreceiver->handle_toolbar FOR o_Alvgrid.
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
*& Method handle_double_click
* This method is called when the user double clicks on a line to drill
* down.
* The following are exported from the ALV
* LVC_S_ROW
* LVC_S_COL
* LVC_S_ROID
METHOD HANDLE_DOUBLE_CLICK.
* The double click drill down processing should be
* coded in the form below.
PERFORM F9007_HANDLE_DOUBLE_CLICK USING E_ROW
E_COLUMN
ES_ROW_NO.
ENDMETHOD.
ENDCLASS.
*& Form F9007_HANDLE_DOUBLE_CLICK
* This form is called when the user double clicks on a line to drill
* down.
* -->P_E_ROW_ID - Row ID text
* -->P_E_COLUMN_ID - Column ID
* -->P_ES_ROW_NO - Row number
FORM f9007_handle_double_click USING p_row
p_column
p_row_no.
DATA: lw_output LIKE LINE OF i_output.
* RG:16/11/2004 - Start of Changes
* Need to check that a subtotal or grand total line has not been
* double-clicked, otherwise the report will produce a short dump!
check p_row+0(1) is initial.
* RG:16/11/2004 - End of Changes
READ TABLE i_output INDEX p_row INTO lw_output.
CASE p_column.
WHEN 'KNUMA'.
IF NOT lw_output-knuma IS INITIAL.
SET PARAMETER ID 'VBO' FIELD lw_output-knuma.
CALL TRANSACTION 'VBO3' AND SKIP FIRST SCREEN.
ENDIF.
WHEN 'VBAK_VBELN'.
IF NOT lw_output-vbak_vbeln IS INITIAL.
SET PARAMETER ID 'AUN' FIELD lw_output-vbak_vbeln.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
WHEN 'VBRK_VBELN'.
IF NOT lw_output-vbrk_vbeln IS INITIAL.
SET PARAMETER ID 'VF' FIELD lw_output-vbrk_vbeln.
CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM. " F9007_HANDLE_DOUBLE_CLICK -
Editable alv using OO ALV(newly edited row values are not updating )
Hi friends,
i am facing a problem. i am displaying an output alv using OO ALV.
i am creating a new row and validating the newly created row values and changing if it is not according to the criteria. but the newly edited values are not capturing in method
pr_data_changed->mt_inserted_rows as it contains values only entries entered for the first time .
i am not getting the newly edited values in it.
please do the needful.
Thanks and Regards,
srinivasHi!
to rectify the problem in the Code.....
You can Go through this program....for changed values....
https://wiki.sdn.sap.com/wiki/x/AwBIBQ
Regards. -
LOGO required in ALV top of page using factory method
Hi,
I am doing an ALV using factory method of class Cl_SALV_TABLE. Can any one help me about putting a LOGO on the top of page.
Thanks in advance.
AmitavaHi,
In START-OF-SELECTION.
put form to display header
like PERFORM build_header
gr_table->display( ).
then...
in FORM
FORM build_header.
lr_grid TYPE REF TO cl_salv_form_layout_grid,
lr_logo TYPE REF TO cl_salv_form_layout_logo,
create object lr_logo.
lr_logo->set_left_content( lr_grid ).
lr_logo->set_right_logo( 'LOGO_NAME' ).
* Set the element top_of_list
gr_table->set_top_of_list( lr_logo ).
ENDFORM.
thanx. -
Problem activating the back and exit button with the ALV using OO
I have wrote my first alv using Methods.My problem is that i can't activete the BACK and EXIT button in the standart toolbar .
Look my code please .....
Without PF-STATUS can i do it ?
*& Report YDP_DOUBLE_ALV
REPORT YDP_DOUBLE_ALV.
TABLES : YQM_CERT , MARA , YOUTPUT_APPL.
DATA : ALV_GRID TYPE REF TO CL_GUI_ALV_GRID,
CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
FIELD_CAT TYPE LVC_T_FCAT,
LAYOUT TYPE LVC_S_LAYO.
DATA : ALV_GRID2 TYPE REF TO CL_GUI_ALV_GRID,
CUSTOM_CONTAINER2 TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
* FIELD_CAT TYPE LVC_T_FCAT,
* LAYOUT TYPE LVC_S_LAYO.
DATA: DYNNR TYPE SY-DYNNR,
REPID TYPE SY-REPID.
DATA: OK_CODE TYPE SY-UCOMM.
DATA : BEGIN OF ITAB OCCURS 0.
INCLUDE STRUCTURE YQM_CERT.
DATA END OF ITAB.
DATA : BEGIN OF ITAB1 OCCURS 0.
INCLUDE STRUCTURE YOUTPUT_APPL.
DATA END OF ITAB1.
* MODULE DISPLAY_ALV OUTPUT
MODULE DISPLAY_ALV OUTPUT.
SET PF-STATUS 'ZST9'.
PERFORM DISPLAY_ALV.
ENDMODULE. "DISPLAY_ALV OUTPUT
"DISPLAY_ALV OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
START-OF-SELECTION.
LAYOUT-ZEBRA = 'X'.
LAYOUT-GRID_TITLE = 'YQM_CERT'.
LAYOUT-CWIDTH_OPT = 'X'.
LAYOUT-SMALLTITLE = 'X'.
SELECT * FROM YQM_CERT INTO ITAB.
APPEND ITAB.
ENDSELECT.
SELECT * FROM YOUTPUT_APPL INTO ITAB1.
APPEND ITAB1.
ENDSELECT.
CALL SCREEN 100.
END-OF-SELECTION.
*& Form DISPLAY_ALV
* text
FORM DISPLAY_ALV.
IF ALV_GRID IS INITIAL.
CREATE OBJECT CUSTOM_CONTAINER
EXPORTING
* PARENT =
CONTAINER_NAME = 'CC_ALV'
* style =
* LIFETIME = lifetime_default
REPID = REPID
DYNNR = DYNNR
* NO_AUTODEF_PROGID_DYNNR =
* EXCEPTIONS
* CNTL_ERROR = 1
* CNTL_SYSTEM_ERROR = 2
* CREATE_ERROR = 3
* LIFETIME_ERROR = 4
* LIFETIME_DYNPRO_DYNPRO_LINK = 5
* others = 6
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT ALV_GRID
EXPORTING
* I_SHELLSTYLE = 0
* I_LIFETIME =
I_PARENT = CUSTOM_CONTAINER
* I_APPL_EVENTS = space
* I_PARENTDBG =
* I_APPLOGPARENT =
* I_GRAPHICSPARENT =
* I_NAME =
* I_FCAT_COMPLETE = SPACE
* EXCEPTIONS
* ERROR_CNTL_CREATE = 1
* ERROR_CNTL_INIT = 2
* ERROR_CNTL_LINK = 3
* ERROR_DP_CREATE = 4
* others = 5
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'YQM_CERT'
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
IS_LAYOUT = LAYOUT
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
* IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = ITAB[]
* IT_FIELDCATALOG =
* IT_SORT =
* IT_FILTER =
* EXCEPTIONS
* INVALID_PARAMETER_COMBINATION = 1
* PROGRAM_ERROR = 2
* TOO_MANY_LINES = 3
* others = 4
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
CALL METHOD ALV_GRID->REFRESH_TABLE_DISPLAY
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
* EXCEPTIONS
* FINISHED = 1
* others = 2
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDFORM. "DISPLAY_ALVHi
U need to active them in your status ZST9.
Max -
Editable alv using checkboxes.
Hi All,
I am working on editable alv using checkboxes.I have few requirements.
1) i have all checkboxes in my row.If i select the Row fieldname all of my checkboxes hsould be checked.
2) in my internsl table i have field called comments.If comment field has space i need to disable the checkbox.If comment is filled then i need to enable the chekkbox.
Field catalog need to be changed based on my internal table.
Can anybody please let me know how can i solve the above issues.
Thanks
Swapna.1. There is no event for this (row of column), so this will not be possible.
2. Check report BCALV_EDIT_05. -
Have not been able to use keynote if it's linked to icloud. It just starts and turns off quickly. No problem if I toggle off using icloud. Any ideas.
Have you updated to the latest level of Keynote on your iPad? Keynote 2.0.1 (1075) - Check Settings > Keynote
If so, there isn't much that you can do other than report this bug to Apple http://www.apple.com/feedback/ipad.html
You could try restarting or resetting your iPad.
Restart: Press On/Off button until the Slide to Power Off slider appears, select Slide to Power Off and, after the iPad shuts down, then press the On/Off button until the Apple logo appears.
Reset: Press the Home and On/Off buttons at the same time and hold them until the Apple logo appears (about 10 seconds). -
ALV using splitter flush problem
Hi
I am using ALV splitter (having two alvs on same screen).
But the values are not getting flush, getting the same alv values, even after coming back to the same alv screen with new values.
Can anyone please tell me which objects i need to set_focus and which to free.
Thanks
ManuHi,
U need to use public method REFRESH_TABLE_DISPLAY in CL_GUI_ALV_GRID ....
Amitava -
Alv using class In list format
Hi,
I am using a method set_table_for_first_display in class cl_gui_alv_grid to display ALV. but by default the output appears in grid format, I want to change the output in LIST format.
What can I do to change the output in list format.
Kind Regards,
Abhishek.try this.... this is an example code.... don't use set_table_for_first_display rather use CL_SALV_TABLE and execute the below code
*& Report ZAMIT_TEST
REPORT zamit_test MESSAGE-ID z_zzz_ca_messages.
* constants for icons
TYPE-POOLS: icon, col.
* type for internal table
TYPES: BEGIN OF x_sflight.
* selfld TYPE char1.
INCLUDE STRUCTURE sflight.
TYPES: seatsfree TYPE sflight-seatsocc,
usage TYPE n, " exception
icon_future TYPE icon-id, " icon for future / past
line_counter TYPE i, " line counter
it_colors TYPE lvc_t_scol, " internal tab for cell color info
END OF x_sflight.
* Internal table
DATA: i_sflight TYPE STANDARD TABLE OF x_sflight,
wa_sflight TYPE x_sflight,
wa_colors TYPE lvc_s_scol,
list_display TYPE sap_bool,
vref_cont TYPE REF TO cl_gui_custom_container,
vref_alv TYPE REF TO cl_salv_table, " ALV instance
oref_error TYPE REF TO cx_salv_error, " Error instance
l_text_alv_e TYPE string,
ok_code TYPE syucomm.
SELECT-OPTIONS: so_car FOR wa_sflight-carrid MEMORY ID car,
so_con FOR wa_sflight-connid.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK alv WITH FRAME TITLE text-alv.
PARAMETERS: pa_full RADIOBUTTON GROUP alvd DEFAULT 'X',
pa_cont RADIOBUTTON GROUP alvd,
pa_list RADIOBUTTON GROUP alvd.
SELECTION-SCREEN END OF BLOCK alv.
PARAMETERS: p_layout TYPE slis_vari.
* CLASS lcl_handler DEFINITION
CLASS lcl_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
on_added_function FOR EVENT added_function OF cl_salv_events_table
IMPORTING e_salv_function, " type salv_de_function
on_double_click FOR EVENT double_click OF cl_salv_events_table
IMPORTING row, " type salv_de_row = int4
on_link_click FOR EVENT link_click OF cl_salv_events_table
IMPORTING row " type salv_de_row = int4
column." type salv_de_column = char(30)
ENDCLASS. "lcl_handler definition
* CLASS lcl_handler IMPLEMENTATION
CLASS lcl_handler IMPLEMENTATION.
METHOD on_added_function.
DATA: l_oref_columns TYPE REF TO cl_salv_columns_table,
l_oref_column TYPE REF TO cl_salv_column_table,
l_oref_column1 TYPE REF TO cl_salv_column,
l_except1 TYPE REF TO cx_salv_not_found, "Exception
l_text1 TYPE string, "Exception msg
l_lvc_s_colo TYPE lvc_s_colo.
CASE e_salv_function.
WHEN 'REORDER'.
* get the COLUMNS object
l_oref_columns = vref_alv->get_columns( ).
* positions: (MANDT column + 3 key colums)
l_oref_columns->set_column_position( columnname = 'SEATSOCC'
position = 5 ).
l_oref_columns->set_column_position( columnname = 'SEATSOCC_B'
position = 6 ).
l_oref_columns->set_column_position( columnname = 'SEATSOCC_F'
position = 7 ).
* prepare color info
* column SEATSOCC
TRY.
CALL METHOD l_oref_columns->get_column
EXPORTING
columnname = 'SEATSOCC'
RECEIVING
value = l_oref_column1.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
l_oref_column ?= l_oref_column1.
l_oref_column->set_color( value = l_lvc_s_colo ).
* column SEATSOCC_B
TRY.
CALL METHOD l_oref_columns->get_column
EXPORTING
columnname = 'SEATSOCC_B'
RECEIVING
value = l_oref_column1.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
l_oref_column ?= l_oref_column1.
l_oref_column->set_color( value = l_lvc_s_colo ).
* column SEATSOCC_F
TRY.
CALL METHOD l_oref_columns->get_column
EXPORTING
columnname = 'SEATSOCC_F'
RECEIVING
value = l_oref_column1.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
l_oref_column ?= l_oref_column1.
l_oref_column->set_color( value = l_lvc_s_colo ).
ENDCASE.
ENDMETHOD. "on_added_function
METHOD on_double_click.
DATA: message_text(70),
lc_seatsfree_e(10),
lc_seatsfree_b(10),
lc_seatsfree_f(10).
READ TABLE i_sflight INTO wa_sflight INDEX row.
CHECK sy-subrc EQ 0.
lc_seatsfree_e = wa_sflight-seatsmax - wa_sflight-seatsocc.
lc_seatsfree_b = wa_sflight-seatsmax_b - wa_sflight-seatsocc_b.
lc_seatsfree_f = wa_sflight-seatsmax_f - wa_sflight-seatsocc_f.
CONCATENATE 'FREE SEATS:'(frs) 'ECONOMY:'(eco) lc_seatsfree_e
'BUSINESS'(bus) lc_seatsfree_b 'FIRST'(fst) lc_seatsfree_f
INTO message_text SEPARATED BY space.
MESSAGE message_text TYPE 'I'.
ENDMETHOD. "on_double_click
METHOD on_link_click.
DATA: lc_carrname TYPE scarr-carrname,
lc_currcode TYPE scarr-currcode,
message_text(70).
READ TABLE i_sflight INTO wa_sflight INDEX row.
CHECK sy-subrc EQ 0.
CASE column.
WHEN 'CARRID'.
SELECT SINGLE carrname currcode
INTO (lc_carrname, lc_currcode)
FROM scarr
WHERE carrid = wa_sflight-carrid.
IF sy-subrc EQ 0.
CONCATENATE 'AIRLINE:'(air) wa_sflight-carrid
'NAME:'(nme) lc_carrname
'CURRENCY:' lc_currcode
INTO message_text
SEPARATED BY space.
MESSAGE message_text TYPE 'I'.
ENDIF.
WHEN 'SELFLD'.
MESSAGE i000 with 'Checkbox Clicked'.
ENDCASE.
ENDMETHOD. "on_link_click
ENDCLASS. "lcl_handler IMPLEMENTATION
START-OF-SELECTION.
* retrieve data into internal table
SELECT * FROM sflight
INTO CORRESPONDING FIELDS OF TABLE i_sflight
WHERE carrid IN so_car
AND connid IN so_con.
END-OF-SELECTION.
* fill additional data fields
LOOP AT i_sflight INTO wa_sflight.
* seats free
wa_sflight-seatsfree =
wa_sflight-seatsmax + wa_sflight-seatsmax_b
+ wa_sflight-seatsmax_f
- wa_sflight-seatsocc - wa_sflight-seatsocc_b
- wa_sflight-seatsocc_f.
* usage (exception light)
IF wa_sflight-seatsfree = 0.
wa_sflight-usage = '1'.
ELSEIF wa_sflight-seatsfree <= 20.
wa_sflight-usage = '2'.
ELSE.
wa_sflight-usage = '3'.
ENDIF.
* icon "in the future/not in the future"
IF wa_sflight-fldate > sy-datum.
wa_sflight-icon_future = icon_positive.
ELSE.
wa_sflight-icon_future = icon_negative.
ENDIF.
* cell colors
* single cell if planetype is 747-400
IF wa_sflight-planetype = '747-400'.
CLEAR wa_colors.
wa_colors-fname = 'PLANETYPE'.
wa_colors-color-col = col_positive.
wa_colors-color-int = 1.
APPEND wa_colors TO wa_sflight-it_colors.
ENDIF.
* whole line if seatsfree gt 200
IF wa_sflight-seatsfree >= 200.
CLEAR wa_colors.
wa_colors-color-col = col_heading.
wa_colors-color-int = 1.
APPEND wa_colors TO wa_sflight-it_colors.
ENDIF.
MODIFY i_sflight
FROM wa_sflight
TRANSPORTING
seatsfree
usage
icon_future
it_colors.
ENDLOOP.
CASE 'X'.
WHEN pa_full OR pa_list.
IF pa_list IS NOT INITIAL.
list_display = if_salv_c_bool_sap=>true.
ELSE.
list_display = if_salv_c_bool_sap=>false.
ENDIF.
TRY.
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display = list_display
IMPORTING
r_salv_table = vref_alv
CHANGING
t_table = i_sflight.
CATCH cx_salv_msg INTO oref_error.
l_text_alv_e = oref_error->get_text( ).
MESSAGE i000 WITH l_text_alv_e.
LEAVE LIST-PROCESSING.
ENDTRY.
* define settings
PERFORM define_settings USING vref_alv.
* display ALV
vref_alv->display( ).
WHEN pa_cont.
CALL SCREEN 100.
ENDCASE.
*& Form define_settings
* text
* -->P_ALV ALV object
FORM define_settings USING p_alv TYPE REF TO cl_salv_table.
PERFORM: sub_set_display USING p_alv,
sub_set_columns USING p_alv,
sub_set_sorts USING p_alv,
sub_set_aggregs USING p_alv,
sub_set_selections USING p_alv,
sub_set_layout USING p_alv,
sub_set_functions USING p_alv,
sub_set_events USING p_alv,
sub_set_header USING p_alv.
ENDFORM. " define_settings
*& Form sub_set_display
* set general display attributs
* -->P_ALV ALV object
FORM sub_set_display USING p_alv TYPE REF TO cl_salv_table.
DATA: lr_display TYPE REF TO cl_salv_display_settings,
l_title TYPE lvc_title.
* get display settings object
lr_display = p_alv->get_display_settings( ).
* set header
l_title = text-ttl.
lr_display->set_list_header( value = text-ttl ).
* set horizontal lines off
lr_display->set_horizontal_lines( value = ' ' ).
* set striped pattern
lr_display->set_striped_pattern( value = 'X' ).
ENDFORM. " sub_set_display
*& Form sub_set_columns
* text
* -->P_ALV text
FORM sub_set_columns USING p_alv TYPE REF TO cl_salv_table.
DATA: l_oref_columns TYPE REF TO cl_salv_columns_table,
l_oref_column TYPE REF TO cl_salv_column_table,
l_oref_column1 TYPE REF TO cl_salv_column,
l_except1 TYPE REF TO cx_salv_not_found, "Exception
l_except2 TYPE REF TO cx_salv_data_error, "Exception
l_text1 TYPE string, "Exception msg
l_scrtext_s TYPE scrtext_s,
l_scrtext_m TYPE scrtext_m,
l_scrtext_l TYPE scrtext_l,
l_lvc_tip TYPE lvc_tip, " for tooltip
l_pos TYPE i, " column position
l_lvc_s_colo TYPE lvc_s_colo. " column color
l_oref_columns = p_alv->get_columns( ). " get columns object
* set exception column
TRY.
CALL METHOD l_oref_columns->set_exception_column
EXPORTING
value = 'USAGE'.
CATCH cx_salv_data_error INTO l_except2.
l_text1 = l_except2->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
* set count column
TRY.
CALL METHOD l_oref_columns->set_count_column
EXPORTING
value = 'LINE_COUNTER'.
CATCH cx_salv_data_error INTO l_except2.
l_text1 = l_except2->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
* set cell colors / line colors column
TRY.
CALL METHOD l_oref_columns->set_color_column
EXPORTING
value = 'IT_COLORS'.
CATCH cx_salv_data_error INTO l_except2.
l_text1 = l_except2->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
* column ICON_FUTURE
TRY.
CALL METHOD l_oref_columns->get_column
EXPORTING
columnname = 'ICON_FUTURE'
RECEIVING
value = l_oref_column1.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
l_oref_column ?= l_oref_column1.
l_oref_column->set_icon( ).
l_scrtext_s = text-fut.
l_oref_column->set_short_text( value = l_scrtext_s ).
l_oref_column->set_row( value = 2 ).
* Column SEATSFREE
TRY.
CALL METHOD l_oref_columns->get_column
EXPORTING
columnname = 'SEATSFREE'
RECEIVING
value = l_oref_column1.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
l_oref_column ?= l_oref_column1.
* set color to COL_GROUP
l_lvc_s_colo-col = col_group.
l_lvc_s_colo-int = 1.
l_oref_column->set_color( value = l_lvc_s_colo ).
** Column SELFLD
* TRY.
* CALL METHOD l_oref_columns->get_column
* EXPORTING
* columnname = 'SELFLD'
* RECEIVING
* value = l_oref_column1.
* CATCH cx_salv_not_found INTO l_except1.
* l_text1 = l_except1->get_text( ).
* MESSAGE i000 WITH l_text1.
* LEAVE LIST-PROCESSING.
* ENDTRY.
* l_oref_column ?= l_oref_column1.
** set color to COL_GROUP
* if pa_list = 'X'.
* l_oref_column->set_cell_type( value =
* if_salv_c_cell_type=>CHECKBOX ).
* ELSEIF pa_full = 'X'.
* l_oref_column->set_cell_type( value =
* if_salv_c_cell_type=>CHECKBOX_HOTSPOT ).
* endif.
ENDFORM. "sub_set_columns
*& Form sub_set_sorts
* -->P_ALV text
FORM sub_set_sorts USING p_alv TYPE REF TO cl_salv_table.
DATA: l_oref_sorts TYPE REF TO cl_salv_sorts,
l_except1 TYPE REF TO cx_salv_not_found, "Exception
l_except2 TYPE REF TO cx_salv_existing, "Exception
l_except3 TYPE REF TO cx_salv_data_error, "Exception
l_text1 TYPE string. "Exception msg
* get the SORTS object
l_oref_sorts = p_alv->get_sorts( ).
* add sorts
TRY.
CALL METHOD l_oref_sorts->add_sort
EXPORTING
columnname = 'CARRID'
position = 1.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_existing INTO l_except2.
l_text1 = l_except2->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_data_error INTO l_except3.
l_text1 = l_except3->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
TRY.
CALL METHOD l_oref_sorts->add_sort
EXPORTING
columnname = 'CONNID'
position = 2
subtotal = if_salv_c_bool_sap=>true.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_existing INTO l_except2.
l_text1 = l_except2->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_data_error INTO l_except3.
l_text1 = l_except3->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
TRY.
CALL METHOD l_oref_sorts->add_sort
EXPORTING
columnname = 'FLDATE'
position = 3.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_existing INTO l_except2.
l_text1 = l_except2->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_data_error INTO l_except3.
l_text1 = l_except3->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
ENDFORM. " sub_set_sorts
*& Form sub_set_aggregs
* -->P_ALV text
FORM sub_set_aggregs USING p_alv TYPE REF TO cl_salv_table.
DATA: l_oref_aggregs TYPE REF TO cl_salv_aggregations,
l_except1 TYPE REF TO cx_salv_data_error, "Exception
l_except2 TYPE REF TO cx_salv_not_found, "Exception
l_except3 TYPE REF TO cx_salv_existing, "Exception
l_text1 TYPE string. "Exception msg
l_oref_aggregs = p_alv->get_aggregations( ).
TRY.
CALL METHOD l_oref_aggregs->add_aggregation
EXPORTING
columnname = 'SEATSFREE'
aggregation = if_salv_c_aggregation=>total.
CATCH cx_salv_data_error INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_not_found INTO l_except2.
l_text1 = l_except2->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_existing INTO l_except3.
l_text1 = l_except3->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
ENDFORM. " sub_set_aggregs
*& Form sub_set_selections
* -->P_ALV text
FORM sub_set_selections USING p_alv TYPE REF TO cl_salv_table.
DATA: lr_selections TYPE REF TO cl_salv_selections.
* get the SELECTIONS object
lr_selections = p_alv->get_selections( ).
* set the selection mode
lr_selections->set_selection_mode(
value = if_salv_c_selection_mode=>cell ).
ENDFORM. " sub_set_selections
*& Form sub_set_layout
* -->P_ALV text
FORM sub_set_layout USING p_alv TYPE REF TO cl_salv_table.
DATA: lr_layout TYPE REF TO cl_salv_layout,
ls_key TYPE salv_s_layout_key.
* get the LAYOUT object
lr_layout = p_alv->get_layout( ).
* set the layout key
ls_key-report = sy-cprog.
lr_layout->set_key( value = ls_key ).
* set save restriction
* (restriction "none" is intended,
* so we may use the default)
lr_layout->set_save_restriction(
* VALUE = IF_SALV_C_LAYOUT=>RESTRICT_NONE
* allow setting a default layout
lr_layout->set_default( value = 'X' ).
* set initial layout
lr_layout->set_initial_layout( value = p_layout ).
ENDFORM. " sub_set_layout
*& Form sub_set_functions
* -->P_ALV text
FORM sub_set_functions USING p_alv TYPE REF TO cl_salv_table.
DATA: lr_functions TYPE REF TO cl_salv_functions_list,
l_except1 TYPE REF TO cx_salv_existing,
l_except2 TYPE REF TO cx_salv_wrong_call,
l_text1 TYPE string,
* help variables for method call ADD_FUNCTION
l_icon TYPE string,
l_text TYPE string,
l_tooltip TYPE string.
IF pa_full = 'X' or pa_list = 'X'.
p_alv->set_screen_status( pfstatus = 'SALV_TABLE_STANDARD'
report = sy-repid
set_functions = p_alv->c_functions_all ).
ENDIF.
* get the FUNCTIONS object
lr_functions = p_alv->get_functions( ).
* offer all generic functions
lr_functions->set_all( value = if_salv_c_bool_sap=>true ).
* subtract average
lr_functions->set_aggregation_average(
value = if_salv_c_bool_sap=>false ).
* subtract all export functions
lr_functions->set_group_export(
value = if_salv_c_bool_sap=>false ).
* enable exort to local file
lr_functions->set_export_localfile(
value = if_salv_c_bool_sap=>true ).
* subtract transfer to lotus
lr_functions->set_view_lotus(
value = if_salv_c_bool_sap=>false ).
* customer defined function:
* display occupied seats columns most left
* and highlight them
* IF pa_cont = 'X'.
* l_icon = icon_insert_row.
* l_text = text-tot.
* l_tooltip = text-ttt.
* TRY.
* CALL METHOD lr_functions->add_function
* EXPORTING
* name = 'REORDER'
* icon = l_icon
* text = l_text
* tooltip = l_tooltip
* position = if_salv_c_function_position=>right_of_salv_functions.
* CATCH cx_salv_existing INTO l_except1.
* l_text1 = l_except1->get_text( ).
* MESSAGE i000 WITH l_text1.
* LEAVE LIST-PROCESSING.
* CATCH cx_salv_wrong_call INTO l_except2.
* l_text1 = l_except2->get_text( ).
* MESSAGE i000 WITH l_text1.
* LEAVE LIST-PROCESSING.
* ENDTRY.
* ENDIF.
ENDFORM. " sub_set_functions
*& Form sub_set_events
* text
* -->P_ALV text
FORM sub_set_events USING p_alv TYPE REF TO cl_salv_table.
DATA: lr_event TYPE REF TO cl_salv_events_table.
* get the EVENT object
lr_event = p_alv->get_event( ).
SET HANDLER :
lcl_handler=>on_added_function FOR lr_event,
lcl_handler=>on_double_click FOR lr_event,
lcl_handler=>on_link_click FOR lr_event.
ENDFORM. " sub_set_events
*& Form sub_set_header
* -->P_ALV text
FORM sub_set_header
USING p_alv TYPE REF TO cl_salv_table.
DATA: lr_grid TYPE REF TO cl_salv_form_layout_grid.
* 1st step: create the grid object
CREATE OBJECT lr_grid.
* 2nd step: add some text items
lr_grid->create_header_information( row = 1 column = 1
text = 'Flight List Grp ##'(fll) ).
lr_grid->create_text( row = 2 column = 1
text = 'Please check utilization'(uti) ).
* 3rd step: declare grid as header of list
p_alv->set_top_of_list( value = lr_grid ).
ENDFORM. " sub_set_header
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SALV_TABLE_STANDARD'.
SET TITLEBAR 'T100'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module create_control OUTPUT
* text
MODULE create_control OUTPUT.
IF vref_cont IS NOT BOUND.
* create container control
* and link it to the dynpro
CREATE OBJECT vref_cont
EXPORTING
container_name = 'MY_CONTAINER'
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'Error when creating the container object'.
ENDIF.
* create ALV and
* link it to the container control
TRY.
cl_salv_table=>factory(
EXPORTING
r_container = vref_cont
IMPORTING
r_salv_table = vref_alv
CHANGING
t_table = i_sflight ).
CATCH cx_salv_msg INTO oref_error.
l_text_alv_e = oref_error->get_text( ).
MESSAGE i000 WITH l_text_alv_e.
LEAVE LIST-PROCESSING.
ENDTRY.
* display ALV
vref_alv->display( ).
ENDIF.
ENDMODULE. " create_control OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
SET SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module exit INPUT
* text
MODULE exit INPUT.
SET SCREEN 0.
ENDMODULE. " exit INPUT -
Problem with checkbox group in row popin of table.
In table row popin I have kept Check Box Group.I have mapped the texts property of checkbox group to the attribute which is under the subnode of the table.the subnode properties singleton=false,selectioncardinality=0-n,and cardinality=0-n.
if there are 'n' number of records in the table.each record will have its own row popin and in the row popin there is check box group.
the check box group in the row popin belongs to that perticular row.
but the checkboxegroup values in row popins of all the rows are getting changed to the row which is lead selected.
The same scenario (table in the row popin is showing the values corresponding to its perticular row and all the table values in popin are not getting changed to the one lead selected in the main table)is working fine with the table in place of checkbox group in row popin with datasource property of table binded to the subnode
I cant trace out the problem with checkbox group in place of table.
Please help me in this regard.I have to place check box group in place of table in row popin.
Thanks and Regards
Kiran Kumar KI have done the same thing successfully with normal check box ui element. Try using check box in your tabel cell editor instead of check box group.
Maybe you are looking for
-
Problem with contacts after upgrading to iOS 7 (iphone 5)
After upgrading to iOS 7 (iphone 5), the contacts (loaded from icloud) in greek language aren't sorted!!! They are under the # symbol!! Anyone has a solution. I didnt have this problem with previous iOS versions!!!!
-
Bad URL Created by XML Report Wizard
Hello all, I don't know if anyone else has run into or published this, but I thought I would as an FYI, and since I burned 90 minutes troubleshooting it. I used the Report Builder Wizard in shared components, built a query, exported to XML, built my
-
Report for Activity hours consumed
Dear All, I am lookinf for a report showing no. of activity hrs. actually consumed with in a given period.I guess there are certain reports available in CO ,but looking for the right one.Plz help.
-
Porting from CS4 to CS5, save document failed.
I am porting programes from CS4 to CS5, and meet a problem. In my program I need delete some page from a indesign document and then save it back. I open the document use the code below InterfacePtr<IK2ServiceRegistry> serviceRegistry(Porting::GetP
-
Hi there Just wanted to know is it a bug or feature - in case if Column store table has non capital letters in its name, then bulk load does not work and performance is ruined? Mike