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

Simple error

Former Member
0 Likes
781

Hi Experts,

I am doing aging report. In the for the days i should subtract duedate from document date.

days = duedate - document date.

Here the problem is some times bcoz of the wrong data.. im getting -days(minus ) . so in order to avaoid this i want to skip the document number.. when ever - or * anything come like this.

How to solve this problem.

<removed by moderator>

Regards,

Sunita.

Edited by: Craig Cmehil on Jul 3, 2008 3:30 PM

1 ACCEPTED SOLUTION
Read only

sachin_mathapati
Contributor
0 Likes
753

Hi Sunita ,

Check if Document date is less than duedate before Subtracting.

If Doc date is Greater than due date the use the FM to subtract two dates..

FIMA_DAYS_AND_MONTHS_AND_YEARS -- u2013 Calculates the difference between two dates

<removed by modertor>

Regards,

Sachin M M

Edited by: Jan Stallkamp on Jul 2, 2008 12:59 PM

6 REPLIES 6
Read only

Subhankar
Active Contributor
0 Likes
753

Hi

please use the FM..HR_SGPBS_YRS_MTHS_DAYS

DATA: l_day TYPE i,

l_month TYPE i.

IF p_dper = c_check.

CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'

EXPORTING

beg_da = s_budat-low

end_da = s_budat-high

IMPORTING

no_day = l_day

no_month = l_month

EXCEPTIONS

dateint_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE e000 WITH

'Date range can not be calculated'(037).

ENDIF.

Read only

sachin_mathapati
Contributor
0 Likes
754

Hi Sunita ,

Check if Document date is less than duedate before Subtracting.

If Doc date is Greater than due date the use the FM to subtract two dates..

FIMA_DAYS_AND_MONTHS_AND_YEARS -- u2013 Calculates the difference between two dates

<removed by modertor>

Regards,

Sachin M M

Edited by: Jan Stallkamp on Jul 2, 2008 12:59 PM

Read only

former_member195383
Active Contributor
0 Likes
753

data : wf_char type char10.

wf_char = days.

if wf_char+0(1) eq '-'.

skipp the rest of the logic.....

Try the above...it will work..

<removed by modertor>

Edited by: Jan Stallkamp on Jul 2, 2008 12:59 PM

Read only

0 Likes
753

Hey Prasana,

Thanks For your help. Issue completed.

Regards

Sunita.

Read only

Former Member
0 Likes
753

hi sunitha, check due date & doc. date

LOOP AT wa_tab INTO itab.

IF wa_tab-duedate GT wa_tab-Docdate.

days = w_tab-duedate - wa_tab-document date.

ELSE.

CONTINUE.

ENDIF.

ENDLOOP.

or in else part u can delete that record before continue.

Edited by: venkat reddy on Jul 2, 2008 9:29 AM

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
753

if days < 0.

skip.........

endif.