ABAP Programs: Form parameters with generic types
REPORT ZSOURCE1009.
* Variable for later use
DATA: 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 types
FORM 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.
———————
ABAPer, mail: abap.community@gmail.com http://www.erpdb.info
If you like this post, you may as well like these too:
- ABAP Programs: Using interface parameters of a form REPORT ZSOURCE1004* 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...
- ABAP Programs: Type check for form parameters REPORT ZSOURCE1007.* 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...
- ABAP Programs: Form parameters without type reference REPORT ZSOURCE1008.* 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...
- ABAP Programs: Classifying parameters REPORT ZSOURCE1005. * 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...
- ABAP Programs: Using table parameters REPORT ZSOURCE1006. * 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...
- ABAP Programs: Simple Form REPORT ZSOURCE1001. * 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.*...
- ABAP Programs: Local data in a form REPORT ZSOURCE1002. * 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...
- Different types of ABAP Programs There are nine types of ABAP Programs in SAP: 1 Executable Programs (ABAP Reports) I INCLUDE Program M Module Pool/Dialogue programs S Sub-Routine Pool J Interface Pool K Class Pool...
- ABAP Programs: Complex Non-Elementary Types and Data Objects REPORT ZSOURCE0408. * Nested recordsTYPES: BEGIN OF ADDRESS, CITY(25), STREET(30), END OF ADDRESS, BEGIN OF PERSON, NAME(25), ADDRESS TYPE ADDRESS, END OF PERSON.DATA RECEIVER TYPE PERSON.RECEIVER-NAME = ‘Smith’.RECEIVER-ADDRESS-CITY = ‘Big...
- FORM: ABAP Keyword a day FORM: Defines a subroutine. Syntax FORM [USING ... [VALUE(][)] [TYPE |LIKE ]„. ] [CHANGING... [VALUE(][)] [TYPE |LIKE ]„. ]. Introduces a subroutine. The USING and CHANGING additions define the subroutine’s...
- ABAP Program: Dynamic external perform (call back form) Here the two programs which are calling dynamically. REPORT ZSOURCE2309. PERFORM EXTFORM IN PROGRAM ZSOURCE2310 USING 'CALL_BACK_FORM' SY-CPROG. FORM CALL_BACK_FORM. WRITE / 'I am the call back form in ZSOURCE2309.'....
- SAP ABAP Generic Questions and Answers Here is a set of two documents with question and answers for TAW10. It will definitely help you to improve your ABAP skills. Download & ....
- ABAP Tips and Tricks #1: Generic Hints Use the CHECK command instead of an IF statement whenever possible. This reduces processing time and improves readability. Use the ON CHANGE OF command instead of developing code to compare...
- ABAP Tips and Tricks #2: Generic Hints Initialization Event: This event is executed before the output of the selection screen. The INITIALIZATION section is only performed when the ABAP is started directly, and is not executed if...
- ABAP Source Code: Character types REPORT ZSOURCE0403. * Type c is the default type when no type is specified.* Initial value is space, if it is not specified explicitly.DATA: NAME(25) TYPE C, CITY(25), FLAG, SINGLE_CHARACTER...



















Leave a Reply