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: 

Relationship Operator is not Supported

ninad18
Explorer
0 Kudos
708

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
660

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
661

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
660

IT Working Thanks a lot.

Sandra_Rossi
Active Contributor
0 Kudos
660

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
660

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 ).