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: 

Obsolete syntax and possible dynamic IF statement?

former_member602116
Participant
0 Kudos

Hi Experts,

I have two questions regarding ABAP:

1. I have read that EXPORT IMPORT is not totally obsolete, export/import without MEMORY ID is obsolete but if we use:

EXPORT itab FROM itab FROM MEMORY ID 'XXXXX'

IMPORT itab TO itab FROM MEMORY ID 'XXXXX'

I have read threads regarding this from 2013 and just wanted to confirm if this is still true?

2. Is there a way to make an IF statement dynamic? Requirement is I have operations maintained in a custom table field: GT/LE/EQ/LT/GE and want to use this field. Instead of explicitly writing IF lv_var1 EQ lv_var2, I want to use the table field: IF lv_var1 <table_field> lv_var2. Is this possible?

Thanks in advance for any inputs!

Regards,

Katherine Darunday

1 ACCEPTED SOLUTION

GK817
Active Contributor

Hello,

1. Yes, IMPORT/EXPORT memory can be used but just be aware of clearing the memory id and using within one LUW.

2. Dynamic IF condition is not possible straightforward way. But there is a bit complex, alternative available, please go through this blog:

https://blogs.sap.com/2016/02/29/dynamic-if-condition/

You can also consider using CASE statement as dynamic options will be limited.

Gaurav

6 REPLIES 6

GK817
Active Contributor

Hello,

1. Yes, IMPORT/EXPORT memory can be used but just be aware of clearing the memory id and using within one LUW.

2. Dynamic IF condition is not possible straightforward way. But there is a bit complex, alternative available, please go through this blog:

https://blogs.sap.com/2016/02/29/dynamic-if-condition/

You can also consider using CASE statement as dynamic options will be limited.

Gaurav

Sandra_Rossi
Active Contributor
0 Kudos

Please ask the questions separately, otherwise it will be very difficult for visitors to locate answers.

Szczerbowski
Active Participant

It is easy to check what is obsolete or not in the F1 help on a keyword or the whole chapter - Obsolete Language Elements.

Sandra_Rossi
Active Contributor

1. The way you say it, people could think that EXPORT IMPORT is mostly obsolete. That's incorrect. You're talking about a very specific syntax without ID which was not documented and has been obsolete for a long time (I didn't even know that some people used it). It's officially obsolete since at least 2011 (ABAP 7.31), but developers didn't use it before because anything error-prone should not be used.

Sandra_Rossi
Active Contributor
IF dynamic_condition-operator = 'GT'.
  IF operand1 GT operand2.
    ...
  ENDIF.
ELSEIF dynamic_condition-operator = 'LE'.
  IF operand1 LE operand2.
    ...
  ENDIF.
ELSEIF dynamic_condition-operator = 'EQ'.
  IF operand1 EQ operand2.
    ...
  ENDIF.
ELSEIF ...
...

ankit_aggarwal5
Explorer

For 2)

The other alternate that can be used is via Dynamic WHERE clauses on internal tables you are going to use the tables. Otherwise, you can also choose to convert your variables into type table use the dynamic where clause. Hope this helps.