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: 

Relationship Operator is not Supported

ninad18
Explorer
0 Kudos

IF sy-subrc = 0.
if gwa_invdata-werks = '4200' OR '4210'
gwa_output-add_tracking_number_req_mt-tracking-carrier_code = 'MOL'.
ELSE.
gwa_output-add_tracking_number_req_mt-tracking-carrier_code =
gwa_scaccode-scac_code.

Relational operator "GWA_OUTPUT-ADD_TRACKING_NUMBER_REQ_MT-TRACKING-CARRIER_CODE" is not supported.

1 ACCEPTED SOLUTION

jmodaal
Active Contributor

Hello,

1) comparing a field to more than 1 value in ABAP is not possible as short as you tried it

2) the error message comes up because of the missing . at the end of the if clause.

IF sy-subrc = 0.
if gwa_invdata-werks = '4200' or gwa_invdata-werks = '4210'.
gwa_output-add_tracking_number_req_mt-tracking-carrier_code = 'MOL'.
ELSE.
gwa_output-add_tracking_number_req_mt-tracking-carrier_code = gwa_scaccode-scac_code.
endif.
endif.

Kind regards

Jan

PS: please use the 'Code' button when using code in your postings.

4 REPLIES 4

jmodaal
Active Contributor

Hello,

1) comparing a field to more than 1 value in ABAP is not possible as short as you tried it

2) the error message comes up because of the missing . at the end of the if clause.

IF sy-subrc = 0.
if gwa_invdata-werks = '4200' or gwa_invdata-werks = '4210'.
gwa_output-add_tracking_number_req_mt-tracking-carrier_code = 'MOL'.
ELSE.
gwa_output-add_tracking_number_req_mt-tracking-carrier_code = gwa_scaccode-scac_code.
endif.
endif.

Kind regards

Jan

PS: please use the 'Code' button when using code in your postings.

0 Kudos

IT Working Thanks a lot.

Sandra_Rossi
Active Contributor
0 Kudos

Please edit your question (Actions>Edit), select your code and press the button [CODE], which makes the code appear colored/indented, it'll be easier for people to look at it. Thanks!

Sandra_Rossi
Active Contributor

If you want to do the same code for several values of one variable, I'd recommend using either CASE:

CASE gwa_invdata-werks.
  WHEN '4200' OR '4210'.
    gwa_output-add_tracking_number_req_mt-tracking-carrier_code = 'MOL'.
  WHEN OTHERS.
    gwa_output-add_tracking_number_req_mt-tracking-carrier_code = gwa_scaccode-scac_code.
ENDCASE.

Or SWITCH if the same target variable is to be initialized:

gwa_output-add_tracking_number_req_mt-tracking-carrier_code
           = SWITCH #( gwa_invdata-werks
             WHEN '4200' OR '4210' THEN
                 'MOL'
             ELSE
                 gwa_scaccode-scac_code ).