How to set a selected checkbox in output internal table of oops ALV grid
Hi All,
i have a checkbox as first column in my ALV grid output using oops alv, when i select some checkbox, that rows have to be selected and i need to process only selected rows in user command.
i have given the below code also in fieldcatolg.
f_fldcat-fieldname = 'checkbox'.
f_fldcat-tabname ='gi_output'
f_fldcat-checkbox = 'X'.
f_fldcat-edit = 'X'.
but the checkbox is not getting set in internal table when i select some checkboxes.
can anybody explain y the checkbox in internal table not getting set?
Thanks,
Srilakshmi.
Hi,
i tried already whatever u said, but still not resolved.Pasted my code below..can u please look into it.
MODULE pbo OUTPUT.
PERFORM init_container.
PERFORM prepare_field_catalog.
PERFORM prepare_layout.
PERFORM display_output.
ENDMODULE. " PBO OUTPUT
*& Module PAI INPUT
text
MODULE pai INPUT.
DATA: lt_rows TYPE lvc_t_row.
CASE gv_okcode.
WHEN gc_exit OR gc_back OR gc_canc. " Finish program
LEAVE PROGRAM.
when 'PRINT'.
CALL METHOD gv_grid->get_selected_rows
IMPORTING et_index_rows = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
ENDCASE.
ENDMODULE. " PAI INPUT
*& Form INIT_CONTAINER
text
FORM init_container .
CREATE OBJECT gv_custom_container
EXPORTING
container_name = gc_container.
CREATE OBJECT gv_grid
EXPORTING
i_parent = gv_custom_container.
CREATE OBJECT gv_document
EXPORTING
style = 'ALV_GRID'.
*& Form PREPARE_FIELD_CATALOG
text
FORM prepare_field_catalog .
PERFORM fill_catalog USING:
'Table Name' 'Field Name' 'NoZero' 'sel-text'
'GI_OUTPUT' 'CHECKBOX' ' ' text-013 'X',
'GI_OUTPUT' 'KUNNR' 'X' text-003 ' ',
'GI_OUTPUT' 'NAME1' ' ' text-004 ' ',
'GI_OUTPUT' 'BELNR' 'X' text-005 ' ',
'GI_OUTPUT' 'BLART' ' ' text-006 ' ',
'GI_OUTPUT' 'BUDAT' ' ' text-007 ' ',
'GI_OUTPUT' 'BLDAT' ' ' text-008 ' ',
'GI_OUTPUT' 'DMBTR' ' ' text-009 ' ',
'GI_OUTPUT' 'WAERS' ' ' text-010 ' '.
ENDFORM. " PREPARE_FIELD_CATALOG
*& Form FILL_CATALOG
text
FORM fill_catalog USING fv_tabname
fv_fldname
fv_nozero
fv_seltxt
fv_checkbox.
DATA f_fldcat TYPE lvc_s_fcat.
f_fldcat-fieldname = fv_fldname.
f_fldcat-tabname = fv_tabname.
f_fldcat-no_zero = fv_nozero.
f_fldcat-coltext = fv_seltxt.
f_fldcat-checkbox = fv_checkbox.
IF fv_checkbox = gc_x.
f_fldcat-edit = gc_x.
ENDIF.
APPEND f_fldcat TO gi_fieldcat.
ENDFORM. " FILL_CATALOG
*& Form PREPARE_LAYOUT
text
FORM prepare_layout .
gs_layout-info_fname = 'COL'.
gs_layout-cwidth_opt = gc_x.
gs_layout-zebra = gc_x.
gs_layout-no_toolbar = gc_x.
gs_layout-no_rowmark = '1'.
gs_layout-sel_mode = 'A'.
ENDFORM. " PREPARE_LAYOUT
*& Form DISPLAY_OUTPUT
text
FORM display_output .
CALL METHOD gv_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_outtab = gi_output
it_fieldcatalog = gi_fieldcat.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_user_command FOR gv_grid.
CALL METHOD cl_gui_control=>set_focus EXPORTING control = gv_grid.
ENDFORM. " DISPLAY_OUTPUT
Similar Messages
-
How to make a row as selected in output internal table in oops ALV
Hi All,
I have ALV grid output using oops ALV concept, in my output i have a checkbox as first column when i select this checkbox and press a push button 'Print' which is there above ALV grid that particular line in output table should get selected and i need to code some logic for printing selected row.
how to make the particluar row in the output internal table to be selected and where to write the logic for print once it is pressed?
Thanks in advance
Srilakshmi.but the checkbox is not getting set in internal table when i select some checkboxes.
can anybody explain y the checkbox in internal table not set?
Hi Srilakshmi,
As explained by Uwe, when we change a field ( say check box ) in ALV grid, the view (frontend) changes (showing the tick mark) but the changed data ( normally ) is not transfered to the backend.
We can initiate this data transfer by just registering the cl_gui_alv_grid=>mc_evt_modified edit event
go_grid->set_table_for_first_display( CHANGING it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab ).
go_grid->set_ready_for_input( 1 ).
go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_modified ). " This does the trick
Now as soon as we check a checkbox, the data_changed event is triggered.
This initiates data transfer to the backend and the checkbox field in internal table is updated.
check the below code for example.
DATA: go_cont TYPE REF TO cl_gui_custom_container,
go_grid TYPE REF TO cl_gui_alv_grid,
gt_fieldcat TYPE lvc_t_fcat,
gv_language TYPE spras VALUE 'E',
gt_outtab TYPE TABLE OF bus_loca_demo WITH HEADER LINE.
START-OF-SELECTION.
CALL SCREEN 100.
* MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'BASIC'.
SET TITLEBAR '001'.
PERFORM create_and_init_alv CHANGING gt_outtab[]
gt_fieldcat.
ENDMODULE. "pbo OUTPUT
* MODULE PAI INPUT *
MODULE pai INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'PRINT'.
BREAK-POINT.
ENDCASE.
ENDMODULE. "pai INPUT
FORM create_and_init_alv CHANGING pt_outtab LIKE gt_outtab[]
pt_fieldcat TYPE lvc_t_fcat.
CHECK go_cont IS NOT BOUND.
CREATE OBJECT go_cont
EXPORTING
container_name = 'CUSTOM'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_cont.
PERFORM build_display_table.
PERFORM build_fieldcat CHANGING pt_fieldcat.
go_grid->set_table_for_first_display( CHANGING it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab ).
go_grid->set_ready_for_input( 1 ).
go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_modified ). " This does the trick
ENDFORM. "CREATE_AND_INIT_ALV
FORM build_display_table.
FREE gt_outtab.
DO 10 TIMES.
gt_outtab-creation_partner = sy-index.
gt_outtab-date_field = sy-datum.
APPEND gt_outtab.
ENDDO.
ENDFORM. "build_display_table
FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'BUS_LOCA_DEMO'
CHANGING
ct_fieldcat = pt_fieldcat.
LOOP AT pt_fieldcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN 'CHECKBOX'.
ls_fcat-checkbox = 'X'.
ls_fcat-edit = abap_true.
MODIFY pt_fieldcat FROM ls_fcat.
WHEN 'ENTER_FIELD' OR 'DBLCLICK_FIELD'.
ls_fcat-no_out = abap_true.
MODIFY pt_fieldcat FROM ls_fcat.
ENDCASE.
ENDLOOP.
ENDFORM. "build_fieldcat
Cheers,
Jose. -
How to set default selected checkbox in af:tableSelectMany /
Hi,
I am new to ADF technology, I am using JDev 10..3g.
I want to set the checkbox as default selected for particular rows.
but I don't know how to set default selected checkbox in <af:tableSelectMany />
Is there any way to do this using ADF<af:tableSelectMany />
Thanks,
MohammedHi Jeroen,
Thanks for reply. but the problem is that I am getting data from database and based on some flag I need to select checkbox while page is loading first time.
at that time the table is null as till now it not rendered. and when its rendered it means page is displayed now.
just before display I need to set checkbox as selected.
I don't want to do like this (when user is pressing any command button then only is should update checkbox selection).
Thanks,
Mohammed. -
How to set default selection in html:radio
hai
how to set default selection in <html:radio>.No it won't help.
You can't set a value into an <input type="file"> control at all. The user has to put values in themselves.
The reason behind this is security. If the programmer could put any value they liked in there, you could upload any file at all from a users computer without their intervention. eg C:\windows\system32\passwords.txt
Bottom line: you can't put a default value into the input type="file" control.
And a good thing too ;-) -
How to set up selected ringtone in i-phone 5...?
hi, please help
how to set up selected ringtone in i-phone 5...?i mean if i want to select my own song from i-tune and want to set it as a ringtone...then how is it done..?
-
How can i decleare select-options in module pool table control?
Hi everybody!!
Can anyone tell me how can I decleare select-options in module pool table control screen?. I have declared it in a screen with a table control but a dump is triggered due to an error when generating the selection screen.
Regards...My suggestion will be try to use fm
call function 'FREE_SELECTIONS_DIALOG'
Please search this forum you can find lot of threads related to this.
a® -
How to select data from an internal table
material norm date last modified
B2-SP HEAT 50.000 20090420
BF COKE 575.000 20090419
GROSS COKE 200.000 20090419
B2-SP HEAT 100.000 20090419
TWT 33.000 20090330
B7-SP HEAT 2.000 20090310
B1-SP HEAT 1.000 20090309
B7-SP HEAT 615.000 20090308
B2-SP HEAT 585.000 20090308
B1-SP HEAT 100.000 20090308
B3-SP HEAT 610.000 20090308
BF COKE 68.500 20090308
GROSS COKE 72.600 20090308
B8-SP HEAT 600.000 20090308
B9-SP HEAT 625.000 20090308
BX-SP HEAT 615.000 20090308
B9-SP HEAT 58.000 20090307
B1-SP HEAT 100.000 20090307
B6-SP HEAT 350.000 20090306
B2-SP HEAT 888.000 20090306
Like above there r numerous data in a table :
how will i select data into another internal table where material above is not repeated with latest modified date.please help.Hi Sonu,
The main task is to move the contents of the one internal table to another with some condition.
First sort and delete the duplicate entries from the First Internal table like below :
sort it_tab by material ascending date_modified descending.
delete adjacent duplicates from it_tab.
Then move that Internal table contents to another internal table.
Define another internal table with the same structure as you have first internal table and then
Second Step :
it_itab1 = it_itab.
If you are using seperate Header line and Body then you can do like below :
it_itab1[] = it_itab[].
This will fix the issue.
Please let me know if you need any further explonation.
Regards,
Kittu
Edited by: Kittu on Apr 24, 2009 12:21 PM -
How to insert select columns from one internal table to another
Hi,
How to insert select columns from one internal table to another based on condition as we do from a standart table to internal table.
regards,
SriramHi,
If your question is for copying data from 1 int table to other ;
we can use
APPEND LINES OF it_1 TO it_2.
or if they have different columns then:
loop at it_1 into wa_it1.
move wa_it1-data to wa_it2-d1.
apped wa_it2 to it_2.
clear wa_it2.
endloop.
thnxz -
How to set a change pointer for a perticular table?
Hi,
Please let me know how to set a change pointer for a perticular table.what do you mean by 'change pointer'? normally this idiom is used for sending ÍDOCs from one system/client/org-unit to another ...
do you generally want to record changes to a specific table? then set parameter rec/client using RZ10 for your instance profiles and restart the instances in order for the parameter to take effect.
set the table to 'record all changes' using SE11.
you might re-consider if the table has a lot of data and is accessed very often for performance-resons.
change protocols can be evaluated using tx, SCU3. -
How to assign select-option values to internal table
hi all,
how to assign select-option values to internal table
thanks in advance.Hi,
You just need to loop at your select-option field and take the values from low and high fields.
for. e.g
loop at s_werks .
move:s_werks-low to <your itab>
if not s_werks-high is initial .
move: s_werks-high to <youritab>
endif .
append <your itab>
endloop .
OR use select statement.
regards,
Omkar.
Message was edited by:
Omkaram Yanamala
Message was edited by:
Omkaram Yanamala -
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 -
Select Data from 2 intern tables
Hi Experts,
how I can select Data from 2 intern Tables into another intern table?
For Example:
My Result Table has the fields: mandt, user, ID, ID_Name.
My select table no. 1 has the fields mandt, XYZ (like A_Name), ID, ID_Name, ...
My select table no. 2 has the fields mandt, A_Name, User, ...
I want to search for all entries in select table no. 1 and 2. where are a_name have the same worth.
How I can select my Dates?
Regards,
Mikehii
you can do it by using for all entries and with READ statement ..do like follow code
IF i_marc[] IS NOT INITIAL.
SELECT matnr " Material Number
werks " Plants
lgort " Storage Location
FROM mard
INTO TABLE i_mard
FOR ALL ENTRIES IN i_marc
WHERE matnr EQ i_marc-matnr
AND werks EQ i_marc-werks
AND lgort IN s_lgort.
ENDIF. " IF i_mara[] IS NOT INITIAL
IF sy-subrc EQ 0.
LOOP AT i_output INTO wa_output.
READ TABLE i_mard INTO wa_mard WITH KEY matnr = wa_output-matnr.
wa_output-lgort = wa_mard-lgort.
MODIFY i_output FROM wa_output.
CLEAR wa_output.
ENDLOOP. " LOOP AT i_output
ENDIF. " IF sy-subrc EQ 0
regards
twinkal -
Hi Experts,
Pls. let me know that,
How to fetch the SAP Standard Prog. built internal table into my_z_prog.?
For more explannation, pls. see my other thread with name of yestrday,
SUBMIT RFGLBALANCE WITH selection criteria, then How to get resulted itab?
thanqHi
Suppose RFGLBALANCE is your standard program and you have an internal table named I_RFGLBALANCE.
And lets say your Z program name is Z_SRINIVAS.
First find out the type of the internal table you want in your Z-program in the standard program. And declare an internal table of similar type in your Z-program.
I hope you can do this much.
Later wherever you are putting the below mentioned code.
SUBMIT RFGLBALANCE WITH selection criteria
Write the code which i have written.Obviously modify it to suit your requirement.
Please show what is not working fine so that even anyone else can help you with the problem you are facing.
Regards,
Mayank -
How can I get Number of Lines from internal table?
Hello at all,
i have in my Report a internal Table, which have many KUNNR.
For example the internal Table:
MANDT.......KUNNR......NAME.........FIRSTNAME........CITY
...040..........12345.........Owen............Michael........Liverpool
...040..........12345.........Owen............Michael........Liverpool
...040..........99999.......Johnson.......... Jeffrey........London
...040..........12345.........Owen............Michael........Liverpool
...040..........55555.......Hardley.......... Kingston.......Birmingham
I want to know, how many same KUNNR are existing in the internal Table?
In my example i need the result 3, because their is existing 3 times the Kunnr 12345 in the internal Table.
Have anyone an idea, how can I resolve this problem?
Edited by: Thomas Zloch on Jun 21, 2010 2:55 PM - one question mark at a time is sufficientHi,
1.Create two internal tables of same type and sort according to Kunnr then Delete the
adjusent duplicates by comparing KUNNR
2.Sort the table by KUNNR and use ON change of Concept in that Just increment the counter.
I am writing the sample logic here.
tables kna1.
data: t_kna1 type table of kna1,
w_kunnr type kna1-kunnr,
counter type i," Holds No.of KUNNRs in the T_kna1
t_kna2 type table of kna1.
select * from kna1 into table kna1 up to 100 rows.
t_kna2[] = t_kna1[].
delete t_kna2 by kunnr.
delete adjusent duplicates from t_kna2 by comparing kunnr."1st Method
read table t_kna2 transporting no-fields.
counter = sy-tfill."1st Method
loop at t_kna1 into kna1."2nd Method
at first.
w_kunnr = kna1-kunnr .
counter = 1.
endat.
if w_kunnr ne kna1-kunnr.
counter = counter + 1.
endif.
endloop.
Note : Here I used a sample table KNA1 in this there are no Duplicates of KUNNR . -
Select data into deep internal table
Dear Experts.
I created a dynamiv deep internal table.
while selecting data , into the internal table it is giving a dump. saying that deep structure.
SELECT OBJTY OBJID ARBPL WERKS from crhd
INTO CORRESPONDING FIELDS OF TABLE <f_tab>
where WERKS = pr_werks.
I used the field catalog also.even same error is comming.
how to get data into deep internal table by select statement.
Please help me,
Regards,
RahulHI,
Try creating dynamic internal table like:
Field-symbols: <dyn_table> type standard table,
<dyn_wa> ,
<dyn_field>.
Data: dy_table type ref to data,
ifc type lvc_t_fcat ,
xfc type lvc_s_fcat ,
Count type i ,
Count1 type i ,
Index type i ,
dy_line type ref to data.
Data counter type i.
Data: line type string ,
List like table of line.
Data: idetails type abap_compdescr_tab,
xdetails type abap_compdescr .
Data: ref_table_des type ref to cl_abap_structdescr.
*Looping at field cat internal table to populate another field cat to be passed
* In method used below for creating final dynamic internal table
Loop at fieldcat into fieldcat1.
Clear xfc.
Xfc-fieldname = fieldcat1-fieldname.
Xfc-datatype = fieldcat1-datatype.
Xfc-intlen = fieldcat1-intlen.
Append xfc to ifc.
endloop.
Clear fieldcat1.
*Method called to create dynamic internal table on the basis of field catalog created above
Call method cl_alv_table_create=>create_dynamic_table
Exporting
it_fieldcatalog = ifc u201Cfield catalog appended above
Importing
ep_table = dy_table. u201CDynamic internal table which will be created
Assign dy_table->* to <dyn_table>.
*Create dynamic work area and assign to FS
Create data dy_line like line of <dyn_table>.
Assign dy_line->* to <dyn_wa>.
Then use this dynamic internal table created from above method
in the Select Query.
Hope it helps
Regards
Mansi
Maybe you are looking for
-
Can I add a second email to my iTunes account?
MMy wife is getting an iPhone and I would like to add her to my iTunes account. Is this possible or does she need to open her own account?
-
Need Suggestion about Solman support & testing E CATT feature
Hi Solman Experts . I need your Strong suggestion. Actually i am working in ABAP module , I recently joined as a fresher in small company, I got opportunity to go Saudi for "Solman support & testing ,E CATT" in big MNC . Now i need suggestion ,
-
I've been getting "Unknown error" a lot lately, is there a known issue here?
"Sync encountered an error while syncing: Unknown error." I have been getting this error lately across multiple desktops. Is there a known issue recently introduced into the Firefox 4 beta series?
-
How to define object type in plsql
I create a type... CREATE OR REPLACE TYPE t_Archive_Data_Obj AS OBJECT (Archive_Name VARCHAR2(40), Archive_Data CLOB); I create a type in plsql..... TYPE tt_Archive_Data IS TABLE OF t_Archive_Data_Obj; Can I, instead of creating the object type as a
-
Imac will not sleep automatically
I read and tried all the fixes listed regarding sleep. I can make the iMac sleep manually BUT even that is odd as it takes more than one attempt for it to take hold as it starts to sleep and wakes itself up. This can be either 1 or 4 tries depending