Skip to Content
0
Former Member
Apr 21, 2008 at 05:49 AM

need help regarding Runtime internal table

12 Views

hi gurus.,

i created one run time internal table <L_TABLE> and work area <L_LINE> .. i am unable to access the work area field .. tell me how can i access it .. also i need to access the fieldname based on one variable value .. its very urgent .. kindly help me .. here is my code ...

&----


*& Report ZERUM_PROJECTION_REPORT

*&

&----


*&

*&

&----


REPORT ZERUM_PROJECTION_REPORT.

TABLES: ZERNUM_TSHT_ID .

TYPE-POOLS: SLIS.

DATA: IT_TSHT_ID TYPE STANDARD TABLE OF ZERNUM_TSHT_ID .

DATA: WA_TSHT_ID TYPE ZERNUM_TSHT_ID .

DATA: BEGIN OF IT_DATE OCCURS 0,

TDATE LIKE ZERNUM_TSHT_ID-TDATE,

END OF IT_DATE .

DATA: IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,

IS_FCAT LIKE LINE OF IT_FCAT,

LS_LAYOUT TYPE SLIS_LAYOUT_ALV.

DATA: IT_FIELDCAT TYPE LVC_T_FCAT,

IS_FIELDCAT LIKE LINE OF IT_FIELDCAT.

DATA: NEW_TABLE TYPE REF TO DATA,

NEW_LINE TYPE REF TO DATA,

OB_CONT_ALV TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

OB_ALV TYPE REF TO CL_GUI_ALV_GRID,

VG_CAMPOS(255) TYPE C,

I_CAMPOS LIKE TABLE OF VG_CAMPOS,

VG_CAMPO(30) TYPE C,

VG_TABLES(60) TYPE C.

*DATA: e_params LIKE zutsvga_alv_01.

FIELD-SYMBOLS: <L_TABLE> TYPE TABLE,

<L_LINE> TYPE ANY,

<L_FIELD> TYPE ANY.

SELECT-OPTIONS : SO_TDATE FOR ZERNUM_TSHT_ID-TDATE .

START-OF-SELECTION .

SELECT * INTO TABLE IT_TSHT_ID FROM ZERNUM_TSHT_ID WHERE TDATE IN SO_TDATE .

DATA W_V1 TYPE I .

W_V1 = SO_TDATE-HIGH - SO_TDATE-LOW.

DO W_V1 TIMES .

APPEND SO_TDATE-LOW TO IT_DATE .

SO_TDATE-LOW = SO_TDATE-LOW + 1 .

IF SO_TDATE-LOW EQ SO_TDATE-HIGH .

EXIT.

ENDIF.

ENDDO.

LOOP AT IT_DATE .

IS_FCAT-FIELDNAME = IT_DATE-TDATE.

IS_FCAT-REF_FIELDNAME = 'DATLO'.

IS_FCAT-REF_TABNAME = 'SYST'.

APPEND IS_FCAT TO IT_FCAT.

ENDLOOP.

LOOP AT IT_FCAT INTO IS_FCAT.

IS_FIELDCAT-FIELDNAME = IS_FCAT-FIELDNAME.

IS_FIELDCAT-REF_FIELD = IS_FCAT-REF_FIELDNAME.

IS_FIELDCAT-REF_TABLE = IS_FCAT-REF_TABNAME.

APPEND IS_FIELDCAT TO IT_FIELDCAT.

CONCATENATE IS_FIELDCAT-REF_TABLE IS_FIELDCAT-REF_FIELD

INTO VG_CAMPOS SEPARATED BY '~'.

APPEND VG_CAMPOS TO I_CAMPOS.

ENDLOOP.

CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE

EXPORTING

IT_FIELDCATALOG = IT_FIELDCAT

IMPORTING

EP_TABLE = NEW_TABLE.

*... Creating work area

ASSIGN NEW_TABLE->* TO <L_TABLE>.

CREATE DATA NEW_LINE LIKE LINE OF <L_TABLE>.

ASSIGN NEW_LINE->* TO <L_LINE>.

LOOP AT IT_DATE .

READ TABLE IT_TSHT_ID INTO WA_TSHT_ID WITH KEY TDATE = IT_DATE-TDATE .

IF SY-SUBRC EQ 0 .

+* here i need to access the fieldname in <L_LINE> with* heading IT_DATE-TDATE .+

  • <L_LINE> = 'X' .

  • NEW_LINE-IT_DATE-TDATE = 'X'.

ENDIF.

ENDLOOP.