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

Syntax Error

Former Member
0 Likes
384

Hi friends,

I need to move data into an internal table from a data base table based on the year and the month.

However if there is no data for a particular month it has pick data for the immediate next month..

Below is my code and am having some syntax error at the if statements where i am doing addition on the month.

TABLES : t009b,

tvarvc.

DATA : month TYPE i,

year TYPE i,

day TYPE i.

DATA : BEGIN OF t_period OCCURS 0,

bdatj TYPE bdatj,

bumon TYPE bumon,

butag TYPE butag,

poper TYPE poper,

END OF t_period.

month = sy-datum+4(2).

day = sy-datum+6(2).

year = sy-datum+0(4).

START-OF-SELECTION.

SELECT t009bbdatj t009bbumon t009bbutag t009bpoper

INTO t_period

FROM t009b

WHERE t009b~bdatj = year.

IF t_period-bumon = month.

APPEND t_period.

ELSEIF t_period-bumon = month + 1.

APPEND t_period.

ELSE.

EXIT.

ENDIF.

ENDSELECT.

Thanks,

Shejal.

1 ACCEPTED SOLUTION
Read only

guillaume-hrc
Active Contributor
0 Likes
355

Hi,

In your ELSEIF condition, you cannot do the addition (month + 1).

You should first assign a varaible:

next_mont = month + 1.
IF ...
...
ELSEIF t_period-bumon = nexst_month.
...
ENDIF.

Best regards,

Guillaume

2 REPLIES 2
Read only

guillaume-hrc
Active Contributor
0 Likes
356

Hi,

In your ELSEIF condition, you cannot do the addition (month + 1).

You should first assign a varaible:

next_mont = month + 1.
IF ...
...
ELSEIF t_period-bumon = nexst_month.
...
ENDIF.

Best regards,

Guillaume

Read only

0 Likes
355

Thanks Guillaume.