Showing posts with label SYNTAX CHECK. Show all posts
Showing posts with label SYNTAX CHECK. Show all posts

Syntax for Modify in Change internal table

Variant

MODIFY itab [FROM wa] [INDEX idx].

Effect

Changes an entry in the internal table itab .

If you specify FROM wa , the line is replaced by the explicitly specified work area wa . If the FROM specification is omitted, the line is replaced by the header line from itab .

With INDEX idx , you can specify the table index of the line to be changed. The index specification can be omitted in a LOOP on an internal table.

The INDEX specification can also appear before the FROM specification.

The return code value is set as follows:

When specifying the insertion point with INDEX idx :

SY-SUBRC = 0 The change was executed.

SY_SUBRC = 4 The index specification was too big. The change was not executed because the table had fewer than idx entries.

If you do not specify the insertion point, the &ABAP_SUBRC is set to 0.

The counting of table entries begins with 1.

Performance

You can avoid unnecessary assignments by using statements which have an explicitly specified work area for internal tables with a header.

The runtime required to execute the MODIFY itab INDEX idx statement is about 5 msn (standardized microseconds).(96.3)

Related posts :

Syntax for Modify data base table part one
and two

DO

EDITOR CALL PART ONE

EDITOR CALL PART TWO

ELSE AND ELSE-IF

EXEC

Syntax for Modify data base table part two

This post is in continuation with modify data base syntax part one.Going through that post will give you more convenience in understanding the present topic.

Addition 1

... FROM wa

Effect

The values for the line to be inserted or updated are not taken from the table work area dbtab , but from the explicitly specified work area wa . When doing this, the data is read from left to right according to the structure of the table work area dbtab . Since the structure of wa is not taken into account, the work area wa must be at least as wide as the table work area dbtab and the alignment of the work area wa must correspond to the alignment of the table work area. Otherwise, a run time error occurs.

If a work area is not explicitly specified, the values for the line to be inserted or updated are also taken from the table work area dbtab if the statement is in a FORM or FUNCTION where the table work area is stored in a formal parameter or local variable of the same name.

Addition 2

... CLIENT SPECIFIED

Effect

Switches off automatic client handling. This allows you to edit data across all clients even when dealing with client-specific tables. The client field is treated like a normal table field that can be programmed to accept values in the table work area dbtab or *dbtab where the line to be edited occurs.

The addition CLIENT SPECIFIED must be specified immediately after the name of the database table.

Variant 2

MODIFY dbtab FROM TABLE itab. or MODIFY (dbtabname) FROM TABLE itab.

Addition

... CLIENT SPECIFIED

Effect

Mass modify: Inserts new lines or updates existing lines of a database table. The primary keys for identifying the lines to be inserted or updated and the relevant values are taken from the internal table itab . The lines of the internal table itab must satisfy the same conditions as the work area wa in addition 1 to variant 1.

If the internal table itab is empty, SY-SUBRC and SY-DBCNT are set to 0.

Addition

... CLIENT SPECIFIED

Effect

As for variant 1.

Variant 3

MODIFY dbtab VERSION vers. or MODIFY *dbtab VERSION vers.

Effect

Inserts a new line or updates an existing line in a database table, the name of which is taken from the field vers at run time.If no line exists with the specified primary key, an INSERT is executed. Otherwise, an UPDATE is performed. The database table must be defined in the ABAP/4 Dictionary and its name must conform to the naming conventions for R/2 ATAB tables.

These stipulate that the name must begin with 'T' and may contain up to four further characters. The field vers must contain the table name without the leading 'T'. Only lines in the current client are inserted or updated. The line to be inserted is taken from the statically specified table work area dbtab or *dbtab .

SY-SUBRC is set to 0 if the line is successfully inserted or updated. SY-SUBRC <> 0 is not possible since any other result causes a run time error.

EXPORT PART ONE

EXPORT PART TWO

FETCH

FIELD SYMBOLS

FORM

Syntax for Modify data base table

Variants

1. MODIFY dbtab. or MODIFY *dbtab. or MODIFY (dbtabname) ... . .

2. MODIFY dbtab FROM TABLE itab. or MODIFY (dbtabname) FROM TABLE itab.

3. MODIFY dbtab VERSION vers. or MODIFY *dbtab VERSION vers.

Effect

Inserts new lines or updates existing lines in a database table . If a line with the specified primary key already exists, an INSERT is executed. Otherwise, an UPDATE is performed. You can specify the name of the database table either in the program itself in the form MODIFY dbtab ... or at runtime as the contents of the field dbtabname in the form MODIFY (dbtabname) ... .

In both cases, the database table must be
defined in the ABAP/4 Dictionary. If the program contains the name of the database table, it must also have a corresponding TABLES statement. Normally, records are inserted or updated only in the current client. Data can only be inserted or updated using a view , if the view refers to a single table and was created in the ABAP/4 Dictionary with the maintenance status "No restriction".

MODIFY belongs to the Open SQL command set. When the statement has been executed, the system field SYDBCNT contains the number of edited lines.

The return code value is set as follows:

SY-SUBRC = 0 All lines were successfully inserted or updated.
Any other result causes a runtime error.

Automatic definition of INSERT and UPDATE is expensive. You should therefore use MODIFY only if you cannot define the INSERT and UPDATE cases yourself in the program.

Since the MODIFY statement does not perform authority checks , you have to program them yourself.

Variant 1

MODIFY dbtab. or
MODIFY *dbtab. or
MODIFY (dbtabname) ... .

Additions

1. ... FROM wa
2. ... CLIENT SPECIFIED

Effect

Inserts a new line or updates an existing line in a database table. If you specify the name of the database table yourself, the primary key for identifying the line to be inserted or updated and the relevant values are taken from the table work area dbtab or *dbtab . If the name of the database table is not determined until runtime, you need to use the addition ... FROM wa .

Example

Insert or change data of the customer Robinson in the current client:

TABLES SCUSTOM.
SCUSTOM-ID = '12400177'.
SCUSTOM-NAME = 'Robinson'.
SCUSTOM-POSTCODE = '69542'.
SCUSTOM-CITY = 'Heidelberg'.
SCUSTOM-CUSTTYPE = 'P'.
SCUSTOM-DISCOUNT = '003'.
SCUSTOM-TELEPHONE = '06201/44889'.
MODIFY SCUSTOM.

FORM PART TWO

FORMAT

FORMAT PART TWO

FORMAT PART THREE

FREE

Syntax for Message

Variants

MESSAGE xnnn.

Additions

1. ... WITH f1 ... f4
2. ... RAISING exception

Effect

Outputs the message no. nnn for the MESSAGE-ID specified in the REPORT statement with the message type x. Dialog control recognizes the following message types:

I - Info : Press ENTER to continue
W - Warning : Correction
possible
E - Error : Correction required
A - Abend :
Transaction terminated
X - Exit : Transaction terminated with
short dump MESSAGE_TYPE_X
S - Success : Message on next screen
See also MODULE .

In list processing , the effect of the message types differs in some respects:1· With type E messages, the processing leaves any details list which has been started and returns to the previous list level.
2· Type W messages are always output as error messages (like type E).
3· During generation of the basic list, type W and type E messages result in termination (like type A).Example

MESSAGE I121.

1· You edit messages by selecting Tools -> ABAP/4 Workbench -> Development -> Programming environ. -> Messages .
2· You can specify a different MESSAGE-ID in parentheses after the error number, e.g. MESSAGE I121(44) .
3· When executing the statement, the following system variables are set:

* SY-MSGID (message ID)
* SY-MSGTY (message type)
* SY-MSGNO (message number)

Addition 1

... WITH f1 ... f4

Effect

Inserts the contents of a field fi in the message instead of in the variables &i. If unnumbered variables (&) are used in a message text, these are replaced consecutively by the fields f1 to f4 .

To aid conversion, only numbered variables (&1 to &4) are to be used in future if several fields are involved.

If a "&" is supposed to appear in the message at runtime, you must enter "&&". In the long text of a message, the symbol &Vi& is replaced by the field contents of fi . After WITH , you can specify 1 to 4 fields.

You can output up to 50 characters per field. If the field contains more characters, these are ignored.

Example

MESSAGE E010 WITH 'Example' SY-UNAME.

When executing the statement, the contents of the fields f1 to f4 are assigned to the system fields SY-MSGV1 , SY-MSGV2 , SY-MSGV3 and SY-MSGV4 .

Addition 2

... RAISING except.

Effect

Only possible within a function module :

Triggers the exception except.

If the program calling the function module handles the exception itself, control returns immediately to that program (see CALL FUNCTION ). In this case, the export parameters of the function module are ignored. However, the calling program can refer to the system field values .

If the calling program does not handle the exception itself, the message is output (see RAISE ).

Example

MESSAGE E777 RAISING NOT_FOUND.

Variant 2

MESSAGE ID mid TYPE mtyp NUMBER mnr.

Effect

As for variant 1, where you can set the following message components dnyamically:

ID Message ID TYPE Message type NUMBER Number
You can also use all the other additions as with the basic form.

See here about syntax for loop in internal table here .

FORM PART TWO

FORMAT

FORMAT PART TWO

FORMAT PART THREE

FREE

Syntax for LOOP on Internal Table part three

This is in continuation with Loop syntax with respect to internal table in part one and two. Going through this links will help in understanding the present concept.

Addition 4

... TRANSPORTING NO FIELDS

Effect

There is no field transport in the output area of the internal table. This addition can be used only in conjunction with a WHERE condition. Since it would make no sense to specify a work area with INTO wa when using the addition TRANSPORTING NO FIELDS , this option does not exist.

This addition can be used to determine a set of line indexes (index set) or to determine the number of lines in a table which satisfy a given condition.

Example

Determining the number COUNT of lines in a name table TAB which contain the name 'Walter' and the corresponding index set INDEX_SET .

DATA: BEGIN OF TAB OCCURS 100,

NAME(30) TYPE C,

END OF TAB,

COUNT TYPE I,

INDEX_SET LIKE SY-TABIX OCCURS 10 WITH

HEADER LINE.

LOOP AT TAB TRANSPORTING NO FIELDS WHERE

NAME CS 'Walter'.

INDEX_SET = SY-TABIX.

APPEND INDEX_SET.

ADD 1 TO COUNT.

ENDLOOP.

Loops on screen fields Syntax

Basic form

LOOP AT SCREEN.

Effect

All fields of the current screen are stored in the system table SCREEN with their attributes. The " LOOP AT SCREEN " statement places this information in the header line of the system table. If you want to change the attributes, you must put back the changed header line with MODIFY SCREEN . You can only do this in the PBO module of a screen .

If you use this statement for step loop processing, the information (and any changes) apply only to the current steploop line. Outside step loop processing, the information for a step loop field applies to the complete column.

Step loop fields should never be changed after the corresponding step loop processing has been performed. You can use the CONTINUE statement to leave the current loop pass prematurely and continue with the next loop pass.

Overview of all SCREEN fields:

Field Length Type Meaning

SCREEN-NAME 30 C Field name
SCREEN-GROUP1 3 C Evaluation of

modification group 1

SCREEN-GROUP2 3 C Evaluation of

modification group 2

SCREEN-GROUP3 3 C Evaluation of

modification group 3

SCREEN-GROUP4 3 C Evaluation of

modification group 4

SCREEN-REQUIRED 1 C Field input mandatory
SCREEN-INPUT 1 C Field ready to accept input
SCREEN-OUTPUT 1 C Field will be displayed
SCREEN-INTENSIFIED 1 C Field highlighted
SCREEN-INVISIBLE 1 C Field invisible
SCREEN-LENGTH 1 X Field length
SCREEN-ACTIVE 1 C Field active

Example

Make all fields display only:

CONSTANTS OFF VALUE '0'.

LOOP AT SCREEN.

SCREEN-INPUT = OFF.

MODIFY SCREEN.

ENDLOOP.

GENERATE

GET PART ONE AND TWO THREE

GET CURSOR PART ONE TWO

GET CURSOR PART ONE AND TWO

Syntax for LOOP on Internal Table part two

This syntax check on loop in internal table is in continuation with part one .

Addition 1

... FROM n1

Addition 2

... TO n2

Effect

Places all internal table entries from the entry with the index (SY-TABIX ) = n1 to the entry with the index = n2 inclusive in the output area in turn.

If either one of the additions " FROM n1 " or " TO n2 " is missing, then the table is processed either from the first entry or up to the last entry (according to what is missing).

Example

Output table entries 7 and 8:

DATA: BEGIN OF T OCCURS 100,

BAREA(5), BLNCE(5),

END OF T.

LOOP AT T FROM 7 TO 8.

WRITE: / T-BAREA, T-BLNCE.

ENDLOOP.

Addition 3


... WHERE logexp

Effect

Places all internal table entries which satisfy the condition logexp in turn in the output area. The condition logexp can be almost any logical expression . The only restriction is that the first field for each comparison must be a sub-field of the line structure of the internal table itab .

Example

DATA: BEGIN OF T OCCURS 100,

BAREA(5), BLNCE(5),

END OF T.

LOOP AT T WHERE BAREA > 0.

WRITE: / T-BAREA, T-BLNCE.

ENDLOOP.

which has the same effect as:

LOOP AT T.

CHECK T-BAREA > 0.

WRITE: / T-BAREA, T-BLNCE.

ENDLOOP.

Avoid using either the AT NEW/END OF or FIRST/LAST statements in a LOOP loop with a WHERE condition.

The performance of a LOOP AT ... WHERE statement can be improved significantly if the fields to be compared always have the same data type. The comparison fields should be defined as follows:

DATA LIKE .

Example

DATA: BEGIN OF T OCCURS 100,

BAREA(5), BLNCE(5),

END OF T.

DATA CMP_BAREA LIKE T-BAREA.

CMP_BAREA = '01'.

LOOP AT T WHERE BAREA = CMP_BAREA.

WRITE: / T-BAREA, T-BLNCE.

ENDLOOP.

IF KEYWORD

IMPORT PART ONE AND TWO

INCLUDE


INFOTYPES

What is Loops on an internal table

Basic form

LOOP AT itab.
LOOP AT itab INTO wa.

Additions

1. ... FROM n1
2. ... TO n2
3. ... WHERE logexp
4. ... TRANSPORTING NO FIELDS

Effect

Processes an internal table (DATA ) in a loop which begins with LOOP and ends with END LOOP . Each of the internal table entries is sent to the output area in turn.When LOOP AT itab. is used, the header line of the internal table itab is used as output area. In the case of LOOP AT itab INTO wa , there is an explicitly specified work area wa .

If the internal table is empty, all the statements between LOOP and ENDLOOP are ignored. In each loop pass, SY-TABIX contains the index of the current table entry. After leaving a LOOP , SY-TABIX has the same value as it had before. Inserting and/or deleting lines in a LOOP affects subsequent loop passes.

You can use the CONTINUE statement to leave the current loop pass prematurely and continue with the next loop pass. To leave loop processing altogether, you use EXIT . At the end of loop processing (i.e. after ENDLOOP ), the return code value of SY-SUBRC specifies whether the loop
was actually processed.

SY-SUBRC = 0 The loop was executed at least once.
SY_SUBRC = 4 The loop was not executed, either because there was no entry at all or because there was no entry which satisfied the conditions.

Example

The table T is defined as follows:

DATA: BEGIN OF T OCCURS 100,
BAREA(2), BLNCE TYPE P,
END OF T.
After the table has been filled with data (using APPEND ), it is
then output:
LOOP AT T.
WRITE: / T-BAREA, T-BLNCE.
ENDLOOP.

If an internal table is processed only on a restricted basis (with the additions FROM , TO and /or WHERE ), you should not use the control structures for control break processing because the interaction of a restricted LOOP and the AT statement is undefined at present.

If SUM is used in a LOOP and an explicit output area wa has also been specified, this output area must be compatible with the line type of the internal table itab .(91.4)

What is a Idoc?
Outbound process overview
Outbound process via message control
EDI outbound process
EDI inbound process overview

What is syntax for loop part two

Basic form

LOOP AT dbtab.

Addition

... VERSION vers

This variant is no longer maintained and should therefore not be used . Instead, please use a SELECT statement.

Effect

Loop processing of the database table dbtab .You must declare the table dbtab under TABLES in the program. dbtab is a table name which begins with "T" and consists of up to five characters.The processing is the same as for variant 1 (except that the system field SY-TABIX is not set). If you want to process the whole table, you must set all table fields to SPACE . Otherwise, the table fields you want to use as a generic argument must be filled beforehand.

Fields of type P and type N have an initial value other than SPACE . This means that fields of this type after CLEAR or MOVE SPACE TO ... are not set to SPACE .

In the case of tables which have arguments containing fields of type P or type N , the entire table header line must be set to SPACE ( MOVE SPACE TO dbtab , not (!) CLEAR dbtab ). It is preferable to use SELECT instead.

Addition

... VERSION vers

You should use this addition only if it is absolutely necessary. In some cases, you can (and it makes sense) to avoid this LOOP addition by using a generation program.

Effect

Specifies a dynamically definable table name. The field varaiable must be a 4-character C field which contains the table name. It is declared under PARAMETERS and evaluated at runtime. The entry read is always placed in the assigned table T.... .

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

What is loops on internal table part two

Addition 1

... FROM n1

Addition 2

... TO n2

Effect

Places all internal table entries from the entry with the index (SY-TABIX ) = n1 to the entry with the index = n2 inclusive in the output area in turn.

If either one of the additions " FROM n1 " or " TO n2 " is missing, then the table is processed either from the first entry or up to the last entry (according to what is missing).

Example

Output table entries 7 and 8:

DATA: BEGIN OF T OCCURS 100,
BAREA(5), BLNCE(5),
END OF T.
LOOP AT T FROM 7 TO 8.
WRITE: / T-BAREA, T-BLNCE.
ENDLOOP.

Addition 3

... WHERE logexp

Effect

Places all internal table entries which satisfy the condition logexp in turn in the output area. The condition logexp can be almost any logical expression . The only restriction is that the first field for each comparison must be a sub-field of the line structure of the internal table itab .

Example

DATA: BEGIN OF T OCCURS 100,
BAREA(5), BLNCE(5),
END OF T.
LOOP AT T WHERE BAREA > 0.
WRITE: / T-BAREA, T-BLNCE.
ENDLOOP.
which has the same effect as:
LOOP AT T.
CHECK T-BAREA > 0.
WRITE: / T-BAREA, T-BLNCE.
ENDLOOP.

The interaction between the LOOP AT ... WHERE statement and the AT control break statements is currently undefined. It is therefore important to avoid using either the AT NEW/END OF or FIRST/LAST statements in a LOOP loop with a WHERE condition.

The performance of a LOOP AT ... WHERE statement can be improved significantly if the fields to be compared always have the same data type. The comparison fields should be defined as follows:

DATA LIKE .

Example:

DATA: BEGIN OF T OCCURS 100,
BAREA(5), BLNCE(5),
END OF T.
DATA CMP_BAREA LIKE T-BAREA.
CMP_BAREA = '01'.
LOOP AT T WHERE BAREA = CMP_BAREA.
WRITE: / T-BAREA, T-BLNCE.
ENDLOOP.

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

What is Syntax for Loop ?

Basic form

LOOP.

Effect

Processes the extracted dataset.
By using LOOP ... ENDLOOP , you can process the dataset generated by EXTRACT like an internal table (as in LOOP AT itab ) - if required, after sorting with SORT .

At the end of a control level, the control total of a numeric field f is stored in the field SUM(f) . This total includes all records read, even if further processing in the LOOP has been skipped by CHECK . At the end of a control level, the number of different values which a field f has accepted from the sort key within the group, i.e. the number of control records where the field f has changed its value, is stored in the field CNT(f) .

You can use the CONTINUE statement to leave the current loop pass prematurely and continue with the next loop pass. To leave loop processing altogether, you use EXIT .

At present, the return code value in SY-SUBRC is not set when you use LOOP with extracts. In Release 4.0, however, SYSUBRC will also specify for LOOP via extracts at the end of loop processing (i.e. after ENDLOOP ) whether the loop was processed at least once.

When you have processed a dataset with SORT or LOOP ... ENDLOOP , you cannot extract any more records with EXTRACT . You cannot nest loops on extracted datasets (unlike internal tables), i.e. only one loop on an extracted dataset can be active at any time. However, several consecutive loops are allowed.

Example

DATA: ONR(7), POSITION(3) TYPE N,
CUSTOMER(20),
PNR(5) TYPE N, NAME(15), UNITS TYPE I,
ORDERS TYPE I.
FIELD-GROUPS: HEADER, ORDER, PRODUCT.

INSERT ONR POSITION INTO HEADER.
INSERT CUSTOMER INTO ORDER.
INSERT PNR NAME UNITS INTO PRODUCT.

ONR = 'GF00012'. POSITION = '000'.
CUSTOMER = 'Good friend'.
EXTRACT ORDER.
ADD 1 TO POSITION.
PNR = '12345'. NAME = 'Screw'. UNITS = 100.
EXTRACT PRODUCT.

ADD 1 TO POSITION.

PNR = '23456'. NAME = 'Nail'. UNITS = 200.
EXTRACT PRODUCT.
ONR = 'NB00056'. POSITION = '000'.
CUSTOMER = 'Nobody'.

EXTRACT ORDER.

ONR = 'MM00034'. POSITION = '000'.
CUSTOMER = 'Moneymaker'.
EXTRACT ORDER.

ADD 1 TO POSITION.

PNR = '23456'. NAME = 'Nail'. UNITS = 300.
EXTRACT PRODUCT.
ADD 1 TO POSITION.

PNR = '34567'. NAME = 'Hammer'. UNITS = 4.
EXTRACT PRODUCT.
SORT.
LOOP.
AT ORDER.
WRITE: /, / ONR, CUSTOMER.
ENDAT.
AT ORDER WITH PRODUCT.
WRITE 'ordered:'.
ENDAT.
AT PRODUCT.
WRITE: / ONR, PNR, NAME, UNITS.
ENDAT.
AT END OF ONR.
WRITE: / 'Sum of units:', 26 SUM(UNITS).
ORDERS = CNT(POSITION) - 1.
WRITE: / 'Number of orders:', ORDERS.
ENDAT.
ENDLOOP.

This code generates the following list:

GF00012 Good friend ordered:
GF00012 12345 Screw 100
GF00012 23456 Nail 200
Sum of units: 300
Number of orders: 2
MM00034 Moneymaker ordered:
MM00034 23456 Nail 300
MM00034 34567 Hammer 4
Sum of units: 304
Number of orders: 2
NB00056 Nobody
Sum of units: 0
Number of orders: 0

The previous post of the blog deals with edi outbound process.
Message control architecture part one and two
EDI output types part one and twoMessage control and control table
Working of message control part one and two

Syntax Check for LOAD part two

Previously we have discussed regarding syntax check for LOAD part one . This post is in continuation with that post.

Variant 7

LOAD REPORT prog PART 'SELC' INTO itab.

Effect

Loads the description of the selection variables ( SELECTOPTIONS and PARAMETERS ) into the internal table itab . itab must have the Dictionary structure RSELC .

Variant 8

LOAD REPORT prog PART 'STOR' INTO itab.

Effect

Loads the initial values of the global data into the internal table itab . The line width of itab determines where the line break occurs. Ideally, itab should contain exactly one field of the type X .

Variant 9

LOAD REPORT prog PART 'LITL' INTO itab.

Effect

Loads the literal table into the internal table itab . The line width of itab determines where the line break occurs. Ideally, itab should contain exactly one field of the type X .

Variant 10

LOAD REPORT prog PART 'SYMB' INTO itab.

Effect

Loads the symbol table into the internal table itab . itab must have the Dictionary structure RSYMB .

Variant 11

LOAD REPORT prog PART 'LREF' INTO itab.

Effect

Loads the line reference into the internal table itab . itab must have the Dictionary structure RLREF .

Variant 12

LOAD REPORT prog PART 'SSCR' INTO itab.

Effect

Loads the description of the selection screen into the internal table itab . itab must have the Dictionary structure RSSCR .

Variant 13

LOAD REPORT prog PART 'BASE' INTO itab.

Effect

Loads the segment table into the internal table itab . itab must have the Dictionary structure RBASE .

Variant 14

LOAD REPORT prog PART 'INIT' INTO itab.

Effect

Loads the initial values of the local data into the internal table itab . The line width of itab determines where the line break occurs. Ideally, itab should contain exactly one field of the type X .

Variant 15

LOAD REPORT prog PART 'DATP' INTO itab.

Effect

Loads the data descriptions of the parameters and local field symbols into the internal table itab . itab must have the dictionary structure RDATA .

Variant 16

LOAD REPORT prog PART 'TXID' INTO itab.

Effect

Loads the index of the text elements (assignment of text keys to data control blocks) into the internal table itab . itab must have the dictionary structure RTXID .

Variant 17

LOAD REPORT prog PART 'COMP' INTO itab.

Effect

Loads the description of the components of the (internal) structures used in the program into the internal table itab . itab must have the dictionary structure RDATA .

Runtime errors
  1. · LOAD_REPORT_PART_NOT_FOUND : An invalid identification was specified under part .
  2. · LOAD_REPORT_PROGRAM_NOT_FOUND : The specified program prog does not exist.
  3. · LOAD_REPORT_TABLE_TOO_SHORT : The specified internal table is too narrow.(88).
Related Post

Syntax for Insert data into Table and Insert part two and Leave

FILTER DEPENDENT BADI IMPLEMENTATION PART TWO
SAP ABAP FILTER DEPENDENT BADI IMPLEMENTATION

Syntax Check for Load

Basic form

LOAD REPORT prog PART part INTO itab.

Effect

Loads the specified part of the generated version of the program prog into the internal table itab (for analysis purposes only).

The return code value is set as follows:

SY-SUBRC = 0 The load for the program prog exists and is current.

SY_SUBRC = 4 The load for the program prog does not exist.

SY-SUBRC = 8 The load for the program prog exists, but is not current. In some cases, this SY-SUBRC may mean that the program load has been destroyed. You can resolve this by generating the program. With PART 'LREF' , SY-SUBRC = 8 means that the line reference table is incorrect for the program. With PART 'CONT' , it means that the reference part of the internal table is empty.

itab has been filled only if SY-SUBRC = 0 .

Variant 1

LOAD REPORT prog PART 'HEAD' INTO itab.

Effect

Loads the program header into line 1 of the internal table itab . itab must have the Dictionary structure RHEAD .

Variant 2

LOAD REPORT prog PART 'TRIG' INTO itab.

Effect

Loads the event control blocks into the internal table itab . itab must have the Dictionary structure RTRIG .

Variant 3

LOAD REPORT prog PART 'CONT' INTO itab.

Effect

Loads the processing control blocks into the internal table itab . itab must have the Dictionary structure RCONT .

Variant 4

LOAD REPORT prog PART 'DATA' INTO itab.

Effect

Loads the static data descriptions into the internal table itab . itab must have the Dictionary structure RDATA .To find the data description for a data index i, proceed as follows:

0 <= i < 14 ="="> i+1 Index in data_itab
2^14 <= i < 15 ="="> i+1 - 2^14 Index in
datv_itab
2^15 <= i < 16 ="="> i+1 - 2^15 Parameter index
(2^14 = 16384, 2^15 = 32768)

Variant 5

LOAD REPORT prog PART 'DDNM' INTO itab.

Effect

The names of the dictionary structures used in the program are set in the internal table itab . itab must have the dictionary structure RDDNM .

Variant 6

LOAD REPORT prog PART 'DATV' INTO itab.

Effect

Loads the variable data descriptions into the internal table itab . itab must have the Dictionary structure RDATA .To find the data description for a data index i, proceed as follows:

0 <= i < 14 ="="> i+1 Index in data_itab
2^14 <= i < 15 ="="> i+1 - 2^14 Index in
datv_itab
2^15 <= i < 16 ="="> i+1 - 2^15 Parameter index
(2^14 = 16384, 2^15 = 32768)(87)

Related Post

Syntax for Insert data into Table and Insert part two and Leave
SAP ABAP BADI PART ONE

ABAP BADI PART TWO
ABAP BADI PART THREE

Syntax Check for Leave

LEAVE TO LIST-PROCESSING

LEAVE TO LIST-PROCESSING.

Addition

... AND RETURN TO SCREEN scr.

Effect

Switches from "dialog processing" (module pool, screens) of the current transaction to "list processing". You can then use all the usual list layout commands ( WRITE , SKIP , ...).

After leaving the current screen, the list formatted in this way is displayed implicitly or explicitly by LEAVE SCREEN . Here, all list programming options are possible, e.g. line selection, F keys ,windows.

LEAVE LIST-PROCESSING continues with "Processing Before Output" ( PBO ) of the screen which controls the list processing.

After switching to list processing mode with SET PF-STATUS ... ,you are recommended to define a GUI (Graphical User Interface) of type List or List in dialog box .

Addition

... AND RETURN TO SCREEN scr.

Effect

LEAVE LIST-PROCESSING continues with "Processing Before Output" ( PBO ) of the screen scr.

Using LEAVE LIST-PROCESSING to leave list processing explicitly is only necessary in exceptional cases; normally, the standard F keys (F3 Back and F15 Exit ) are sufficient.

LEAVE TO SCREEN

LEAVE TO SCREEN scr.

Effect

Leaves the current screen and processes the screen scr . If scr = 0, processing in CALL mode continues after the CALL SCREEN statement. Otherwise, you branch to the transaction selection screen.

LEAVE TO TRANSACTION

LEAVE TO TRANSACTION tcod.

Addition

... AND SKIP FIRST SCREEN

Effect

Terminates the current processing and starts the (new) transaction tcod .

Examples

Start Transaction SM02 :

LEAVE TO TRANSACTION 'SM02'.

Restart current transaction:

LEAVE TO TRANSACTION SY-TCODE.

Addition

... AND SKIP FIRST SCREEN

Effect

Processes the first screen of the transaction in the background. If possible, the fields on this screen are filled with values from the SAP memory . Therefore, you should set the desired values with SET PARAMETER . If an error occurs when processing the initial screen (due to incorrect or imcomplete parameter values), this is reported and you must correct or complete the input manually on this screen.(86.5).

Related Post

Syntax for Insert data into Table and Insert part two

ABAP BADI PART FOUR

BADI PART FIVE

ABAP BADI PART SIX CALLING BADI AND ITS USES

BADI INTRODUCTION

Syntax for Insert Continued

Previously we have discussed regarding syntax for Insert data into table part one and part two.We have also learned regarding inserting data into a internal table. Here is the continuation for that.

Insert a program

Basic form

INSERT REPORT prog FROM itab.

Effect

Inserts the program prog from the internal table itab into the library. The internal table itab contains the source code; the lines of the table cannot be more than 72 characters long. The program attributes (type, date, ...) are set by the system, but you can change them manually or in the program (table TRDIR ).

Runtime errors

1 · INSERT_PROGRAM_INTERNAL_NAME : he program name prog is reserve internally; it begins with '%_T' .

2· INSERT_PROGRAM_NAME_BLANK : The program name prog must not contain any blanks
characters.

3· INSERT_PROGRAM_NAME_TOO_LONG : The program name prog is too long; it cannot be more than 8 characters long.

4· INSERT_REPORT_LINE_TOO_LONG : One of the source code lines is longer than 72 characters.

INSERT - Insert text elements

Basic form

INSERT TEXTPOOL prog ...FROM itab ...LANGUAGE lg.

Effect

Assigns the text elements in the internal table itab to the program prog and the language lg and inserts them in the library. The line structure of the table itab is described in the section Text elements .

Example

The following program uses the internal table TAB to set the text elements of the program PROGNAME .

DATA: PROGRAM(8) VALUE 'PROGNAME',
TAB LIKE TEXTPOOL OCCURS 50 WITH HEADER
LINE.
TAB-ID = 'T'. TAB-KEY = SPACE. TAB-ENTRY =
'Sales'.
APPEND TAB.
TAB-ID = 'I'. TAB-KEY = '200'. TAB-ENTRY = 'Tax'.
APPEND TAB.
TAB-ID = 'H'. TAB-KEY = '001'. TAB-ENTRY = 'Name
Age'.
APPEND TAB.
TAB-ID = 'S'. TAB-KEY = 'CUST'. TAB-ENTRY =
'Customer'.
APPEND TAB.
TAB-ID = 'R'. TAB-KEY = SPACE. TAB-ENTRY = 'Test
program'.
APPEND TAB.
SORT TAB BY ID KEY.
INSERT TEXTPOOL PROGRAM FROM TAB LANGUAGE
SY-LANGU.

The internal table should be sorted by the components ID and KEY to enable faster access to the text elements at runtime. However, this is not obligatory. The component LENGTH (see text elements ) for the length of a text element does not have to be set explicitly. In this case - as in the example - the actual length of the text element is used.

The value of LENGTH cannot be smaller than the text to which it applies. If your length specification is too short, it is ignored by INSERT and the actual length is used instead. On the other hand, larger values are allowed and can be used to reserve space for texts that may be longer when translated into other languages.

Related Post

Syntax for Insert data into Table

LESSON 1 DATA PORTS IN IDOC

LESSON 2 DEFINING PARTNER PROFILE FOR IDOC

LESSON 3 PARTNE RPROFILES AND PORTS IN IDOC

LESSON 4 CONVERTING DATA INTO IDOC SEGMENTS

Syntax for Insert into a Internal Table

Variant 1

INSERT [wa INTO|INITIAL LINE INTO] itab [INDEX idx].

Effect

Inserts a new line into an internal table.

If you specify wa INTO , the new line is taken from the contents of the explicitly specified work area wa .

When using INITIAL LINE INTO , a line containing the appropriate initial value for its type is inserted into the table.

If you omit the specification before itab , the new line is taken from the header line of the internal table itab .

INDEX idx specifies the table index before which the line is inserted into the table itab . If the table has exactly idx - 1 entries, the line is appended to the table.

Within a LOOP , on an internal table, you do not have to specify the insertion point with INDEX idx . The source table is then inserted before the current LOOP line in the target table.

The return code value is set as follows:

When specifying the insertion point with INDEX idx :

SY-SUBRC = 0 The entry was inserted.
SY_SUBRC = 4 Index specification too large.

The entry was not inserted because the table has fewer than idx - 1 entries.

Return code value If the insertion point is not specified, the is set to 0.

Inserting lines within a LOOP ... ENDLOOP structure affects subsequent loop passes.

Invalid index specifications (for example, idx <= 0), result in a runtime error. Example

Insert values into a table of whole numbers:

DATA: VALUE TYPE I,
ITAB TYPE I OCCURS 100 WITH HEADER LINE.
ITAB = 5.
VALUE = 36.
INSERT ITAB INDEX 1.
INSERT VALUE INTO ITAB INDEX 2.
INSERT INITIAL LINE INTO ITAB INDEX 2.

The table ITAB now contains three lines with the values 5, 0 and 36.

Variant 2

INSERT LINES OF itab1 [FROM idx1] [TO idx2] INTO itab2 [INDEX idx3.

Effect

Inserts the internal table itab1 or a section of itab1 into the internal table itab2 .

As with variant 1, INDEX idx3 is to specifies the table index before which you want to insert in the target table itab2 .

Within a LOOP , on an internal table, you do not have to specify the insertion point with INDEX idx3 . The source table is then inserted before the current LOOP line in the target table.

By specifying FROM idx1 or TO idx2 , you can restrict the line area from which the source table itab1 is taken. If there is no FROM specification, the line area begins with the first line of itab1 . If there is no TO specification, the line area ends with the last line of itab1 . This means that the whole table is inserted, if neither a FROM nor a TO is specified.

Return code value

The is set as for variant 1.

You can use DESCRIBE TABLE itab1 LINES ... to determine the size of the table itab1 before or after the INSERT statement and thus establish how many lines were actually inserted into the
table.

Inserting lines within a LOOP ... ENDLOOP structure affects subsequent loop passes. Invalid index specifications (for example, idx <= 0), result in a runtime error. Performance

Inserting a line into an internal table incurs index maintenance costs which depend on the insertion point.

For example, inserting a line in the middle of a 100-byte wide internal table with 200 entries requires about 90 msn (standardized microseconds). If you want to insert the contents of one internal table into another internal table, you incur index maintenance costs only once with the variant INSERT LINES OF ... . Compared with a LOOP which inserts the lines of the source table oneby- one into the target table, this represents a distinct improvement in performance.
Inserting a table of 500 lines with a 100-byte line width in the middle of a similar size table can thus be amde up to 20 times faster.(84.4)

Related Post

Syntax for Insert data into Table
LESSON 5 DEVELOPING OUTBOUND IDOC FUNCTION

LESSON 6 CREATION OF IDOC DATA

Insert Data into Table Syntax Part two

This Insert data into table is in continuation with previous post .

Variant 2

INSERT dbtab. or
INSERT *dbtab. or
INSERT (dbtabname) ...

Additions

1. ... FROM wa
2. ... CLIENT SPECIFIED

Effect

These are the SAP -specific short forms for the statements explained under variant 1.

  1. · INSERT INTO dbtab VALUES dbtab. or
  2. · INSERT INTO dbtab VALUES *dbtab. or
  3. · INSERT INTO (dbtabname) VALUES wa.
When the command has been executed, the system field SYDBCNT contains the number of inserted lines (0 or 1).

The return code value is set as follows:

SY-SUBRC = 0 Line successfully inserted.
SY_SUBRC = 4 Line could not be inserted, since a line with the same key already exists.

Example

Add a line to a database table:

TABLES SAIRPORT.
SAIRPORT-ID = 'NEW'.
SAIRPORT-NAME = 'NEWPORT APT'.
INSERT SAIRPORT.

Addition 1

... FROM wa

Effect

The values for the line to be inserted are not taken from the table work area dbtab , but from the explicitly specified work area wa . The work area wa must also satisfy the conditions described in variant 1. As with this variant, the addition allows you to specify the name of the database table directly or indirectly.

If a work area is not explicitly specified, the values for the line to be inserted are taken from the table work area dbtab if the statement is in a FORM or FUNCTION where the table work area is stored in a formal parameter or local variable of the same name.

Addition 2

... CLIENT SPECIFIED

Effect

As for variant 1.

Variant 3

INSERT dbtab FROM TABLE itab. or
INSERT (dbtabname) FROM TABLE itab.

Additions

... CLIENT SPECIFIED
... ACCEPTING DUPLICATE KEYS

Effect

Mass insert: Inserzts all lines of the internal table itab in a single operation. The lines of itab must satisfy the same conditions as the work area wa in variant 1.

When the command has been executed, the system field SYDBCNT contains the number of inserted lines.

If the internal table itab is empty, SY-SUBRC and SY-DBCNT are set to 0 after the call.

Addition 1

... CLIENT SPECIFIED

Effect

As for variant 1.

Addition 2

... ACCEPTING DUPLICATE KEYS

Effect

If a line cannot be inserted, the processing does not terminate with a runtime error, but the return code value of SY-SUBRC is merely set to 4. All the remaining lines are inserted when the
command is executed.

The return code value is set as follows:

SY-SUBRC = 0 All lines successfully inserted. Any other result causes a runtime error .(82.6)

Related Post

LESSON 10 SENDING IDOC VIA STANDARD R3 SYSTEM

LESSON 11 IDOC OUTBOUND TEIGGER PART TWO

Syntax for Insert in data base table

Variants

1. INSERT INTO dbtab VALUES wa. or INSERT INTO (dbtabname) VALUES wa.

2. INSERT dbtab. or INSERT *dbtab. or INSERT (dbtabname) ...

3. INSERT dbtab FROM TABLE itab. or INSERT (dbtabname) FROM TABLE itab.

Effect

Inserts new lines in a database table .

You can specify the name of the database table either in the program itself in the form dbtab or at runtime as the contents of the field dbtabname . In both cases, the database table must be defined in the ABAP/4 Dictionary . If the program contains the name of the database table, it must also include a corresponding TABLES statement.

Normally, lines are inserted only in the current client. Data can only be inserted using a view if the view refers to a single table and was defined in the ABAP/4 Dictionary with the maintenance status "No restriction".

INSERT belongs to the Open SQL command set.

You cannot insert a line if a line with the same primary key already exists or if a UNIQUE index already has a line with identical key field values.

When inserting lines using a view , all fields of the database table that are not in the view are set to their initial value - if they were defined with NOT NULL in the ABAP/4 Dictionary . Otherwise they are set to NULL .

Since the INSERT statement does not perform authorization checks , you must program these yourself.

Lines specified in the INSERT command are not actually added to the database table until after the next ROLLBACK WORK .Lines added within a transaction remain locked until the transaction has finished. The end of a transaction is either a COMMIT WORK , where all database changes performed within the transaction are made irrevocable, or a ROLLBACK WORK , which cancels all database changes performed within the transaction.

Variant 1

INSERT INTO dbtab VALUES wa. or INSERT INTO (dbtabname) VALUES wa.

Addition

... CLIENT SPECIFIED

Effect

Inserts one line into a database table.

The line to be inserted is taken from the work area wa and the data read from left to right according to the structure of the table work area dbtab . Here, the structure of wa is not taken into account. For this reason, the work area wa must be at least as wide (see DATA ) as the table
work area dbtab and the alignment of the work area wa must correspond to the alignment of the table work area.

Otherwise, a runtime error occurs. When the command has been executed, the system field SYDBCNT contains the number of inserted lines (0 or 1).

The return code value is set as follows:

SY-SUBRC = 0 Line was successfully inserted.

SY_SUBRC = 4 Line could not be inserted since a line with the same key already exists.

Example

Insert the customer Robinson in the current client:

TABLES SCUSTOM.
SCUSTOM-ID = '12400177'.
SCUSTOM-NAME = 'Robinson'.
SCUSTOM-POSTCODE = '69542'.
SCUSTOM-CITY = 'Heidelberg'.
SCUSTOM-CUSTTYPE = 'P'.
SCUSTOM-DISCOUNT = '003'.
SCUSTOM-TELEPHONE = '06201/44889'.
INSERT INTO SCUSTOM VALUES SCUSTOM.

Addition

... CLIENT SPECIFIED

Effect

Switches off automatic client handling. This allows you to insert data across all clients even when dealing with clientspecific tables. The client field is then treated like a normal table field which you can program to accept values in the work area wa that contains the line to be inserted.

The addition CLIENT SPECIFIED must be specified immediately after the name of the database table.

Example

Insert the customer Robinson in client 2:

TABLES SCUSTOM.
SCUSTOM-MANDT = '002'.
SCUSTOM-ID = '12400177'.
SCUSTOM-NAME = 'Robinson'.
SCUSTOM-POSTCODE = '69542'.
SCUSTOM-CITY = 'Heidelberg'.
SCUSTOM-CUSTTYPE = 'P'.
SCUSTOM-DISCOUNT = '003'.
SCUSTOM-TELEPHONE = '06201/44889'.
INSERT INTO SCUSTOM CLIENT SPECIFIED VALUES
SCUSTOM.

Initialization Syntax Check

Basic form

INITIALIZATION.

Effect

Processing event.

Executed before the selection screen is displayed.The parameters (PARAMETERS ) and selection criteria (SELECT OPTIONS ) defined in the program already contain default values (if specified). You can assign different values here and also change the database-specific selections.

In contrast to R/2 , this event is also executed during background processing.

Example

Define the last day of the previous month as the key date:

PARAMETERS QUAL_DAY TYPE D DEFAULT SYDATUM.

INITIALIZATION.

QUAL_DAY+6(2) = '01'.

QUAL_DAY = QUAL_DAY - 1.

INITIALIZATION is executed in the following steps:

Specify default values for the selections. Execute the event INITIALIZATION. Import variant (if used to start the report).

On SUBMIT , the values specified for each WHERE clause are also transferred, if necessary. Execute the event AT SELECTION-SCREEN OUTPUT , if it occurs in the report (unlike INITIALIZATION , this event is always executed for PBO of a selection screen). Display selection screen.

Transport the screen fields containing user input to the report fields. Continue with START-OF-SELECTION .

Since INITIALIZATION is only executed once when you start the report, it is not suitable for screen modifications such as suppressing individual parameters (LOOP AT SCREEN , MODIFY SCREEN ) because these changes would disappear again when the user pressed ENTER. The correct event for screen modifications is AT SELECTION-SCREEN OUTPUT .(80.5)


SAP WORK flow in sales and distribution 1
SAP WORK flow in sales and distribution 2
SAP WORK flowin sales and distribution 3

Syntax for Infotypes

Basic form

INFOTYPES nnnn.

nnnn between 0000 and 0999: HR master data info types
nnnn between 1000 and 1999: HR planning data info types
nnnn between 2000 and 2999: HR time data info types
nnnn between 3000 and 8999: Not yet used
nnnn between 9000 and 9999: Customer-specific info types

Additions

1. ... NAME c
2. ... OCCURS occ
3. ... MODE N
4. ... VALID FROM begin TO end

Effect

Declares the HR info type nnnn . Creates an internal table as follows:

DATA BEGIN OF Pnnnn OCCURS 10.

INCLUDE STRUCTURE Pnnnn.

DATA END OF Pnnnn VALID BETWEEN BEGDA AND

ENDDA.

Example

INFOTYPES: 0000, 0001, 0002.

Addition 1

... NAME c

Effect

c is a name

c is a name up to 20 characters long. Creates an internal table as follows:

DATA BEGIN OF c OCCURS 10.
INCLUDE STRUCTURE Pnnnn.
DATA END OF c VALID BETWEEN BEGDA AND ENDDA.

Example

INFOTYPES: 0005 NAME VACATION, 0006 NAME ADDRESS.

Addition 2

... OCCURS occ

Effect

occ is a number for the OCCURS value. Creates an internal table as follows:

DATA BEGIN OF c OCCURS m.
INCLUDE STRUCTURE Pnnnn.
DATA END OF c VALID BETWEEN BEGDA AND ENDDA.

Example

INFOTYPES 0003 OCCURS 1.

Addition 3

... MODE N

Applies only to the HR logical databases PNP and PCH .

Effect

The info type tables are not filled by GET PERNR (logical database PNP ) or GET OBJEC (logical database PCH ). The effect of the INFOTYPES statement is then the same as the data declaration of an internal table .

Example

INFOTYPES: 2001 MODE N, 2002 MODE N, 2003 MODE N.

Addition 4

... VALID FROM begin TO end.

... VALID FROM begin TO end.

Effect

This addition should only be used with the logical database PNP .

GET PERNR retrieves only those info type records which are valid within the time range ( begin and end ) specified. begin and end are dates with the format YYYYMMDD.

Example

INFOTYPES: 0007 VALID FROM 19910101 TO 19911231.

Note

Each info type has a formal description in the ABAP/4 Dictionary as table Pnnnn .

If you enter SHOW INFOTYPES nnnn in the editor command line, the system displays information about the info type nnnn .

If you enter SHOW INFOTYPES * , you see a list of all info types.


Work flow for MM PART 5

Syntax for Include

INCLUDE prog

Basic form

INCLUDE prog.

Effect

Includes the program prog in the main program for syntax check and generation purposes. Include programs are used to divide very large programs into smaller more manageable units. They also allow you to create common program components.

Example

INCLUDE LSPRITOP.

The whole of an INCLUDE statement must appear on one line where it is the only statement allowed. The include program must consist of complete statements (and comments). You can use the service report RSINCL00 to generate reference lists for include programs.

INCLUDE STRUCTURE

Basic form

INCLUDE STRUCTURE rec.

Effect

When you define a structure rec (with DATA or TYPES ), this statement copies the components of the structured data type subRec to the structure rec . Since you can define nested data structures (i.e. structures with sub-structures) starting from Release 3.0, you should use INCLUDE STRUCTURE only if you want to introduce types in a program first and nested structures in a later step.


A data definition DATA: BEGIN OF rec.
INCLUDE STRUCTURE subRec.
DATA: END OF rec.

is equivalent to

DATA rec LIKE subRec.

You are recommended to use the second formulation. Even if the structure rec to be defined contains additional components, instead of

DATA: BEGIN OF rec,
...
INCLUDE STRUCTURE subRec.
DATA: ...
END OF rec.

you should use

DATA: BEGIN OF rec,
...
rec LIKE subRec,
...
END OF rec.

so that subRec can be referenced as a sub-structure of rec .

Although " INCLUDE STRUCTURE subRec. " breaks up the substructure subRec into its components, the alignment of subRec is retained. This means that padding fields may be inserted before the first and/or before the last component of subRec in rec .

INCLUDE TYPE

Basic form

INCLUDE TYPE subRec.

Effect

When you define a structure rec (with DATA or TYPES ), this statement copies the components of the structured data type subRec to the structure rec .

Since you can define nested data structures (i.e. structures with sub-structures) starting from Release 3.0, you should use INCLUDE TYPE only if you want to introduce types in a program first and nested structures in a later step.(78.8).


Work flow for MM PART 6
Work flow for MM PART 7