ABAPCREATE_OBJECT_PARA_TABLES - CREATE OBJECT PARA TABLES

PERFORM Short Reference   PERFORM Short Reference  
This documentation is copyright by SAP AG.

CREATE OBJECT - parameter_tables

Short Reference



Syntax

... [PARAMETER-TABLE ptab]
    [EXCEPTION-TABLE etab].


Effect

The PARAMETER-TABLE and EXCEPTION-TABLE additions pass actual parameters dynamically to the instance constructor or assign return codes to the non-class-based exceptions.

These additions can be used only if the instantiated class is specified dynamically in name.Using the special internal tables ptab and etab, they assign actual parameters to the input parameters of the instance constructor, or return codes to the non-class-based exceptions.

The syntax and meaning are the same as those that apply to the dynamic form of the CALLMETHOD statement. The internal tables ptab and etab in particular must be defined with reference to the tables ABAP_PARMBIND_TAB and ABAP_EXCPBIND_TAB from thetype group ABAP.

Example

The following example illustrates how a dialog box ofControlFramework (CFW) is generated dynamically and how input parameters are passed dynamically to theinstance constructor of the global class CL_GUI_DIALOGBOX_CONTAINER. The class is defined explicitlyusing the TYPE addition.

DATA: container TYPE REF TO cl_gui_container,
      exc_ref TYPE REF TO cx_root,
      exc_text TYPE string.

DATA: class TYPE string VALUE `CL_GUI_DIALOGBOX_CONTAINER`,
      ptab TYPE abap_parmbind_tab,
      ptab_line TYPE abap_parmbind.

ptab_line-name = 'PARENT'.
ptab_line-kind = cl_abap_objectdescr=>exporting.
GET REFERENCE OF CL_GUI_CONTAINER=>DESKTOP
              INTO ptab_line-value.
INSERT ptab_line INTO TABLE ptab.

ptab_line-name = 'WIDTH'.
ptab_line-kind = cl_abap_objectdescr=>exporting.
GET REFERENCE OF 1000 INTO ptab_line-value.
INSERT ptab_line INTO TABLE ptab.

ptab_line-name = 'HEIGHT'.
ptab_line-kind = cl_abap_objectdescr=>exporting.
GET REFERENCE OF 300 INTO ptab_line-value.
INSERT ptab_line INTO TABLE ptab.

TRY.
    CREATE OBJECT container TYPE (class)
                 PARAMETER-TABLE ptab.
  CATCH cx_sy_create_object_error INTO exc_ref.
    exc_text = exc_ref->get_text( ).
    MESSAGE exc_text TYPE 'I'.
ENDTRY.


ABAP Short Reference   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.


Length: 3453 Date: 20120522 Time: 042919     triton ( 79 ms )