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

if statement

Former Member
0 Likes
770

Hi All,

Please let me know is there anything wrong with following if statement.

LOOP AT t_bsid_zpp_zpr.

IF t_bsid_zpp_zpr-zterm = 'ZPP '.

IF ( t_bsid_zpp_zpr-blart = 'SS' OR t_bsid_zpp_zpr-blart = 'SR' ).

t_bsid = t_bsid_zpp_zpr.

APPEND t_bsid.

ENDIF.

ENDIF.

ENDLOOP.

IF NOT t_bsid[] IS INITIAL.

record-blart_002 = 'P7'.

PERFORM sub_process_records.

ENDIF.

Regards,

Sai Prasad

1 ACCEPTED SOLUTION
Read only

former_member386202
Active Contributor
0 Likes
748

Hi,

nothing but if u r facing any problem on that then try like this

LOOP AT t_bsid_zpp_zpr.

IF ( t_bsid_zpp_zpr-zterm = 'ZPP ' ) AND

( t_bsid_zpp_zpr-blart = 'SS' ) OR

( t_bsid_zpp_zpr-blart = 'SR' ).

t_bsid = t_bsid_zpp_zpr.

APPEND t_bsid.

ENDIF.

ENDLOOP.

IF NOT t_bsid[] IS INITIAL.

record-blart_002 = 'P7'.

PERFORM sub_process_records.

ENDIF.

Regards,

Prashant

7 REPLIES 7
Read only

former_member386202
Active Contributor
0 Likes
749

Hi,

nothing but if u r facing any problem on that then try like this

LOOP AT t_bsid_zpp_zpr.

IF ( t_bsid_zpp_zpr-zterm = 'ZPP ' ) AND

( t_bsid_zpp_zpr-blart = 'SS' ) OR

( t_bsid_zpp_zpr-blart = 'SR' ).

t_bsid = t_bsid_zpp_zpr.

APPEND t_bsid.

ENDIF.

ENDLOOP.

IF NOT t_bsid[] IS INITIAL.

record-blart_002 = 'P7'.

PERFORM sub_process_records.

ENDIF.

Regards,

Prashant

Read only

JozsefSzikszai
Active Contributor
0 Likes
748

"Please let me know is there anything wrong with following if statement."

syntactically it is ok, the question is if you get, what you expect...

however you can make simplier:

LOOP AT t_bsid_zpp_zpr WHERE zterm = 'ZPP ' AND

( blart = 'SS' OR blart = 'SR' ).

t_bsid = t_bsid_zpp_zpr.

APPEND t_bsid.

ENDLOOP.

ec

Read only

Former Member
0 Likes
748

hi sai

this if statement is correct . if condition is true then loop is working other wise it's not work .

check ur itab fields its correct r not .

Read only

Former Member
0 Likes
748

HI

there is nothing wrong , tell me what problem facing you

Read only

johndeconinck
Participant
0 Likes
748

Absolutely correct. Maybe something's wrong in your form sub_process_records?

Regards,

John.

Read only

matt
Active Contributor
0 Likes
748

First, it isn't surrounded by CODE blocks, so I'll fix that.

LOOP AT t_bsid_zpp_zpr.

  IF t_bsid_zpp_zpr-zterm = 'ZPP '.
    IF ( t_bsid_zpp_zpr-blart = 'SS' OR t_bsid_zpp_zpr-blart = 'SR' ).
      t_bsid = t_bsid_zpp_zpr.
      APPEND t_bsid.
    ENDIF.
  ENDIF.
ENDLOOP.

IF NOT t_bsid[] IS INITIAL.
  record-blart_002 = 'P7'.
  PERFORM sub_process_records.
ENDIF.

Second, it is overly complex.

LOOP AT t_bsid_zpp_zpr WHERE zterm = 'ZPP ' AND ( blart = 'SS' OR blart = 'SR' ).
  APPEND z_bsid_zpp_zpr TO t_bsid.
ENDLOOP.

IF NOT t_bsid[] IS INITIAL.
  record-blart_002 = 'P7'.
  PERFORM sub_process_records.
ENDIF.

matt

Read only

matt
Active Contributor
0 Likes
748

There is a possible issue I've just noticed. Is the space after ZPP necessary?

matt