ABAP Interview

Embed Size (px)

Citation preview

  • 7/27/2019 ABAP Interview

    1/17

    http://www.youtube.com/watch?v=ILrM6GSgCDE&list=RD02WSiXhe8Rq08

    Very good Chanting of God

    http://www.topdomainer.com/services/

    http://www.gampa.in/

    1) http://www.youtube.com/watch?v=Bisc3tJyryo

    2) http://www.123greetings.com/birthday/birthday_flowers/anniversa58.html

    3) http://www.youtube.com/watch?v=qPuFgJXyXBY

    4) http://www.youtube.com/watch?v=Mmke73EQZ08&list=PL2CCA3C3B15E1A89B

    5) http://www.youtube.com/watch?v=LuYND_k2UZs

    India Payrolls :

    1) Financial Year starts on April 1st.

    2) Payroll Driver Program ------> HINCALC0.

    Payroll Driver Program Transaction Code ------> PC00_M40_CALC.

    3) Payroll Related Info types Starts on -----> 0580----> 0590.a) 0581 -----> HRA b) 0583 -----> Car Allowance. c) 0585 ------> 80D Deductions .

    d) 0586 -----> 80C Deductions e) 0587 -------> PF

    4) Indian Payroll Schema -----> IN00.

    5) We have PF, HRA components in Indian Payslips.

    6) Payslips will be Generated ------> Monthly ------> 12.

    7) Benefits in India Payrolls ------>

    a) 0167 -------> Health Plans . b) 0168 -------> Insurance Plans .

    c) 0169 -------> Savings Plans . d) 0171 -------> General Benefits .

    e) 0376 -------> Medical Benefits Information.

    USA Payrolls :

    1) Financial Year starts on January 1st.

    2) Payroll Driver Program ------> RPCALCU0.

    Payroll Driver Program Transaction Code ------> PC00_M10_CALC.

    3) Payroll Related Info types ----->

    a) 0194 ------> Garnishment Document

    b) 0195 ------> Garnishment Order.

    c) 0207 ------> Residence Tax .

    d) 0208 ------> Work Tax.

    e) 0209 ------> Unemployee Tax.

    f) 0210 ------> With Holding .

    http://www.youtube.com/watch?v=ILrM6GSgCDE&list=RD02WSiXhe8Rq08http://www.youtube.com/watch?v=ILrM6GSgCDE&list=RD02WSiXhe8Rq08http://www.topdomainer.com/services/http://www.topdomainer.com/services/http://www.gampa.in/http://www.gampa.in/http://www.youtube.com/watch?v=Bisc3tJyryohttp://www.youtube.com/watch?v=Bisc3tJyryohttp://www.123greetings.com/birthday/birthday_flowers/anniversa58.htmlhttp://www.123greetings.com/birthday/birthday_flowers/anniversa58.htmlhttp://www.youtube.com/watch?v=qPuFgJXyXBYhttp://www.youtube.com/watch?v=qPuFgJXyXBYhttp://www.youtube.com/watch?v=Mmke73EQZ08&list=PL2CCA3C3B15E1A89Bhttp://www.youtube.com/watch?v=Mmke73EQZ08&list=PL2CCA3C3B15E1A89Bhttp://www.youtube.com/watch?v=LuYND_k2UZshttp://www.youtube.com/watch?v=LuYND_k2UZshttp://www.youtube.com/watch?v=LuYND_k2UZshttp://www.youtube.com/watch?v=Mmke73EQZ08&list=PL2CCA3C3B15E1A89Bhttp://www.youtube.com/watch?v=qPuFgJXyXBYhttp://www.123greetings.com/birthday/birthday_flowers/anniversa58.htmlhttp://www.youtube.com/watch?v=Bisc3tJyryohttp://www.gampa.in/http://www.topdomainer.com/services/http://www.youtube.com/watch?v=ILrM6GSgCDE&list=RD02WSiXhe8Rq08
  • 7/27/2019 ABAP Interview

    2/17

    4) USA Payroll Schema -----> U000.

    5) Payslips will be Generated ------> Monthly ------> 12.

    Semi-Monthly -------> 24.

    Bi-Weekly -------> 26.

    Weekly --------> 52.

    Non-Standard --------> 20 or 22.6) Benefits in USA Payrolls ------>

    a) 0170 ------> Flexible Spending Accounts .

    b) COBRA Benefits ------> Consolidated O Mini Bus Reconciliation Act.

    c) Garnishments.

    d) Savings Bond Purchase.

    Personnel Actions : Transaction code ------> PA40.

    1) Classical 2) Interactive 3) LDB Reports 4) SAP Queries 5) ALV Reports

    6) Report Writer / Report Painter. 7) Views .

    3) LDB Reports ----> SE36 -----> a) PNP -----> GET PERNR.

    B) PNPCE -----> GET PERAS .

    C) PCH -----> GET OBJEC .

    D) PAP ------> GET APPLICANT.

    E) TRVCP .

    4) SAP Queries --------> a) SQ01 ------> SAP Queries.

    b) SQ02 -------> Info Group.

    c) SQ03 -------> User Group Dependency.

    a) Simple List b) Statistical Reports ------> AVG, MIN, MAXc) Ranked List ------> Analytical Purpose.

  • 7/27/2019 ABAP Interview

    3/17

    5) ALV Reports

    TYPE-POOLS SLIS.

    a) REUSE_ALV_LIST_DISPLAY.

    B) REUSE_ALV_GRID_DISPLAY.

    C) RESUSE_ALV_COMMENTARY_WRITE.

    D) REUSE_ALV_FIELDCATALOG_MERGE.E) REUSE_ALV_EVENTS _GET.

    a) Hiring.

    b) Rehiring.

    c) Transfer.

    d) Retirement.e) Change in Pay .

    f) Change in Organizational Unit.

    g) Severance.

    1) INS 2) COP 3) LIS9 4) MOD 5) DEL 6) EDQ

    Sum:

    You can only use this statement within a LOOP. If you use SUM in an AT - ENDAT block, the system calculatestotals for the numeric fields of all lines in the current line group and writes them to the corresponding fields in

    the work area. If you use the SUM statement outside an AT - ENDAT block (single entry processing), the system

    calculates totals for the numeric fields of all lines of the internal table in each loop pass and writes them to the

    corresponding fields of the work area. It therefore only makes sense to use the SUM statement in AT...ENDAT

    blocks. If the table contains a nested table, you cannot use the SUM statement. Neither can you use it if you are

    using a field symbol instead of a work area in the LOOP statement.

    Collect:

    If an entry with the same key already exists, the COLLECT statement does not append a new line, but adds the

    contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry.

    You can also go through this:

    SUM:

    When processing an internal table in a block starting with LOOP and concluded by ENDLOOP , SUM calculates

    the control totals of all fields of type I , F and P (see also ABAP/4 number types ) and places them in the

    LOOP output area (header line of the internal table or an explicitly specified work area).

    When you use SUM in a LOOP with an explicitly specified output area, this output area must be compatible with

    the line type of the internal table.When using LOOP to process a sorted extract (see SORT ), the control totalof f at the end of the group appears in the field SUM(f) - - if f is type I , F or P .

  • 7/27/2019 ABAP Interview

    4/17

    COLLECT:

    COLLECT is used to create unique or compressed datsets. The key fields are the default key fields of the internal

    table itab .

    If you use only COLLECT to fill an internal table, COLLECT makes sure that the internal table does not contain

    two entries with the same default key fields.

    If, besides its default key fields, the internal table contains number fields,the contents of these number fields are

    added together if the internal table already contains an entry with the same key fields.

    If the default key of an internal table processed with COLLECT is blank, all the values are added up in the

    first table line.

    If you specify wa INTO , the entry to be processed is taken from the explicitly specified work area wa . If not, i t

    comes from the header line of the internal table itab .

    After COLLECT , the system field SY-TABIX contains the index of the - existing or new - table entry with default

    key fields which match those of the entry to be processed.

    COLLECT can create unique or compressed datasets and should be used precisely for this purpose. If

    uniqueness or compression are unimportant, or two values with identical default key field values could not

    possibly occur in your particular task, you should use APPEND instead. However, for a unique or compressed

    dataset which is also efficient, COLLECT is the statement to use.

    If you process a table with COLLECT , you should also use COLLECT to fill it. Only by doing this can you

    guarantee that the internal table will actually be unique or compressed, as described above and COLLECT willrun very efficiently.

    If you use COLLECT with an explicitly specified work area, it must be compatible with the line type of the internal

    table.

    ******************************************************************

    SUM.

    Effect

    When processing an internal table in a block starting with LOOP and concluded by ENDLOOP, SUM calculatesthe control totals of all fields of type I, F and P (see also ABAP number types) and places them in the LOOP

    output area (header line of the internal table or an explicitly specified work area).

    You can use the SUM statement both at the end and the beginning of a control group (see also AT FIRST/LAST).

    Example

    Display the table T with sub-totals:

    TYPES: BEGIN OF T_TYPE,

  • 7/27/2019 ABAP Interview

    5/17

    CODE(4),

    SALES TYPE P,

    DISCOUNT TYPE P,

    END OF T_TYPE.

    DATA: T TYPE STANDARD TABLE OF T_TYPE WITH NON-UNIQUEDEFAULT KEY INITIAL SIZE 100,

    WA_T TYPE T_TYPE.

    ...

    LOOP AT T INTO WA_T.

    AT FIRST.

    SUM.

    WRITE: /4 'Grand Total:',

    20 WA_T-SALES, 40 WA_T-DISCOUNT.

    ULINE. SKIP.

    ENDAT.

    WRITE: / WA_T-CODE,20 WA_T-SALES, 40 WA_T-DISCOUNT.

    AT END OF CODE.

    SUM.

    WRITE: / WA_T-CODE, 10 'Total:',

    20 WA_T-SALES, 40 WA_T-DISCOUNT.

    SKIP.

    ENDAT.

    ENDLOOP.

    Example

    Summarized sales figures by company:

    COLLECT

    Effect

    COLLECT allows you to create unique or summarized datasets. The system first tries to find a table entry

    corresponding to the table key. (See also Defining Keys for Internal Tables). The key values are taken either from

    the header line of the internal table itab, or from the explicitly-specified work area wa. The line type of itab must

    be flat - that is, it cannot itself contain any internal tables. All the components that do not belong to the key must

    be numeric types ( ABAP Numeric Types).

    If the system finds an entry, the numeric fields that are not part of the table key (see ABAPNumeric Types) are

    added to the sum total of the existing entries. If it does not find an entry, the system creates a new entry instead.

    The way in which the system finds the entries depends on the kind of the internal table:

    TYPES: BEGIN OF COMPANY,

    NAME(20) TYPE C,

    SALES TYPE I,

    END OF COMPANY.

    DATA: COMP TYPE COMPANY,

  • 7/27/2019 ABAP Interview

    6/17

    COMPTAB TYPE HASHED TABLE OF COMPANY

    WITH UNIQUE KEY NAME.

    COMP-NAME = 'Duck'. COMP-SALES = 10. COLLECT COMP INTO COMPTAB.

    COMP-NAME = 'Tiger'. COMP-SALES = 20. COLLECT COMP INTO COMPTAB.

    COMP-NAME = 'Duck'. COMP-SALES = 30. COLLECT COMP INTO COMPTAB.

    Table COMPTAB now has the following contents:

    NAME | SALES

    SUM.

    When processing an internal table in a block starting with LOOP and concluded by ENDLOOP , SUM calculatesthe control totals of all fields of type I , F and P (see also ABAP/4 number types ) and places them in theLOOP output area (header line of the internal table or an explicitly specified work area).

    When you use SUM in a LOOP with an explicitly specified output area, this output area must be compatible withthe line type of the internal table.When using LOOP to process a sorted extract (see SORT ), the control total of fat the end of the group appears in the field SUM(f) - - if f is type I , F or P .

    COLLECT.

    COLLECT is used to create unique or compressed datsets. The key fields are the default key fields of the internaltable itab .

    If you use only COLLECT to fill an internal table, COLLECT makes sure that the internal table does not containtwo entries with the same default key fields.

    If, besides its default key fields, the internal table contains number fields,the contents of these number fields areadded together if the internal table already contains an entry with the same key fields.

    If the default key of an internal table processed with COLLECT is blank, all the values are added up in thefirst table line.

    If you specify wa INTO , the entry to be processed is taken from the explicitly specified work area wa . If not, itcomes from the header line of the internal table itab .

    After COLLECT , the system field SY-TABIX contains the index of the - existing or new - table entry with defaultkey fields which match those of the entry to be processed.

    COLLECT can create unique or compressed datasets and should be used precisely for this purpose. Ifuniqueness or compression are unimportant, or two values with identical default key field values could notpossibly occur in your particular task, you should use APPEND instead. However, for a unique or compresseddataset which is also efficient, COLLECT is the statement to use.

    If you process a table with COLLECT , you should also use COLLECT to fill it. Only by doing this can youguarantee that the internal table will actually be unique or compressed, as described above and COLLECT willrun very efficiently.

    If you use COLLECT with an explicitly specified work area, it must be compatible with the line type of the internaltable.COLLECT allows you to create unique or summarized datasets. The system first tries to find a table entrycorresponding to the table key. The key values are taken either from the header line of the internal table itab, or

    from the explicitly-specified work area.If the system finds an entry, the numeric fields that are not part of the table key (see ABAP number types) areadded to the sum total of the existing entries. If it does not find an entry, the system creates a new entry instead.

  • 7/27/2019 ABAP Interview

    7/17

    The way in which the system finds the entries depends on the type of the internal table:

    - STANDARD TABLE:The system creates a temporary hash administration for the table to find the entries. This means that the runtimerequired to find them does not depend on the number of table entries. The administration is temporary, since it isinvalidated by operations like DELETE, INSERT, MODIFY, SORT, ...). A subsequent COLLECT is then no longerindependent of the table size, because the system has to use a linear search to find entries. For this reason, you

    should only use COLLECT to fill standard tables.

    - SORTED TABLE:The system uses a binary search to find the entries. There is a logarithmic relationship between the number oftable entries and the search time.

    1. What is ALV programming in ABAP? When is this grid used in ABAP?-

    a) ALV is Application List viewer. Sap provides a set of ALV (ABAP LIST VIEWER) function modules

    which can be put into use to embellish the output of a report.

    b) This set of ALV functions is used to enhance the readability and functionalityof any report

    output.

    c) Cases arise in sap when the output of a report contains columns extending more than

    255 characters in length.

    d) In such cases, this set of ALV functions can help choose selected columns and arrange the different

    columns from a report output and also save different variants for report display. This is a very efficient

    tool for dynamically sorting and arranging the columns from a report output.

    e) The report output can contain up to 90 columns in the display with the wide array of display

    options.

    2. What are the Disadvantages of LDB ?

    i) If you don't specify a logical database in the program attributes, the GET events never occur.

    ii)There is no ENDGET command, so the code block associated with an event ends with the next event

    statement (such as another GET or an END-OF-SELECTION).

    The GET Statement end with either GET LATE (OR) END-OF-SELCTION Statement.

    3.What is a batch input session?-

    BATCH INPUT SESSION is an intermediate step between internal table and database table. Data along

    with the action is stored in session ie data for screen fields, to which screen it is passed, program name

    behind it, and how next screen is processed.

    4.What is the difference between macro and subroutine?-

    a) Macros can only be used in the program the are defined in and only after the definition are expanded

    at compilation / generation.

    Subroutines (FORM) can be called from both the program the are defined in and other programs .

  • 7/27/2019 ABAP Interview

    8/17

    b) A MACRO is more or less an abbreviation for some lines of code that are used more than once or

    twice. A FORM is a local subroutine (which can be called external). A FUNCTION is (more or less) a

    subroutine that is called external.

    c) Since debugging a MACRO is not really possible, prevent the use of them (Ive never used them,

    but seen them in action). If the subroutine is used only local (called internal) use a FORM. If thesubroutine is called external (used by more than one program) use a FUNCTION.

    5) What are the phases of background processing?

    a) Job Scheduling. Tcode is ----> SM36.

    b) Job Processing.

    c) Job Overview.

    6) What is a Spool request?

    Spool requests are generated during dialog or background processing and placed in the spool

    database with information about the printer and print format. The actual data is places in theTem Se (Temporary Sequential objects).

    7) What is a Table attribute?

    The table's attributes determine who is responsible for maintaining a table and which types of access

    are allowed for the table. The most important table attributes are:

    a) Delivery class.

    b) Table maintenance allowed.

    c) Activation type.

    8) What is the significance of Delivery Class?The delivery class controls the degree to which the SAP or the customer is responsible for table

    maintenance.

    a) Whether SAP provides the table with or without contents.

    b) Determines the table type.

    c) Determines how the table behaves when it is first installed, at upgrade, when it is transported,

    and when a client copy is performed.

    9) What is the max. no. Of structures that can be included in a table or structure.

    9, Nine.

    10 ) To how many tables can an append structure be assigned.

    1, One.11) What are the aggregate objects in the Dictionary?

    a) Views

    b) Match Code.

    c) Lock Object.

    12) What is a view?

    A view is a logical view on one or more tables. A view on one or more tables i.e., the data from a

    view is not actually physically stored instead being derived from one or more tables.

    13) What are the different types of parameters?

    Formal Parameters: Parameters, which are defined during the definition of subroutine with the FORM

    statement

  • 7/27/2019 ABAP Interview

    9/17

    Actual Parameters: Parameters which are specified during the call of a subroutine with the PERFORM

    statement.

    14) Difference between Value table and check table?

    Value Table : Domain level Validations.

    Check table : Data element level validations.

    15) Personnel Actions related Tcode ------> PA40

    Dynamic Actions related Tcode -------> SM30 or SM31.

    Dynamic Actions related Table is -------> V_T588Z.

    Fast Entry Actions related Tcode ------> PA42 .

    Fast Entry Actions related Table ------> T529A.

    16) Off-Cycle Payrolls Tcode ------> PUOC_10.

    Special Payments or Bonuses or Payments Reversals we have to run Off -Cycle Payrolls.

    Off-cycle Payments related info type ------> 0267.

    17) Implicit Enhancements :

    EDIT ------> Enhancement Operations -------> Show Implicit Enhancement Options.

    a) Start or End of any Program either

    a) Executable Program .

    b) Include Program.

    c) Subroutine Pool.

    d) Function Pool.

    b) Start or End of Form .

    c) End of Structure.

    d) End of class either it may be Public or Protected or Private.

    18) Table Maintenance Generator

    To check it go to SM30 . In SM30, we find display, Maintain options.

  • 7/27/2019 ABAP Interview

    10/17

  • 7/27/2019 ABAP Interview

    11/17

    ABAP Performance Standards

    By Tejaswini

    Following are the performance standards need to be following in writing ABAP programs:

    1. Unused/Dead code

    Extended Program Checking Transaction code ------> SLIN

    Avoid leaving unused code in the program. Either comment out or delete the unused situation.Use program --> check --> extended program to check for the variables, which are not usedstatically.

    2. Subroutine Usage

    For good modularization, the decision of whether or not to execute a subroutine should be made

    before the subroutine is called. For example:

    This is better:IF f1 NE 0.

    PERFORM sub1.

    ENDIF.

    FORM sub1....

    ENDFORM.

    Than this:

    PERFORM sub1.

    FORM sub1.IF f1 NE 0.

    ...ENDIF.

    ENDFORM.

    3. Usage of IF statements

    When coding IF tests, nest the testing conditions so that the outer conditions are those which aremost likely to fail. For logical expressions with AND , place the mostly likely false first and for theOR, place the mostly likely true first.

    Example - nested IF's:

    IF (least likely to be true).

    IF (less likely to be true).

    IF (most likely to be true).ENDIF.

  • 7/27/2019 ABAP Interview

    12/17

    ENDIF.ENDIF.

    Example - IF...ELSEIF...ENDIF :

    IF (most likely to be true).

    ELSEIF (less likely to be true).

    ELSEIF (least likely to be true).

    ENDIF.

    Example - AND:

    IF (least likely to be true) AND(most likely to be true).

    ENDIF.

    Example - OR:

    IF (most likely to be true) OR(least likely to be true).

    4. CASE vs. nested Ifs

    When testing fields "equal to" something, one can use either the nested IF or the CASE statement.The CASE is better for two reasons. It is easier to read and after about five nested IFs the

    performance of the CASE is more efficient.

    5. MOVE statements

    When records a and b have the exact same structure, it is more efficient to MOVE a TO b than toMOVE-CORRESPONDING a TO b.

    MOVE BSEG TO *BSEG.

    is better than

    MOVE-CORRESPONDING BSEG TO *BSEG.

    6. SELECT and SELECT SINGLE

    When using the SELECT statement, study the key and always provide as much of the left-most partof the key as possible. If the entire key can be qualified, code a SELECT SINGLE not just aSELECT. If you are only interested in the first row or there is only one row to be returned, usingSELECT SINGLE can increase performance by up to three times.

    7. Small internal tables vs. complete internal tables

    In general it is better to minimize the number of fields declared in an internal table. While it may be

    convenient to declare an internal table using the LIKE command, in most cases, programs will not useall fields in the SAP standard table.

  • 7/27/2019 ABAP Interview

    13/17

    For example:

    Instead of this:

    data: t_mara like mara occurs 0 with header line.

    Use this:

    data: begin of t_mara occurs 0,

    matnr like mara-matnr,...

    end of t_mara.

    8. Row-level processing and SELECT SINGLE

    Similar to the processing of a SELECT-ENDSELECT loop, when calling multiple SELECT-SINGLEcommands on a non-buffered table (check Data Dictionary -> Technical Info), you should do thefollowing to improve performance:

    o Use the SELECT into to buffer the necessary rows in an internal table, then

    o sort the rows by the key fields, then

    o use a READ TABLE WITH KEY ... BINARY SEARCH in place of the SELECT SINGLE

    command. Note that this only make sense when the table you are buffering is not toolarge (this decision must be made on a case by case basis).

    9. READing single records of internal tables

    When reading a single record in an internal table, the READ TABLE WITH KEY is not a direct READ.This means that if the data is not sorted according to the key, the system must sequentially read thetable. Therefore, you should:

    o SORT the table

    o use READ TABLE WITH KEY BINARYSEARCH for better performance.10. SORTing internal tables

    When SORTing internal tables, specify the fields to SORTed.

    SORT ITAB BY FLD1 FLD2.

    is more efficient than

    SORT ITAB.

    11. Number of entries in an internal table

    To find out how many entries are in an internal table use DESCRIBE.

    DESCRIBE TABLE ITAB LINES CNTLNS.

    is more efficient than

  • 7/27/2019 ABAP Interview

    14/17

    LOOP AT ITAB.

    CNTLNS = CNTLNS + 1.

    ENDLOOP.

    12. Performance diagnosis

    To diagnose performance problems, it is recommended to use the SAP transaction SE30, ABAP/4Runtime Analysis. The utility allows statisticalanalysis of transactions and programs.

    13. Nested SELECTs versus table views

    Since releASE 4.0, OPEN SQL allows both inner and outer table joins. A nested SELECT loop maybe used to accomplish the same concept. However, the performance of nested SELECT loops isvery poor in comparison to a join. Hence, to improve performance by a factor of 25x and reducenetwork load, you should either create a view in the data dictionary then use this view to select data,or code the select using a join.

    14. If nested SELECTs must be used

    As mentioned previously, performance can be dramatically improved by using views instead of nestedSELECTs, however, if this is not possible, then the following example of using an internal table in anested SELECT can also improve performance by a factor of 5x:

    Use this:form select_good.

    data: t_vbak like vbak occurs 0 with header line.data: t_vbap like vbap occurs 0 with header line.

    select * from vbak into table t_vbak up to 200 rows.select * from vbap

    for all entries in t_vbakwhere vbeln = t_vbak-vbeln.

    ...endselect.

    endform.

    Instead of this:form select_bad.

    select * from vbak up to 200 rows.

    select * from vbap where vbeln = vbak-vbeln....

    endselect.

    endselect.

    endform.

    Although using "SELECT...FOR ALL ENTRIES IN..." is generally very fast, you should be aware of

    the three pitfalls of using it:

  • 7/27/2019 ABAP Interview

    15/17

    Firstly, SAP automatically removes any duplicates from the rest of the retrieved records. Therefore, ifyou wish to ensure that no qualifying records are discarded, the field list of the inner SELECT must bedesigned to ensure the retrieved records will contain no duplicates (normally, this would meanincluding in the list of retrieved fields all of those fields that comprise that table's primary key).

    Secondly, if you were able to code "SELECT ... FROM FOR ALL ENTRIES IN

    TABLE " and the internal table is empty, then all rows from will beretrieved.

    Thirdly, if the internal table supplying the selection criteria (i.e. internal table in the example"...FOR ALL ENTRIES IN TABLE ") contains a large number of entries, performancedegradation may occur.

    15. SELECT * versus SELECTing individual fields

    In general, use a SELECT statement specifying a list of fields instead of a SELECT * to reducenetwork traffic and improve performance. For tables with only a few fields the improvements may beminor, but many SAP tables contain more than 50 fields when the program needs only a few. In the

    latter case, the performace gains can be substantial. For example:

    Use:

    select vbeln auart vbtyp from table vbak

    into (vbak-vbeln, vbak-auart, vbak-vbtyp)

    where ...

    Instead of using:

    select * from vbak where ...

    16. Avoid unnecessary statements

    There are a few cases where one command is better than two. For example:

    Use:

    append to .

    Instead of:

    = .

    append (modify ).

    And also, use:

    if not [] is initial.

    Instead of:

    describe table lines .

    if > 0.

  • 7/27/2019 ABAP Interview

    16/17

    17. Copying or appending internal tables

    Use this:

    [] = []. (if is empty)

    Instead of this:

    loop at .

    append to .

    endloop.

    However, if is not empty and should not be overwritten, then use:

    append lines of [from index1] [to index2] to .

  • 7/27/2019 ABAP Interview

    17/17