on 11-25-2014 11:49 AM
Hi Experts,
I have a requirement like ...I want to display the fields of a table in LinkToAction and On particular action I want the field
to be as Input Field as mentioned below ...
.
Process :
1. When I click on Insert Row button , I want the field of a table as "Input Field" and in other case it should be in LinkToAction field ....
Request to guide me for the same ...
Regards,
Karthik S
Hi Karthik,
Please refer to the below document
Table with cell variant | Team ABAP
Your requirement can be achieved as below
clear ls_timesheet.
append ls_timesheet to lt_timesheet.
Now, new line should have input fields as cell editors in your table.
Hope this helps you.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi rama,
Thanks a lot for yr' reply ...
I have added the field VARIANT in the strcture....just have a doubt that...same structure used in other
applications....will there be any type compatible issue in it ??
I have tried ...I need to perform it in on Click of "INSERT ROW" button....so i can write the rest of code in the method of INSERT_ROW ...right ??
Can u suggest idea for the same ...
Regards,
KArthik S
Hi Karthik,
as long as fields of structure are not altered it wont be any issue. Adding new field would not be any issue.
In supply function you pass variant key to get link to action as cell editor.
On insert button, if variant key is empty it will pick input field as cell editor.
Regards,
Rama
Hi Karthik,
The variant key cannot be same for both input field and link to action. It should be different.
So, you no need to have two variants, you can just have one variant either for link to action or input field.
By default, an element without any variant would be set as cell editor in table. if you pass VARIANT key exclusively, then system sets the element inside variant as cell editor.
In your case, create a variant for LINK TO ACTION and pass while populating value into context node. For initial line, no need to pass any variant key as system by default picks the INPUT field as cell editor.
Hope this helps you.
Regards,
Rama
Hi Rama,
Thanks a lot for your Valuable replies ...
I have tried the same and I have applied the Variant key for LinkToAction and No Variant key for Input Field.
On Click of Insert Row Button, I have passed the below code ...
ls_timesheet-variant = space .
* append a line to the node
lo_el_timesheet = lo_nd_timesheet->bind_structure( new_item = ls_timesheet set_initial_elements = abap_false ).
Still, I could able to see the layout as disable one for the field of a table ...
I have applied the logic only on DAY3...Mon Column....
Can u sugeest an idea for it .
Regards,
Karthik S
Hi Rama,
Thanks for your reply ...
I have given the value of Enabled as Check one ...
When I Click on "Insert Row" Button, .....field of a table is editable one....But , the value which is
available for LinkToAction Field is not populating into the screen .
I have attached the screen for reference ...
On Click of Insert Row : which Its fine now
Can u guide for the same ...
Regards,
Karthik S
Hi Rama,
Thanks a lot for yr' valuable reply ...
I made the cell Variant only for Input field....not for LinkToAction ...
If I am changing the value in the LinkToAction field via Pop-up Window...like below
Step 1 : If i am changing the value ...from 3.00 to 4.00 of Row (5) Column (Tue) ...its getting changed
in the above row too of respective Column....
Before
After
Can u suggest an idea ....for not reflecting in other cells of the respective column ...
Hi Karthik,
I suspect, some where the value is getting set for other cell while updating changed value to the cell from popup window.
I suggest you to debug and check if your update logic is changing other cell's value as well.
If you are not able to find, could you share the code, where you update the changed value back to context node.
Regards,
Rama
Hi Rama,
Thanks for your reply ...
I have given the below list of code in "Sumbit of Pop-up screen" ...
lo_nd_timesheet->get_static_attributes_table( importing table = lt_timesheet ).
clear ls_timesheet .
loop at lt_timesheet into ls_timesheet.
if sy-tabix ge 2 . "lv_chang_index . "concatenate 'day' lo_componentcontroller->change_column
* ls_timesheet-day3 = lv_changed_value .
* modify lt_timesheet from ls_timesheet transporting day3.
* clear ls_timesheet.
if lv_chang_column = 1.
ls_timesheet-day1 = lv_changed_value .
modify lt_timesheet from ls_timesheet transporting day1 . "lv_chang_column.
clear ls_timesheet.
elseif lv_chang_column = 2.
ls_timesheet-day2 = lv_changed_value .
modify lt_timesheet from ls_timesheet transporting day2 . "lv_chang_column.
clear ls_timesheet.
elseif lv_chang_column = 3.
ls_timesheet-day3 = lv_changed_value .
modify lt_timesheet from ls_timesheet transporting day3 . "lv_chang_column.
clear ls_timesheet.
elseif lv_chang_column = 4.
ls_timesheet-day4 = lv_changed_value .
modify lt_timesheet from ls_timesheet transporting day4 . "lv_chang_column.
clear ls_timesheet.
elseif lv_chang_column = 5.
ls_timesheet-day5 = lv_changed_value .
modify lt_timesheet from ls_timesheet transporting day5 . "lv_chang_column.
clear ls_timesheet.
elseif lv_chang_column = 6.
ls_timesheet-day6 = lv_changed_value .
modify lt_timesheet from ls_timesheet transporting day6 . "lv_chang_column.
clear ls_timesheet.
elseif lv_chang_column = 7.
ls_timesheet-day7 = lv_changed_value .
modify lt_timesheet from ls_timesheet transporting day7 . "lv_chang_column.
clear ls_timesheet.
endif .
endif.
endloop.
Can u suggest me an idea on it ...
Regards,
Karthik S
Hi Karthik,
Your code updates changed value to all cells of respective column. So, if you change a value in any cell, it changes all cells in the same column of every row.
You have to update only the row which got changed. not all the rows
Sample code:
data lv_colname type string.
field-symbols: <fv_value> type any.
lo_nd_timesheet->get_static_attributes_table( importingtable = lt_timesheet ).
" Collect changed row index into variable lv_changed_row
" Collect changed column value into variable lv_changed_column
" Collect changed value into lv_changed_value.
read lt_timesheet into ls_timesheet index lv_changed_row
if sy-subrc is initial.
lv_colname = lv_changed_row.
concatenate 'DAY' lv_colname into lv_colname.
unassign <fv_value>
assign component lv_colname of structure ls_timesheet into <fv_value>.
if <fv_value> is assigned.
<fv_value> = lv_changed_value.
endif.
modify lt_timesheet from ls_timesheet index lv_changed_row.
endif.
You can also directly read only one line from context node and modify that instead of reading whole table and setting it back
Hope this helps you.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use CellVariants to achieve this. Search for Cell Variants in Table.
Regards,
kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check the following link it might help you to develop your logic..
WebDynpro for ABAP Cell Variants - Web Dynpro ABAP - SCN Wiki
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.