Archive for June, 2008

Question and Answer about SAP ABAP Assignments, Conversions, and Calculations

Monday, June 30th, 2008

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. (more…)

Popularity: 9% [?]

How to Search the Descriptions of a Structure or Table

Monday, June 30th, 2008

Step by step how to search the descriptions of a structure or table:

  1. Begin at the Dictionary: Table/Structure: Display Fields screen.
  2. Choose the menu path Table->Print. The Print Table Manual screen is displayed. Here you specify which details you want to see.
  3. Tickmark all fields and press the Continue button. The Print: screen is displayed.
  4. If the Output Device field is blank, position your cursor in the field, press the down arrow, and choose any output device. (It doesn’t matter which device you choose; it won’t be used.)
  5. Press the Print Preview button at the bottom of the screen. The Print Preview for xxxx Page 00001 of nnnnn screen is displayed.
  6. Choose the menu path Goto->List Display. The Print Preview for xxxx screen is displayed.
  7. Type %sc in the Command field on the Standard toolbar.
  8. Press the Enter key. The Find screen is displayed.
  9. In the Search For field, type a character string to be found. If you are searching for the current logon language, you might type language. Wildcard characters are not permitted. (more…)

Popularity: 8% [?]

Commonly Used System Variables in SAP

Monday, June 30th, 2008

There are 176 system variables available within every ABAP/4 program. You do not have to define them; they are automatically defined and are always available. To display a list of system variables, display the DDIC structure syst. You can display it by using the Dictionary: Initial Screen, or by double-clicking on the name of any system variable in your program. Below list of commonly used system variables in SAP

Name Description
sy-datum Current date
sy-uzeit Current time
sy-uname Current user id
sy-subrc Last return code
sy-mandt Logon client
sy-pagno Current output page number
sy-colno Current output column number
sy-linno Current output list line number
sy-vline Vertical line
sy-uline Horizontal line
sy-repid Current report name
sy-cprog Main program name
sy-tcode Current transaction code
sy-dbcnt Within a select, contains the current iteration counter. After the endselect, contains number of rows that match the where clause.

Popularity: 10% [?]

Why do I need to create field strings? Why can’t I use just simple variables?

Monday, June 30th, 2008

Field strings give you a way of organizing your variables into groups. When you have hundreds of variables in a program, organizing them into field strings makes the relationships between the variables clearer. Using field strings to group fields together also enables you to perform an operation on a group of variables as if they were a single variable. So, for example, if you need to move 100 variables, you can usually code a single statement to perform the move from one field string to another, instead of coding 100 assignment statements for individual variables.

Moving a single field string is also more efficient than 100 move statements, so your program runs faster. You will see in the coming chapters that many statements can use a field string as an operand. If you can use field strings, you can take advantage of them, and they will save you a lot of coding and debugging time.

Popularity: 8% [?]

What is Field String

Monday, June 30th, 2008

A field string is a type of variable, and is the equivalent of a structure in the DDIC but is defined within an ABAP/4 program. Like a structure, a field string is a series of fields grouped together under a common name. The difference lies mainly in where the definition resides. The term structure in R/3 applies only to a Data Dictionary object containing a collection of fields. The term field string applies to a collection of fields defined in an ABAP/4 program.

Two statements are usually used to define field strings in an ABAP/4 program:

  • data
  • tables

Using the DATA Statement to Define a Field String

A field string defined using the data statement is a modifiable data object. It can have global or local visibility. Syntax for Defining a Field String Using the DATA Statement (more…)

Popularity: 7% [?]