‎2011 Jul 04 8:50 PM
Hello gurus, Im sorry about the silly question.
I have a question about using TVARV in an ABAP program.
A program is presenting a problem and I think that in this code:
SELECT SIGN OPTI LOW HIGH
FROM TVARV
INTO TABLE R_1_163431035_VELOCIDADE
WHERE NAME = '1_163431035_VELOCIDADE'
AND TYPE = 'S'.
IF ZMM001-VELOCIDADE_B IN R_1_163431035_VELOCIDADE AND
ZOPERADORAS-OPERADORA = 'ABCD' AND
ZMM001-MATERIAL IN R_1_163431035_PRODUTO.
...
ELSE.
...
ENDIF.What happens is that the value "ZMM001-SPEED" B not exist in "R1_163431035_VELOCIDADE" but the program executes commands under the IF and not under the ELSE, as I imagine it would work. Is this correct ?
I am new to ABAP programming, but I have a lot of XP in other programming languages ​​and this makes no sense to me.
Anyone know where I can find some documentation of the use of "TVARV" in ABAP programs?
I search the Internet if other programmers use TVARV this way, but found nothing, which leads me to think that was a quick and dirty solution that used here.
If this is a bad way to program, what would be the best way?
Regards
Ronaldo.
‎2011 Jul 05 2:24 PM
Hello, thank you very much for your reply.
I agree, ABAP is a programming language completely different from the others, little by little I'm adapting to it.
But in this case, the range is not empty, there are 17 records, in this way.:
For the column "SING" all values ​​are "E"
For the column "OPTI" all values ​​"EQ"
For the column "LOW" values ​​are different, but none of them are equal to the contents of "ZMM001-VELOCIDADE_B"
All records in the column "HIGH" are empty.
The other range is not empty, and there is a record in that Satisfy the search condition and ZOPERADORAS-OPERATOR = 'ABCD' is also true.
I look in the documentation something about it before asking here in the forum but found nothing. Maybe I did not know how to search.
I found something of use "IF" with "IN", in selection screens.
The "IF" with "IN" using "TVARV" as used in the program of the post above has the same behavior of a selection screen?
I know it's a silly and very basic question, but other language that I used, only the SQL has the "IN" operator,
but I think they work in different ways, so I would like to understand how it works in ABAP.
best regards
Ronaldo.
‎2011 Jul 04 10:01 PM
Hi,
It's ABAP, it does not look like other languages! So, the first reflex is to add a favorite to the ABAP documentation : If the range is empty then everything matches. It is not related to TVARV.
BR
Sandra
‎2011 Jul 05 2:24 PM
Hello, thank you very much for your reply.
I agree, ABAP is a programming language completely different from the others, little by little I'm adapting to it.
But in this case, the range is not empty, there are 17 records, in this way.:
For the column "SING" all values ​​are "E"
For the column "OPTI" all values ​​"EQ"
For the column "LOW" values ​​are different, but none of them are equal to the contents of "ZMM001-VELOCIDADE_B"
All records in the column "HIGH" are empty.
The other range is not empty, and there is a record in that Satisfy the search condition and ZOPERADORAS-OPERATOR = 'ABCD' is also true.
I look in the documentation something about it before asking here in the forum but found nothing. Maybe I did not know how to search.
I found something of use "IF" with "IN", in selection screens.
The "IF" with "IN" using "TVARV" as used in the program of the post above has the same behavior of a selection screen?
I know it's a silly and very basic question, but other language that I used, only the SQL has the "IN" operator,
but I think they work in different ways, so I would like to understand how it works in ABAP.
best regards
Ronaldo.
‎2011 Jul 05 2:46 PM
Hi Ronaldo,
But in this case, the range is not empty, there are 17 records, in this way.:
For the column "SING" all values ​​are "E"
It means that the result is false if ZMM001-VELOCIDADE_B has the same value as one of the 17 records (E = exclude).
For instance, if it has value 'C' and one of 17 records matches C, then the result is false.
The "IF" with "IN" using "TVARV" as used in the program of the post above has the same behavior of a selection screen?
Yes, the same behavior as the selection criterion to be exact. You can press the help key in the complex selection dialog for more info.
I know it's a silly and very basic question, but other language that I used, only the SQL has the "IN" operator, but I think they work in different ways, so I would like to understand how it works in ABAP.
Not silly ;-). Yes they work differently.
More info here:
- http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba74635c111d1829f0000e829fbfe/frameset.htm
- http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba71f35c111d1829f0000e829fbfe/frameset.htm
BR
Sandra