Application Development 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: 

how to put a check with the date

Former Member
0 Kudos

Hi,

I have created a ztable with 3 fields .

clientcode(3),

date,--date geneated

version--- fileversion

i need to update this table everytime i execute the data. Every time version shd get incremented when i execute the program. When i excute the program next day version shd be updated by '1'.

i wrote the code for version updated i'm not getting the logic how to put a check with the date.

SELECT *

FROM zfi_enetflver

INTO TABLE gt_flver.

SORT gt_flver DESCENDING.

CLEAR: gv_dt, v_file.

CONCATENATE sy-datum6(2) sy-datum4(2) INTO gv_dt.

READ TABLE gt_flver WITH KEY client_code = gv_clcd.

IF sy-subrc = 0.

idx = sy-tabix.

IF gt_flver-zdate = ' '.

gt_flver-zdate = sy-datum.

ENDIF.

IF gt_flver-version = ' '.

gt_flver-version = '001'.

gv_filever = gt_flver-version.

MODIFY gt_flver INDEX idx TRANSPORTING zdate version.

MODIFY zfi_enetflver FROM TABLE gt_flver. "TRANSPORTING version.

CONCATENATE 'E:\' 'ENET\' gv_clcd gv_dt '.' gt_flver-version INTO v_file.

ELSE.

gt_flver-version = gt_flver-version + 1.

gv_filever = gt_flver-version.

MODIFY gt_flver INDEX idx TRANSPORTING version.

MODIFY zfi_enetflver FROM TABLE gt_flver .

CONCATENATE 'E:\' 'ENET\' gv_clcd gv_dt '.' gt_flver-version INTO v_file.

ENDIF.

ENDIF.

clientcode is the key field in ztable do i need to make date field key ??

please help me with the logic

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You need to implement below logic:

1. check if field_date = sy-datum. in this case do nothing.

2. else . move sy-datum to field_date .

3. modify your internal table with field_date .

4. populate final table to database table .

hope you get it.

5 REPLIES 5

Former Member
0 Kudos

You need not to make date as key.

Former Member
0 Kudos

You need to implement below logic:

1. check if field_date = sy-datum. in this case do nothing.

2. else . move sy-datum to field_date .

3. modify your internal table with field_date .

4. populate final table to database table .

hope you get it.

0 Kudos

how to refresh the version if i am executing the program first time on tat day for example if the version is 50 for the previous date now the shd get modified with todays date and version as 1..

0 Kudos

Hai,

Firstly check data For todays date, if does not Exist, then assign 1 to version, if date already Exist then update version.

Regards

shelly Malik

0 Kudos

Its simple Ramya,

Put a check on date, if today date not equal to the date in field.

Just put version as 1 .

not modify the tables , as you are doing now.

hope you got it.