09-19-2008 7:24 AM
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-19-2008 7:35 AM
09-19-2008 7:45 AM
You can try something as below:
SELECT single * INTO <wa_ztable> FROM <ztable>
WHERE vbeln = p_vbeln.
IF sy-subrc EQ 0.
<wa_ztable>-vbeln = p_vbeln.
<wa_ztable>-count = <wa_ztable> + 1.
MODIFY <ztable> FROM <wa_table>.
ELSE.
<wa_ztable>-vbeln = p_vbeln.
<wa_ztable>-count = 1.
INSERT INTO <ztable> VALUE <wa_ztable>.
ENDIF.
Regards
Eswar
09-19-2008 7:55 AM
To make the application persistent design a transparent table where u can store vbeln and counter value (count).
enter vbeln in the selection screen.
read ur custom table with the vbeln entered.
If record not found then set the counter to 1.
if record found then increment the counter by 1.
ans at last update the table with vbeln and new counter value.
09-19-2008 8:14 AM
Hi Rudra,
First You need to create a Ztable(say ZTT_VBELN_COUNT) with Three fields MANDT VBELN ETIMES.
Now in your program add code as below;
DATA wa_vbeln_count type line of ZTT_VBELN_COUNT.
SELECT SINGLE * FROM ZTT_VBELN_COUNT INTO CORESSPONDING FIELDS OF wa_vbeln_count where VBELN = lv_vbeln.
IF SY-SUBRC EQ 0.
wa_vbeln_count-etimes = wa_vbeln_count-etimes + 1.
ELSE
wa_vbeln_count-vbeln = lv_vbeln.
wa_vbeln_count-etimes = 1.
ENDIF.
MODIFY ZTT_VBELN_COUNT FROM wa_vbeln_count.
Regards
Karthik D