Friday, 8 February 2013

Creating DDIC Structure Dynamically Using FM

***CREATING A DDIC STRUCTURE DYNAMICALLY USING FUNCTION MODULES ***
**PGM CREATES A DDIC STRUCTURE ZSCARR CONTAINING ALL FIELDS OF SCARR TABLE**
DATA lt TYPE TABLE OF dd03p,
       ls TYPE dd02v.
FIELD-SYMBOLS <fs> LIKE LINE OF lt.

CALL FUNCTION 'DDIF_TABL_GET'
  EXPORTING
    name      'SCARR'
  IMPORTING
    dd02v_wa  ls
  TABLES
    dd03p_tab lt.
ls-tabclass 'INTTAB' .
ls-tabname  'ZSCARR' .
ls-as4user  sy-uname .
ls-as4time  sy-uzeit .
ls-as4date  sy-datum .
ls-applclass '' .
ls-authclass '' .
LOOP AT lt ASSIGNING <fs>.
  <fs>-tabname 'ZSCARR'.
ENDLOOP.
CALL FUNCTION 'DDIF_TABL_PUT'
  EXPORTING
    name           = 'ZSCARR'
   dd02v_wa        ls
 TABLES
   dd03p_tab       lt.
IF sy-subrc 0.
  MESSAGE 'STRUCTURE CREATED ' TYPE 'I'.
ENDIF.
CALL FUNCTION 'DDIF_TABL_ACTIVATE'
  EXPORTING
    name 'ZSCARR'.
IF sy-subrc 0.
  MESSAGE 'STRUCTURE ACTIVATED' TYPE 'I'.
ENDIF.

1 comment:

Unknown said...

Can you show code for multiple table entries rather that hard coded values using sleect option and saving it in TR after activation

Comments system

Disqus Shortname