Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

creation of dynamic internal table is not synchronous

Former Member
0 Kudos

In my code following lines are used to create a dynamic table.

REFRESH : INCTABL .

CLEAR INCTABL .

INCTABL-LINE = 'data: begin of dyntab occurs 10,'. APPEND INCTABL.

INCTABL-LINE = 'zpltnamec like zvendplt-zpltnamec,'. APPEND INCTABL.

INCTABL-LINE = 'sourcing like zopsdwbom-sourcing,'. APPEND INCTABL.

INCTABL-LINE = 'zmatgrp like zrmrpmaterial-zmatgrp,'. APPEND INCTABL.

INCTABL-LINE = 'zcollection like zrmrpmaterial-zcollection,'.

APPEND INCTABL.

INCTABL-LINE = 'fiscintrodt like zrmrpmaterial-zfiscintrodt,'.

APPEND INCTABL.

INCTABL-LINE = 'bednr like ekpo-bednr,'. APPEND INCTABL.

INCTABL-LINE = 'revlv like ekpo-revlv,'. APPEND INCTABL.

INCTABL-LINE = 'ematn like ekpo-ematn,'. APPEND INCTABL.

INCTABL-LINE = 'menge like mara-eannr,'. APPEND INCTABL.

INCTABL-LINE = 'stprs like mara-eannr,'. APPEND INCTABL.

*inctabl-line = 'kbetr like cdred-f_new,'. append inctabl.

DATA : T_KBETR(72) .

DATA :CNT(2).

DO LIN TIMES .

CNT = SY-INDEX .

CONCATENATE 'kbetr' CNT ' like cdred-f_new,' INTO T_KBETR .

CONDENSE T_KBETR .

INCTABL-LINE = T_KBETR . APPEND INCTABL.

ENDDO .

INCTABL-LINE = 'end of dyntab. '. APPEND INCTABL.

INSERT REPORT 'zcrchangereport_3'(001) FROM INCTABL.

but during run time it is using the previously created dynamic internal table structure and then creating currently required internal table.

how to overcome this problem/

Thanks.

1 REPLY 1

naimesh_patel
Active Contributor
0 Kudos

Hello,

Instead of creating report, create subroutine pool. Like

INCTABL-LINE = 'report ztest.'. APPEND INCTABL.

INCTABL-LINE = 'form main'. APPEND INCTABL.

INCTABL-LINE = 'data: begin of dyntab occurs 10,'. APPEND INCTABL.

INCTABL-LINE = 'zpltnamec like zvendplt-zpltnamec.'. APPEND INCTABL.

INCTABL-LINE = 'data: end of dyntab.'. APPEND INCTABL.

CATCH SYSTEM-EXCEPTIONS GENERATE_SUBPOOL_DIR_FULL = 9.

GENERATE SUBROUTINE POOL inctabl NAME l_name

MESSAGE L_MESSAGE LINE L_LINE WORD L_WORD.

ENDCATCH.

IF L_MESSAGE IS INITIAL.

PERFORM (L_FORM) IN PROGRAM (L_NAME).

ELSE.

WRITE : L_MESSAGE, L_LINE.

ENDIF.

You can get the message in L_message variable, if any error occurs.

Regards,

Naimesh