How to validate the columns in dynamic alv grid
Hi Friends,
I want to validatethe value of all the columens (min 1 and max 40) which i create dynamically in alv grid.
value must be between 0 and 1 only.
Please help ,, need urgently.
method handle_data_changed.
data: ls_good type lvc_s_modi,
li_diff type i,
value type p DECIMALS 3,
old_value type p DECIMALS 3,
lw_outtab1 type gt_tab.
clear value.
loop at er_data_changed->mt_good_cells into ls_good.
value = ls_good-value.
old_value = ls_good-value.
if value lt 0 or value gt 1.
MESSAGE 'Value is out of range' TYPE 'I'.
Read table gt_outtab1 into lw_outtab1 index ls_good-row_id .
perform show_alv.
clear ls_good.
ENDIF.
ENDCASE.
ENDLOOP.
I again created the table.. actually data is not changed in the internal table but still it shows the changed value in the alv grid. even in build the table again and call the refersh alv grid method..
Similar Messages
-
How to find the selected item in alv grid or table control
can any one tell me please
how to find the selected item in alv grid or table controlIn table control, If you goto screen painter and goto table control properties ( f2 ), there is one check-box w/selColumn check that and give column name. Then add that column to your internal table.
IN PAI
LOOP AT it_tkhdr.
FIELD it_tkhdr-sel_row
MODULE tab_tkhdr_mark ON REQUEST.
ENDLOOP.
MODULE tab_tkhdr_mark INPUT.
MODIFY it_tkhdr INDEX tc_tkhdr-current_line.
ENDMODULE. " tab_tkhdr_mark INPUT
here it_TKHDR is internal table sel_row is field for selection
After that, you can loop at it_tkhdr where sel_row is 'X' to get selected rows.
regards,
Gagan -
How to extract the column width in ALv report if its executed in background
I am executing an ALV report in background , in front end i am getting data properly, in back end for some columns some of the digits are missing.For example if PO no is of 10 digits it will display only 8 becos column size is like that , how to extract coulmns in back ground.
I have executed in background and checked the spool and for some of the columns width is not sufficient to display comeplete data so please suggest how to extract the columns sizes if executed inj background for an ALVHi Deepthi,
you can try with the above mentioned suggestions ,if its worked its fine ,
If not use Docking container instead of custom container, For ALV in back ground jobs, its suggest to use docking container instead of custom container , below you can find the declaration for docking container and code to use docking and custom container in your program for fore and back ground.
or you can use docking container alone for both operations.
Data : G_DOCK1 TYPE REF TO CL_GUI_DOCKING_CONTAINER,
IF CCON IS INITIAL. (ccon is container name )
*Check whether the program is run in batch or foreground
IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
*Run in foreground
CREATE OBJECT CCON
EXPORTING
CONTAINER_NAME = 'CON1'.
CREATE OBJECT GRID1
EXPORTING
I_PARENT = parent_1.
ELSE.
*Run in background
CREATE OBJECT GRID1
EXPORTING
I_PARENT = G_DOCK1.
ENDIF.
ENDIF.
B&R,
Saravana.S -
How to increase the column size of Alv tbale
Hi All,
I created an Alv table to display the content of my database table. In one of the column the entire data from my database are not displayed the last few characters are missing. The data type for that column in the database is char. Can any one help me how to increase the column size in my Alv table or any suggestions to resolve this issue.Hi Vadiv,
Try with this..
DATA: LR_IF_CONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE,
LR_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE,
LR_CMDL TYPE REF TO CL_SALV_WD_CONFIG_TABLE,
LR_TABLE_SETTING TYPE REF TO IF_SALV_WD_TABLE_SETTINGS.
LR_CMP_USAGE = WD_THIS->WD_CPUSE_ALV( ).
IF LR_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
LR_CMP_USAGE->CREATE_COMPONENT( ).
ENDIF.
" get reference to the ALV model
LR_IF_CONTROLLER = WD_THIS->WD_CPIFC_ALV( ).
LR_CMDL = LR_IF_CONTROLLER->GET_MODEL( ).
LR_TABLE_SETTING ?= LR_CMDL.
" Set column width
DATA LR_COL TYPE REF TO CL_SALV_WD_COLUMN.
LR_COL = LR_CMDL->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'PERNR' ).
LR_COL->SET_WIDTH( '70' ) .
LR_COL = LR_CMDL->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'ENAME' ).
LR_COL->SET_WIDTH( '100' ) .
LR_TABLE_SETTING->SET_FIXED_TABLE_LAYOUT( ABAP_TRUE ).
You can refer to webdynpro component SALV_WD_TEST_TABLE_PROPS. Go to the view TABLE and look inside the method SET_COLUMN_SETTINGS. I hope this will help you.
Cheers,
Kris. -
How to switch off column coloring of alv grid printouts?
Hello World!
Is there any possibility (a customizing option or a parameter) to switch off cell/column coloring of alv grid printouts?
It is very useful to see colored columns in screens, but they are darkened in printouts. How to avoid it?
Thanks and regards,
VladimirHi,
You can have different layouts for a ALV report and each layout the look and feel can be different.
So, the manual activity is the user will have to switch to the B/W layout before printing. I am not sure if you have enabled the LAYOUT option for the user to change it by himself.
I hope I am able to get across my point.
If you are using OO ALV control, you can dynamically change the layout using set_frontend_layout method. The user can also change the layout --
choose Change layout or Settings ® Layout ® Change.
The Change Layout dialog box shows you which columns are currently displayed and which additional columns can be displayed.
Regards,
Ravi
Note - Please mark the helpful answers
Message was edited by: Ravikumar Allampallam -
How to identify the modified rows in ALV grid in OO
Hello All,
I have strange problem and i don't know how to solve it?
I have ALV grid and in that ALV grid i have two buttons 'CONT' and 'ALLOC', when the user press 'ALLOC' button i will give a popup to make the user to enter some value.
After entering the value i will do some calicualtions and i will distribute the amount in the fields of ALV grid and i should update the ALVGRID.
Normally we can use CALL METHOD ME->REFRESH_TABLE_DISPLAY.( I have already checked by using this method and it worked fine)
Here is the way my program look like
ALVTREE1
ALVTREE2
|----
ALVGRID
The problem is when i press the other button CONT i am unable to know what values exist in ALVGRID.
How can i find these distributed amount in ALV?
I hope i am clear while explaining problem.
Here is the required code:
method handle_user_command.
data: lt_fields type table of sval,
ls_field type sval,
ls_fieldcatalog type lvc_s_fcat,
ls_merkpl type zvhf_merkpl,
lv_month(2) type n ,
lv_year(4) type n ,
lv_spmon type zvhf_allocation-spmon,
lv_value type p.
field-symbols: <fs> type any,
<ls_merkpl> type zvhf_merkpl.
case e_ucomm.
when 'CNT'.
call method gcl_gui_alv_grid->check_changed_data.
call method dailogbox_container->set_visible
exporting
visible = space.
call method gcl_gui_alv_tree2->frontend_update.
call method gcl_gui_alv_tree2->update_calculations.
clear: gt_merkpl.
when 'ALCT'.
Popup to get the values enterd by the user
ls_field-tabname = 'DD02V'.
ls_field-fieldname = 'DDTEXT'.
append ls_field to lt_fields.
call function 'POPUP_GET_VALUES'
exporting
popup_title = 'Enter value'
start_column = '1'
start_row = '1'
tables
fields = lt_fields
exceptions
error_in_fields = 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.
elseif sy-subrc = 0.
read table lt_fields into ls_field index 1.
if sy-subrc = 0.
gv_value = ls_field-value.
Read the table zvhf_allocation with nodekey in order to get percentages
select * from zvhf_allocation into table gt_allocation
where dvkbur = gs_node_info-nodename.
Read gt_merkpl in order to get existing line in ALV grid
loop at gt_merkpl into ls_merkpl.
*Read FCAT inorder to find the field and move proprtinate value
loop at gt_fieldcatlog3 into ls_fieldcatalog.
*Split is required to match ZVHF_ALLOCATION-SPMON with screen text and to proprtinate the value
split ls_fieldcatalog-scrtext_l at '.' into
lv_month lv_year.
concatenate lv_year lv_month into lv_spmon.
Check whether an entry exist or not in ZVHF_allocation
read table gt_allocation into gs_allocation
with key spmon = lv_spmon binary search.
*If an entry exist proprtinate the value as enterd in table
if sy-subrc = 0.
lv_value = gv_value * gs_allocation-prozent.
lv_value = lv_value / 100.
perform assign_value using ls_fieldcatalog-fieldname lv_value
changing ls_merkpl.
modify gt_merkpl from ls_merkpl.
endif.
endloop.
CALL METHOD gcl_gui_alv_grid->frontend_update.
call method gcl_gui_alv_grid->refresh_table_display
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.
endloop.
endif.
endif.
endcase.
endmethod. "handle_user_command
If you have any further questions please let me know.
Regards,
LisaHello Vijay,
Thanks for you reply,
The event data_changed is not working because i called method refresh_table_display. So the event changed will not be raised after i press button CONT
If i didn't call this method then i can see the value enterd by the user in ALV grid.
So, do you have an more ideas.
Regards,
Lisa -
All the columns of an alv grid report are not downloading in excel in 1 lin
Hi All,
I have some 60 columns in my alv grid report and user can download the report using list->export->localfile->spreadsheet.
What the issue is that all the columns are not downloading in one line, instead they split in two rows.
Please help.
Regards,
Neha Patelhi,
just use this procedure it will solve your problem:
Firstly export the data to memory using the FM LIST_FROM_MEMORY.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE e000(su) WITH text-001.
ENDIF.
then i converted it into ASCII using LIST_TO_ASCI,
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = t_xlstab
listobject = t_listobject
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE e003(yuksdbfzs).
ENDIF.
This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=>newline and cl_abap_char_utilities=>horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with
cl_abap_char_utilities=>horizontal_tab.
Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.
This will create an excel attachment.
Sample code for formatting the data for the attachment in excel format.
u2022 Format the data for excel file download
LOOP AT t_xlstab INTO wa_xlstab .
DESCRIBE TABLE t_xlstab LINES lw_cnt.
CLEAR lw_sytabix.
lw_sytabix = sy-tabix.
u2022 If not new line then replace '|' by tabs
IF NOT wa_xlstab EQ cl_abap_char_utilities=>newline.
REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab
WITH cl_abap_char_utilities=>horizontal_tab.
MODIFY t_xlstab FROM wa_xlstab .
CLEAR wa_xlstab.
wa_xlstab = cl_abap_char_utilities=>newline.
IF lw_cnt NE 0 .
lw_sytabix = lw_sytabix + 1.
u2022 Insert new line for the excel data
INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.
lw_cnt = lw_cnt - 1.
ENDIF.
CLEAR wa_xlstab.
ENDIF.
ENDLOOP.
Sample code for creating attachment and sending mail:
FORM send_mail .
u2022 Define the attachment format
lw_doc_type = 'XLS'.
u2022 Create the document which is to be sent
lwa_doc_chng-obj_name = 'List'.
lwa_doc_chng-obj_descr = w_subject. "Subject
lwa_doc_chng-obj_langu = sy-langu.
u2022 Fill the document data and get size of message
LOOP AT t_message.
lt_objtxt = t_message-line.
APPEND lt_objtxt.
ENDLOOP.
DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.
IF lw_tab_lines GT 0.
READ TABLE lt_objtxt INDEX lw_tab_lines.
lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
lwa_doc_chng-obj_langu = sy-langu.
lwa_doc_chng-sensitivty = 'F'.
ELSE.
lwa_doc_chng-doc_size = 0.
ENDIF.
u2022 Fill Packing List For the body of e-mail
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = 'RAW'.
APPEND lt_packing_list.
u2022 Create the attachment (the list itself)
DESCRIBE TABLE t_xlstab LINES lw_tab_lines.
u2022 Fill the fields of the packing_list for creating the attachment:
lt_packing_list-transf_bin = 'X'.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = lw_doc_type.
lt_packing_list-obj_name = 'Attach'.
lt_packing_list-obj_descr = w_docdesc.
lt_packing_list-doc_size = lw_tab_lines * 255.
APPEND lt_packing_list.
u2022 Fill the mail recipient list
lt_reclist-rec_type = 'U'.
LOOP AT t_recipient_list.
lt_reclist-receiver = t_recipient_list-address.
APPEND lt_reclist.
ENDLOOP.
u2022 Finally send E-Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = lw_sent_to_all
TABLES
packing_list = lt_packing_list
object_header = lt_objhead
contents_bin = t_xlstab
contents_txt = lt_objtxt
receivers = lt_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Hope it will help you
Regards
Rahul sharma -
How to merge the 2 field in alv gride display
Tables for ALV display
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
wa_layout TYPE slis_layout_alv,
it_exclude TYPE slis_t_extab,
wa_exclude TYPE slis_extab,
it_header TYPE STANDARD TABLE OF zqm_imir_hdr,
wa_header LIKE LINE OF it_header,
it_final TYPE STANDARD TABLE OF zqm_imir_itm,
wa_final LIKE LINE OF it_final,
it_vcode TYPE RANGE OF zqm_wtr_itm-vcode,
wa_vcode LIKE LINE OF it_vcode.
DEFINE m_fieldcat.
wa_fieldcat-fieldname = &1.
wa_fieldcat-tabname = &2.
wa_fieldcat-seltext_m = &3.
wa_fieldcat-outputlen = &4.
wa_fieldcat-col_pos = &5.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
END-OF-DEFINITION.
DEFINE m_vcode.
wa_vcode-option = &1.
wa_vcode-sign = &2.
wa_vcode-low = &3.
wa_vcode-high = ''.
append wa_vcode to it_vcode.
clear wa_vcode.
END-OF-DEFINITION.
START-OF-SELECTION.
PERFORM data_retrival.
PERFORM lead_time_calculation.
IF it_final[] IS NOT INITIAL.
PERFORM alv_display.
ENDIF.
Display ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = wa_layout
it_fieldcat = it_fieldcat
i_save = c_x
it_excluding = it_exclude
TABLES
t_outtab = IT_OUTPUT[]
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.
m_fieldcat: 'ZIMIRNO' 'IT_OUTPUT' text-003 21 0,
'PRUEFLOS' 'IT_OUTPUT' text-004 21 1,
'ZCRDAT' 'IT_OUTPUT' text-030 9 2,
'INITS' 'IT_OUTPUT' text-031 6 3,
'SPLIT' 'IT_OUTPUT' text-005 12 4,
'WERK' 'IT_OUTPUT' text-006 5 5,
'LOSMENGE' 'IT_OUTPUT' text-007 24 6,
'MENGENEINH' 'IT_OUTPUT' text-008 15 7,
'NAMEVEND' 'IT_OUTPUT' text-009 11 8,
*& Hypercare - 721600 - IMIR Changes - Start
'KONT_PSPNR' 'IT_OUTPUT' text-023 15 7,
'POSID' 'IT_OUTPUT' text-023 15 9,
*& Hypercare - 721600 - IMIR Changes - End
'LTEX1' 'IT_OUTPUT' text-024 24 10,
'EBELN' 'IT_OUTPUT' text-010 26 11,
'MBLNR' 'IT_OUTPUT' text-011 24 12,
'ANZGEB' 'IT_OUTPUT' text-012 17 13,
'GEBEH' 'IT_OUTPUT' text-013 4 14,
'MATNR' 'IT_OUTPUT' text-014 18 15,
'TXZ01' 'IT_OUTPUT' text-015 128 16,
'SPECE' 'IT_OUTPUT' text-016 23 17,
'VCODE' 'IT_OUTPUT' text-017 24 18,
'TAGNO' 'IT_OUTPUT' text-018 10 19,
'HEATNO' 'IT_OUTPUT' text-019 11 20,
'IDCODE' 'IT_OUTPUT' text-020 7 21,
'TCNO' 'IT_OUTPUT' text-021 9 22,
'REMARKS' 'IT_OUTPUT' text-022 30 23,
'BUDAT' 'IT_OUTPUT' text-025 30 24,
'CPUTM' 'IT_OUTPUT' text-026 30 25,
'VDATUM' 'IT_OUTPUT' text-027 30 26,
'VEZEITERF' 'IT_OUTPUT' text-028 30 27,
'ZLTIME' 'IT_OUTPUT' text-029 30 26,
'LEADTIME' 'IT_OUTPUT' text-029 30 28.
DATA : v_unit like T006-MSEHI VALUE 'HR',
v_FCALID like SCAL-FCALID,
v_zltim TYPE f,
v_zltime TYPE p LENGTH 8 DECIMALS 2.
SELECT SINGLE FABKL INTO v_FCALID FROM T001W WHERE WERKS = s_werks.
SELECT zcrdat INTO TABLE it_zqm_imir_hdr
from zqm_imir_hdr
FOR ALL ENTRIES IN it_final
where zcrdat EQ it_final-zcrdat.
SELECT mblnr mjahr budat cputm
INTO TABLE it_mkpf
from mkpf
FOR ALL ENTRIES IN it_final
where mblnr EQ it_final-mblnr
AND mjahr EQ it_final-mjahr.
SELECT prueflos vdatum vezeiterf
INTO TABLE it_qave
from qave
FOR ALL ENTRIES IN it_final
where prueflos EQ it_final-prueflos.
SORT it_mkpf BY mblnr mjahr.
SORT it_qave by prueflos.
SORT it_zqm_imir_hdr BY zcrdat.
LOOP AT it_final into wa_final.
CLEAR: wa_output,wa_mkpf,wa_qave,wa_zqm_imir_hdr.
MOVE-CORRESPONDING wa_final to wa_output.
READ TABLE it_zqm_imir_hdr INTO wa_zqm_imir_hdr WITH KEY zcrdat = wa_final-zcrdat
BINARY SEARCH.
READ TABLE it_mkpf INTO wa_mkpf WITH KEY mblnr = wa_final-mblnr
mjahr = wa_final-mjahr
BINARY SEARCH.
MOVE wa_zqm_imir_hdr-zcrdat TO wa_output-zcrdat.
MOVE wa_mkpf-budat TO wa_output-budat.
MOVE wa_mkpf-cputm TO wa_output-cputm.
READ TABLE it_qave INTO wa_qave WITH KEY prueflos = wa_final-PRUEFLOS
BINARY SEARCH.
MOVE wa_qave-vdatum TO wa_output-vdatum.
MOVE wa_qave-vezeiterf TO wa_output-vezeiterf.
LV_START_DATE = wa_zqm_imir_hdr-zcrdat.
LV_START_DATE = wa_mkpf-budat.
LV_START_TIME = wa_mkpf-cputm.
LV_END_TIME = wa_qave-vezeiterf.
LV_END_DATE = wa_qave-vdatum.
IF LV_START_DATE IS NOT INITIAL.
IF LV_END_DATE IS NOT INITIAL.
CALL FUNCTION 'SD_CALC_DURATION_FROM_DATETIME'
EXPORTING
i_date1 = LV_START_DATE
i_time1 = LV_START_TIME
i_date2 = LV_END_DATE
i_time2 = LV_END_TIME
IMPORTING
E_TDIFF = LV_DIFF
E_DATE2_EARLY = E_DATE2_EARLY
EXCEPTIONS
INVALID_DATETIME = 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.
eNDFORM.}
This is my code unable to merge the to tabs position is on 3rd and 4th.
need help ......
thanks,Hi,
From Your code I saw that you called Macro of fieldcat after Calling the ALV Function Did You Check That One.
Following links may be useful for you ,
ALV report: How to merge 2 columns into 1 column?
Hope this information helps You
Regards,
Raghava Channooru -
How to Edit the CheckBox in Classic ALV GRID Display
Hi,
I want to Edit the checkbox in Grid Display.
I have one checkbox field in my internal Table,
Code Of the Program,
Data :
Begin of itab occurs 0,
CHK type C,
MATNR like MARA-MATNR,
end of itab.
Iam building the fieldcatelog using Merge Funcion module.
After that I am chaning the properties of the field
catelog like below,
loop at I_FCAT assigning <FCAT>.
Case <FCAT>-Fieldname
When 'CHK'.
<FCAT>-Checkbox = 'X'.
<FCAT>-INPUT = 'X'.
I dont have edit option in fieldcatelog.
modify I_FCAT from <FCAT>.
endcase.
endloop.
In the Layout,
I_LAYOUT-box_fieldname = 'CHK'.
I_LAYOUT-box_tabname = 'ITAB'.
It is displaying the Checkbox field.but I couldnt edit the checkBox.
I can able to edit in REUSE_ALV_LIST_DISPLAY.
But I have to use REUSE_ALV_GRID_DISPLAY.How to edit the checkbox.
Thanks in Advance,
SumithraHi vasu,
The below procedure explains you to create a checkbox cloumn in the grid and allows you to edit i hope this will helps u.
The ALV Grid Control displays the cells of a column as checkboxes if the column is marked as a checkbox column in the field catalog.
Add another field to the output table in which you want to display checkboxes
OR
Define an existing field as a checkbox.
Procedure
1. Add a field to your output table:
Data: gt_fieldcat type lvc_t_fcat.
Types: begin of gs_outtab.
Types: checkbox type c. "field for checkbox
Include structure <ABAP Dictionary structure> .
Types: end of gs_outtab.
Data: gt_outtab type gs_outtab occurs 0 with header line.
2 * Add an entry for the checkbox to the field catalog
clear ls_fcat.
ls_fcat-fieldname = 'CHECKBOX'.
* Essential: declare field as checkbox and
* mark it as editable field:
ls_fcat-checkbox = 'X'.
ls_fcat-edit = 'X'.
* do not forget to provide texts for this extra field
ls_fcat-coltext = text-f01.
ls_fcat-tooltip = text-f02.
ls_fcat-seltext = text-f03.
append ls_fcat to gt_fieldcat.
regards,
venu. -
How to decrease the row height in ALV Grid (OOPS).
HI Experts,
I have displayed ALV Grid using CL_GUI_ALV_GRID=>SET_TABLE_FOR_DISPLAY.
I want to decrease the row height and width.
Can any one suggest how to do this?
Regards,
Kumar.Hi Kumar,
Row height it predefined and you won't change it, but you can adjust column width.
For that use field COL_OPT of layout structure ( type LVC_SLAYO ) to optimize all columns width, or set explicit width using field catalog, setting field OUTPUTLEN for certain column.
Regards
Marcin -
How to make the editable col. in alv grid scrollable?
friends,
i have made the last col. in my alv grid editable..even though i have declared it as char of length 255, it's showing only 50 characters in the grid..but when i try to type beyond 50 characters, it's not allowing...how to make it scrollable so that it extends beyond 50 char. and capture all the characters typed in that col.? pl suggest..thanks all..
Sathish. RHi, u can extend the length of your last field.
LOOP AT t_fieldcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN text-001.
ls_fcat-outputlen = c_10. "10
WHEN text-002.
ls_fcat-outputlen = c_20. "20
WHEN text-003. "your lastfield
ls_fcat-outputlen = c_255. "255
"do nothing
ENDCASE.
*fixed column
ls_fcat-fix_column = c_x.
*changes to take effect
MODIFY t_fieldcat FROM ls_fcat.
IF sy-subrc = 0.
"do nothing
ENDIF.
CLEAR ls_fcat.
ENDLOOP. -
How to capture the checkbox status in ALV Grid display
I need some immediate help regarding Grid ALV.
My Requirement: I need to display an ALV grid report along with checkboxes. Further, I need to provide an option wherein the user can checkboxes and select the records that I need to process further (by clicking the process button on the ALV Report).
My Query: The problem here is that I am not able to capture the status of the checkboxes. This means that I am not able to capture which of the records have been selected by checking their resp checkboxes.
Solutions that I have tried: I have tried capturing the same at user command by checking the value in slis_selfield. But all the records show the value as 1 for the checkbox field.
Kinldy suggest how to go about it.
I am not using Object Oriented ALV. Please suggest something to be used in ALV Grid display in 4.6C version.
Regards,
NamrataHere is a Sample code , it might help you
TABLES : sflight.
TYPE-POOLS: slis.
DATA : w_repid LIKE sy-repid.
w_repid = sy-repid.
DATA: BEGIN OF it_sflight OCCURS 0,
checkbox(1),
carrid LIKE sflight-carrid,
END OF it_sflight.
*layout
DATA: wa_layout TYPE slis_layout_alv.
*field catalog
DATA: it_fieldcatalog TYPE slis_t_fieldcat_alv,
wa_fieldcatalog TYPE slis_fieldcat_alv.
START-OF-SELECTION.
SELECT carrid FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_sflight.
END-OF-SELECTION.
CLEAR it_fieldcatalog.
REFRESH it_fieldcatalog.
wa_fieldcatalog-fieldname = 'CHECKBOX'.
wa_fieldcatalog-outputlen = '3'.
wa_fieldcatalog-col_pos = '1'.
wa_fieldcatalog-seltext_m = 'Chk'.
wa_fieldcatalog-checkbox = 'X'.
wa_fieldcatalog-edit = 'X'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'CARRID'.
wa_fieldcatalog-outputlen = '10'.
wa_fieldcatalog-col_pos = '2'.
wa_fieldcatalog-seltext_m = 'Carrid'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
is_layout = wa_layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcatalog
TABLES
t_outtab = it_sflight
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form USER_COMMAND
FORM user_command USING p_ucomm TYPE sy-ucomm
p_selfld TYPE slis_selfield.
CASE p_ucomm.
WHEN '&DATA_SAVE'.
DATA ref1 TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.
CALL METHOD ref1->check_changed_data.
LOOP AT it_sflight WHERE checkbox = 'X'.
DELETE it_sflight INDEX sy-tabix.
ENDLOOP.
p_selfld-refresh = 'X'.
ENDCASE.
ENDFORM. "user_command -
How to divide 2 columns totals in ALv grid
Hi All,
i developed alv report & displayed totals. now i need to divide those totals and display as another column total.
anyone please suggest.
col1 col2 col3
tot1 tot2 tot3
tot3 = tot2 / tot1.
thanks,Hi,
For this, in HTML_TOP_OF_PAGE or TOP_OF_PAGE first you need to get global reference variable for GRID
for getting reference call FM GET_GLOBALS_FROM_SLVC_FULLSCR.
By using this reference call method GET_SUBTOTALS it will get the all total into Internal Table .
Using Field Symbols u can calculate. Still u have any problem i will help u further .
Regards,
Ravindra. -
How to Organize the columns in the dynamic internal table?
Hello Folks!
How to Organize the columns in the dynamic internal table? i tried passing the parameter COL_POS to the fieldcatalog, Which is not working.Organize in What order ? What is your way to output ?
If you use ALV, you need to create fresh FIELD CATALOG for your dynamic table and then assign the column position.
Regards,
Diwakar -
How to use the column names generated from Dynamic SQL
Hi,
I have a problem with Dynamic SQL.
I have written an SQL which will dynamically generate the Select statement with from and where clause in it.
But that select statement when executed will get me hundreds of rows and i want to insert each row separately into one more table.
For that i have used a ref cursor to open and insert the table.
In the select list the column names will also be as follows: COLUMN1, COLUMN2, COLUMN3,....COLUMNn
Please find below the sample code:
TYPE ref_csr IS REF CURSOR;
insert_csr ref_csr;
v_select VARCHAR2 (4000) := NULL;
v_table VARCHAR2 (4000) := NULL;
v_where VARCHAR2 (4000) := NULL;
v_ins_tab VARCHAR2 (4000) := NULL;
v_insert VARCHAR2 (4000) := NULL;
v_ins_query VARCHAR2 (4000) := NULL;
OPEN insert_csr FOR CASE
WHEN v_where IS NOT NULL
THEN 'SELECT '
|| v_select
|| ' FROM '
|| v_table
|| v_where
|| ';'
ELSE 'SELECT ' || v_select || ' FROM ' || v_table || ';'
END;
LOOP
v_ins_query :=
'INSERT INTO '
|| v_ins_tab
|| '('
|| v_insert
|| ') VALUES ('
|| How to fetch the column names here
|| ');';
EXECUTE IMMEDIATE v_ins_query;
END LOOP;
Please help me out with the above problem.
Edited by: kumar0828 on Feb 7, 2013 10:40 PM
Edited by: kumar0828 on Feb 7, 2013 10:42 PM>
I Built the statement as required but i need the column list because the first column value of each row should be inserted into one more table.
So i was asking how to fetch the column list in a ref cursor so that value can be inserted in one more table.
>
Then add a RETURNING INTO clause to the query to have Oracle return the first column values into a collection.
See the PL/SQL Language doc
http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/returninginto_clause.htm#sthref2307
Maybe you are looking for
-
How do I use AirDrop to share files and documents between my iPad and computer?
Even directly plugging in my two devices to eachother I cannot get my documents onto both of my devices unless I go through a rediculously long route to do so. The only reason I got the IPAD was to NOT have to go save afile on my computer, email it t
-
How do I read my archived email stored as a pdf by adobe?
How do I read my archived email stored as a pdf by adobe? I have been archiving my email in adobe x. When I go to view it I cant seem to access the information, but the file is 200 mb and growing. I can read the first email but that is all.
-
Problem to connect database from Developer 6i
I have downloaded Developer 6i from oracle.com before that, I have already downloaded 9i database default_home directory is c:\orant. while i was installing develper 6i it was installed with forms_home, c:\orant\forms. I was using the forms builder t
-
Problem With Crystal Reports Reading Date Fields From CSV File
I have a date field in a CSV file in the format 06/28/09 17:23:55.523. When I use ODBC the configuartion picks it up a character field. I overright the recommendation type by specifing it is a date field but whne I bring the data into crystal reports
-
Blackberry Download Manager..i​s this a real program?
Downloaded Blackberry Download Manager on to my Mac. It seems to be working but, then again, I can't tell because it does nothing. I 'synched' the phone but that's it. The software said that it completed the synch but , So? Synched to what, to wh