Showing posts with label Syntax Check. Show all posts
Showing posts with label Syntax Check. Show all posts

SAP Full Form and Meaning of SPLIT Keyword in ABAP

SAP has its own importance and here in this post we are going to talk about the full form of sap and its meaning and how the keyword SPLIT is used in ABAP programming.

Variants

1. SPLIT f AT g INTO h1 ... hn.
2. SPLIT f AT g INTO TABLE itab.

Variant 1

SPLIT f AT g INTO h1 ... hn.

Effect

Splits the contents of the f according to the delimiter g and places them in the fields h1 to hn ( n >= 2).g is used in its defined length. The return code value is set as follows:

SY-SUBRC = 0 All hi fields (1 <= i <= n ) were big enough.
SY_SUBRC = 4 One of the hi fields was not big enough and had to be truncated.

DATA: NAMES(30) VALUE 'Charly, John, Peter',
ONE(10),
TWO(10),
DELIMITER(2) VALUE ','.
SPLIT NAMES AT DELIMITER INTO ONE TWO.

Now, ONE has the value "Charly" and TWO has the value "John, Pete" .
SY-SUBRC is set to 4, since TWO was not big enough to include "John, Peter" .
DATA: NAMES2(30) VALUE 'Charly, John, Peter', THREE(10) VALUE 'New York',
FOUR(10),
FIVE(10),
SIX(10) VALUE 'SAP'.
SPLIT NAMES2 AT ',' INTO THREE FOUR FIVE SIX.
IF THREE = 'Charly' AND
FOUR = ' John' AND
FIVE = ' Peter' AND
SIX = SPACE.
WRITE 'SPLIT is OK'.
ENDIF.

Outputs "SPLIT is OK" .

Unless the number of target fields is greater than the number of delimiters in the source field, very little information ought to be lost. Therefore, the last target field in this case contains the "rest", including the delimiters .

If the source field does not contain the separator sequence at all, it is copied incomplete to the first
target field.

Variant 2

SPLIT f AT g INTO TABLE itab.

Effect

Like variant 1.

Stores the components of f in the internal table itab . For each part of f , a "special" table line is created. f is considered without trailing blanks.

Example

DATA: BEGIN OF ITAB OCCURS 10,
WORD(20),
END OF ITAB.
SPLIT 'STOP Two STOP Three STOP ' AT 'STOP' INTO
TABLE ITAB.

Now, ITAB has three lines. The first line is blank, the second contains 'Two' and the third contains 'Three' .

Performance

The runtime required for the SPLIT command in the first example for variant 1 is about 15 msn (standardized microseconds). If the sub-fields of f are written to an internal table, about 30 msn are needed.

Related Posts:




SAP definition,full form,over veiw and introduction

SAP Full form of planning and distribution of goods
SAP full form for mrp,sales and materiel planning
What is SAP and Why do we are in need of It
sap full form,meaning and history of SAP

SAP full form syntax for SET

ABAP Reports Syntax for Select Options

Here in this post we are going to have a look at the abap programming language syntax for a key word select optoins.Basic form for this key word is SELECT-OPTIONS sel FOR f.

Effect

Declares a variable selection option. This statement only makes sense in reports, i.e. in programs defined as type 1 in the attributes. You can execute reports with the SUBMIT statement. The statements SELECTOPTIONS and PARAMETERS determine the technical interface and the user interface. The parameters and selection options you specify are displayed on the selection screen for the user to enter values

sel must be 1 - 8 characters long.

This statement defines an internal table sel with a fixed structure which consists of the fields sel-SIGN , sel-OPTION , sel-LOW and sel-HIGH . · A report can be assigned to a logical database ldb . This means that both the logical database ldb and the report can define selection options and parameters. You define the database-specific selection options in an ABAP/4 include program DBldbSEL . The system then imports this include program into the actual logical database access program SAPDBldb and into the report. As a result, the database-specific selection options relevant to the report are available both to the database program SAPDBldb and to the report. The 'report-specific' selection options are known only in the report Some SELECT-OPTIONS additions are allowed only in DBldbSEL . The addition 'NO DATABASE SELECTION' can only be used in the report.

· Each line of the internal table sel formulates a condition. If you require precise details about how to formulate these conditions, see the section on the IN operator under Logical expressions .

If the user enters a value set on the selection screen, the internal table sel is automatically filled.
You can use normal ABAP/4 statements to read and manipulate the internal table sel .

The values you enter for the database-specific selection options are passed directly to the database for data selection . This also applies to report-specific SELECT-OPTIONS that refer to a field in a logical database table defined for dynamic selections .You must check report-specific selections that refer to other fields with the CHECK statement . This process is therefore not as efficient as the process described above.

· Under "Text elements/selection texts", you should enter a description for each selection criterion sel . This description is displayed on the selection screen. If no such text exists, the name sel of the selection option is displayed instead.

· The LOW and HIGH fields of a selection option are displayed in a length up to 18 bytes long (scrollable up to 45 bytes). If you define a length longer than 45, fields are truncated on the selection screen after the 45th character. This affects the first line of the SELECT-OPTIONS table. You can, however, pass longer selection options to a report if they are specified with the addition NO-DISPLAY and thus do not appear on the selection screen. Without NO-DISPLAY , the fields are then truncated whenever the selection screen is processed in the background .

Field attributes on the selection screen.The input/output fields displayed on the selection screen for entry of upper and lower limits have the same attributes for type, length or conversion exits as the field f specified after FOR . If f is a Dictionary field, the selection screen is regenerated automatically after most changes to its attributes. The attributes 'Check table' and 'Fixed values' are exceptions to this rule. If these are changed, you have to generate the program in the ABAP/4 Editor. This also generates the selection screen.

Addition 1

... DEFAULT g

Effect

Proposes the single value g as the default selection when the report is called.


· For each SELECT-OPTION , you can only specify one DEFAULT .
· You must specify the default value g in its internal format, e.g. " SELECT-OPTIONS DATE FOR SYDATUM DEFAULT '19931224' ", not " ... DEFAULT '24.12.1993' ".
· The default value g should normally be a literal because, at runtime, it is transferred to the selection options table sel so early that no value can be assigned to the field g . System fields are an exception here because the system usually assigns values to them as soon as the report processing starts.

· On the "Multiple Selection" screen, you can also enter ranges for selection options with " NO INTERVALS ".

· By combining this addition with " NO-EXTENSION ", you can restrict the user to entry of a single value for the selection option, but with the possibility of also choosing single value options like 'Greater than' or 'Less than or equal'.

Addition

... NO DATABASE SELECTION

Effect

This addition is allowed only for report-specific SELECTOPTIONS which refer to a field f belonging to a table dbtab of the logical database. Here, the selections entered by the user are not passed directly to the logical database unless the logical database supports dynamic selections for dbtab if dynamic selections for dbtab are not supported, the addition has no effect.
This addition can be useful if you only want the selections entered by the user for this SELECT-OPTION to be effective under certain conditions. However, you should be careful when using it: Since the selections have to be checked with CHECK after the records have been read, this has a
considerable effect on performance.

ABAP Programming Report for Stock Requirement List
programming report on produciton order for abap

sap programming syntax for select options in abap

abap programming use the word select options in its keyword usage to get the required output as shown below.

Effect

Declares a variable selection option.

This statement only makes sense in reports, i.e. in programs defined as type 1 in the attributes. You can execute reports with the SUBMIT statement. The statements SELECTOPTIONS and PARAMETERS determine the technical interface and the user interface. The parameters and selection options you specify are displayed on the selection screen for the user to enter values (see also the addition NO-DISPLAY or SUBMIT without the addition VIA SELECTION-SCREEN .

sel must be 1 - 8 characters long.

· This statement defines an internal table sel with a fixed structure which consists of the fields sel-SIGN , sel-OPTION , sel-LOW and sel-HIGH .
· A report can (by means of an entry in the attributes) be assigned to a logical database ldb . This means that both the logical database ldb and the report can define selection options (and parameters). You define the (database-specific) selection options in an ABAP/4 include program DBldbSEL (in logical database maintenance). The system then imports this include program into the actual logical database access program SAPDBldb and (partially) into the report. As a result, the database-specific selection options (and parameters) relevant to the report are available both to the database program SAPDBldb and to the report.

The 'report-specific' selection options are known only in the report (not in SAPDBldb ). Some SELECT-OPTIONS additions are allowed only in DBldbSEL . The addition 'NO DATABASE SELECTION' can only be used in the report.

· Each line of the internal table sel formulates a condition. If you require precise details about how to formulate these conditions, see the section on the IN operator under Logical expressions .
· If the user enters a value set on the selection screen, the internal table sel is automatically filled.

You can use normal ABAP/4 statements to read and manipulate the internal table sel .

· The values you enter for the database-specific selection options are passed directly to the database for data selection (i.e. no unwanted records are read). This also applies to report-specific SELECT-OPTIONS that refer to a field in a logical database table defined for dynamic selections (see also the addition " NO DATABASE SELECTION ").

You must check report-specific selections that refer to other fields with the CHECK statement (i.e. unwanted records must first be read from the database and discarded afterwards). This process is therefore not as efficient as the process described above.

· Under "Text elements/selection texts", you should enter a description for each selection criterion sel . This description is displayed on the selection screen. If no such text exists, the name sel of the selection option is displayed instead.

· The LOW and HIGH fields of a selection option are displayed in a length up to 18 bytes long (scrollable up to 45 bytes). If you define a length longer than 45, fields are truncated on the selection screen after the 45th character. This affects the first line of the SELECT-OPTIONS table. You can, however, pass longer selection options to a report if they are specified with the addition NO-DISPLAY and thus do not appear on the selection screen. Without NO-DISPLAY , the fields are then truncated whenever the selection screen is processed in the background (SUBMIT without VIA SELECTION-SCREEN ).

Example

SELECT-OPTIONS PROGRAM FOR SY-REPID.

&ABAP-EFFECT& Suppose you create an internal table

PROGRAM with the header line fields PROGRAM-SIGN ,

PROGRAM-OPTION , PROGRAM-LOW and PROGRAM-HIGH .

PROGRAM-LOW and PROGRAM-HIGH have the same field attributes as SY-REPID . When the report is executed, a line on the selection screen contains the text 'PROGRAM' or the associated selection text as well as input fields for PROGRAMLOW and PROGRAM-HIGH . At the end of the line, there is a pushbutton with an arrow. When you press this button, you branch to the 'Complex Selections' screen where you can enter more selection lines for sel . Here, you can formulate very complicated selection conditions. For further information about how these entries determine the result set, see Logical expressions or select Utilities -> Help sel. screen on the 'Complex Selections' screen.

· Field attributes on the selection screen. The input/output fields displayed on the selection screen for entry of upper and lower limits have the same attributes for type, length or conversion exits as the field f specified after FOR .

Related Posts:

SAP ABAP HR report for EEOC
ABAP Programming hr new hire report
SAP ABAP HR PAYROLL REPORT
ABAP HR head count report for sap
SAP ABAP FICO REPORT FOR GROUP CURRENCY RECONCILIATION
fico reconcilation report for company code currency report
SAP ABAP FICO report about profitability analysis
SAP ABAP fico report profitability analysis report
My sapcrm customers and consumer segmentation
Organizational challenges in crm and mysap solutions
Business View and Mysap.com
What is SAP R/3 introduction to mysap.com
SAP FICO cross company code reconciliation report
sap sales and distribution back orders report in abap

sales in erp programming invoice reportabap syntax for search and select

abap programming syntax for Select

Abap programming has some keywords and select is one of the important one among them.Here is the syntax check for that.

Basic form

ELECT result [target] FROM source [where] [GROUP BY fields] [ORDER BY order].

Effect

Retrieves an extract and/or a set of data from a database table or view (see Relational database ). SELECT belongs to the OPEN SQL command set.

Each SELECT command consists of a series of clauses specifying different tasks:

The SELECT result clause specifies

· whether the result of the selection is a table or a single record,
· which columns the result is meant to have and
· whether the result is allowed to include identical lines.

The INTO target clause specifies the target area into which the selected data is to be read. If the target area is an internal table, the INTO clause specifies
· whether the selected data is to overwrite the contents of the internal table or
· whether the selected data is to be appended to the contents and
· whether the selected data is to be placed in the internal table all at once or in several packets.
The INTO clause can also follow the FROM clause.

You can omit the INTO clause. The system then makes the data available in the table work area (see TABLES ) dbtab . If the SELECT clause includes a "*", the command is processed like the identical SELECT * INTO dbtab FROM dbtab statement. If the SELECT clause contains a list a1 ... an , the command is executed like SELECT a1 ... an INTO CORRESPONDING FIELDS OF dbtab FROM dbtab .

If the result of the selection is meant to be a table, the data is usually (for further information, see INTO -Klausel ) read line by line within a processing loop introduced by SELECT and concluded by ENDSELECT . For each line read, the processing passes through the loop once. If the result of the selection is meant to be a single record, the closing ENDSELECT is omitted.

The FROM source clause the source (database table or view ) from which the data is to be selected. It also determines

· the type of client handling,
· the behavior for buffered tables and
· the maximum number of lines to be read.

The WHERE where clause specifies the conditions which the result of the selection must satisfy. It thus determines the lines of the result table. Normally - i.e. unless a client field is specified in the WHERE clause - only data of the current client is selected. If you want to select across other clients, the FROM clause must include the addition ... CLIENT SPECIFIED
. The GROUP-BY fields clause combines groups of lines together into single lines. A group is a set of lines which contain the same value for every database field in the GROUP BY clause.
The ORDER-BY order clause stipulates how the lines of the result table are to be ordered. Each time the SELECT statement is executed, the system field SY-DBCNT contains the number of lines read so far. After ENDSELECT , SY-DBCNT contains the total number of lines read.

Related Posts:

SAP ABAP HR report for EEOC
ABAP Programming hr new hire report
SAP ABAP HR PAYROLL REPORT
ABAP HR head count report for sap
SAP ABAP FICO REPORT FOR GROUP CURRENCY RECONCILIATION
fico reconcilation report for company code currency report
SAP ABAP FICO report about profitability analysis
SAP ABAP fico report profitability analysis report
My sapcrm customers and consumer segmentation
Organizational challenges in crm and mysap solutions
Business View and Mysap.com
What is SAP R/3 introduction to mysap.com
SAP FICO cross company code reconciliation report
sap sales and distribution back orders report in abap

sales in erp programming invoice report

ABAP Programming Syntax for Scan keyword

ABAP programming language has some keywords and scan is one among them.The syntax for this programming word is as shown below.

Basic form

SCAN ABAP-SOURCE itab1 TOKENS INTO itab2
STATEMENTS INTO itab3.

Effect

Breaks down the ABAP/4 source code in the source code table itab1 into tokens according to the rules of the ABAP/4 scanner. The tokens are written - one per line - to the token table itab2 . The token table itab2 must have the structure STOKEN . (If you specify the addition WITH ANALYSIS , the token table must have the extended structure STOKEX .)

Normally, comments are filtered out and subordinate source code units (included programs, called macros) are ignored. If you want to include these items, use the additions WITH COMMENTS and WITH ANALYSIS .

In addition to classifying the source code by token, the scanner organizes the tokens themselves into statements - using the colon-comma logic to form chain records - and the statement table itab3 contains a statement description on each line. Here, a three-part chain record "a: b, c1 c2, d." results in three entries "a b,", "a c1 c2," and "a d." in the statement table itab3 .

The statement table itab3 must have the structure SSTMNT . The statement classification characters colon, comma and period are not written to the token table itab2 . Instead, the table itab3 contains details about the position of a colon or the type (comma or period and position of the end marker in the statement description.

The return code value is set as follows:
SY-SUBRC = 0 Source code table is not empty, contains no errors and is broken down into tokens.

SY-SUBRC = 1 Source code table is not empty and is broken down into tokens, but at least one include program does not exist (can occur only in connection with the addition WITH INCLUDES ).
SY-SUBRC = 2 Source code table itab1 is empty or a blank line range was selected (applies to the additions FROM and TO ).

SY_SUBRC = 4 Scanner detects error in source code. \
SY-SUBRC = 8 Other error or RABAX in scanner.

The fields of the structure STOKEN , and thus the columns of the token table itab2 , have the following meaning:

TYPE Type of token with possible values:
I (Identifier)
S (String, i.e. character literal)
L (List, enclosed in parentheses)
C (Comment)
ROW Number of line where token occurs or where it begins (>= 1)
COL Offset of first character of token relative to start of line (>= 0)
LEN Length of token STR Character string forming the token (or just first part) OVFL Overflow flag for field STR with the following possible values:

SPACE (no overflow, token fits completely in field STR )
X (overflow, either not resolved (no overflow are specified) or token fits in overflow area c1 ))
O (overflow of token and overflow of overflow area c1 )
OFF1 Offset in overflow area, if token does not fit completely in field STR and an overlfow area c1 is specified and token fits completely in overflow area c1 .

The fields of the structure SSTMNT , and thus the columns of the statement table itab3 , have the following meaning:
TYPE Type of statement with the following possible values:
E (Native SQL statement between EXEC SQL and
ENDEXEC )
I ( INCLUDE prog )
J ( INCLUDE prog , prog does not exist, can occur only in connection with the addition WITH INCLUDES )
R (Call a macro from table TRMAC )
D (Call an internally defined macro with DEFINE )
M (Macro definition between DEFINE and END-OF-DEFINITION )
C ( COMPUTE statement, sometimes without COMPUTE as first token)
K (Other ABAP/4 key word)
N (Blank statement)
U (Unknown, non-blank statement)
LEVEL Index of source code unit in the level table itab5 (>= 1, if level table specified, otherwise 0)

FROM Index of first token of statement in the token table itab2
TO Index of last token of statement in the token table itab2 (the end marker of the statement - comma or period - counts as no more then a token)

NUMBER Statement counter in a source code unit. Covers all statements, regardless of how many are actually selected - in cases where a key word table itab4 is specified PREFIXLEN Number of tokens before the colon (with chain statements >= 1, otherwise 0)

When expanding macro calls, no position specifications are available. The relevant fields in the token table itab2 and in the statement table itab3 are then set to 0. Unlike the usual syntax check, the following are not treated as errors:

· Comma without preceding colon (the comma then acts as an end marker),
· Open chain statement sequence at end of source code,
i.e. the last statement is closed by a comma, not by a period,
· Open statement at end of source code, i.e. the last statement is closed neither by a period nor by a comma.
To be able to analyze errors without modifying programs, use the additions INCLUDE , MESSAGE , WORD , LINE and OFFSET .

These provide information about the errors which have occurred.

Related Posts:

ABAP HR head count report for sap
SAP ABAP FICO REPORT FOR GROUP CURRENCY RECONCILIATION
fico reconcilation report for company code currency report
SAP ABAP FICO report about profitability analysis
SAP ABAP fico report profitability analysis report
My sapcrm customers and consumer segmentation
Organizational challenges in crm and mysap solutions
Business View and Mysap.com
What is SAP R/3 introduction to mysap.comSyntax for report key word for sap abap

SAP ABAP Syntax for Report in Programming

Report is the key word used in sap abap programming and here we are going to learn about the way it is used in writing the code for programming this abap language.

Effect

Introduces the report. You can choose any name you like up to 8 characters long.

Example

REPORT ZREPNAME.

Only standard SAP reports should begin with 'R'.

Addition 1

... NO STANDARD PAGE HEADING

Effect

Suppresses output of the standard page header (see NEWPAGE ).

Addition 2

... LINE-SIZE col

Effect

Creates a report with col columns per line. The maximum line length permitted is 255 characters.

If the LINE-SIZE specification is missing, the line length corresponds to the current screen width. The system field SYLINSZ contains the current line size for generating reports (see NEW-PAGE ... LINE-SIZE ).

The specified LINE-SIZE must not appear in quotation marks.

· If the you want the report list (i.e. the output) to be printable, do not define a LINE-SIZE with a value greater than 132 because most printers cannot handle wider lists.

Example

REPORT ZREPNAME LINE-SIZE 132.

Addition 3

... LINE-COUNT lin(n)

Effect

Creates a report with lin lines per page, of which n lines are reserved for the END-OF-PAGE processing. If you omit the " (n) ", the default value 0 applies. The system field SY-LINCT contains the current number of lines per page for generating reports.

If the LINE-COUNT specification is missing, the number of lines per page is calculated dynamically from the number of lines actually output on this page. Here, a page break no longer occurs automatically, but must be specified explicitly with NEW-PAGE , and the system field SY-LINCT is set to 0. (NEW-PAGE ... LINE-COUNT )

The LINE-COUNT must not be enclosed in quotation marks.

Further information about using LINE-COUNT .

Examples

REPORT ZREPNAME LINE-COUNT 65.

The page has 65 lines.

REPORT ZREPNAME LINE-COUNT 65(8).

The page has 65 lines, of which the last 8 are only defined by
END-OF-PAGE .

Addition 4

... MESSAGE-ID xx

Effect

Takes the messages output by MESSAGE under the specified 2- character ID xx from table T100 .

Example

REPORT RSTEST00 MESSAGE-ID SY.

Addition 5

... DEFINING DATABASE ...

Effect

All the database programs must specify in the REPORT statement the three-character name of the logical database to which they belong.

This addition is generated automatically (in the REPORT statement) when you create a logical database by selecting Utilities -> Development/test -> Logical databases .

This ID must not be enclosed in quotation marks.

Example

REPORT SAPDBKDF DEFINING DATABASE KDF.

The previous post deals with sap abap syntax of refresh .

Related Posts:

My sapcrm customers and consumer segmentation
Organizational challenges in crm and mysap solutions
Business View and Mysap.com
What is SAP R/3 introduction to mysap.comFICO sap abap reporting

SAP ABAP Syntax for Refresh mysap programming

Refresh is the key word used in sap abap programming to get the fresh and modified data from mysap server. The previous programming sap abap key word is regarding recieve.

Basic form

REFRESH CONTROL ctrl FROM SCREEN scr.

Effect

Initializes the control ctrl defined by a CONTROLS statement according to its description in the screen scr . The screen scr does not have to match the initial screen for the control .

REFRESH - Delete an internal table

Variants

1. REFRESH itab.
2. REFRESH itab FROM TABLE dbtab.
3. REFRESH itab FROM SELECT-OPTIONS.

Variant 1

REFRESH itab.

Effect

The internal table itab is reset to its initial state, i.e. all table entries are deleted.
The return code value SY-SUBRC is undefined.

· The header entry of a table with a header line remains unchanged. It can be reset to its initial value using CLEAR .

· FREE itab can be used to free up the memory allocated to the table.

Variant 2

REFRESH itab FROM TABLE dbtab.

This variant is no longer maintained and should no longer be used (. Please use the SELECT ... INTO TABLE statement instead.

Effect

The internal table itab is deleted and it is then filled with the contents of the database table dbtab .

A generic argument can be used to specify a restriction to a particular part of the database table when filling (LOOP AT dbtab , READ TABLE dbtab ).

The table dbtab must be declared in the program using TABLES.

The return code value SY-SUBRC is undefined.

Example

Deleting an internal table MESSAGES , followed by filling the table with all messages from the table T100 with language key 'D' and ID 'RF' .

TABLES T100.
DATA BEGIN OF MESSAGES OCCURS 200.
INCLUDE STRUCTURE T100.
DATA END OF MESSAGES.
MESSAGES-TEXT = 'Delete me'.
APPEND MESSAGES.
T100-SPRSL = 'D'.
T100-ARBGB = 'RF'.
REFRESH MESSAGES FROM TABLE T100.
Variant 3
REFRESH itab FROM SELECT-OPTIONS.

This variant is no longer supported . The equivalent functionality is now available in the function module
RS_REFRESH_FROM_SELECTOPTIONS .

Effect

Deletes the internal table itab and then transfers the database selections and the selection parameters together with the values entered by the user.

Performance

The runtime for the execution of the REFRESH statement is around 5 ms (standard microseconds).

REFRESH - Refresh the SAPGUI interface

Basic form

REFRESH SCREEN.

This statement is no longer maintained and should therefore not be used.Instead, please use a SET USER-COMMAND f statement.

Effect

Refreshes the SAPGUI interface after receiving the results of the asynchronous Remote Function Call via RECEIVE RESULTS FROM FUNCTION func .

This form of the REFRESH statement simulates pressing the return key.

Using this variant only makes sense in connection with the asynchronous Remote Function Call (CALL FUNCTION func ...STARTING NEW TASK taskname ) after receiving the results of such a call within the FORM routine (RECEIVE RESULTS FROM FUNCTION func ). It has no effect in other environments.

It ensures that the last screen is processed again with the commad '%_RS'. You can see this value in the command<0> field in the top left corner of the current screen.

REFRESH

Delete an internal table

- REFRESH itab.

- REFRESH itab FROM TABLE dbtab.

- REFRESH itab FROM SELECT-OPTIONS.

Refresh the SAPGUI interface

- REFRESH SCREEN.

Initialize a control

- REFRESH CONTROL ctrl FROM SCREEN scr.

129

Related Posts:

Business View and Mysap.com
ERP software selection
ERP implementation process and advantages SAP FINANCE cost center summery
MYsap crm business scenarios and sap solutions
MySAP CRM and customer relationship management
Customer Relationship Management and mysap an introduction
What is SAP R/3 introduction to mysap.comFICO sap abap reporting

SAP ABAP Syntax for Receive Keyword

Receive is the keyword used in abap programming of sap erp and its syntax is explained Below.The previous post deals with read keyword of sap abap.

Basic form

REPLACE f WITH g INTO h.

Addition

... LENGTH len (length specification for field f )

Effect

Replaces the first occurrence of the contents of field f in field h with the contents of field g . All fields are handled in their defined length; this means that closing blanks are not ignored.

The return code value indicates whether the string f was

found in h and replaced by g :

SY-SUBRC = 0 String replaced.
SY_SUBRC =Justify Full 4 String not replaced.

Example

DATA FIELD(10).
MOVE 'ABCB' TO FIELD.
REPLACE 'B' WITH 'string' INTO FIELD.

returns:

FIELD = 'AstringCB', SY-SUBRC = 0

The fields f and g in the REPLACE statement should not overlap. Otherwise, the result is undefined.

Addition

... LENGTH len ... (length specification for field f )

Effect

Searches for the string f in the field h not in its (full) field length, but in the length len .

Example

DATA: PATTERN(5) VALUE 'ABC',
LEN TYPE I,
REPL_STRING(5) VALUE '12345',
FIELD(12) VALUE 'abcdeABCDE'.
REPLACE PATTERN WITH REPL_STRING
INTO FIELD.

does not change FIELD , since 'ABC ' does not occur in abcdeABCDE ' .

LEN = STRLEN( PATTERN ).
REPLACE PATTERN LENGTH LEN
WITH REPL_STRING
INTO FIELD.

Related Posts:

SAP R/3 Introduction to best ERP Mysap
Challenges in implementing ERP
ERP implementation practices
Enterprise resource planning introduction
ERP software selection
ERP implementation process and advantages SAP FINANCE cost center summery
MYsap crm business scenarios and sap solutions
MySAP CRM and customer relationship management
Customer Relationship Management and mysap an introduction
CRM Management and sales and service strategy of mysap crm
MySAP CRM and customer as business partner
How Customer Relationship management makes company Leader
CRM Uses and how to get best results with CRM
CRM software solutions and mysap advantage
SAP FICO internal order summery report
Credit Score Chart

ABAP Syntax for Read in SAP Programming

ABAP programming is used for SAP is used to extract data from R/3 data base and here we are going to learn about syntax of key word READ. Our previous discussion is regarding sap syntax for provide.





READ Determine calendar information


The READ CALENDAR statement exists only in the R/2 System.
In the R/3 System, the following function modules are substituted:

· DATE_COMPUTE_DAY : Returns the day for a date
· DATE_CONVERT_TO_FACTORYDATE : Returns the factory calendar date for a date
· DATE_GET_WEEK : Returns the week in which a date occurs
· EASTER_GET_DATE : Returns the Easter dates for a year
· FACTORYDATE_CONVERT_TO_DATE : Returns the date for a factory calendar date
· HOLIDAY_CHECK_AND_GET_INFO : Checks whether a date is a public holiday and, if necessary, returns information
· WEEK_GET_FIRST_DAY : Returns the first day of a week

READ - Read a file

Basic form

READ DATASET dsn INTO f.

Addition

... LENGTH len

Effect

Reads a record from the sequential file specified in dsn (a field or a literal) and stores it in the field f (usually a field string).

· Binary mode (addition IN BINARY MODE in the OPEN DATASET statement:
Read from file in length of field f .

· Text mode (addition IN TEXT MODE in the OPEN statement):

Read a line.

If the specified file is not open, READ DATASET attempts to open the file dsn ( IN BINARY MODE FOR INPUT or with the specifications of the last OPEN command for this file). Any errors result in the termination of the program.

To read all the records in a file, you are recommended to place READ DATASET in a DO loop that you leave with EXIT .

The return code value is set as follows:

SY-SUBRC = 0 Record read from file.
SY_SUBRC = 4 End of file reached.

Example

Define the field string REC :
DATA: BEGIN OF REC,
TEXT(30),
NUMBER TYPE I,
END OF REC.

Read the file "/usr/test":

DO.
READ DATASET '/usr/test' INTO REC.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
WRITE: / REC-TEXT, REC-NUMBER.
ENDDO.

You can use TRANSFER to output records to a sequential dataset.

· The format of file names depends largely on the operating system. You can access portable programs by using the function module FILE_GET_NAME which returns the physical name for a given logical file name.

Related Posts:

COST CENTER of SAP Actual line items
SAP Finance General Ledger report account balance
Finance general ledger line items SAP ABAP report
General ledger report SAP FINACNE
SAP FICO customer open items report
Customer balance in local currency for SAP FICO
Vendor open items report
SAP Finance abap report for Vendor balance in local currency

SAP Programming Syntax for Provide in ABAP

The sap programming language ABAP syntax for provide is discussed here in detail and we have done about print control in the previous post.

Basic form

PROVIDE f1 f2 ... FROM itab1
g1 g2 ... FROM itab2
...
* FROM itabi
...
BETWEEN f AND g.

Effect

Retrieves the contents of the specified fields from the internal tables ( itab1 , itab2 , ...) and places them in the table header lines within the required range. Also executes the processing block enclosed by the PROVIDE and ENDPROVIDE statements for each range.

For itab1 , itab2 ... only tables with header lines are allowed.

Basic principle:

The diagram below illustrates the functionality of the PROVIDE statement for the most simple case where just two tables A and B are to be processed:

IA1 IA2
|-----------| |--------------| table A
: : : :
: IB1 : IB2 : :
: |-----------| |-------------| : table B
: : : : : : : :
: : PROVIDE area : : :
...|----------------------------------------|...
: : : : : : : :
:TI1: TI2 :TI3: : TI4 : TI5 : TI6 :
...|---|-------|---| |-------|-----|-----|...

result ranges

The data structures which form the basis for the table lines must each contain two components which can be interpreted as a range (e.g. start date and end date). In the diagram, the ranges belonging to the entries in table A are marked with IA1 or IA2 , and those in table B with IB1 or IB2 .

If you split the ranges of both tables into overlapping and non-overlapping ranges and then form the union set with the PROVIDE area, this results in 6 sub-ranges TI1 to TI6 . In these sub-ranges, the values of the tables A and B are constant. The PROVIDE1 statement makes the contents of the tables A and B available for the 6 sub-ranges, one after the other. It thus acts as a kind of loop where the data of the tables involved can be processed1 with reference to each range.

Effect

General principle

Each of the specified internal tables has two fields which contain the line-related validity range. You can determine these in the DATA statement with the addition " VALID BETWEEN ... AND ...

". If this addition is not used, sub-fields of the table determine these range fields (e.g. VALID BETWEEN first field AND second field). These fields can be date fields, time fields or even number fields. Both these two fields and also f and g should be the same type.

PROVIDE splits the range f to g into sub-ranges so that each of the fields ( f1 , f2 , ...) specified for each table is constant in this range and so that each sub-range is as large as possible (range limits are considered part of the range).

Each time the processing passes through the loop, the current range limits and the specified sub-fields are placed in the header lines of the internal tables. If you want to make all subfields available, enter '*' instead of the field list. The unspecified sub-fields are set to their initial value (CLEAR ).

It is a requirement that the ranges within a table are in ascending order and not overlapping. However, there can be gaps between one upper range limit and the next lower range limit. For each table itab1 , itab2 ... , the automatically generated fields itab1_VALID , itab2_VALID , ... indicate (with 'X' oder Leerzeichen ' ' ) whether a suitable entry was found for the current sub-range.

sap edi with out message control
sap edi outbound process with message control for purchase introduction
And part two of edi outbound with message control for Purchase order
Cost center report for open line items of SAP
ERP Introduction

SAP programming Syntax Print Control ABAP

Syntax check for perform in sap programming is the previous topic of ABAP and now we are going to discuss deal with print control syntax of sap.

Effect

Determines the desired print format for the subsequent characters, starting from the current output position.

You define the output position either implicitly:

· Line 1/column 1 before the first WRITE output on the current page.

· Line and column of the next field output with WRITE .

or explicitly:

· Line 1/column 1 using NEW-PAGE ,
· Line n/column 1 using SKIP TO LINE n

· Line */column m using POSITION n (* = current output line).

With output to the screen or when printing screen output, the statement has no effect.

Variant 2

PRINT-CONTROL INDEX-LINE f.

Effect

Ouputs the contents of the field f as an index line in the current print output. An index line usually contains only administration information for archiving and is not output when printing. If no print mode is active, the statement has no effect. If the WRITE statement has already begun a print line, the index line is output after this line.

Example

DATA: INDEX_LINE(200).
PRINT-CONTROL INDEX-LINE INDEX_LINE.

Related Posts

Challenges in implementing ERP

ERP implementation practices
Enterprise resource planning introduction
Enterprise resource planing implementation process and its advantages
These are the following recent posts about fico reports of sap abap from this blog.

SAP Finance General Ledger report account balance
Finance general ledger line items SAP ABAP report
General ledger report SAP FINACNE
SAP FICO customer open items report
Customer balance in local currency for SAP FICO
Vendor open items report
SAP Finance abap report for Vendor balance in local currency
Customer relationship management introduction

SAP Programming syntax Perform code

We are discussing regarding SAP programming language ABAP and its syntax for perform and it is the continuation of it.

Variant 5

PERFORM n ON COMMIT

Addition

1. ... LEVEL level

Effect

Executes the specified subroutine when a COMMIT WORK occurs. This allows you to execute a subroutine only if the logical transaction has ended successfully. The subroutine is not executed until the key word COMMIT WORK is called. FORMs specified several times are executed only once on COMMIT WORK (see COMMIT WORK ). If you call ROLLBACK WORK , you delete all the specified routines.

With PERFORM ... ON COMMIT , you cannot transfer any data with USING/CHANGING . To do this, you must either store the data in global variables or store it temporarily with EXPORT ... TO MEMORY .

Addition 1

... LEVEL level

Effect

The addition LEVEL , followed by a field, defines the order in which the subroutines are executed after COMMIT WORK .

They are called in ascending order of level. If there is no addition LEVEL , the subroutine always has the level zero. If the level is the same, the order of calls determines the order of execution. Level assignment occurs during development, e.g. by defining constants in an include program. The level must be of type I.


ABAP TOPIC WISE COMPLETE COURSE

BDC
OOPS ABAP
ALE
IDOC'S
BADI
BAPI
Syntax Check
Interview Questions
ALV Reports with sample code
ABAP complete course
ABAP Dictionary
SAP Scripts
Script Controls
Smart Forms
Work Flow
Work Flow MM
Work Flow SD
Communication Interface

You may be also interested in the following SAP Finance reports.

SAP Finance General Ledger report account balance
Finance general ledger line items SAP ABAP report
General ledger report SAP FINACNE
SAP FICO customer open items report
Customer balance in local currency for SAP FICO
Vendor open items report
SAP Finance abap report for Vendor balance in local currency
Customer relationship management introduction
Enterprise resource planning introduction

ABAP Syntax Code for Perform in SAP Programming

ABAP Code for programming SAP data retrieval has a key word perform and the previous post deals with syntax of perform and this is in continuation of that.

Variant 3

PERFORM form IN PROGRAM prog.

Additions

1. ... USING p1 p2 p3 ...
2. ... CHANGING p1 p2 p3 ...
3. ... TABLES itab1 itab2 ...
4. ... IF FOUND

Effect

Similar to variation 2 (external PERFORM ), except that here you can specify both the subroutine and the program dynamically (at runtime); in this case, you must enclose the variables form or prog in parentheses. If you omit specification of the program after IN PROGRAM , ABAP/4 searches for the routine in the current program.

Example

DATA: RNAME(30) VALUE 'WRITE_STATISTIC',

PNAME(8) VALUE 'ZYX_STAT'.

PERFORM WRITE_STATISTIC(ZYX_STAT).

PERFORM (RNAME) IN PROGRAM ZYX_STAT.

PERFORM WRITE_STATISTIC IN PROGRAM (PNAME).

PERFORM (RNAME) IN PROGRAM (PNAME).

All four of the above PERFORM statements have the same effect, i.e. they call the subroutine 'WRITE_STATISTIC' defined in the program 'ZYX_STAT' .

Addition 4

... IF FOUND

Effect

Calls the specified subroutine only if it already exists. Otherwise, the statement is ignored.

Variant 4

PERFORM n OF form1 form2 form3 ... .

Effect

Drives a subroutine specified by the index n from a list of subroutine names listed in the statement. At runtime, the variable n must contain a value between 1 (first name) and the total number of subroutines specified (last name). Up to 256 subroutine names are possible.

Runtime errors

· PERFORM_INDEX_0 : The index specified was too small.

· PERFORM_INDEX_NEGATIVE : The index specified was negative.

· PERFORM_INDEX_TOO_LARGE : The index specified was too large.

SAP Finance sample report for abap code and programming can be learned here.

ABAP TOPIC WISE COMPLETE COURSE

BDC
OOPS ABAP
ALE
IDOC'S
BADI
BAPI
Syntax Check
Interview Questions
ALV Reports with sample code
ABAP complete course
ABAP Dictionary
SAP Scripts
Script Controls
Smart Forms
Work Flow
Work Flow MM
Work Flow SD
Communication Interface

SAP ABAP Syntax for Perform

The sap abap syntax for perform has different variants an shown below.

Variant 1

PERFORM form.

Additions

1. ... USING p1 p2 p3 ...
2. ... CHANGING p1 p2 p3 ...
3. ... TABLES itab1 itab2 ...

Effect

Calls the subroutine form specified in the FORM statement. On completion, processing in the main program resumes.

Example

PERFORM HELP_ME.
...
FORM HELP_ME.
...
ENDFORM.

The PERFORM statement calls the subroutine HELP_ME .

Nested calls are allowed (i.e. PERFORM within a FORM ... ENDFORM ).Recursive calls are also possible.

To define local data, use the DATA statement after FORM . Each time you enter the subroutine, the data is recreated (with an initial value) and released at the end (from the stack).

To define global data used within a subroutine, use the LOCAL statement after FORM . The values are saved when you enter the subroutine and then released at the end (from the stack).

Runtime errors

· PERFORMANCE_PARAMETER_MISSING : The called form expects more parameters than were specified.

· PERFORM_PARAMETER_COUNT ,

· PERFORM_TOO_MANY_PARAMETERS : More parameters were given than the FORM expected.

· PERFORM_CONFLICT_TYPE ,

· PERFORM_CONFLICT_GENERIC_TYPE ,

· PERFORM_BASE_WRONG_ALIGNMENT ,

· PERFORM_PARAMETER_TOO_SHORT ,

· PERFORM_TABLE_REQUIRED : The parameter type does not match the type specified in the FORM definition.

· PERFORM_BASE_LITL : A literal was passed to a structured parameter.

Addition 1

... USING p1 p2 p3 ...

Addition 2

... CHANGING p1 p2 p3 ...

Effect

These additions are equivalent to each other.

Parameter offset and length can be passed as variables. The addition ' ...USING p1+off(*) ' causes parameter p1 to be passed with offset off so that the field limits of p1 are not exceeded.

Example

DATA: NUMBER_I TYPE I VALUE 5,
NUMBER_P TYPE P VALUE 4,
BEGIN OF PERSON,
NAME(10) VALUE 'Paul',
AGE TYPE I VALUE 28,
END OF PERSON,

ALPHA(10) VALUE 'abcdefghij'.
FIELD-SYMBOLS .
ASSIGN NUMBER_P TO .

PERFORM CHANGE USING 1
NUMBER_I
NUMBER_P
PERSON
ALPHA+NUMBER_I().

FORM CHANGE USING VALUE(PAR_1)
PAR_NUMBER_I
PAR_NUMBER_P
PAR_POINTER

PAR_PERSON STRUCTURE PERSON
PAR_PART_OF_ALPHA.
ADD PAR_1 TO PAR_NUMBER_I.
PAR_NUMBER_P = 0.
PAR_PERSON-NAME+4(1) = ALPHA.
PAR_PERSON-AGE = NUMBER_P + 25.
ADD NUMBER_I TO PAR_POINTER.

PAR_PART_OF_ALPHA = SPACE.
ENDFORM.

Field contents after the PERFORM call are as follows:

NUMBER_I = 6
NUMBER_P = 6
= 6
PERSON-NAME = 'Paula'
PERSON-AGE = 25
ALPHA = 'abcde j'

The field type and length of the parameters remain. If parameter values change within the subroutine, these new values remain after you leave the subroutine. However, this does not apply to parameters passed with VALUE (see FORM )

If you pass literals, you must either leave them unchanged or pass them in the FORM definition with the USING VALUE statement.

ABAP TOPIC WISE COMPLETE COURSE

BDC
OOPS ABAP
ALE
IDOC'S
BADI
BAPI
Syntax Check
Interview Questions
ALV Reports with sample code
ABAP complete course
ABAP Dictionary
SAP Scripts
Script Controls
Smart Forms
Work Flow
Work Flow MM
Work Flow SD
Communication Interface

SAP ABAP Syntax for Parameters part five

This post is in continuation with previous post about SAP ABAP syntax for parameters part four.

Addition 15

... VALUE-REQUEST

Effect

This addition is only allowed for database-specific parameters in the INCLUDE DBldbSEL . It permits self-programmed value help (for report-specific parameters, this is achieved by specifying the event key word AT SELECTION-SCREEN ON VALUE-REQUEST FOR ... ). The addition has the following effect:

On the selection screen, the parameter has a button for requesting possible entries. When the user presses this button or F4 , this starts the FORM routine p_VAL in the database access program SAPDBldb (if it exists). Then - even if the parameter with LIKE points to a Dictionary field - this FORM routine is processed rather than displaying the check table or the fixed values of the Dictionary field.

Example

* INCLUDE DBXYZSEL
...
PARAMETERS PL_TYPE LIKE SAPLANE-PLANETYPE VALUEREQUEST.
...
REPORT SAPDBXYZ DEFINING DATABASE XYZ.
...
TABLES SAPLANE.
...
FORM PL_TYPE_VAL.
...
CALL FUNCTION ...
...
ENDFORM.

Addition 16

... HELP-REQUEST

Effect

Like VALUE-REQUEST , this addition is only allowed for database-specific parameters in the INCLUDE DBldbSEL . It permits self-programmed value help (for report-specific parameters, this is achieved by specifying the event key word AT SELECTION-SCREEN ON VALUE-REQUEST FOR ... ). When the user presses F1 , this starts the FORM routine p_HLP in the database access program SAPDBldb (if it exists). Then -even if the parameter with LIKE points to a Dictionary field - this FORM routine is processed rather than displaying the data element documentation of the Dictionary field. You can also branch from the routine p_HLP to a function module which displays its own documentation.

Example

* INCLUDE DBXYZSEL
...
PARAMETERS PL_TYPE LIKE SAPLANE-PLANETYPE HELPREQUEST.
...
REPORT SAPDBXYZ DEFINING DATABASE XYZ.
...
TABLES SAPLANE.
...
FORM PL_TYPE_HLP.
...
CALL FUNCTION ...
...
ENDFORM.

ABAP TOPIC WISE COMPLETE COURSE

BDC
OOPS ABAP
ALE
IDOC'S
BADI
BAPI
Syntax Check
Interview Questions
ALV Reports with sample code
ABAP complete course
ABAP Dictionary
SAP Scripts
Script Controls
Smart Forms
Work Flow
Work Flow MM
Work Flow SD
Communication Interface

SAP ABAP Syntax for Parameters part Four

SAP ABAP Syntax for parameters were previously discussed in part one, two and three and the present post is in continuation with it.

Addition 13

... FOR TABLE dbtab

Effect

Assigns the database-specific parameter p to the table dbtab . This addition only makes sense in a logical database access program.

With database-specific parameters, you need this addition to ensure that the selection screen for a report contains only database-specific parameters which belong to a table from the currently active report.

Addition 14

... AS MATCHCODE STRUCTURE

Effect

Creates the database-specific parameter p as a field string according to the Dictionary structure MCPARAMS with the fields MCID (matchcode ID ) and STRING (search string ). Used for data selection through matchcode entry. On the selection screen, both sub-fields are displayed in a box with the text "Matchcode selection".

You can get a list of possible entries for the matchcode ID and the search string by pressing F4 . If you choose a matchcode ID and press F4 in the field "Search string", you see a dialog box where you can enter a search criterion for each field of the matchcode ID. The system interprets what you enter generically for each sub-field.

The addition AS MATCHCODE STRUCTURE only makes sense in a logical database access program and must therefore be used together with the addition FOR TABLE . It can also be combined with the addition MODIF ID , but not with any other additions. The matchcode object to which the matchcode ID and the search string refer is determined when you define the logical database.

Example

Input on the selection screen:

Matchcode ID: Customers Search string: Daniel

The effect of this is to select all customers whose names begin with "Daniel".

Performance

Matchcode selection can improve program performance considerably. This is because specifying a search string often describes the required set of data records more accurately than the key fields of the table. For example, it is easier to select by name ("Daniel") than by customer number ("000043010") and far fewer records are read from the database.

If a logical database (e.g. ldb ) contains a parameter p defined with AS MATCHCODE STRUCTURE , the system always creates an internal table ldb_MC which includes all the key fields of the selected records. The structure of ldb_MC is determined by the matchcode object and generated automatically. In the maintenance transaction for logical databases, the structure is displayed as a comment in the database program.

Example

Matchcode object for table T1 with key field T1-K1 . The table ldb_MC then has the following structure:

DATA: BEGIN OF ldb_MC OCCURS 100,
T1_K1 LIKE T1-K1,
END OF ldb_MC.

If the user has entered values in the matchcode parameter fields, the program reads the selected data from the matchcode table after START-OF-SELECTION and makes it available to the logical database program in the internal table ldb_MC . Then, the database program processes the records in the subroutine PUT_ldb_MATCHCODE and, with the help of PUT , triggers the appropriate GET events in the report. Subsequent processing is exactly the same as that for data selection direct from the database.


Example

FORM PUT_ldb_MATCHCODE.
SELECT * FROM T1
WHERE K1 = ldb_MC-T1_K1
FOR ALL ENTRIES IN ldb_MC.
PUT T1.
ENDSELECT.
ENDFORM.

In matchcode selection, the system flags all fields in the internal table MC_FIELDS which are filled with values by the matchcode (the field name is in MC_FIELDS-FIELDNAME and the flag is in MC_FIELDS-SUPPLIED ).

Example

A field F0 is supplied with a value by the matchcode if the following condition is satisfied:

IF MC_FIELDS-FIELDNAME EQ 'F0'
AND MC_FIELDS-SUPPLIED NE SPACE.

ABAP TOPIC WISE COMPLETE COURSE

BDC
OOPS ABAP
ALE
IDOC'S
BADI
BAPI
Syntax Check
Interview Questions
ALV Reports with sample code
ABAP complete course
ABAP Dictionary
SAP Scripts
Script Controls
Smart Forms
Work Flow
Work Flow MM
Work Flow SD
Communication Interface

OTHER PROGRAMMING COURSES:

Dot Net Complete Course Part one and two
ASP.NET part one and