09-18-2008 5:06 PM
Hi,
in my selection screen i have billing doc no- vbeln.
in my ztable i have etimes a field.
when i enter a bill doc no and press f8, my etimes feild in ztable sets to 1.
my requirement is if i enter a bill doc as 97600654 for first time, etimes is 1.
for second time if i enter that same bill doc i.e 97600654 , etimes should be 2 and if third then 3 and so on.
if a new doc is entered then etimes is again 1.
how to code this..plz provide some code.
09-18-2008 5:12 PM
If there is concorrency, you should consider on locking your ztable first.
If not, just do something similar to this:
CLEAR w_etimes.
SELECT SINGLE etimes FROM ztable
INTO (w_etimes)
WHERE vbeln EQ p_vbeln.
IF sy-subrc EQ 0.
ADD 1 TO w_etimes.
UPDATE ztable
SET etimes = w_etimes
WHERE vbeln EQ p_vbeln.
ELSE.
wa-vbeln = p_vbeln.
wa-etimes = 1.
INSERT ztable FROM wa.
ENDIF.
Regards,
Valter Oliveira.