‎2005 Nov 23 3:41 PM
Hi All,
Iam developing a table control.
i have a screen with 2 fields say for example empid and empname .if enter a value in empid and then if press enter then empname should be filled.
so please help me out how to do this.if possible plz send me a sample code .
with regards,
kiran i
‎2005 Nov 23 3:56 PM
‎2005 Nov 23 4:03 PM
‎2005 Nov 23 4:10 PM
If you used the table control wizard, then you probably have a module like this.
module itabcon_modify input.
<b> if not itab-field1 is initial.
concatenate 'This is the description for'
itab-field1 into itab-field2.
endif.</b>
modify itab
index itabcon-current_line.
endmodule.
The code in BOLD is an example of how you would fill the other field. Here is where you would do it, whether it comes from the DB or not.
Regards,
RIch Heilman
‎2005 Nov 23 4:16 PM
iam not using wizard table control.send me some detailed code of this iam new to module poll programming
with regards,
krian.i
‎2005 Nov 23 4:25 PM
‎2005 Nov 23 4:27 PM
‎2005 Nov 23 4:39 PM
‎2005 Nov 24 2:27 AM
Hi kiran,
Refer the below for a brief idea of how to code for a module pool program.
*************
&----
*& Module pool ZTESTRAJ_TABLECONTROL *
*& *
&----
*& *
*& *
&----
PROGRAM ztestraj_tablecontrol .
TABLES mara.
CONTROLS : tc1 TYPE TABLEVIEW USING SCREEN 100.
TYPES : BEGIN OF t_mara,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
mbrsh TYPE mara-mbrsh,
meins TYPE mara-meins,
lsel TYPE c,
END OF t_mara.
DATA : it_mara TYPE STANDARD TABLE OF t_mara WITH HEADER LINE,
it_mara1 TYPE STANDARD TABLE OF t_mara WITH HEADER LINE,
cols LIKE LINE OF tc1-cols.
DATA : v_lines TYPE i,
lsel,
v_fill TYPE i,
v_limit TYPE i.
DATA : fg_set TYPE c VALUE ''.
DATA : ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
CONSTANTS : c_mtart(4) TYPE c VALUE 'FERT'.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
SET TITLEBAR 'RAJ'.
IF fg_set = ''.
SELECT matnr
mtart
mbrsh
meins
FROM mara
INTO TABLE it_mara
WHERE mtart = c_mtart.
DESCRIBE TABLE it_mara LINES v_fill.
v_lines = v_fill.
fg_set = 'X'.
ENDIF.
IF fg_set = 'X'.
EXIT.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module fill_table_control OUTPUT
&----
text
----
MODULE fill_table_control OUTPUT.
READ TABLE it_mara INTO it_mara1 INDEX tc1-current_line.
ENDMODULE. " fill_table_control OUTPUT
&----
*& Module cancel INPUT
&----
text
----
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE. " cancel INPUT
&----
*& Module read_table_control INPUT
&----
text
----
MODULE read_table_control INPUT.
v_lines = sy-loopc .
it_mara1-lsel = lsel.
MODIFY it_mara FROM it_mara1 INDEX tc1-current_line.
ENDMODULE. " read_table_control INPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE user_command_0100 INPUT.
ok_code = sy-ucomm.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'NEXT_LINE'.
tc1-top_line = tc1-top_line + 1.
v_limit = v_fill - v_lines + 1.
IF tc1-top_line > v_limit.
tc1-top_line = v_limit.
ENDIF.
WHEN 'PREV_LINE'.
tc1-top_line = tc1-top_line - 1.
IF tc1-top_line < 0.
tc1-top_line = 0.
ENDIF.
WHEN 'NEXT_PAGE'.
tc1-top_line = tc1-top_line + v_lines.
v_limit = v_fill - v_lines + 1.
IF tc1-top_line > v_limit.
tc1-top_line = v_limit.
ENDIF.
WHEN 'PREV_PAGE'.
tc1-top_line = tc1-top_line - v_lines.
IF tc1-top_line < 0.
tc1-top_line = 0.
ENDIF.
WHEN 'LAST_PAGE'.
tc1-top_line = v_fill - v_lines + 1.
WHEN 'FIRST_PAGE'.
tc1-top_line = 0.
WHEN 'DELETE'.
READ TABLE tc1-cols INTO cols
WITH KEY screen-input = '1'.
IF sy-subrc = 0.
LOOP AT it_mara INTO it_mara1 WHERE lsel = 'X'.
DELETE it_mara.
fg_set = 'X'.
ENDLOOP.
ELSE.
fg_set = ''.
ENDIF.
WHEN 'INSERT'.
LOOP AT it_mara INTO it_mara1 WHERE lsel = 'X'.
INSERT INITIAL LINE INTO it_mara INDEX sy-tabix.
ENDLOOP.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'JADOO'.
READ TABLE tc1-cols INTO cols
WITH KEY selected = 'X'.
IF sy-subrc = 0.
cols-invisible = '1'.
MODIFY tc1-cols FROM cols INDEX sy-tabix.
ENDIF.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*************
Regards,
Raj
‎2005 Nov 24 4:51 AM
Hi Rajasekhar,
Thanks for the reply.But my requirement is if i write in empid field and press enter then empid and emp name should be filled.
with regards,
kiran
‎2005 Nov 24 7:01 AM
For enter,
case sy-ucomm.
when ' '.
Name = 'test'.
endcase.
Try this
‎2005 Nov 24 1:05 PM
Hi All,
Could any one of you help me out.In table control when iam enteringa value and pressing enter that is disappearing.how to restict that.
with regards,
kiran i
‎2005 Nov 24 1:24 PM