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

Regrading IF statement

Former Member
0 Likes
1,184

Hi All,

Please check the below code in that i am able to fetch the w_duedate for first and third if condition.

But i am not able to fetch the w_duedate for the second if condition can anyone let me know how

deal with this issue. I have made bold for the if condition which is not working.

IF fs_terms-ztag1 NE 0 AND

fs_terms-ztag2 NE 0.

w_days = fs_terms-ztag3.

w_duedate = fs_bseg-zfbdt + fs_terms-ztag3.

ENDIF.

IF fs_terms-ztag3 EQ 0 AND

fs_terms-ztag1 NE 0.

w_days = fs_terms-ztag2.

w_duedate = fs_bseg-zfbdt + fs_terms-ztag2.

ENDIF.

IF fs_terms-ztag2 EQ 0 AND

fs_terms-ztag3 EQ 0.

w_days = fs_terms-ztag1.

w_duedate = fs_bseg-zfbdt + fs_terms-ztag1.

ENDIF.

regards

VENk@

12 REPLIES 12
Read only

Former Member
0 Likes
1,155

hai,

Check Condition Properly, It will not be fulfilled thats y its not fetching data second time.

Read only

Former Member
0 Likes
1,155

Hi,

If the IF condition is not working it just means that the condition is not statisfied. There can be no other reason for this when the syntax is correct.

Check in the internal table fs_terms for any records where the field ztag3 is zero and ztag1 is not zero. Since you have used AND, but these conditions must be satisfied.

Regards,

Vikranth

Read only

Former Member
0 Likes
1,155

What is the data type of the fields ztag1, ztag2 & ztag3 , I'm hoping it numeric.

BR,

Advait

Read only

Former Member
0 Likes
1,155

can you please tell us whats the value going to thse two fields and how have you defined the type of those fields

fs_terms-ztag3 EQ 0 AND

fs_terms-ztag1 NE 0.

Read only

Former Member
0 Likes
1,155

Hi,

Itu2019s based on data type; Try below 3 options mostly it will work

1) If itu2019s character the try with SPACE

2) Otherwise try with INITIAL.

3) Also try with u20180u2019

Salil....

Read only

arvind_soni
Participant
0 Likes
1,155

Hello,

Please check for initial and not 0 for data type date

Edited by: Arvind Soni on Sep 16, 2009 3:46 PM

Read only

0 Likes
1,155

Hi all,

My data type is DEC (BSEG-ZBD2T) and i have also checked with initial space.

But still it is not working. Please anymore answers.

Cheers!!

VEnk@

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,155

Hello,

Did you try with IS INITIAL?

IF fs_terms-ztag3 IS INITIAL AND
fs_terms-ztag1 IS NOT INITIAL.
w_days = fs_terms-ztag2.
w_duedate = fs_bseg-zfbdt + fs_terms-ztag2.
ENDIF.

BR,

Suhas

Read only

0 Likes
1,155

I dont know why it should not work.

At least this code is working in my system.


DATA: BEGIN OF fs_terms,
        ztag1 LIKE bseg-zbd2t,
        ztag2 LIKE bseg-zbd2t,
        ztag3 LIKE bseg-zbd2t,
      END OF fs_terms.

fs_terms-ztag1 = 12.

IF fs_terms-ztag3 EQ 0 AND
fs_terms-ztag1 NE 0.
  WRITE 'Valid condition'.
ENDIF.


"  Output : Valid condition

Of course , the assumption is that there is a non zero value in ztag1 field.

BR,

Advait

Read only

Former Member
0 Likes
1,155

Hi all i have debugged the program there was no entries in internal table.

CLosed.

Read only

0 Likes
1,155

You should have done this before posting the question here. From now check all the possibilities and still if you are stuck only then post.

Read only

0 Likes
1,155

Vikranth Reddy i have done it before posting itself and found it is working fine for all my conditions.

But except 2 payment terms(0009, 0006 ) is not working which i have checked after posting. So with this

i hope i am not wrong posting my query.

If possible try to see i have posted another query wth which you can understand.

Regards

VEnk@