Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

modify the table control

Former Member
0 Likes
2,768

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

8 REPLIES 8
Read only

Former Member
0 Likes
1,662

*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.

Read only

0 Likes
1,662

Thanks Sagar and Priyadarshini.

Many Thanks...Given points

Read only

0 Likes
1,662

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

Read only

0 Likes
1,662

Anybody? Appreciate any response

Read only

0 Likes
1,662

If you set the screen field to the value you want as default in the PBO, then the listbox should show that value at runtime... e.g. in the example I posted at

the company and country both get defaulted (the listbox1 content drives the listbox2 value in that example).

Jonathan

Read only

0 Likes
1,662

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

Read only

0 Likes
1,662

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

Read only

Former Member
0 Likes
1,662

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.