Checkbox as one of the field in the internal table in the list
Hi,
I have a requirement of processing the certain records of the internal table for which checkboxes are selected in the list.
The selected records need to be updated in the custom table and the unselected records need to be ignored.
I have created the PF status and the application tool bar and a button on the tool bar.
Then when the report is executed the list is displayed with the records with one of the field as a checkbox.
At user-command.
Then in the at user-command handling the button click event.
I want to know which records are been selected and which are not.
If some one knows please let me know.
Thanks
S Patel
This is exactly what you need to do:-
PBO
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
CREATE OBJECT g_grid
EXPORTING i_parent = g_custom_container.
Select data from your table
PERFORM select_data CHANGING pt_outtab[].
Build fieldcat
PERFORM build_fieldcat CHANGING pt_fieldcat.
Exclude standard buttons from the Toolbar
PERFORM exclude_tb_functions CHANGING lt_exclude.
Display output in ALV grid
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
it_toolbar_excluding = lt_exclude
CHANGING
it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab[].
PAI
Get modified data
CALL METHOD gv_grid->check_changed_data.
LOOP AT gt_output INTO wa_output WHERE zzchkbox EQ c_x.
MOVE-CORRESPONDING wa_output TO wa_selblk.
APPEND wa_selblk TO lt_selblk.
ENDLOOP.
This method will give you all the records which are selected in the list output. Collect them and modify your custom table.
Edited by: Rudresh Chand on Feb 28, 2010 8:26 AM
Similar Messages
-
Difference between the Field Group and Internal Table.
Hi all,
Can anybody tell me the difference between the Field group and Internal table and when they will used?
Thanks,
Sriram.Hi
Internal Tables: They are used to store record type data in tabular form temporarily in ABAP programming. Or we can say, it stores multiple lines of records for temporary use in ABAP programming.
A field group is a user-defined grouping of characteristics and basic key figures from the EC-EIS or EC-BP field catalog.
Use
The field catalog contains the fields that are used in the aspects. As the number of fields grows, the field catalog becomes very large and unclear. To simplify maintenance of the aspects, you can group fields in a field group. You can group the fields as you wish, for example, by subject area or responsibility area. A field may be included in several field groups.
When maintaining the data structure of an aspect, you can select the field group that contains the relevant characteristics and basic key figures. This way you limit the number of fields offered.
Regards
Ashish -
Moving the fields to final internal table
hi experts,
i have a single field in an internal table and i want to move it to final internal table.
i tried this code but its not working.
IF NOT it_ymmessr IS INITIAL.
LOOP AT it_ymmessr into it_final..
move it_ymmessr-srvpos to it_final-srvpos.
ENDLOOP.
ENDIF.
there is dat in the it_ymmessr.
i have five to six similar internal tables with 1 to 3 records and i have to move them to final internal table.
regards,
vinayHi,
IF NOT it_ymmessr IS INITIAL.
LOOP AT it_ymmessr into it_final..
<b>Have one more firld which is the common field for both the tables into it_ymmessr so that u can fill the record correctly.</b>
READ TABLE it_ymmessr WITH key XXXX = it_final-XXXX.
IF sy-subrc = 0.
it_final-srvpos = it_ymmessr-srvpos.
<b>MODIFY it_final.</b>
ENDIF.
CLAER it_final.
ENDLOOP.
ENDIF. -
Dynamic access to the fields of an internal table
Hi,
Currently i'm having 10 fields in 1 internal table, and i need to validate this 10 fields but i dont like have too many "if and endif" statement. Is there any option to write an dynamic code.
Example
Data: begin of table,
field1 type c,
field2 type c,
field3 type c,
field4 type c,
field10 type c,
end of table.
Let say i want to fill field1 with 1, field2 with 2,........................... field10 with 10.
So instead of using this code
table-field1 = '1'.
table-field2 = '2'.
table-field3 = '3'.
table-field10 = '10'.
Can i do something dynamic like this
DO 10 times.
Dynamic coding, any idea ?
ENDDO.
<Modified the subject line>
Edited by: Suhas Saha on Jul 12, 2011 4:27 PMHi,
Sorry may my question is not detail enough. I would like to read the field from the internal table dynamically.
Data: begin of table,
field1 type c,
field2 type c,
field3 type c,
field4 type c,
field10 type c,
end of table.
Let say i want to fill field1 with 1, field2 with 2,........................... field10 with 10.
So instead of using this code
table-field1 = '1'.
table-field2 = '2'.
table-field3 = '3'.
table-field10 = '10'.
IF table-field1 < 0,
endif.
IF table-field2 < 0,
endif.
IF table-field3 < 0,
endif.
|
IF table-field10 < 0,
endif.
Can i do something dynamic like this
DO 10 times.
Dynamic coding, any idea ?
ENDDO. -
How to pass the contents of an internal table to the IDoc FIDCC2?
Hi,
I have an internal table. Using its contents, I have to create an Idoc and do GL posting.
I have to use FIDCC2 Idoc and the function module IDOC_INPUT_FIDCC2.
Can u please let me know how to pass the contents of the internal table into the idoc FIDCC2 and do the GL posting?
Regards,
Balaji. RHi balaji,
use function IDOC_INBOUND_FROM_FILE. This will do half the process.
Documentation is missing, but program RSEINB00 explains something,
also some links
[http://help.sap.com/saphelp_nw70/helpdata/EN/dc/6b7f1543d711d1893e0000e8323c4f/frameset.htm]
[RSEINB00 does not work in background]
[RSEINB00 flat file to idoc uploading in XI]
[Loading flat idoc via report RSEINB00 into integration server fails]
Hope it helps.
Regards,
Clemens -
How can I set the field ICt in component table of the Tasklist as "Input" ?
Hi experts,
How can I set the field ICt (BOM's Item Category (POSTP)) in component table of the Tasklist as "Input" Status (The system is in gray now).
I can define the different Category value by IB01 or IB02,then I can select them at the Tasklist's component table.But sometimes I need batch input such as LSMW,so pls kindly tell me how to setup it,thanks!
YinjunHi,
BOM is created with some component and item category.
In task list when you go to component, in normal case one selects and copies BOM over there by clicking component selection button.
Once BOM is copied over there the BOM item category will get copied. As it is BOM item category in Task list it is greyed and it will get copied automatically from BOM.
You specify item category required by you in IB01 or IB02 and then use that BOM in task list. Go to componenet tab and click component selection button. Once BOM is copied over there the BOM item category will get copied -
Dynamic Internal Table with the same name
Hey Guys
I have a question.
I know that we can create dynamic internal table taking a struct dynamically.
But I have 2 ques on the same subject.
1. Can we create an internal table based on a type that we have locally declared eg
types: begin of ty_demo.
var1(1) type c,
var2 type p,
end of ty_demo.
2. If an internal table is already declared based on the above type say data: i_tab type standard table of ty_demo.
If i need to enhance the struct of this internal table. Can i do that by dynamically redefining it based on a different structure but keepin the same name i_tab.
In a nut shell I cannot change the name of my itab but I want to enhance the structure.
I Hope I am clear.
Help will be greatly apprcieated.
Thanks
Sameerhai.
we can create an internal table based on a type that we have locally declared, but you have to use data instead of types like.
data: begin of ty_demo.
var1(1) type c,
var2 type p,
end of ty_demo.
check the example notes for dynamic itab .
Dynamic internal table is internal table that we create on the fly with flexible column numbers.
For sample code, please look at this code tutorial. Hopefully it can help you
Check this link:
http://www.****************/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm
Sample code:
DATA: l_cnt(2) TYPE n,
l_cnt1(3) TYPE n,
l_nam(12),
l_con(18) TYPE c,
l_con1(18) TYPE c,
lf_mat TYPE matnr.
SORT it_bom_expl BY bom_comp bom_mat level.
CLEAR: l_cnt1, <fs_dyn_wa>.
Looping the component internal table
LOOP AT it_bom_expl INTO gf_it_bom_expl.
CLEAR: l_cnt1.
AT NEW bom_comp.
CLEAR: l_cnt, <fs_dyn_wa>, lf_mat.
For every new bom component the material data is moved to
temp material table which will be used for assigning the levels
checking the count
it_mat_temp[] = it_mat[].
Component data is been assigned to the field symbol which is checked
against the field of dynamic internal table and the value of the
component number is been passed to the dynamic internal table field
value.
ASSIGN COMPONENT c_comp_list OF STRUCTURE <fs_dyn_wa> TO
<fs_check>.
<fs_check> = gf_it_bom_expl-bom_comp.
ENDAT.
AT NEW bom_mat.
CLEAR l_con.
ENDAT.
lf_mat = gf_it_bom_expl-bom_mat.
Looping the temp internal table and looping the dynamic internal table
*by reading line by line into workarea, the materialxxn is been assigned
to field symbol which will be checked and used.
LOOP AT it_mat_temp.
l_nam = c_mat.
l_cnt1 = l_cnt1 + 1.
CONCATENATE l_nam l_cnt1 INTO l_nam.
LOOP AT <fs_dyn_table2> ASSIGNING <fs_dyn_wa2>.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa2> TO <fs_xy>.
ENDLOOP.
IF <fs_xy> = lf_mat.
CLEAR lf_mat.
l_con1 = l_con.
ENDIF.
Checking whether the material exists for a component and if so it is
been assigned to the field symbol which is checked against the field
of dynamic internal table and the level of the component number
against material is been passed to the dynamic internal table field
value.
IF <fs_xy> = gf_it_bom_expl-bom_mat.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
CLEAR l_con.
MOVE gf_it_bom_expl-level TO l_con.
CONCATENATE c_val_l l_con INTO l_con.
CONDENSE l_con NO-GAPS.
IF l_con1 NE space.
CONCATENATE l_con1 l_con INTO l_con SEPARATED BY c_comma.
CLEAR l_con1.
l_cnt = l_cnt - 1.
ENDIF.
<fs_check> = l_con.
l_cnt = l_cnt + 1.
ENDIF.
ENDLOOP.
AT END OF bom_comp.
At end of every new bom component the count is moved to the field
symbol which is checked against the field of dynamic internal table
and the count is been passed to the dynamic internal table field
value.
ASSIGN COMPONENT c_count OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
<fs_check> = l_cnt.
INSERT <fs_dyn_wa> INTO TABLE <fs_dyn_table>.
ENDAT.
ENDLOOP.
regards.
sowjanya.b -
The contents in a internal table
Hi Experts,
I have a doubt in filling the contents of an internal table with the database table fields reference.
For eg: There is an internal table like this:
data: begin of t_conditions occurs 0,
kschl like rv13a-kschl,
vkorg like komg-vkorg,
kunnr like komg-kunnr,
matnr like komg-matnr,
kbetr(15) type c,
datab(10) type c,
datbi(10) type c,
end of t_conditions.
in the above example, the "matnr" he has taken with the reference field "komg-matnr"..
Please look at the following internal table:
data: begin of t_material occurs 0,
matnr(18) type c,
matkl(9) type c,
bismt(18) type c,
end of t_material.
In the above 2 examples the declaration of "matnr" field is diffrent from one with the other.
in 1st eg., he has taken as: <b>matnr like komg-matnr</b>
where as in the 2nd eg: <b>matnr(18) type c,</b>
my question is: how can i know where to declare as in the 1st eg., and where to use like in the 2nd eg.,
Please clarify.
I greatly appreciate your help.
Thanks,Hi sey
If you see in the domain level both the DOMIAN's will be the same. So it doesn't matter. All the matnr will have a character type of size 18.
for the programmer reference they will using the table name in which they want to select the data.
i.e for the first ex. he will be selecting data from the KOMG table and in the second from the MARA table.
but both the Matnr type are same.
<b>there is a small change since the second ex doesn't use any table it is simply of type c. the difference is when you reference to any Data DICTIONARY object then it can contain certain conversion exits, etc. so it will apply for your reference data typr</b>
regards
kishore
Message was edited by: Harikishore Sreenivasulu -
Copying data from a table in the Database to an internal table.
Hello,
How do I copy data that is a table that is in the database and and then load the data to an internal table in the ABAP/4 Aditor.
Please help.hi,,
do this way ...
tables : mara.
parameters : p_matnr like mara-matnr,
start-of-selection.
select <fields> from mara into table it_mara
where matnr = p_matnr.
if sy-subrc = 0.
endif. -
Passing content of field symbol to internal table
Hi experts,
I need to pass the content of a field symbol to a internal table. Below is the following structure of the field symbol and internal table. But I'm encountering a short dump:
TYPES: BEGIN OF fint_frange,
fieldname LIKE rsdstabs-prim_fname,
fieldtype(1) TYPE c,
selopt_t TYPE fint_selopt_t,
END OF fint_frange.
TYPES: fint_frange_t TYPE fint_frange OCCURS 10.
CONSTANTS: lc_save_selections(31) TYPE c VALUE '(RFINTITAR)GT_SAVE_SELECTIONS[]',
FIELD-SYMBOLS: <fs_save_selections> TYPE STANDARD TABLE.
ASSIGN (lc_save_selections) TO <fs_save_selections>.
i_save_selections[] = <fs_save_selections>.
Short dump: You attempted to move one data object to another.
This is not possible here because the internal tables concerned
are neither compatible nor convertible.
Thanks in advance.Hi,
what is ur internal table structure?
if structure of both field symbol and internal table is not same,
u can not put equal betwwen them.
ur <fs_save_selections> is having one constanat value lc_save_selections.
and ur assaigning that to an internal table with some structure ......
so structure is not same for both..........check it once.
Regards,
kk. -
Field catalog for internal table in ALV
In my program the internal table consists many fields from various tables and structure doesn't belong to a single data table.
In order to get output in ALV grid following FM has been used
REUSE_ALV_GRID_DISPLAY
for field catalog the fields are defined specifically.
l_fieldcat-fieldname = 'VBELN'.
l_fieldcat-outputlen = 10.
l_fieldcat-seltext_l = 'Billing doc'.
l_fieldcat-no_zero = 'X'.
l_fieldcat-hotspot = 'X'.
append l_fieldcat to p_fieldtab.
..............and so on for all the fields.
Just wanted to know is there any other method to display all the fields of this internal table automatically so each field is not specified specifically.
anyaHi
Try this instead:
*& Form create_fieldcatalog
* Create a field catalogue from any internal table
* -->PT_TABLE Internal table
* -->PT_FIELDCAT Field Catalogue
FORM create_fieldcatalog
USING pt_table TYPE ANY TABLE
CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA:
lr_tabdescr TYPE REF TO cl_abap_structdescr
, lr_data TYPE REF TO data
, lt_dfies TYPE ddfields
, ls_dfies TYPE dfies
, ls_fieldcat TYPE lvc_s_fcat
CLEAR pt_fieldcat.
CREATE DATA lr_data LIKE LINE OF pt_table.
lr_tabdescr ?= cl_abap_structdescr=>describe_by_data_ref( lr_data ).
lt_dfies = cl_salv_data_descr=>read_structdescr( lr_tabdescr ).
LOOP AT lt_dfies
INTO ls_dfies.
CLEAR ls_fieldcat.
MOVE-CORRESPONDING ls_dfies TO ls_fieldcat.
APPEND ls_fieldcat TO pt_fieldcat.
ENDLOOP.
ENDFORM. "create_fieldcatalog -
Dynamic field access in internal tables
Hi everyone.
I woulkd like to know if there is any way to identify the fields of an internal table at runtime. I'm creating a method in a class, and i would like to accept any itab as a paramter and then access the fields of that itab. I currently have the itab passing no problem using field symbols, and i am able to loop at the data, but i am unsure how to get the field names.
Any suggestions?
Thanks!Hi,
Check the code below:
REPORT ZYKTEST3 .
DATA: d_ref TYPE REF TO data,
d_ref2 TYPE REF TO data,
i_alv_cat TYPE TABLE OF lvc_s_fcat,
ls_alv_cat LIKE LINE OF i_alv_cat.
TYPES: tabname LIKE dcobjdef-name ,
fieldname LIKE dcobjdef-name,
desc LIKE dntab-fieldtext.
PARAMETER: p_tablen TYPE tabname. -
> Input table field
DATA: BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE dntab.
DATA: END OF itab.
FIELD-SYMBOLS : <f_fs> TYPE table,
<f_fs1> TYPE table,
<f_fs2> TYPE ANY,
<f_fs3> TYPE ANY,
<f_fs4> type any,
<f_field> TYPE ANY.
REFRESH itab.
CALL FUNCTION 'NAMETAB_GET' -
> Fetches the fields
EXPORTING
langu = sy-langu
tabname = p_tablen
TABLES
nametab = itab
EXCEPTIONS
no_texts_found = 1.
LOOP AT itab .
ls_alv_cat-fieldname = itab-fieldname.
ls_alv_cat-ref_table = p_tablen.
ls_alv_cat-ref_field = itab-fieldname.
ls_alv_cat-seltext = itab-fieldtext.
ls_alv_cat-reptext = itab-fieldtext.
APPEND ls_alv_cat TO i_alv_cat.
ENDLOOP.
internal table build
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = i_alv_cat
IMPORTING
ep_table = d_ref.
ASSIGN d_ref->* TO <f_fs>. -
> Dynamic table creation with fields of the table
DATA: l_field TYPE fieldname,
l_field1 type fieldname.
SELECT * FROM (p_tablen) INTO CORRESPONDING FIELDS OF TABLE <f_fs>.
Fetching of the data from the table
LOOP AT <f_fs> ASSIGNING <f_fs2>.
Here u can check the validations and process
ASSIGN COMPONENT 2 OF STRUCTURE <f_fs2> TO <f_fs3>.
ASSIGN COMPONENT 3 OF STRUCTURE <f_fs2> TO <f_fs4>.
IF sy-subrc = 0.
MOVE <f_fs3> TO l_field.
MOVE <f_fs4> TO l_field1.
WRITE:/1 l_field(20),
22 l_field1(10).
ENDIF.
ENDLOOP.
Regards
Kannaiah -
Calculation of a field of an internal table
Hi all,
Good Day. I have to calculate the value of an internal table using the following rule.
Total amount : 1,000,0000.00
Amnt per ins Remaining balace
10,00,000.00 90,00,000.00
10,00,000.00 80,00,000.00
10,00,000.00 70,00,000.00
Here Total amount is a variable.
and Amnt per ins & Remaining balace are internal table fields.
I have to calculate the value of Remaining balace whose 1st value will be deducted as Total amount - Amnt per ins but other values will be deducted as Remaining balace - Amnt per ins . Can anyone give me some idea how to do this ?
Thanks,
Tripod.Hi All,
This problem is now solved. -
Hi,
I have exported the data from two sources, MS-Excel and SAP Business One to Sap Business One (8.81). While exporting the data, I got the error "The field is too small to accept the data you attempt to add. try inserting or pasting less data" for the first time, Immediately when I run it again, it shows export successfully completed, but nothing is changed in the SAP Business One. Could you please provide the solution as early as possible?
Thanks & Regards,
Chaitanya.Bok
i solve the problem.i rezise the colomn size
thanks -
Changing the order of fields in an internal table
Hi all,
I'm using field symbol as internal table. this table has got a standard database structure.
I want to make the 3rd column of this internal table as 1st colums keeping rest of the columns as it is.
Is there any way to do this?
Thanks,
Anil.Hi
Instead of directly taking the type as a standard structure , declare the FS internal table as type of types structure.
Data: fs_scarr like type_s_scarr.
FIELD-SYMBOLS <scarr2> TYPE fs_scarr
In the types put the third column as first one and use into corresponding in select query
or else
while displaying the internal table change the order of the columns
Loop at itab into fs_itab.
write : col3
col2
col4
endloop.
Thanks,
Viquar Iqbal -
Moving the data from multiple internal tables into a single one
Hello everyone,
I am creating a classical report which uses the following tables.
tables : ekko, ekpo, mara, makt,lfa1.
my input parameter is
Select-options Purchase Order number
Following fields are getting used.
Doc no EKKO-EBELN
Material EKPO-MATNR
Item number EKPO-EBELP
Quantity EKPO-MENGE
Material Group MARA-MATKL
Vendor EKKO-LIFNR
Old Material code MARA-BISMT
Material Desc. MAKT-MAKTX
Vendor name LFA1-NAME1
Now i need to do the following task.
1 Select record from EKKO Using document number.
2 Select record from EKPO using EKKO record using Document no as key.
3 Find out Old Material code of each and every material from Material master.
4 Find out Material description for each and every material from MAKT.
5 Sort record on Vendor, Purchase Order number and Material.
I have defined seperate internal tables for these operation.
Once i have fetched records into these individual internal tables from the corresponding DB tables i need to move these values into a new internal tables which has all the above fields mentioned
I need to move these values into a new internal table because to display the values on the report.
Any idea for the above ? Plz help with a sample example or some relevant.
Regards,
Ranjith NambiarHi
1 Select record from EKKO Using document number.
2 Select record from EKPO using EKKO record using Document no as key.
Use inner join and retrive data into one internal table.for Ex ITAB1
3 Find out Old Material code of each and every material from Material master.
Use ITAB1 with for allentries in MARA table to get the onl materil number populate in to one table.
4 Find out Material description for each and every material from MAKT.
Get the Material desc with the same manner as above,
5 Sort record on Vendor, Purchase Order number and Material.
now sort the ITAB1 as you req.
now Loop on the ITAB1.
and read above 2 tables for old matnr and matner deac and append into another table as you want.
Hope this will help.
Regards,
Hiren Patel
Maybe you are looking for
-
In Portal Anonymous mode - Change password option not coming- login fails
Hi Experts, We are having some application which requires login in anonymous mode. When we click the application and give the user id password, it loggs in properly, there is no problem in that. But if the password is reset by administrator,
-
Hi, I use Windows 7, Photoshop CS5.1 often pops up with "Could not complete [command] because there is not enough memory (RAM)." I have increased my performance preferences to (1451mb) 90%, however I have not restarted Photoshop as I want to try and
-
Hi Guru's, I having problem while uploading pricing conditions data.i want to upload more than 10000 thousand records. in selection screen,we are provinding file path (Presentation server) and using fm "gui_upload" updating the content into internal
-
Problem on loading applet netscape4.73 in macos9 very urgent pls help me
Hello, Problems on loading applet in Netscape4.73(jre1.1.5) AppleMac OS-9. when i try to load applet of size ~ 200kb in Netscape 4.73 AppleMac os9, then browser abruptly closing with the AppleMac os error message :- the Applicarion " Netscape Communi
-
How can I get Mail to store my account password?
Whenever I retrieve mail or send mail, I have to re-enter my password. The account page will not retain the password I type in. Even though I save the changes, the PW is dropped and I have to re-enter it fevery time. Any body know a fix?