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: 

Error in logical expression: Instead if "", a field, a function, or "(" was expected.

brenm1989
Explorer
745

Hi,

I facing syntax problem in ABAP.

For the line: "if sy-subrc <>." I get the Error-Message, as mentioned in the title.

Could you help me?

(BTW: The Code is working, if take a "do 18 times"-loop and comment out the if-block.)

field-symbols: <fs>.
loop at gt_output into data(gs_output).

do.
   assign component sy-index of structure gs_output to <fs>.
if sy-subrc <>.
   exit.
  endif.
Write:/ <fs>.

enddo.
endloop.
1 ACCEPTED SOLUTION

MateuszAdamus
Active Contributor
283

Hello brenm1989

You're missing the value part of the IF SY-SUBRC <> condition. It should be like this:

do.
  assign component sy-index of structure gs_output to <fs>.
  if sy-subrc <> 0. " <-- added zero
    exit.
  endif.

  Write:/ <fs>.
enddo.
Kind regards,
Mateusz
2 REPLIES 2

MateuszAdamus
Active Contributor
284

Hello brenm1989

You're missing the value part of the IF SY-SUBRC <> condition. It should be like this:

do.
  assign component sy-index of structure gs_output to <fs>.
  if sy-subrc <> 0. " <-- added zero
    exit.
  endif.

  Write:/ <fs>.
enddo.
Kind regards,
Mateusz

Abinathsiva
Active Contributor
283

Hi,

If condition is not completed. sy-subrc is not compared with any parameter