‎2007 Feb 19 9:36 AM
hi,
im giving below code everything is working correct except if i given telnum in output screen and press enter the corresponding table data is populated. if i press new then the screen is clear and go for new telephone no, my problem is if i enter telephone no and press enter data dispalyed and delete that telnum and enter new telephone number andpress enter the new telephone no is not displayed. and also i want to set default value for nrart = 'h' (key field) and proz1 = '100,00' (not a key field) for the table zfmkstel
code.
ata : fs_zfm_handy like zfm_handy,
fs_zfmkstel like zfmkstel,
fs_temp_zfm_handy like zfm_handy,
fs_temp_zfmkstel like zfmkstel.
data : t_table1 like table of fs_zfm_handy.
data : ok_code type sy-ucomm,
save_ok like sy-ucomm.
data : f1_rec type i.
*
*data : w_telnum like fs_temp_zfm_handy-telnum,
w_kartnr like fs_temp_zfm_handy-kartnr.
*
*data : ok_code(4).
call screen 600.
----
MODULE status_0600 OUTPUT
----
*
----
module status_0600 output.
set pf-status 'ZSTATUS'.
loop at screen.
*if screen-name = fs_temp_zfmkstel-kostl1 or screen-name = fs_temp_zfm_handy-zutart or
screen-name = fs_temp_zfm_handy-pernr or screen-name = fs_temp_zfm_handy-zdate or
screen-name = fs_temp_zfm_handy-pinnr or screen-name = fs_temp_zfm_handy-puknr or
screen-name = fs_temp_zfm_handy-tarif1 or screen-name = fs_temp_zfm_handy-tarif2 or
screen-name = fs_temp_zfm_handy-tarif3 or screen-name = fs_temp_zfm_handy-gtype or
screen-name = fs_temp_zfm_handy-imei or screen-name = fs_temp_zfm_handy-twincard or
screen-name = fs_temp_zfm_handy-twinbill or screen-name = fs_temp_zfm_handy-einbau or
screen-name = fs_temp_zfm_handy-beschr or screen-name = fs_temp_zfm_handy-text1 or
screen-name = fs_temp_zfm_handy-text2 or screen-name = fs_temp_zfm_handy-text3.
if screen-name = fs_temp_zfmkstel-kostl1.
if f1_rec = 1.
screen-input = 0.
else.
screen-input = 1.
endif.
modify screen.
endif.
endloop.
endmodule. "status_0600 OUTPUT
----
MODULE USER_COMMAND_0600 INPUT
----
*
----
MODULE USER_COMMAND_0600 INPUT.
*ok_save = ok_code.
save_ok = ok_code.
CLEAR OK_CODE.
**
*CASE ok_code.
case save_ok.
when 'SAVE'.
IF f1_rec ne 1 .
if sy-subrc = 0.
update zfm_handy from fs_temp_zfm_handy.
insert zfm_handy from fs_temp_zfm_handy.
MODIFY zfm_handy from fs_temp_zfm_handy.
if sy-subrc = 0.
insert zfmkstel from fs_temp_zfmkstel.
if sy-subrc = 0.
fs_temp_zfmkstel-telnum = fs_temp_zfm_handy-telnum.
fs_temp_zfmkstel-nrart = fs_temp_zfm_handy-nrart.
fs_temp_zfmkstel-proz1 = fs_temp_zfm_handy-proz1.
INSERT ZFMKSTEL FROM FS_TEMP_ZFMKSTEL.
commit work.
if sy-subrc = 0.
message s000(0) with 'record havebeen updated successfully'.
MODIFY ZFMKSTEL FROM FS_TEMP_ZFMKSTEL.
else.
delete zfm_handy from fs_temp_zfm_handy.
endif.
endif.
else.
update zfm_handy from fs_temp_zfm_handy.
if sy-subrc eq 0.
fs_temp_zfmkstel-telnum = fs_temp_zfm_handy-telnum.
update zfmkstel from fs_temp_zfmkstel.
if sy-subrc eq 0.
message s000(0) with 'update sucessfully'.
endif.
endif.
endif.
endif.
WHEN 'NEW'.
Clear fs_temp_zfm_handy.
clear fs_temp_zfmkstel.
clear f1_rec.
WHEN 'EXIT'.
LEAVE PROGRAM.
when OTHERS.
if fs_temp_zfm_handy-telnum ne fs_zfm_handy-telnum or
fs_temp_zfm_handy-kartnr ne fs_zfm_handy-kartnr.
clear f1_rec.
if not fs_temp_zfm_handy-telnum is initial.
if fs_temp_zfm_handy-kartnr is initial.
clear: w_telnum , w_kartnr.
move fs_temp_zfm_handy-telnum to w_telnum.
move fs_temp_zfm_handy-kartnr to w_kartnr.
select * from zfm_handy into table t_table1 where telnum = fs_temp_zfm_handy-telnum.
IF sy-subrc EQ 0 and sy-dbcnt GT 1.
message s000(0) with 'Mob:Nr has more that 1 entry. Please enter Karten number also to select the desired record'.
ELSEIF
sy-subrc EQ 0 and sy-dbcnt EQ 1.
read table t_table1 into fs_zfm_handy index 1.
If sy-subrc eq 0.
fs_temp_zfm_handy = fs_zfm_handy.
f1_rec = 1.
endif.
endif.
else.
select single * from zfm_handy into fs_zfm_handy where telnum = fs_temp_zfm_handy-telnum
and kartnr = fs_temp_zfm_handy-kartnr.
If sy-subrc eq 0.
fs_temp_zfm_handy = fs_zfm_handy.
f1_rec = 1.
endif.
endif.
if f1_rec = 1.
select single * from zfmkstel into fs_zfmkstel where telnum = fs_temp_zfm_handy-telnum.
If sy-subrc eq 0.
fs_temp_zfmkstel = fs_zfmkstel.
endif.
endif.
endif.
endif.
endcase.
endmodule. "USER_COMMAND_0600 INPUT
‎2007 Feb 19 9:41 AM
Hi,
U can create domian for those two fields nrart and proz1 and specify in the value range tab default value as 'H' and '100,00'.
Else before inserting value to the table u can pass these values and INSERT.
‎2007 Feb 19 9:43 AM
1) all fields can be validated in PBO event of the screen
2) it would be good if u paste the flow logic aswell.
any how make sure
u clear all the values of the internal table where u are capturing all other data.
as field telno module user_command_clear_table.
...
..
write your select statement for the new tel no in the PBO, if you not already done it
santhosh
‎2007 Feb 19 10:44 AM
PROCESS BEFORE OUTPUT.
MODULE STATUS_0600.
*module modify_screen.
PROCESS AFTER INPUT.
chain.
field fs_temp_zfm_handy-telnum.
endchain.
MODULE USER_COMMAND_0600.
‎2007 Feb 19 10:46 AM
one solution is write ur select statement in your PBO
santhosh
Message was edited by:
Kaluvala Santhosh
‎2007 Feb 19 9:47 AM
Hi,
Plz check the ok_code when you press ENTER. Put a break-point and see you have any extra clear/refresh statements. Its very difficult to go thru your code line/line.
regards,
Sateesh...