Pages

Friday, June 12, 2015

DYnamic structure and table ceration


*** Test - TBDeleted
datals_segstruc TYPE REF TO cl_abap_structdescr,
      r_data_str TYPE REF TO data.

FIELD-SYMBOLS<fs> TYPE ANY.

ls_segstruc ?= cl_abap_typedescr=>DESCRIBE_BY_NAME'MARA' ).

CREATE DATA:
      r_data_tab TYPE HANDLE r_type_table,
             r_data_str TYPE HANDLE ls_segstruc.

FIELD-SYMBOLS<fs_table> TYPE INDEX TABLE,
               <fs_wa>    TYPE ANY.

ASSIGN:
r_data_tab->TO <fs_table>,
        r_data_str->TO <fs_wa>.

Sunday, October 19, 2014

Table EVENTS in Table Maintenance Generator in SE11

Events can be created inside Table maintenence generator using Environment and modification.

Use TOTAL table which is available in the GLOBAL fields of the EVENTS routine to access all the existing data of the current ZTable.

*---------------------------------------------------------------------*
* Handle Table events to restrict user from entering wrong SH and     *
* In-Transit location if 1 entry is already maintained in the table   *
*---------------------------------------------------------------------*
*  P R O G R A M   C H A N G E   H I S T O R Y                        *
*---------------------------------------------------------------------*
* ##) Correction  Date......  SAP User ID.  Description.............. *
*---------------------------------------------------------------------*
  DATAls_currrent_entry TYPE zfi_pri_gethub,
        ls_existing_entry TYPE zfi_pri_gethub.

  MOVE zfi_pri_gethub TO ls_currrent_entry.

  LOOP AT total INTO ls_existing_entry.
    IF ls_existing_entry-ship_to EQ ls_currrent_entry-ship_to.
      IF ls_existing_entry-in_transit_sloc EQ ls_currrent_entry-in_transit_sloc.
        MESSAGE '1 Ship-to can have only 1 In-transit Location' TYPE 'E'.
      ENDIF.
    ENDIF.
  ENDLOOP.

ENDFORM.                    "new_entry