SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Динамическое создание внутренней таблицы



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dynamic Programming | Динамическое программирование
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sun Sep 02, 2007 5:38 pm    Post subject: Динамическое создание внутренней таблицы Reply with quote

Code:
REPORT ztest91 .

TYPE-POOLS: slis.

TABLES: dd02l.

DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,
      lf TYPE lvc_t_fcat,
      vr TYPE REF TO data,
            fc LIKE LINE OF lt_fieldcat,
            lfc LIKE LINE OF lf.
DATA: g_exit_caused_by_caller,
      gs_exit_caused_by_user TYPE slis_exit_by_user.
FIELD-SYMBOLS: <p> TYPE STANDARD TABLE.

PARAMETERS: tabn LIKE dd02l-tabname.

CLEAR dd02l.
SELECT SINGLE * FROM dd02l WHERE tabname = tabn.

IF NOT dd02l-tabname IS INITIAL.
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name       = tabn
    CHANGING
      ct_fieldcat            = lt_fieldcat
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2.

  LOOP AT lt_fieldcat INTO fc.
    MOVE-CORRESPONDING fc TO lfc.
    APPEND lfc TO lf.
  ENDLOOP.

  CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
      it_fieldcatalog = lf
    IMPORTING
      ep_table        = vr.

  ASSIGN vr->* TO <p>.
  SELECT * FROM (tabn) APPENDING TABLE <p>.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_buffer_active         = ' '
      i_callback_program      = sy-repid
      i_structure_name        = tabn
      i_save                  = 'X'
    IMPORTING
      e_exit_caused_by_caller = g_exit_caused_by_caller
      es_exit_caused_by_user  = gs_exit_caused_by_user
    TABLES
      t_outtab                = <p>
    EXCEPTIONS
      program_error           = 1
      OTHERS                  = 2.
ELSE.
  WRITE:/ 'Неправильное имя таблицы'.
ENDIF.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dynamic Programming | Динамическое программирование All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.