free download sap,abap,basis,fico information matefree download sap,abap,basis,fico information mateABAP report Interactive Report ALV grid ALV list IDOC User Exit RFC Smartform sapscript ABAP Performance Remote Function Module Free SAP ABAP BASIS FICO MM SD CRM PP HR Books and Interview Questions ABAP Interview Questions BDC BAPI ALE BADI EDI In
Articles:
1, 2
Articles
SAP ABAP Program Code Using a dynamic table name
2008-02-17 09:55:00 *&----------------------------------- ----------------------------------**& Chapter 11: Using a dynamic table name*&------------------------------- --------------------------------------*RE PORT CHAP1110.* Variables for later useDATA: TABLENAME(10), COUNT_ROWS TYPE I.* Setting the table name dynamicallyMOVE 'CUSTOMERS' TO TABLENAME.* Selecting dataSELECT COUNT( * ) FROM (TABLENAME) INTO COUNT_ROWS.WRITE: TABLENAME, COUNT_ROWS. More About: Code , Program , Table , Dynamic
SAP ABAP Program Code Using Select-Options
2008-02-17 09:55:00 *&----------------------------------- ----------------------------------**& Chapter 11: Using Select -Options *&--------------------- ----------------------------------------- -------*REPORT CHAP1109.* Work areaTABLES CUSTOMERS.* Specifiying a Select-OptionSELECT-OPTIONS SNAME FOR CUSTOMERS-NAME.* Internal table for later useDATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE.* Reading table entries according to a Select-OptionSELECT * FROM CUSTOMERS INTO TABLE ALL_CUSTOMERS WHERE NAME IN SNAME.* Displaying the reusltLOOP AT ALL_CUSTOMERS. WRITE: / ALL_CUSTOMERS-CITY, ALL_CUSTOMERS-NAME.ENDLOOP. More About: Code , Program
SAP ABAP Program Code Ordering query results
2008-02-17 09:54:00 *&----------------------------------- ----------------------------------**& Chapter 11: Ordering query results*&---------------------------- ----------------------------------------- *REPORT CHAP1108.* Work areaTABLES CUSTOMERS.* Reading table entries in a specified orderSELECT * FROM CUSTOMERS ORDER BY CITY NAME. WRITE: / CUSTOMERS-CITY, CUSTOMERS-NAME.ENDSELECT. More About: Results , Code , Program , Query
SAP ABAP Program Code Getting statistical information
2008-02-17 09:54:00 *&----------------------------------- ----------------------------------**& Chapter 11: Getting statistical information*&------------------------ ----------------------------------------- ----*REPORT CHAP1107.* Work area for a database tableTABLES: BOOKINGS, ACTFLI.* Variables for later useDATA: COUNT_BOOKINGS TYPE I, AVERAGE_SEATS_OCCUPIED LIKE ACTFLI-SEATSOCC, MAX_SEATS LIKE ACTFLI-SEATSMAX.* Getting the number of selected entriesSELECT COUNT(*) FROM BOOKINGS INTO COUNT_BOOKINGS WHERE ORDER_DATE >= '19990101'.WRITE COUNT_BOOKINGS.* Average and maximumSELECT AVG( SEATSOCC ) MAX( SEATSMAX ) FROM ACTFLI INTO (AVERAGE_SEATS_OCCUPIED,MAX_SEATS).WRITE: / AVERAGE_SEATS_OCCUPIED, MAX_SEATS. More About: Information , Code , Program
SAP ABAP Program Code Reading single entries
2008-02-17 09:53:00 *&----------------------------------- ----------------------------------**& Chapter 11: Reading single entries*&---------------------------- ----------------------------------------- *REPORT CHAP1105.* Work area for a database tableTABLES CUSTOMERS.* Reading a single entrySELECT SINGLE * FROM CUSTOMERS WHERE ID = '87654321'.IF SY-SUBRC = 0. WRITE CUSTOMERS-NAME.ELSE. WRITE 'Customer not found.'.ENDIF. More About: Code , Program , Single
SAP ABAP Program Code Selecting single fields
2008-02-17 09:53:00 *&----------------------------------- ----------------------------------**& Chapter 11: Selecting single fields*&----------------------------- ----------------------------------------* REPORT CHAP1106.* Work area for a database tableTABLES CUSTOMERS.* Selecting single fieldsDATA: CID LIKE CUSTOMERS-ID, CNAME LIKE CUSTOMERS-NAME.SELECT ID NAME INTO (CID,CNAME) FROM CUSTOMERS. WRITE: / CID, CNAME.ENDSELECT. More About: Code , Program , Single , Fields
SAP ABAP Program Code Using where clauses
2008-02-17 09:52:00 *&----------------------------------- ----------------------------------**& Chapter 11: Using where clauses*&---------------------------- ----------------------------------------- *REPORT CHAP1104.* Work areasTABLES: BOOKINGS, CUSTOMERS.* Internal tablesDATA CUSTOMER_ORDERS LIKE BOOKINGS OCCURS 100 WITH HEADER LINE.DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE.* Selecting data with a simple where clauseSELECT * FROM BOOKINGS INTO TABLE CUSTOMER_ORDERS WHERE ORDER_DATE = '19990101'.* Displaying the resultLOOP AT CUSTOMER_ORDERS. WRITE / CUSTOMER_ORDERS-FLDATE.ENDLOOP.* Selecting data with a complex where clauseSELECT * FROM BOOKINGS INTO TABLE CUSTOMER_ORDERS WHERE CUSTOMID = '87654321' AND ORDER_DATE >= '19990101'.* Displaying the resultSKIP.LOOP AT CUSTOMER_ORDERS. WRITE / CUSTOMER_ORDERS-FLDATE.ENDLOOP.* Selecting data with a complex where clauseSELECT * FROM CUSTOMERS INTO TABLE ALL_CUSTOME... More About: Code , Program
SAP ABAP Program Code Using internal tables as snapshots of database tables
2008-02-17 09:52:00 *&----------------------------------- ----------------------------------**& Chapter 11: Using internal tables as snapshots of database tables*&----------------------------- ----------------------------------------* REPORT CHAP1103.* Work area for a database tableTABLES CUSTOMERS.* Internal tableDATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE.* Filling the internal table with all entries of the database tableSELECT * FROM CUSTOMERS INTO TABLE ALL_CUSTOMERS.* Displaying the contents of the internal tableLOOP AT ALL_CUSTOMERS. WRITE: / ALL_CUSTOMERS-NAME.ENDLOOP. More About: Tables , Code , Database , Program
SAP ABAP Program Code Using an alternative work area
2008-02-17 09:52:00 *&----------------------------------- ----------------------------------**& Chapter 11: Using an alternative work area*&------------------------------- --------------------------------------*RE PORT CHAP1102.* Work area for a database tableTABLES CUSTOMERS.* alternative work areaDATA MY_CUSTOMER LIKE CUSTOMERS.* Reading all entries of the database tableSELECT * FROM CUSTOMERS INTO MY_CUSTOMER. WRITE: / MY_CUSTOMER-NAME.ENDSELECT. More About: Alternative , Code , Program , Area
SAP ABAP Program Code A simple query
2008-02-17 09:51:00 *&----------------------------------- ----------------------------------**& Chapter 11: A simple query*&------------------------------ ---------------------------------------*R EPORT CHAP1101.* Work area for a database tableTABLES CUSTOMERS.* Reading all entries of the database tableSELECT * FROM CUSTOMERS. WRITE: / CUSTOMERS-NAME.ENDSELECT. More About: Code , Simple , Program , Query
SAP ABAP Program Code Recursive calls
2008-02-17 09:51:00 *&----------------------------------- ----------------------------------**& Chapter 10: Recursive calls*&------------------------------ ---------------------------------------*R EPORT CHAP1011.* Variable for later useDATA: NUMBER TYPE I VALUE 5, RESULT TYPE I VALUE 1.* Calling a form from the main programPERFORM FACTORIAL.WRITE RESULT.* Defining a form with a recursive callFORM FACTORIAL. IF NUMBER EXIT. ENDIF. RESULT = RESULT * NUMBER. NUMBER = NUMBER - 1. PERFORM FACTORIAL.ENDFORM. More About: Calls , Code , Program
SAP ABAP Program Code Calling a function
2008-02-17 09:50:00 *&----------------------------------- ----------------------------------**& Chapter 10: Calling a function*&--------------------------- ----------------------------------------- -*REPORT CHAP1010.* Variable for later useDATA: X TYPE I VALUE 5, Y LIKE X VALUE 7, MAXIMUM LIKE X.* Calling a functionCALL FUNCTION 'MAX_TEST' EXPORTING A = X B = Y IMPORTING MAX = MAXIMUM.WRITE MAXIMUM. More About: Code , Program , Function
SAP ABAP Program Code Form parameters with generic types
2008-02-17 09:50:00 *&----------------------------------- ----------------------------------**& Chapter 10: Form parameters with generic types*&------------------------------ ---------------------------------------*R EPORT CHAP1009.* Variable for later useDATA: SHORT_STRING(3) VALUE 'AB', SHORT_NUMBER(3) TYPE N VALUE '0', ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100.* Calling forms with different actual parameters* Correct call (actual paramter is of type c)PERFORM WRITE_FIRST_CHARACTER CHANGING SHORT_STRING.* Inccorrect call (actual paramter is not of type c)*perform write_first_character changing short_number.* Correct call (actual paramter is a table)PERFORM SORT_AND_SEARCH_IN_TABLE CHANGING ALL_CUSTOMERS.* Form parameters with generic typesFORM WRITE_FIRST_CHARACTER CHANGING F_STRING TYPE C. SHIFT F_STRING LEFT DELETING LEADING SPACE. WRITE AT (1) F_STRING.ENDFORM.FORM SORT_AND_SEARCH_IN_TABLE CHANGING F_TABLE TYPE TABLE. SORT F_TABLE. SEARCH F_TABLE FOR 'Smith'.ENDFORM. More About: Code , Program , Types , Generic
SAP ABAP Program Code Form parameters without type reference
2008-02-17 09:50:00 *&----------------------------------- ----------------------------------**& Chapter 10: Form parameters without type reference*&-------------------------- ----------------------------------------- --*REPORT CHAP1008.* Variable for later useDATA: STRING_1(2) VALUE 'AB', STRING_2(8) VALUE ' ABAP/4'.* Calling forms with different actual parametersPERFORM WRITE_FIRST_CHARACTER CHANGING: STRING_1, STRING_2.* Form parameters without type referenceFORM WRITE_FIRST_CHARACTER CHANGING F_STRING. SHIFT F_STRING LEFT DELETING LEADING SPACE. WRITE AT (1) F_ More About: Code , Type , Reference , Program
SAP ABAP Program Code Using table parameters
2008-02-17 09:49:00 *&----------------------------------- ----------------------------------**& Chapter 10: Using table parameters*&------------------------- ----------------------------------------- ---*REPORT CHAP1006.* Work area of database table and internal table for later useTABLES CUSTOMERS.DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 50 WITH HEADER LINE.* Calling a form with a table parameterPERFORM READ_CUSTOMERS TABLES ALL_CUSTOMERS.LOOP AT ALL_CUSTOMERS. WRITE / ALL_CUSTOMERS-NAME.ENDLOOP.* Defining a form with a table parameterFORM READ_CUSTOMERS TABLES F_CUSTOMERS STRUCTURE ALL_CUSTOMERS. SELECT * FROM CUSTOMERS INTO TABLE F_CUSTOMERS.ENDFORM. More About: Code , Program , Table
SAP ABAP Program Code Type check for form parameters
2008-02-17 09:49:00 *&----------------------------------- ----------------------------------**& Chapter 10: Type check for form parameters*&------------------------- ----------------------------------------- ---*REPORT CHAP1007.* Types and variables for later useTYPES: T_NAME_1(20), T_NAME_2(20).DATA: NAME_1 TYPE T_NAME_1, NAME_2 TYPE T_NAME_2.* Calling forms with different actual parametersPERFORM SET_NAME_LIKE CHANGING NAME_1.PERFORM SET_NAME_LIKE CHANGING NAME_2.PERFORM SET_NAME_TYPE CHANGING NAME_1.PERFORM SET_NAME_TYPE CHANGING NAME_2.* Form definition with type reference via likeFORM SET_NAME_LIKE CHANGING F_NAME LIKE NAME_2. F_NAME = 'Smith'.ENDFORM.* Form definition with type reference via typeFORM SET_NAME_TYPE CHANGING F_NAME TYPE T_NAME_2. F_NAME = 'Smith'.ENDFORM. More About: Code , Check , Program
SAP ABAP Program Code Classifying parameters
2008-02-17 09:48:00 *&----------------------------------- ----------------------------------**& Chapter 10: Classifying parameters*&------------------------- ----------------------------------------- ---*REPORT CHAP1005.* Data declarations for later useDATA: A1 TYPE P VALUE 2, A2 TYPE P VALUE 4, A3 TYPE P VALUE 8.* Calling a form with different parameter typesPERFORM CALC USING A1 A2 CHANGING A3.* Displaying the resultWRITE A3.* Defining a form with different parameter typesFORM CALC USING VALUE(F1) LIKE A1 F2 LIKE A2 CHANGING VALUE(F3) LIKE A3. F3 = F1 + ( F2 * F3 ).ENDFORM. More About: Code , Program
SAP ABAP Program Code Using interface parameters of a form
2008-02-17 09:48:00 *&----------------------------------- ----------------------------------**& Chapter 10: Using interface parameters of a form*&------------------------------- --------------------------------------*RE PORT CHAP1004.* Types and data for later useTYPES: T_NAME(20).DATA: NAME_1 TYPE T_NAME VALUE 'A', NAME_2 TYPE T_NAME VALUE 'B'.* Calling a form with different parametersPERFORM SET_NAME CHANGING NAME_1.PERFORM SET_NAME CHANGING NAME_2.* Defining a form with a parameterFORM SET_NAME CHANGING F_NAME TYPE T_NAME. WRITE F_NAME. F_NAME = 'Smith'. WRITE F_NAME.ENDFORM. More About: Code , Program , Interface , Form
SAP ABAP Program Code Using static variables
2008-02-17 09:46:00 *&----------------------------------- ----------------------------------**& Chapter 10: Using static variables*&-------------------------- ----------------------------------------- --*REPORT CHAP1003.* Calling a form twicePERFORM COUNT.PERFORM COUNT.* Defining a form with a static variableFORM COUNT. STATICS CALLS TYPE I. CALLS = CALLS + 1. WRITE CALLS.ENDFORM. More About: Code , Variables , Program , Static
SAP ABAP Program Code Local data in a form
2008-02-17 09:46:00 *&----------------------------------- ----------------------------------**& Chapter 10: Local data in a form*&------------------------------- --------------------------------------*RE PORT CHAP1002.* Global field of the programDATA FLAG VALUE 'G'.* Displaying the global fieldWRITE FLAG.* Calling a formPERFORM WRITE_FLAG.* Displaying the global field againWRITE FLAG.* Defining a form with local dataFORM WRITE_FLAG.* Local data DATA L_FLAG.* Changing and displaying local data L_FLAG = 'L'. WRITE L_FLAG.ENDFORM. More About: Data , Code , Program , Form
SAP ABAP Program Code Internal flow of control (if, case, do, while)
2008-02-17 09:45:00 *&----------------------------------- ----------------------------------**& Chapter 9: Internal flow of control (if, case, do, while)*&----------------------------- ----------------------------------------* REPORT CHAP0902.* Declarations for later useTABLES CUSTOMERS.DATA: COLOR(10) VALUE 'yellow', N(4) TYPE N VALUE '123', P TYPE P, C4(4) VALUE '124', C5(5) VALUE '00124', SQUARE_NUMBER TYPE I, X TYPE I, Y TYPE I.* Using a condition (e.g., business class or not)IF CUSTOMERS-CUSTTYPE = 'B'.* book business class WRITE 'B'.ELSE.* book economy class WRITE 'Something else'.ENDIF.* Nested if clausesIF N > 0. N = N + 1.ELSE. IF N = 0. WRITE / 'zero'. ELSE. N = N - 1. ENDIF.ENDIF.* Using elseif instead of a nested if clausesIF N > 0. N = N + 1.ELSEIF N = 0. WRITE / 'zero'.ELSE. N = N - 1.ENDIF.* Using a case clauseCASE COLOR. WHEN 'red'. WRITE 'color is red'. WHEN 'green'. WRITE 'color is green'. WHEN 'yellow'. WRITE '... More About: Code , Case , Program , Control
SAP ABAP Program Code Simple form (local subroutine of a program)
2008-02-17 09:45:00 *&----------------------------------- ----------------------------------**& Chapter 10: Simple form (local subroutine of a program)*&--------------------------- ----------------------------------------- -*REPORT CHAP1001.* Global field of the programDATA FLAG VALUE 'G'.* Displaying the global fieldWRITE FLAG.* Calling a formPERFORM SET_FLAG.* Displaying the global field againWRITE FLAG.* Defining a formFORM SET_FLAG.* Changing and displaying the global field FLAG = 'L'. WRITE FLAG.ENDFORM. More About: Code , Local , Program , Form
SAP ABAP Program Code Type-Specific Output Options
2008-02-17 09:44:00 *&----------------------------------- ----------------------------------**& Chapter 8: Type -Specific Output Options *&---------------------------- ----------------------------------------- *REPORT CHAP0808.* Specifying a format templateDATA TIME TYPE T VALUE '154633'.WRITE AT (8) TIME USING EDIT MASK '__:__:__'.* Using decimalsDATA PACKED_NUMBER TYPE P VALUE 123.WRITE PACKED_NUMBER DECIMALS 2. More About: Code , Program
SAP ABAP Program Code Multi-Language Support
2008-02-17 09:44:00 *&----------------------------------- ----------------------------------**& Chapter 8: Multi -Language Support *&---------------------------- ----------------------------------------- *REPORT CHAP0809.* Using text symbolsWRITE: / 'Literal without text symbol', / 'Original text of the source code'(001), / TEXT-002. More About: Code , Program
SAP ABAP Program Code External flow of control (events)
2008-02-17 09:44:00 *&----------------------------------- ----------------------------------**& Chapter 9: External flow of control (events)*&--------------------------- ----------------------------------------- -*REPORT CHAP0901.* Display a list of customersTABLES CUSTOMERS.SELECT * FROM CUSTOMERS. WRITE / CUSTOMERS-NAME.ENDSELECT.* Event for drill downAT LINE-SELECTION. WRITE: / 'This line appears after drill-down'. More About: Events , Code , Program , Control
Defining a Single-Line Basic List
2008-02-07 20:56:00 Suppose you want to generate a list of flight connections and the query name is G1.On the initial screen, you specify this name and select Create. Then, you choose the functional area FLBU (flight bookings) and assign a title and list format.Since you just want to generate a list of flight connections, you only need fields from the functional group Flight connections.You select the fields you require (Arrival time, Short description of airline, Point of departure, Destination, Flight connection code, Departure time) by marking them.Then, choose Basic list. On the next screen, you start to define the basic list.The following sections explain how you proceed when defining a simple basic list: Defining the Line Structure Defining Output Options for Each Line Defining Output Options for Each Field Changing Headers Graphics More About: List , Single
Defining Local Fields
2008-02-07 20:55:00 The definition of local fields allows you to generate new information from the fields in a functional area, without having to include an additional field. The functional area FLBU contains a field for the distance and a field for the flight time. A local field is used to calculate the speed. To define a local field, choose Edit ® Local field ® Create on the Select Field screen. The local field for the speed can be used as an example.When making this definition, the following information is needed:Short name Field name Here, you enter a text which describes the field contents. On all subsequent screens, the local field is identified via this name. Header This is used when calculating column headers. Please note that headers should correspond to the field output length and that they may extend over two lines. Functional group The local field is included in the functional group. Attributes When defining the technical attributes of the local field, you can use any of the f... More About: Fields
Extending Selection Criteria
2008-02-07 20:55:00 On the Selection s screen, you can choose the selection criteria you require when executing the query. If, for example, you select the field Flight connection code, you can specify in the program selections area that you only want to display flights with certain flight numbers. If you want to make an additional selection for a field, you must select it on this screen. As a result, the selection screen is extended by one selection criterion for this field. You can also change the text for this selection criterion if you do not like the text proposed by the query.Texts for selection criteria can only be changed after the appropriate field has been selected and Enter chosen.You should use selection criteria of this type only if they cannot be implemented using dynamic selections. The advantage of dynamic selections is that the number of database accesses is reduced.In our example (selection by Flight connection code), you should use dynamic selections since they are supported by the l... More About: Criteria
Assigning short names
2008-02-07 20:54:00 Each field made available through a functional area can have a short name. You need these short names if you want to place the value of a field in a header (see Changing Headers) or calculate a local field (see Defining Local Fields). Only in these cases do you need to assign a short name. You assign a short name to a field from a functional area by entering the short name in the appropriate input field. If you do not see such a field on the Select Field screen, choose Edit ® Short names ® Switch on/off.A short name can consist of up to 10 characters. It must always begin with a letter and can contain only letters, digits and the underscore character (? _ ?).If you want to know whether a short name is needed, place the cursor on the field concerned or on the short name and select Edit ® Short names ® References. You then see a list of all the places in the query definition where the short name is used.This function only returns a where-used list for the short n... More About: Names
Selecting Fields for Processing
More articles from this author:2008-02-07 20:54:00 On the Select Field screen, you now select the fields you want to process in your basic list, statistic or ranked list, or those you want to use as additional selections. Selecting functional groups To facilitate preselection, the functional areas are divided into functional groups. If you want to generate a list of existing flight connections, you do not need any detailed information about individual flights and associated bookings. By selecting the functional group Flight connections, you restrict the number of fields offered to those belonging to this group.If you are editing an existing query, the Edited column contains all those functional groups from which fields have already been selected. Selecting fields On the following screen, you now select the fields you want to display in your list from the functionals groups selected.You can extend or reduce the selection of functional groups and fields at any time, even if you have already defined sub-lists.You can change the... More About: Fields 1, 2 |



