‎2008 Mar 04 4:19 AM
Hi All,
In a table control, there are two fields. User enters value for one of them and misses another. I am giving an information message to enter the value for the second field. But how do I modify the internal table once the user enters the value. Right now, it is appending the value as the third entry in the internal table since I am using an append statement. How to use the modify table statement in this scenario?
Thanks
Ricky
‎2008 Mar 04 4:29 AM
*check following code ,if its old entry then internal table will be modified otherwise new entry will be added
wa_tab is the table control workarea...
MODIFY it_tab FROM wa_tab INDEX tc_tab-current_line.
IF sy-subrc NE 0.
APPEND wa_tab TO it_tab.
ENDIF.
‎2008 Mar 04 6:30 AM
‎2008 Mar 04 4:18 PM
Hello All,
One more question. Has anybody worked on defaulting the value in a listbox in a table control which has 4 values. I am using VRM_SET_VALUES for the drop down values but I am want to make one of the values as default in the table control while on the PBO event of the screen.
Thanks
Ricky
‎2008 Mar 05 7:18 AM
‎2008 Mar 09 2:25 AM
‎2008 Mar 09 6:08 AM
Thanks Jonathan for the response. I was asking to default in the field level itself in the table control for the list box and not filling the list box with default values. I need to take on the drop down default values as a defaul value in table control listbox field so that the user can see the default value when he enters the screen. The table control has 100 lines and the listbox should be defaulted to the 100 lines. Right now i have done looping through the table and defaulting in the program. But is there anyway to do it in the screen painter itself?
Thanks
Ricky
‎2008 Mar 09 11:28 AM
Yes, I was trying to point out in the sample code both the fill of the listbox and the defaulting in of the initial value on the screen... as for the table control, no I can't think of a way to default any field values into the screen - so I reckon you will need to do this by setting the initial value for the internal table that mirrors the table control, or during PBO.
Jonathan
‎2008 Mar 04 4:45 AM
Hi,
&----
Appending records to the internal table
----
MODULE zmatnr INPUT.
MODIFY i_makt INDEX t_ctrl-current_line.
IF t_ctrl-current_line GT ln.
READ TABLE i_makt WITH KEY zmatnr = i_makt-zmatnr.
IF sy-subrc NE 0.
Inserting record if it does not exist in database
APPEND i_makt.
ELSE.
MESSAGE i005 WITH 'Material Number' i_makt-zmatnr 'already exists'.
ENDIF.
ENDIF.
ENDMODULE.
&----
*& Module set_status OUTPUT
&----
Setting the GUI status
----
MODULE set_status OUTPUT.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'ZTITLE'.
ENDMODULE. " set_status OUTPUT
*&----
*& Module CHECK INPUT
*&----
Modify the internal table using the current line in table control
*----
MODULE check INPUT.
MODIFY i_makt INDEX t_ctrl-current_line.
ENDMODULE. " CHECK INPUT
This is a sample program.
Regards,
Priya.