Question and Answer about SAP ABAP Assignments, Conversions, and Calculations
Q:I can use the clear statement to set a value to blanks or zeros, but is there a statement that can set a variable back to the value I specified using the value addition on the data statement?
A:No, unfortunately there isn’t.
Q:Can I use the move statement with field strings of differing lengths?
A:Yes, you can. They will both be treated as variables of type c. The sending value will be truncated or padded on the end with blanks as needed before assignment to the receiving field string.
Q:Why do I need to know about padding bytes? Doesn’t the system take care of that if I just follow all the rules?
A:Technically, yes, it will. However, as you code more programs, occasionally you will inadvertently assign a field string incorrectly using move. If you understand padding bytes and how they affect your output, hopefully you will be able to recognize the cause of your problems, and won’t resort to a “hack” to make the program work.
Q:It seems strange that I can assign invalid values to variables. What happens if I use one of these variables with an invalid value in it?
A:Anything can happen. I wouldn’t write a program that intentionally relies on invalid values. For example, don’t be tempted to use a special date value of all x to indicate something special like a missing date. The behavior of your program becomes unpredictable when you go outside the allowable boundaries of the language.
Q:The syntax messages often don’t indicate what is truly wrong with my program. Is it me or is the syntax checker way out in left field sometimes?
A:Let’s just say…it isn’t you. My favorite of all time is the message xxxx is expected. It really means “xxxx is not expected.” So when you see that message, insert the word not, and it will be correct.
Popularity: 11% [?]






