CT-Professional_100 – High-Quality-CBT

Course 2: “Extension of language range and application”

This course consists of a selection of ABAP® commands, which allow (together with course 1) you to also program bigger reports of an intermediate level.

Within the language ABAP® it is sufficient to know only a few commands at the beginning to manage light programming requests. Prerequisite for this target however is, that these language elements are really understood.

How much learning content is available?

The course 2 consists of approx. 1940 text sections with approx. 8500 lines in total and 77 ABAP programs. The report examples are illustrated through approx. 250 overlay drawings within the syntax explanations and during the debugging session.

The single topics of each lesson are subsequently listed here as a continuous text. These are mainly the headings from the single text elements. They give an overview of the volume and the detailed structure of the presented knowledge. Of course these course information are properly arranged in the learning tool. You can determine the processing sequence of the single topics and you can:

  • follow the “red thread or learning path” or
  • branch into another learn mode or
  • call individual courses by using direct access or
  • display text elements or
  • access report examples or
  • use the CT-Debug_Simulator.

A detailed listing of the course content

We subsequently listed the essential contents of each course as continuous text. These are mainly the headings of the single text elements. Please look at the volume of the respective course (… and show us something comparable …). Of course these course information are properly arranged in the learning tool.

Continuous text:

APPEND LINES OF itab1 – syntax description, application notes . Copying is targeted to the table end of itab2 . The table header line is not used . Identical data structure required . Omitting the specification of the FROM/TO area . The command variations . APPEND LINES OF itab1 FROM ind1 TO itab2 . APPEND LINES OF itab1 TO ind2 TO itab2 . APPEND LINES OF itab1 TO itab2 . APPEND LINES OF itab1 FROM ind1 TO ind2 TO itab2 . The different variations of “APPEND LINES …” . The current table index SY-TABIX . The content of SY-TABIX refers to … . The index variables “ind1” and “ind2” . Index = 0 . Index out of range . Index negative . Index not numerical . FROM-index greater than TO-index . Selecting table lines in a loop . General information . COLLECT itab – Add a new table line . Editing table lines (Addition) . Key fields within “COLLECT” . Data fields within “COLLECT” . Indication . COLLECT itab (Syntax) . COLLECT makes sense only in connection with other commands . COLLECT work1 INTO itab (up to Release 3.0 ) . The way of operation of “COLLECT itab” . Comparison of the “search fields” (argument fields) . The result: congruent line found or not found . No concordance of the non numerical data fields . Concordance of the non numerical data fields . The basical difference between “COLLECT” and “APPEND” . The command “APPEND” always expands the table . The “COLLECT” expands only when the argument … . “COLLECT” alters also existing … . The “OCCURS instruction”, the paging area and the … . OCCURS instruction will be adapted internally . Why is the number of needed table lines … . Sequential processing of table lines . General application areas for “COLLECT” . Extracts or compression from existing tables . Comparison of the argument fields . Building subsets using additional keys . If not all header lines should be considered … . With “COLLECT” addition is done (also subtraction … . Addition . Subtraktion . “COLLECT” in relation with a table used as parameter … . COLLECT and subprogrames . Every “COLLECT” takes, what in the header line … . COLLECT and CLEAR . Alternatives to “COLLECT” . Commands for processing summation in internal tables . Process big tables and big data volumes using COLLECT? . General estimation . A first alternative to “COLLECT” . Firstly collect the data in table-1 . Sorting table-1 . Table-1 is compressed into Table-2 . Also the well-tried comparison can be of help . Not only addition is possible . A further alternative to “COLLECT” . Sorted generation with simultaneous summation . Table entry is not yet existing . Table entry is already existing . A report example from praxis . DELETE command (an overview) . Short description of the “DELETE …” function . Table lines from an external table . Table lines from a program-internal table . Files on the hard disk of the server … . clusters from an IMPORT/EXPORT-table . source code from reports or programs . screen templates . A specific syntax is applicable, dependent on the . “You only delete once …” . What gets deleted, and who OK’s the data for deletion? . The topics of the department . Which working area is for the deleting data … . Has the agreement/instruction of the responsible party been procured? . Can the data volumes to be deleted be reconstructed? . Are we talking about a large volume of data? . Is the dialog functionality restricted? . Should a batch job be used for the deletion? . Applications programming … . Are test runs available? . Optimal selection conditions? . Have only key-fields been selected in the WHERE ? . Does the sequence of the key-fields reflect the … . Were complex WHERE conditions avoided? . Are the relevant authorization codes in place (in production)? . Will false input parameters be “trapped” ? . Does adequate logging of … . Operating … . Has permission for the current reset action been granted? . Are restore eventualities provided for? . Is dialog functionality restricted during … . Are deletion protocols to be sent to the department ? . The different forms of “DELETE …” . DELETE = deletion of external table lines (database content) . DELETE FROM etab WHERE condition . DELETE FROM etab CLIENT SPECIFIED WHERE . DELETE etab . DELETE (name_etab) (3.0 and later) . DELETE etab FROM TABLE itab . DELETE (name_etab) FROM TABLE itab (3.0 and later) . DELETE etab VERSION name . DELETE FROM DATABASE etab(xx) ID key . DELETE FROM DATABASE etab(xx) CLIENT y ID key . DELETE = deletion of internal table lines . DELETE itab INDEX num . DELETE itab FROM num1 TO num2 (3.0 and later) . DELETE itab WHERE condition (3.0 and later) . DELETE itab . DELETE = deletion of programs (reports) . DELETE REPORT name . DELETE TEXTPOOL name . DELETE DYNPRO name . DELETE = deletion of external data . DELETE DATASET name . “OPEN” can delete data too . Write authorization . Specify complete file names … . Frequency of use of “DELETE …” in practice. . DELETE of external table lines (database) . The “copyright” in unintentional deletions … . DELETE – a command that earns respect … . Frequency of use of “DELETE external table lines” . Tables for customizing … . Client-owned tables … . DELETE of internal table lines . DELETE of data sets . DELETE – program elements . DELETE ADJACENT DUPLICATES … – Delete table lines . A short description . Only records that follow one after another are checked . DELETE ADJACENT DUPLICATES FROM itab COMPARING v1 v2 v3 … . DELETE ADJACENT DUPLICATES FROM itab COMPARING ALL FIELDS . DELETE ADJACENT DUPLICATES FROM itab (ab 3.0) . DELETE ADJACENT DUPLICATES FROM itab COMPARING v1 v2 … (from 3.0) . The comparison of partial contents from v1 v2 . DELETE ADJACENT DUPLICATES FROM itab COMPARING ALL FIELDS (from 3.0) . Supplementary notes on the command . The sorting is decisive . The “DELETE ADJACENT …” – an internal loop command . The number of the deleted table lines . The return code SY-SUBRC . The relative addressing in the case of “DELETE … . The dynamic allocation of the comparison fields . Run-time error in the case of false dynamic field . REPORT-DELETE-ADJACENT-DUPLICATES . REPORT-DEL-ADJ-DUPL-COMPARING . REPORT-DEL-ADJ-DUPL-COMPARING . DELETE-ADJACENT-COMP-All FORMAT . DELETE itab FROM … TO …WHERE – Delete with selection . DELETE itab FROM ind1 WHERE condition . DELETE itab TO ind2 WHERE condition . DELETE itab WHERE condition (from 3.0) . DELETE itab FROM ind1 TO ind2 WHERE condition (from 3.0) . Further remarks … . Use manageable WHERE conditions . No loop command, however system-internal loop commands . The number of the deleted table records . Both index specifications can be used jointly . If the index specification “FROM ind1 … ” is . If the index specification “TO ind2 … ” is . Index specification as a literal or within a variable . Valid index specifications . Invalid index specifications . REPORT-INDEX-WHERE . REPORT INDEX WHERE . DO … ENDDO – The cycle command . DO … further commands … ENDDO (syntax explanation) . Exiting the infinite loop . Further commands in the DO loop . ENDDO . Language elements with comparable effect . DO n1 TIMES . WHILE condition … ENDWHILE (as an alternative to DO – ENDDO) . WHILE log-condition – ENDWHILE . ENDWHILE . CONTINUE or CHECK log-expression . The WHILE loop with “VARY vx FROM v1 NEXT v2”. . The exit of the WHILE loop. . Notes on the use of the “DO …. ENDDO” loop command . The correlation between the keywords “DO” and “ENDDO” . Exiting the loop with “EXIT” . The condition query for the “EXIT” command . Infinite loop, abnormal termination . The different interruption levels of “EXIT” . The “EXIT” command in loops . The command “EXIT” in a subroutine . The command when not in a loop or FORM . The further interruption options . “REJECT” . “STOP” . “LEAVE” . The command “CONTINUE” starts a new loop execution (3.0 and later) . The command “CHECK … ” modifies the processing sequence . The combination of “CHECK” and “EXIT” . Nested loops . Further loop commands . LOOP – ENDLOOP . WHILE – ENDWHILE . SELECT – ENDSELECT . UPLOAD – ENDUPLOAD . The loop counter SY-INDEX . Frequent application areas of “DO – ENDDO” . Reading of external data bases . Editing of strings . Checking of field content for formal correctness . Frequent commands within DO loops . MOVE and/or assignments (v2 = v1) . IF commands, CASE/WHEN, . READ DATASET, SHIFT, ASSIGN, PERFORM . Evaluation of the language element “DO …. ENDDO” in practice . User-friendly construction . What is to be avoided . Little HINT . BREAK-POINT within DO … ENDDO . Special notes for the use of “DO … ENDDO” . The exact timing of the exit . Application options of “DO – ENDDO” in . General information . The DO loop . Displaying the overall content of the internal table . Quitting the loop using “EXIT” . Quitting the loop using “REJECT” . REPORT-LITTLE-TRAP . REPORT- SEQUENCE- MODIFY . REPORT- NESTED- LOOP . AUFBAU-ITAB1 . The outer loop . The inner loop . A small error . REPORT-INTERNAL-TABLE . The system fields SY-INDEX and SY-TABIX . REPORT-STRING-CHECK . DIVIDE-STRING . REPORT-CHARACTER-REPLACE . REPLACE-CHARACTERS . REPLACE-BLANKS . REPORT-REMOVE-CHARACTERS . REPLACE-LEADING-BLANKS . NUMBER-DIGITS . DO n TIMES VARYING v1 NEXT v2 – field for field . DO n TIMES . VARYING y FROM v1 NEXT v2 . Further commands within the DO-loop … . ENDDO . Special features of the work field . The source field can be modified . A larger-size work field can lead to errors . FROM v1 . NEXT v2 . Further processing commands . ENDDO . General information on the application of … . Command execution in the programme loop . The commands correlation . The main task of the command . The types of source field . field strings . Table header lines . variables (individual fields) . Processing the different field types (source field) . Process the single fields of a field string . A small explanation for example . Edit sections of an individual field . Matching up the influencing factors . The statement of the correct field length and the number of loops . As a small bookmark: . If the loop variable is too small . If the DO variable is too large . The length of the source field . If the source field is too small . If the source field is too large . The length of the target field (“… VARYING y …”) . If the target field is too small . If the target is too large . Start and finish of the copied area within the field strings . The length of the copying string . Varying the loop processing with “CHECK” . Skip loop commands with “CONTINUE” (3.0 and later) . Varying the loop variables . Value of the variable or the number 0 . Main field of application . construction of internal tables (APPEND) . assignments to field symbols (ASSIGN) . decisions (IF, ENDIF) . case tests (CASE, WHEN) . branching (PERFORM) . string processing (SHIFT, REPLACE…) . FORM/ENDFORM . INPUT, SET SCREEN … . DATA, TABLES, PARAMETERS … . SELECT/ENDSELECT, LOOP/ENDLOOP… . More than one VARYING entries in a DO statement . More than one VARYING statements in a DO command . Syntax in the case of several copying strings . An example: . A small explanation as an example . Nested loops . Further repeat constructions . LOOP/ENDLOOP, . WHILE/ENDWHILE, . SELECT/ENDSELECT, . UPLOAD/ENDUPLOAD. . EXIT in nested loops . Loop counters SY-INDEX . System field SY-INDEX . Nested loops . Allowed in addition: “EXIT” . Various possible applications in report examples . REPORT- VARYING- TOTALS1 . AUFBAU-IT1 . The inner DO-loop . The external DO-loop . REPORT- TOTALS- CHECK . REPORT- FIELD STRING- MODIFY . DO-VARYING USING WORKFIELD . The first field . Notes on error removal . REPORT- SINGLE FIELD- SNIPPING . REPORT-FIELD STRING-BACKWARDS . REPORT- FIELD STRING-LY . Application friendly construction . What should be avoided? . Little HINTS . It’s still true: . Test solutions carefully using at least 2 copying strings … . Think also of the option to be able to … . Field assignments per ASSIGN can solve problems … . The relative addressing of the sending field . Disadvantages of the command ? . No general, fundamental disadvantage . Error sources . Loop variables too large (forced termination) . Source field too small . Target field too small . Length of the copy (offset) too large . DO n TIMES – limited Do cycle . The general functionality of the command . The general instruction process . The command coherence between “DO n TIMES” and … . Difference between “Exit” and “Cancel”. . (“DO n TIMES …ENDDO”) counting loop . Absolute (“DO … ENDDO”) loop . Modifying the processing sequence in the loop (“CHECK”) . modifying the loop variables . Value of the variable or number 0 . The conversion rules are to be considered . Main areas of application . assignments (AFELD = BFELD) . field symbols (ASSIGN) . decisions (IF, ENDIF) . case tests (CASE, WHEN) . branching (PERFORM) . string processing (SHIFT, REPLACE, …) . Rare and/or inadmissible commands within “DO x TIMES” . FORM – ENDFORM . MODULE . DATA, TABLES, PARAMETERS … . SELECT – ENDSELECT . LOOP – ENDLOOP . nested loops . Further repeating constructions . LOOP … ENDLOOP . WHILE … ENDWHILE . SELECT …. END SELECT . UPLOAD …. ENDUPLOAD . EXIT in nested loops . The loop counter SY-INDEX . The system field SY-INDEX (type I) . Nested loops . Permitted additionally: “EXIT” . Limiting loop cycles “DO n TIMES” . Possible applications in report examples . General information . REPORT-NESTED-DISPLAY . The 1st loop . The 2nd loop . The 3rd loop . REPORT- SHOW- SY-INDEX . LOOP LEVEL USING SCOUNTER LEVEL . REPORT- PRINT ROUTINE- MAXIMUM . PRINT CHARACTER USING parameter . REPORT-INTERACTIVE-LIST . Selection from list level1 . Selection of further list levels . REPORT DO WITH-SHIFT . READ TABLE itab – Reading table lines . General information on the subject of table processing . The command “read table itab” in its mode of operation. . The syntax definitions of the commands . READ TABLE itab WITH KEY arg; Reading table entries . Read internal table directly with key; Direct . READ TABLE itab WITH KEY arg; … COMPARING, . “KEY READ TABLE itab {INTO wb} WITH arg BINARY SEARCH” . The search key . BINARY SEARCH . The length of the key field . The relative addressing of the key field . A remark . The search argument is used left justified . The left justified search argument and “… BINARY . Double search key in the table . Post-selection at “BINARY SEARCH, .. .” . The system fields SY-SUBRC and SY-TABIX . Sequential searching (no BINARY SEARCH) . Searched record found . Searched record not found . Search with “… BINARY SEARCH” . Searched record found . Record not found – search key smaller . Record not found – search key larger . Possible applications in report examples . The “READ TABLE itab” in report examples . The sample programs . READ TABLE itab . “READ TABLE itab {INTO wa} WITH KEY = arg1 {BINARY SEARCH}” . The length of “keyfield” . The argument as an actual value . BINARY SEARCH . READ TABLE itab INTO wa … . “READ TABLE itab WITH KEY tfield1 = arg1 tfield2= arg2 … . The argument as a actual value or variable . Conversions . INTO wa (from 3.0) . BINARY SEARCH . The relative addressing of the key field . The search argument is used left justified . Only round off brackets if the key field is named indirectly . SY-SUBRC = test of the look-up result . BINARY SEARCH . SY-SUBRC and SY-TABIX with the application of BINARY SEARCH . Multiple search key in the data base . Applications possibilities in the report examples . The command ” READ TABLE itab WITH KEY…” in . The sample programs . Example report C-field . READ TABLE IT1 WITH KEY CFELD1 = ‘XYZ’. . READ TABLE IT1 WITH KEY CFELD1 = V1. . READ TABLE IT1 WITH KEY CFELD1 = ‘YZ’ INDEX1 = . KEY READ TABLE IT1 WITH CFELD1+1(4) = ‘KLMN’. . READ TABLE IT1 WITH KEY (V1) = ‘UVWXZ’. . EAD TABLE IT1 WITH KEY (V1) = ‘EFGHI’. . Example report DIV fields . FORMAT FILL2-IT1 . FORMAT DISPLAY-IT1. . FORMAT READ-KEY-FIELD-CN. . FORMAT READ KEY FIELD-CNIP . FORMAT READ-KEY-FIELD-C-OFFS-N. . FORMAT READ-KEY-INDIREKT . FORMAT READ-KEY-INDIREKT-AND-C . FORMAT READ-KEY-IN-WORKAREA . Example report KEY SPACE . READ TABLE itab INDEX n – Index access . INTO wa . General application notes . Reading the first table line . Formulating clear statements . Reading the last table line . The size of a table can change . Reading a table backwards by means of the index . Determining the end of the table first . The system field SY-TABIX . Possible applications in report examples . Report INDEX-DIVERSE . Report INDEX-ZUFALL . Report SUCHEN-ALTERNATIV . Report INDEX-DIVERSE . Report INDEX-ZUFALL . Report SUCHEN-ALTERNATIV . Applying the reading routine in practice . SELECT command – the different command clauses . The general command format of “SELECT …” . SELECT command tfx {destination} FROM source {WHERE . SELECT tfx command (SELECT clause) . SELECT { SINGLE{ FOR UPDATE} | DISTINCT} * . SELECT { SINGLE { FOR UPDATE } | . SELECT { SINGLE{ FOR UPDATE} | DISTINCT} tf1 AS af1 . SELECT { SINGLE { FOR UPDATE } | DISTINCT } stat-func . SELECT { SINGLE{ FOR UPDATE} | DISTINCT} (itab) /selection fields in itab . {INTO destination} (INTO clause) . Work area {destination} as a field string . SELECT … INTO wb … . SELECT … INTO CORRESPONDING FIELD OF wb … . SELECT …INTO (v1, v2 …) . Work area {destination}as a internal table . SELECT …INTO TABLE itab {PACKAGE SIZE n}… . SELECT … INTO CORRESPONDING FIELD OF TABLE itab {PACKAGE SIZE n} . SELECT … APPENDING TABLE itab {PACKAGE SIZE n} . SELECT … APPENDING CORRESPONDING FIELDS OF TABLE itab {PACKAGE SIZE n} . FROM source (FROM clause) . SELECT … FROM etab . SELECT … FROM etab CLIENT SPECIFIED … . SELECT … FROM etab BYPASSING BUFFER … . SELECT … FROM etab UP TO n ROWS … . SELECT … FROM (etab_name) . SELECT …FROM (etab_name) CLIENT SPECIFIED… . SELECT …FROM (etab_name) BYPASSING BUFFER … . SELECT …FROM (etab_name) UP TO n ROWS … . {WHERE condition} (WHERE clause) . The WHERE clause with static elements . Logical operators . SELECT … WHERE tf1 lgop lv2 . Boolean operators . SELECT … WHERE NOT condition . SELECT … WHERE con1 AND cond2 . SELECT … WHERE con1 OR cond2 . String operators . SELECT … WHERE tf1 LIKE lv2 . SELECT … WHERE tf1 IS ZERO . LOOP AT itab WHERE itf1 strOp v2/lit . Range operators . SELECT … WHERE tf1 IN (lv2,lv3 …) . SELECT … WHERE tf1 BETWEENl v2 AND lv3 . WHERE clauses with dynamic elements . SELECT …WHERE (itab1) . SELECT … WHERE cond AND (itab1) . SELECT … WHERE tf1 IN itab2 . SELECT … FOR ALL ENTRIES IN itab1 WHERE cond . {GROUP BY tfn} (GROUP clause) . SELECT … GROUP BY tf1, tf2 … . SELECT… (itab1) . {ORDER BY … } (Sequence clause) . SELECT … ORDER BY PRIMARY KEY . SELECT… ORDER BY tf1, tf2 … . SELECT… ORDER BY (itab1) . General notes on use of the SELECT command . A formal example: . “SELECT * FROM etab … ENDSELECT.” (Syntax) . SELECT * . FROM etab. . Further commands in the SELECT loop . Nesting of SELECT commands is allowed . ENDSELECT . The command “SELECT” as ageneral read instruction … . The database program and the managed data . Proprietary SQL language of the database . The ABAP/4® databank commands . COMMIT WORK . DELETE . INSERT . MODIFY . ROLLBACK WORK . SELECT . UPDATE . The interpretation of the databank commands . The different table types (overview) . Transparent tables . Pool tables . Cluster tables . Import/export tables (cluster) . The SELECT command – a powerful and . The basic command “SELECT * FROM etab … . Exiting from the loop . The selection of the table entries to be read . The supplements to the basic command “SELECT …” . “SELECT * FROM etab WHERE condition … ENDSELECT.” . “SELECT * FROM etab ORDER BY PRIMARY KEY … ENDSELECT.” . “SELECT * FROM etab ORDER BY v1 v2 vn … ENDSELECT.” . “SELECT * FROM etab INTO xtab … ENDSELECT.” . “SELECT * FROM etab BYPASSING BUFFER … ENDSELECT.” . “SELECT * FROM etab UP TO n ROWS … ENDSELECT.” . “SELECT * FROM etab CLIENT SPECIFIED … ENDSELECT.” . The formal prerequisites for the . The external table must be present in the data dictionary . Editor command “SHOW etab” . The external table must generally be stated . Client tables and “SELECT” . General note for (client) table processing . Client dependent table processing . Client independent tables . Reading of table entries with updates or without . No authorization checks when reading with “SELECT” . Effect of a lack of authorization check . “AUTHORITY CHECK” . Defective authorization check . WHERE clause – general overview . An overview of the various WHERE conditions (for . Getting acquainted with the further operands and operators . Brief descriptions of the mode of operation of . A seperate topic of … . The WHERE clause (general description) . The basic command: “SELECT command . The various clauses of the SELECT command . SELECT clause . INTO clause . FROM clause . WHERE clause . GROUP clause . ORDER clause . The WHERE clause in various commands . SELECT … WHERE condition . UPDATE etab SET tf1… WHERE condition … . DELETE FROM etab WHERE condition … . OPEN CURSOR cf1 FOR SELECT … WHERE . LOOP AT itab WHERE condition . The targeted application of the WHERE clause – . The extent of the WHERE clause . WHERE clauses with static elements . The logical operators in WHERE conditions . SELECT … WHERE tf1 logop v2/lit … . The boolean operators in WHERE conditions . SELECT … logBed1 AND logBed2… . SELECT … logBed1 OR logBed2… . SELECT … NOT condition … . SELECT … logBed1 AND ( LogBed2 OR LogBed2 ) . String operators . SELECT … WHERE tf1 LIKE v2/lit . SELECT … WHERE tf1 IS ZERO . LOOP AT itab WHERE itf1 strOp v2/lit . Range operators . SELECT … WHERE tf1 IN (v2, lit…) . SELECT … WHERE tf1 BETWEEN v2/lit AND v3/lit . WHERE clauses with dynamic elements . SELECT … WHERE (itab) . SELECT … WHERE logBed AND (itab) . SELECT … WHERE tf1 IN itab . SELECT … FOR ALL ENTRIES in vtab WHERE logCondition . When the the WHERE clause is . SELECT … . DELETE . UPDATES . OPEN CURSOR … . The tasks of the WHERE clause . SELECT * FROM etab WHERE condition . DELETE FROM etab WHEREcondition . Brief commentary example . UPDATE etab … WHERE condition . Brief commentary example . LOOP AT itab WHERE condition . Brief commentary example . Several individual conditions are combined to . WHERE conditions in “SELECT”, “UPDATE”, “DELETE” . WHERE conditions in LOOP AT itab . AND concatenation . OR concatenation . NOT function . The field type of the comparison value (WHERE tfeld . No relative addressing in the case of external tables . External tables . Internal tables . The primary key fields (= fast access) . Primary key not named completely in WHERE clause . The table fields of the function section . The sequence of the where-fields is all-important . If the WHERE clause is missing in the SELECT command . Pay attention to the selection volume . ORDER BY PRIMARY KEY . ORDER BY tf1 tf2 tfx . External table types and the various . Other external table types . Internal table handling . Most string operators also work with … . Relative addressing only in “LOOP … WHERE …” . Process internal tables with “WHERE …” . General working method in “LOOP AT itab …” . Reduce and economize on runtimes