SAP Database - The Unofficial SAP Knowledge Base

Free Business and Tech Magazines and eBooks

ABAP Programs: Form parameters with generic types

Print This Post Email This Post Written by admin on Nov 20th, 2007 | Filed under: ABAP Programs

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://abaplearner.blogspot.com

If you like this post, you may as well like these too:

  1. 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...
  2. 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...
  3. 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, [...]...
  4. 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.*...
  5. 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...



This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Leave a Reply

  • Subscribe to RSS

  • Free Ebooks