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: 

IF in loop

Former Member
0 Kudos

Hi,

I cant get my IF to Write out what i select.

I am a beginner in coding and when doing the debugging it only skips past the Write statement in the IF.

Thanks y'all

FORM write_data USING u_sflight_tab TYPE t_sflight_tab.

FIELD-SYMBOLS <fs_sflight> LIKE LINE OF u_sflight_tab.

LOOP AT u_sflight_tab ASSIGNING <fs_sflight>.

t_sAvail = <fs_sflight>-SeatsMax - <fs_sflight>-SeatsOcc.

t_PercOcc = t_sAvail / <fs_sflight>-SeatsMax.

IF <fs_sflight>-fldate+4(4) BETWEEN '0301' and '0330'.

Write: 'Spring Break'.

ENDIF.

IF <fs_sflight>-fldate+4(4) BETWEEN '0401' and '0410'.

Write : 'Easter'.

ENDIF.

WRITE: / 'CarrId', <fs_sflight>-carrid,

'ConnID', <fs_sflight>-connid,

'FlDate', <fs_sflight>-fldate,

'SeatsOcc', <fs_sflight>-SeatsOcc,

'sAvail', t_sAvail,

'PercOCC', t_PercOcc,

'SeatsMax', <fs_sflight>-SeatsMax.

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Do you mean that the IF statement codition is not satisfied, and the WRITE statement is never executed? If so, check the values in the condition in debug mode.

REgards,

RIch Heilman

2 REPLIES 2

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Do you mean that the IF statement codition is not satisfied, and the WRITE statement is never executed? If so, check the values in the condition in debug mode.

REgards,

RIch Heilman

0 Kudos

sorry my mistake it I didn't have any data that was matching embarrassing