Application Development and Automation 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: 
Read only

Date Calculation

Former Member
0 Likes
562

Hi,

I have calculate the date and display in the output.

 SELECT MATNR
         WEBAZ             " no of days
         FROM MARC
         INTO TABLE I_MARC
         FOR ALL ENTRIES IN I_FINAL1
         WHERE MATNR = I_FINAL1-MATNR.

  ENDIF.

  LOOP AT I_FINAL1 INTO IS_FINAL1.

     READ TABLE I_MARC INTO IS_MARC WITH KEY
                MATNR = IS_FINAL1-MATNR BINARY SEARCH.
     IF SY-SUBRC EQ 0.

I have to substract the field WEBAZ from i_final1-date and display that as output.

Can any one pls tell how to write the logic for that after the above code. or is there any other way.

5 REPLIES 5
Read only

Former Member
0 Likes
546

Hi,

As long as you have I_FInal1-DATE defined as type DATS, you can directly do a subtraction and this will give u a value in date.

i_final1-date = i_final1-date - webaz.

Read only

Former Member
0 Likes
546

Hi Hema,

try this

LOOP AT I_FINAL1 INTO IS_FINAL1.

lv_tabix = sy-tabix.

READ TABLE I_MARC INTO IS_MARC WITH KEY

MATNR = IS_FINAL1-MATNR BINARY SEARCH.

IF SY-SUBRC EQ 0.

is_final1-new_date = is_final1-date - is_marc-webaz.

modify i_final1 from is_final1 index lv_tabix.

endif.

endloop.

Read only

0 Likes
546

check this :

parameters: p_days like marc-webaz,

p_date like sy-datum.

start-of-selection.

p_date = p_date - p_days.

write 😕 p_date.

Read only

Former Member
0 Likes
546

Subtract the no of days from i_final-date like follows

i_result = i_finla-date - webaz.

hope it works.

Please award oints if it helps for you

thanks

Suresh

Read only

Former Member
0 Likes
546

Hi hema,

1. its simple

2.

LOOP AT I_FINAL1 INTO IS_FINAL1.

READ TABLE I_MARC INTO IS_MARC WITH KEY MATNR = IS_FINAL1-MATNR BINARY SEARCH.

IF SY-SUBRC EQ 0.

*----


DATA : DIFF TYPE I.

DIFF = I_MARC - I_FINAL1-DATE.

WRITE DIFF.

ENDIF.

*----


ENDLOOP

regards,

amit m.