2013 Sep 19 7:33 AM
Hi Friends,
I have a requirement where i have to display the list box in table control for a particular field.
I am able to display the filed as list box in TC with the help of list box option in property option for the field based on the dictionary values in Screen Painter.
Table control is in edit mode.
when i select the list box and add values to the other fields in the table control and press enter values has to be updated in internal table of that table control.
BUT, Issue is that i am not able to update the values in the ITAB of table control with the selected list box. If i press enter the values gets vanished.
I tried several SCN discussion but cannot find the correct answer for the issue above.
Or else is there any other way to populate the list box in table control without using option in Screen painter property.
That is by populating list box using VRM and also issue of handling data in table control.
Please help me in this issue.
With Thanks & Regards,
Kishan Raj K
2013 Sep 19 12:41 PM
Hi krishna ,
*&---------------------------------------------------------------------*
*& Module MODIFY INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module MODIFY input.
MODIFY lt_mara FROM zsample_s_list INDEX tc1-current_line.
if sy-subrc <> 0 .
append zsample_s_list to lt_mara .
endif .
endmodule. " MODIFY INPUT
Add this line to your code and check whether its working fine .
Hi Friends,
I have a requirement where i have to display the list box in table control for a particular field.
I am able to display the filed as list box in TC with the help of list box option in property option for the field based on the dictionary values in Screen Painter.
Table control is in edit mode.
when i select the list box and add values to the other fields in the table control and press enter values has to be updated in internal table of that table control.
BUT, Issue is that i am not able to update the values in the ITAB of table control with the selected list box. If i press enter the values gets vanished.
I tried several SCN discussion but cannot find the correct answer for the issue above.
Or else is there any other way to populate the list box in table control without using option in Screen painter property.
That is by populating list box using VRM and also issue of handling data in table control.
Please help me in this issue.
With Thanks & Regards,
Kishan Raj K
2013 Sep 19 8:42 AM
2013 Sep 19 9:16 AM
Hi kishan raj k,
Please make sure that you have modified your internal table in the PAI inside the table control loop.
Ex.
LOOP AT <itab>.
MODIFY <itab> FROM <wa> INDEX tablecontrol-current_line.
ENDLOOP.
Regards,
Anoop
2013 Sep 19 9:27 AM
I tried adding modify itab in the PAI. Even so same problem exist.
I have not used the VRM methods instead generated listbox using the option in screen painter is that the problem.
2013 Sep 19 9:28 AM
2013 Sep 19 9:36 AM
Hi Ramesh i have generated the list box in the table control based on the program you have said.
In the above mentioned program which you gave they are just displaying values in TC.
In my requirement TC is in Editable mode those data in the internal Table ( used for Table Control ) has to be updated in the Custom ZTable later once internal table is filled.
2013 Sep 19 9:52 AM
Hi Kishan,
VALUE-KEY = '1'.
VALUE-TEXT = 'Name'.
APPEND VALUE TO LIST.
VALUE-KEY = '2'.
VALUE-TEXT = 'Country'.
APPEND VALUE TO LIST.
in your final table it saves as 1 or 2 not like Name or Country.
Can you share your code to find wht's your problem.
2013 Sep 19 10:05 AM
Below is the code which i have used.
*&---------------------------------------------------------------------*
*& Module Pool ZTEST_LIST_TC
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
PROGRAM ztest_list_tc.
CONTROLS : tc1 TYPE TABLEVIEW USING SCREEN 9000 .
TABLES : zsample_s_list.
DATA : lt_mara LIKE TABLE OF zsample_s_list.
*&---------------------------------------------------------------------*
*& Module MODIFY INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module MODIFY input.
MODIFY lt_mara FROM zsample_s_list INDEX tc1-current_line.
endmodule. " MODIFY INPUT
Below code in Screen flow.
PROCESS BEFORE OUTPUT.
MODULE status_9000.
LOOP AT lt_mara INTO ZSAMPLE_S_LIST WITH CONTROL tc1.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT lt_mara .
MODULE MODIFY.
ENDLOOP.
MODULE user_command_9000.
With Regards,
Kishan Raj. K
2013 Sep 19 10:10 AM
Hi Krishna ,
Check what you are getting here zsample_s_list during debug
*&---------------------------------------------------------------------*
*& Module MODIFY INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module MODIFY input.
MODIFY lt_mara FROM zsample_s_list INDEX tc1-current_line.
endmodule. " MODIFY INPUT
2013 Sep 19 10:12 AM
Hi Ramesh, this is the output i get. But when i press enter the value vanish. Matnr in the TC contains the Custom data element where i have created domain with some fixed values and created one global structure zsample_s_list where it contains all the 4 fields. List box displays only the values present in the fixed value of that domain.
With Regards,
Kishan Raj. K
2013 Sep 19 10:15 AM
Hi Ramesh,
I checked in debugger i get value in the zsample_s_list in the PAI.
But it does not update the values into the ITAB.
With Regards,
Kishan Raj. K
2013 Sep 19 11:00 AM
Hi Kishan,
How did you populate the listbox?
Make sure that you gave quotes when you populated the list box. This problem happens when you assign the key without quotes.
ls_value-key = '1'.
ls_value-text = 'Mat 1'.
append ls_value to lt_list.
ls_value-key = '2'.
ls_value-text = 'Mat 2'.
append ls_value to lt_list.
2013 Sep 19 12:24 PM
Hi Susmitha,
I don't populate the list box using VRM Function Module.
Instead i used the listbox option in the property window of that particular field in Screen Painter.
Please see the below image i have rounded it with red rectangle
With Regards,
Kishan Raj. K
2013 Sep 19 12:54 PM
2013 Sep 19 1:01 PM
2013 Sep 19 12:24 PM
Hi krishna ,
Is the whole table control line is getting vanished or just the value you filled using the list box is getting disappeared.
2013 Sep 19 12:26 PM
Hi Juneed,
I tried filling values in one row for all the fileds and press enter then whole row gets blank.
2013 Sep 19 12:32 PM
Hi krishna ,
Since the whole row is getting disappeared problem is not with the list box ,problem is with your table control .. do 2 things
. enter atleast three lines in table control and press enter .
. if you get values in table control then ,jus press an enter .
update me with your output
2013 Sep 19 12:43 PM
Hi Juneed,
i tried with 3 row values as you said then also same problem. All the values got blank including the list box values
2013 Sep 19 12:41 PM
Hi krishna ,
*&---------------------------------------------------------------------*
*& Module MODIFY INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module MODIFY input.
MODIFY lt_mara FROM zsample_s_list INDEX tc1-current_line.
if sy-subrc <> 0 .
append zsample_s_list to lt_mara .
endif .
endmodule. " MODIFY INPUT
Add this line to your code and check whether its working fine .
2013 Sep 19 12:46 PM
Hi Juneed,
Thank for your help it is working fine now, Is it the correct way to do this.
With Regards,
Kishan Raj. K
2013 Sep 19 12:49 PM
Hi Juneed,
Why the modify statement is not working in this case. It should be inserting new records to the internal table. Why it has not worked in this case.
Can you explain why modify is not working so.
With Regards,
Kishan Raj. K
2013 Sep 19 12:58 PM
Modify statement is not working since the internal table is empty .
Another way of dealing this problem is appending initial line to the internal table ,then without append statement you can add lines to the internal table .
Modify statement in internal table and database table is different ,in internal table it wont insert new records ,it just changes already existing records ..
check out help.sap for more details
Regards,
Juneed K Manha
2013 Sep 19 1:00 PM
Hi Kishan,
You have to use the modify or the append statements depending on the condition
MODULE UPDATE_TABLE INPUT.
case tc_wa-col2.
when '1'.
tc_wa-col3 = 'FR'.
when '2'.
tc_wa-col3 = 'FL'.
when '3'.
tc_wa-col3 = 'VG'.
endcase.
read table tc_tab into tc_wa1 index tc-current_line.
if sy-subrc = 0.
modify tc_tab from tc_wa INDEX tc-current_line.
else.
append tc_wa to tc_tab.
endif.
ENDMODULE.
In the above example tc_wa-col2 was a drop down and tc_wa-col3 is populated based on the value in col3.
Now coming to the append and modify statements. If there was some field already populated in that row in the table in table control (from the PBO or earlier in the program), you can use the modify statement. But if its a new row that is being populated in table control, that row does not exist in the table. So modify will not work, since modify just changes an existing row in the table. In such a case, its the append statement that works.
2013 Sep 19 1:13 PM
Hi Friends,
Thanks for your help and efforts.
With Regards,
Kishan Raj. K
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |