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: 

Can Internal Table be declared dynamically

Former Member
0 Kudos

Hi All ,

iam facing a problem in delearing an internal table ,i let u know the query and the problem iam facing in that .

Nothing but the include is used for the Replacment of a interface .

1.iam trying to use an include which is called by nearly 100 programs .

2.since i dont know the number of fields each program is using .

since in the include i have to create a internal table that has to fullfill the needs of each and every program that uses this include .

DATA: objbin TYPE STANDARD TABLE OF solisti1 INITIAL

SIZE 0 WITH HEADER LINE.

internal table has to be created using the above table.

example .

program 1 may be having 4 fields ,and program 2 may be having 5 fields .

can some one help me on this.

Thanks,

vinay .

7 REPLIES 7

Former Member
0 Kudos

refer this thread

Check this one too

This one is on how to modify int table

Message was edited by: Rahul Kavuri

Former Member
0 Kudos

Hi,

yes internal table can be created dynamically.

refer this code:

Create dynamic table with conditions

  • This program permits to create or update lines from source table

  • to target table with create internal tables dynamically.

  • If we have also the possibilities to include conditions for selecting

  • data with where dynamic and with syntax-check of this conditions .

Code

**----


    • Program name.: ZSELECT_DYNAMIC - MOSHEG - from version 4.6

  • This program permits to create or update lines from source table

  • to target table with create internal tables dynamically.

  • If we have also the possibilities to include conditions for selecting

  • data with where dynamic and with syntax-check of this conditions .

*----


  • parameters for this program :

*----


  • Source table Z?????

  • Target table Z?????

  • _ client speciifed

*

  • Code line1 for where dynamic

  • line2 for where dynamic

  • line3 for where dynamic

  • line4 for where dynamic

*----


REPORT zselect_dynamic LINE-SIZE 132

LINE-COUNT 65(1)

NO STANDARD PAGE HEADING

MESSAGE-ID z1.

TYPES ztab LIKE dcobjdef-name .

PARAMETERS: tab_name TYPE ztab DEFAULT 'Z?????' ,

tab_nam2 TYPE ztab DEFAULT 'Z?????' ,

pclient AS CHECKBOX .

SELECTION-SCREEN SKIP .

PARAMETERS: where1(80) ,

where2(80) ,

where3(80) ,

where4(80) .

*

DATA : lcode(72),

prog_tab LIKE lcode OCCURS 0 WITH HEADER LINE .

DEFINE append_line.

append &1 to prog_tab.

END-OF-DEFINITION.

DATA: BEGIN OF nametab OCCURS 0.

INCLUDE STRUCTURE dntab.

DATA: END OF nametab.

DATA: BEGIN OF twhere OCCURS 20,

line(80),

END OF twhere.

DATA: zprogram LIKE sy-cprog,

no_line TYPE i,

zmessage(150) ,

count_commit TYPE i .

DATA: d_ref TYPE REF TO data,

d_ref2 TYPE REF TO data ,

lt_alv_cat TYPE TABLE OF lvc_s_fcat,

ls_alv_cat LIKE LINE OF lt_alv_cat.

FIELD-SYMBOLS : TYPE table,

,

,"TYPE ANY ,

,

.

**----


    • Main program.

**----


START-OF-SELECTION.

END-OF-SELECTION.

**----


    • Main program.

**----


PERFORM z_define_itab .

&----


*& Form z_define_itab

&----


FORM z_define_itab .

CHECK ( tab_name(01) = 'Z' OR tab_name(01) = 'Y' )

  • if you want treat tables with your namespace, insert here your code

AND ( tab_nam2(01) = 'Z' OR tab_nam2(01) = 'Y' ) .

REFRESH nametab.

CALL FUNCTION 'NAMETAB_GET'

EXPORTING

langu = sy-langu

tabname = tab_name

TABLES

nametab = nametab

EXCEPTIONS

no_texts_found = 1.

LOOP AT nametab .

ls_alv_cat-fieldname = nametab-fieldname .

ls_alv_cat-ref_table = tab_name.

ls_alv_cat-ref_field = nametab-fieldname .

APPEND ls_alv_cat TO lt_alv_cat.

ENDLOOP.

  • internal table build

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING it_fieldcatalog = lt_alv_cat

IMPORTING ep_table = d_ref .

ASSIGN d_ref->* TO .

IF where1 IS INITIAL AND where2 IS INITIAL

AND where3 IS INITIAL AND where4 IS INITIAL .

SELECT * FROM (tab_name) INTO TABLE .

  • ORDER BY PRIMARY KEY.

ELSE .

PERFORM select_with_where .

ENDIF .

DESCRIBE TABLE LINES sy-tfill .

IF sy-tfill = 0 .

MESSAGE i000 WITH

'Data not selected, verify the tables or conditions ! ' .

STOP .

ELSE .

MESSAGE s000 WITH 'You have successfully treated yours tables.'.

ENDIF .

CREATE DATA d_ref2 TYPE (tab_nam2).

ASSIGN d_ref2->* TO .

LOOP AT ASSIGNING .

CLEAR .

LOOP AT nametab .

ASSIGN COMPONENT nametab-fieldname

OF STRUCTURE TO .

IF sy-subrc <> 0. EXIT. ENDIF.

ASSIGN COMPONENT nametab-fieldname OF STRUCTURE TO .

IF sy-subrc = 0.

= .

ENDIF.

ENDLOOP .

CHECK sy-subrc = 0.

INSERT INTO (tab_nam2) VALUES .

IF sy-subrc NE 0 .

UPDATE (tab_nam2) FROM .

ENDIF .

ADD 1 TO count_commit .

IF count_commit = '10000' .

COMMIT WORK .

count_commit = 0 .

ENDIF .

WRITE : .

ENDLOOP .

ENDFORM. " z_define_itab

&----


*& Form select_with_where

&----


FORM select_with_where.

IF NOT where1 IS INITIAL .

twhere-line = where1 . APPEND twhere .

ENDIF .

IF NOT where2 IS INITIAL .

twhere-line = where2 . APPEND twhere .

ENDIF .

IF NOT where3 IS INITIAL .

twhere-line = where3 . APPEND twhere .

ENDIF .

IF NOT where4 IS INITIAL .

twhere-line = where4 . APPEND twhere .

ENDIF .

REFRESH prog_tab.

append_line 'REPORT ZGEN .'.

append_line 'TABLES:'.

append_line tab_name.

append_line '.'.

append_line 'DATA: ITAB LIKE'.

append_line tab_name.

append_line 'OCCURS 0 WITH HEADER LINE.'.

append_line 'FORM SELECT_TABLE.'.

append_line 'SELECT * FROM'.

append_line tab_name.

IF pclient = 'X'.

append_line 'CLIENT SPECIFIED'.

ENDIF.

append_line 'INTO TABLE ITAB'.

append_line 'WHERE '.

LOOP AT twhere.

append_line twhere.

ENDLOOP.

append_line ' . '.

append_line 'ENDFORM.'.

PERFORM generate_form .

ENDFORM. " select_with_where

&----


*& Form generate_form

&----


FORM generate_form .

GENERATE SUBROUTINE POOL prog_tab NAME zprogram

MESSAGE zmessage LINE no_line .

IF sy-subrc NE 0.

WRITE: / 'Syntax error : ', zmessage,

/ 'in line', no_line .

STOP.

ENDIF.

SELECT * FROM (tab_name) INTO TABLE

WHERE (twhere) .

ENDFORM. " generate_form

rgds,

latheesh

hymavathi_oruganti
Active Contributor
0 Kudos

there are many therads in this forum regarding this. search it u can find more.

cl_alv_table_create=>create_dynamic table.

the above method is called to create internal table dynamically

Former Member
0 Kudos

Hi Vinay,

Please check if this would serve your purpose.

Anyway detailed explanations, in this regard, are already listed in many older weblogs in SDN.

*----


REPORT yroops_dummy4 .

TYPE-POOLS : abap.

*---The name of the Table

DATA : ws_tabname TYPE dd02l-tabname.

DATA : i_details TYPE abap_compdescr_tab,

wa_details TYPE abap_compdescr.

DATA : wa_fcat TYPE lvc_s_fcat,

i_fcat TYPE lvc_t_fcat.

DATA : o_ref_table_des TYPE REF TO cl_abap_structdescr.

DATA : ws_dy_table TYPE REF TO data.

FIELD-SYMBOLS: <fs_dyn_table> TYPE STANDARD TABLE.

*---Get the Field and other details to create an ITAB

o_ref_table_des ?=

cl_abap_typedescr=>describe_by_name( ws_tabname ).

i_details[] = o_ref_table_des->components[].

*---Create a Field Catalog

LOOP AT i_details INTO wa_details.

wa_fcat-fieldname = wa_details-name .

wa_fcat-datatype = wa_details-type_kind.

wa_fcat-inttype = wa_details-type_kind.

wa_fcat-intlen = wa_details-length.

wa_fcat-decimals = wa_details-decimals.

APPEND wa_fcat TO i_fcat.

CLEAR : wa_fcat, wa_details.

ENDLOOP.

*---Generate the ITAB dynamically

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = i_fcat

IMPORTING

ep_table = ws_dy_table.

ASSIGN ws_dy_table->* TO <fs_dyn_table>.

*----


Regards,

Roopesh

Former Member
0 Kudos

Hi vinay,

check this blog:

/people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table

award if it helps.

regards,

keerthi.

former_member927251
Active Contributor
0 Kudos

Hi Vinay,

Please refer the code below. It will surely help you.

<b>Also, reward points if it helps.</b>


REPORT ZDSAP . 

DATA: d_ref TYPE REF TO data, 
d_ref2 TYPE REF TO data , 
i_alv_cat TYPE TABLE OF lvc_s_fcat, 
ls_alv_cat LIKE LINE OF i_alv_cat. 


TYPES tabname LIKE dcobjdef-name . 
parameter: p_tablen type tabname. 

data: begin of itab occurs 0. 
INCLUDE STRUCTURE dntab. 
data: end of itab. 


FIELD-SYMBOLS : <F_FS> TYPE table, 
<F_FS1> TYPE TABLE, 
<F_FS2> TYPE ANY, 
<F_FS3> TYPE TABLE. 

REFRESH itab. 
CALL FUNCTION 'NAMETAB_GET' 
EXPORTING 
langu = sy-langu 
tabname = p_tablen 
TABLES 
nametab = itab 

EXCEPTIONS 
no_texts_found = 1. 
LOOP AT itab . 
ls_alv_cat-fieldname = itab-fieldname. 
ls_alv_cat-ref_table = p_tablen. 
ls_alv_cat-ref_field = itab-fieldname. 
APPEND ls_alv_cat TO i_alv_cat. 
ENDLOOP. 
* internal table build 
CALL METHOD cl_alv_table_create=>create_dynamic_table 
EXPORTING it_fieldcatalog = i_alv_cat 
IMPORTING ep_table = d_ref . 
ASSIGN d_ref->* TO <F_FS>. 

SELECT * FROM (p_tablen) INTO CORRESPONDING FIELDS OF TABLE <F_FS>. 


LOOP AT <F_FS> ASSIGNING <F_FS2>. 
*your code goes here. 
ENDLOOP.

Regards,

Amit Mishra

0 Kudos

use

REPORT ZUTIL_SEARCH_STRUCTURE MESSAGE-ID 031 .

INCLUDE yDATA_TOP.

INCLUDE ySEL_SCREEN.

INCLUDE yFORMS.

INITIALIZATION.

P4 = 2.

P5 = 1.

AT SELECTION-SCREEN.

IF P4 <= 0 OR P5 <= 0.

MESSAGE E031 WITH 'Search Criteria Cannot be Zero!'.

ENDIF.

START-OF-SELECTION.

PERFORM DYNAMIC_CODE.

&----


*& Include YDATA_TOP *

&----


DATA : ITAB(72) OCCURS 0.

DATA WA(200).

DATA REC_CNT(3).

&----


*& Include YSEL_SCREEN *

&----


SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-001.

PARAMETERS:P1 RADIOBUTTON GROUP COMP.

PARAMETERS:P2 RADIOBUTTON GROUP COMP.

PARAMETERS:P3 RADIOBUTTON GROUP COMP.

SELECTION-SCREEN END OF BLOCK BLK.

SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-002.

PARAMETERS : P4(3) OBLIGATORY.

PARAMETERS : P5(5) OBLIGATORY .

PARAMETERS : P6 AS CHECKBOX.

SELECTION-SCREEN END OF BLOCK BLK1.

&----


*& Include YFORMS *

&----


----


***INCLUDE ZFORMS .

----


&----


*& Form DYNAMIC_CODE

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DYNAMIC_CODE.

APPEND 'REPORT ZSEARCH NO STANDARD PAGE HEADING.' TO ITAB.

APPEND 'TABLES : DD03L,DD02L.' TO ITAB.

DATA TAB LIKE TEXTPOOL OCCURS 0 WITH HEADER LINE.

APPEND 'SELECTION-SCREEN BEGIN OF BLOCK BLK' TO ITAB.

APPEND 'WITH FRAME TITLE TEXT-001.' TO ITAB.

DO P4 TIMES.

REC_CNT = SY-INDEX.

CONDENSE REC_CNT NO-GAPS.

IF P1 = 'X'.

CONCATENATE 'PARAMETERS:F' REC_CNT

' LIKE DD03L-FIELDNAME OBLIGATORY.'

INTO WA.

APPEND WA TO ITAB.

TAB-ID = 'S'.

CONCATENATE 'F' REC_CNT INTO WA.

TAB-KEY = WA.

CONCATENATE'$$$$$$$$' 'Field Name' REC_CNT INTO WA.

TAB-ENTRY = WA.

ENDIF.

IF P2 = 'X'.

CONCATENATE 'PARAMETERS:D' REC_CNT

' LIKE DD03L-ROLLNAME OBLIGATORY.'

INTO WA.

APPEND WA TO ITAB.

TAB-ID = 'S'.

CONCATENATE 'D' REC_CNT INTO WA.

TAB-KEY = WA.

CONCATENATE'$$$$$$$$' 'Data Element' REC_CNT INTO WA.

TAB-ENTRY = WA.

ENDIF.

IF P3 = 'X'.

APPEND 'SELECTION-SCREEN BEGIN OF LINE.' TO ITAB.

CONCATENATE 'SELECTION-SCREEN COMMENT (15) FOR FIELD DT'

REC_CNT '.' INTO WA.

APPEND WA TO ITAB.

CONCATENATE 'PARAMETERS:DT' REC_CNT

' LIKE DD03L-DATATYPE OBLIGATORY.'

INTO WA.

APPEND WA TO ITAB.

CONCATENATE 'SELECTION-SCREEN COMMENT (16) FOR FIELD SIZE'

REC_CNT '.' INTO WA.

APPEND WA TO ITAB.

CONCATENATE 'PARAMETERS:SIZE' REC_CNT

' LIKE DD03L-LENG OBLIGATORY.' INTO WA.

APPEND WA TO ITAB.

APPEND 'SELECTION-SCREEN END OF LINE.' TO ITAB.

TAB-ID = 'S'.

CONCATENATE 'DT' REC_CNT INTO WA.

TAB-KEY = WA.

CONCATENATE'$$$$$$$$' 'Data Type' REC_CNT INTO WA.

TAB-ENTRY = WA.

APPEND TAB.

TAB-ID = 'S'.

CONCATENATE 'SIZE' REC_CNT INTO WA.

TAB-KEY = WA.

CONCATENATE'$$$$$$$$' 'Len. of Field' REC_CNT INTO WA.

TAB-ENTRY = WA.

ENDIF.

APPEND TAB.

ENDDO.

APPEND 'SELECTION-SCREEN END OF BLOCK BLK.' TO ITAB.

APPEND 'DATA: BEGIN OF IT_FLD OCCURS 0,' TO ITAB.

APPEND 'FIELDNAME TYPE DD03L-FIELDNAME,' TO ITAB.

APPEND 'LENG TYPE DD03L-LENG,' TO ITAB.

APPEND 'ROLLNAME LIKE DD03L-ROLLNAME,' TO ITAB.

APPEND 'DATATYPE LIKE DD03L-DATATYPE,' TO ITAB.

APPEND 'END OF IT_FLD.' TO ITAB.

APPEND 'DATA : BEGIN OF IT_STRUCNAME OCCURS 0,' TO ITAB.

APPEND 'TABNAME LIKE DD02L-TABNAME,' TO ITAB.

APPEND 'END OF IT_STRUCNAME.' TO ITAB.

APPEND 'DATA : BEGIN OF IT_MATCH OCCURS 0,' TO ITAB.

APPEND 'TABNAME LIKE DD02L-TABNAME,' TO ITAB.

APPEND 'END OF IT_MATCH.' TO ITAB.

APPEND 'DATA COUNT(3) TYPE I.' TO ITAB.

APPEND 'START-OF-SELECTION.' TO ITAB.

DO P4 TIMES.

REC_CNT = SY-INDEX.

CONDENSE REC_CNT NO-GAPS.

IF P1 = 'X'.

CONCATENATE 'IT_FLD-FIELDNAME = ' '$' 'F' REC_CNT '.' INTO WA.

ENDIF.

IF P2 = 'X'.

CONCATENATE 'IT_FLD-ROLLNAME = ' '$' 'D'

REC_CNT '.' INTO WA.

ENDIF.

IF P3 = 'X'.

CONCATENATE 'IT_FLD-DATATYPE = ' '$' 'DT'

REC_CNT '.' INTO WA.

REPLACE '$' WITH SPACE INTO WA.

APPEND WA TO ITAB.

CONCATENATE 'IT_FLD-LENG = ' '$' 'SIZE'

REC_CNT '.' INTO WA.

ENDIF.

REPLACE '$' WITH SPACE INTO WA.

APPEND WA TO ITAB.

APPEND 'APPEND IT_FLD.' TO ITAB.

ENDDO.

CONCATENATE 'SELECT DISTINCT TABNAME FROM DD03L'

'INTO TABLE IT_STRUCNAME'

INTO WA

SEPARATED BY SPACE.

APPEND WA TO ITAB.

APPEND 'FOR ALL ENTRIES IN IT_FLD' TO ITAB.

IF P1 = 'X'.

CONCATENATE 'WHERE FIELDNAME = IT_FLD-FIELDNAME AND'

'AS4LOCAL = ''A'' .' INTO WA

SEPARATED BY SPACE.

ENDIF.

IF P2 = 'X'.

CONCATENATE 'WHERE ROLLNAME = IT_FLD-ROLLNAME AND'

'AS4LOCAL = ''A'' .' INTO WA

SEPARATED BY SPACE.

ENDIF.

IF P3 = 'X'.

CONCATENATE 'WHERE DATATYPE = IT_FLD-DATATYPE AND'

'LENG = IT_FLD-LENG AND'

INTO WA

SEPARATED BY SPACE.

APPEND WA TO ITAB.

WA = 'AS4LOCAL = ''A'' .' .

ENDIF.

APPEND WA TO ITAB.

APPEND 'LOOP AT IT_STRUCNAME.' TO ITAB.

IF P6 = 'X'.

APPEND 'CLEAR DD02L-ACTFLAG.' TO ITAB.

APPEND 'SELECT SINGLE ACTFLAG FROM DD02L' TO ITAB.

APPEND 'INTO DD02L-ACTFLAG WHERE TABNAME = ' TO ITAB.

APPEND 'IT_STRUCNAME-TABNAME' TO ITAB.

APPEND 'AND AS4LOCAL = ''A''' TO ITAB.

CONCATENATE

'AND TABCLASS IN ( '

'''VIEW'''

','

'''APPEND'''

','

'''INTTAB'''

' ).'

INTO WA.

APPEND WA TO ITAB.

APPEND 'IF SY-SUBRC EQ 0.' TO ITAB.

ENDIF.

APPEND 'DESCRIBE TABLE IT_MATCH.' TO ITAB.

CONCATENATE 'IF SY-TFILL =' P5 '.' INTO WA SEPARATED BY SPACE.

APPEND WA TO ITAB.

APPEND 'EXIT.' TO ITAB.

APPEND 'ENDIF.' TO ITAB.

APPEND 'CLEAR COUNT.' TO ITAB.

DO P4 TIMES.

REC_CNT = SY-INDEX.

APPEND 'CLEAR DD03L-AS4LOCAL.' TO ITAB.

CONDENSE REC_CNT NO-GAPS.

IF P1 = 'X'.

APPEND

'SELECT SINGLE AS4LOCAL FROM DD03L INTO' TO

ITAB.

APPEND 'DD03L-AS4LOCAL' TO ITAB.

CONCATENATE 'WHERE TABNAME = '

'IT_STRUCNAME-TABNAME'

INTO WA SEPARATED BY SPACE.

APPEND WA TO ITAB.

CONCATENATE 'AND FIELDNAME ='

'$'

'F' REC_CNT '$' INTO WA.

REPLACE '$' WITH SPACE INTO WA.

REPLACE '$' WITH SPACE INTO WA.

ENDIF.

IF P2 = 'X'.

APPEND

'SELECT SINGLE AS4LOCAL FROM DD03L INTO' TO

ITAB.

APPEND 'DD03L-AS4LOCAL' TO ITAB.

CONCATENATE 'WHERE TABNAME = '

'IT_STRUCNAME-TABNAME'

INTO WA SEPARATED BY SPACE.

APPEND WA TO ITAB.

CONCATENATE 'AND ROLLNAME ='

'$'

'D' REC_CNT '$' INTO WA.

REPLACE '$' WITH SPACE INTO WA.

REPLACE '$' WITH SPACE INTO WA.

ENDIF.

IF P3 = 'X'.

APPEND

'SELECT SINGLE AS4LOCAL FROM DD03L INTO'

TO ITAB.

APPEND 'DD03L-AS4LOCAL' TO ITAB.

CONCATENATE 'WHERE TABNAME = '

'IT_STRUCNAME-TABNAME'

INTO WA SEPARATED BY SPACE.

APPEND WA TO ITAB.

CONCATENATE 'AND DATATYPE ='

'$'

'DT' REC_CNT INTO WA.

REPLACE '$' WITH SPACE INTO WA.

APPEND WA TO ITAB.

CONCATENATE 'AND LENG =' '$' 'SIZE'

REC_CNT INTO WA.

REPLACE '$' WITH SPACE INTO WA.

ENDIF.

APPEND WA TO ITAB.

IF P6 = 'X'.

CONCATENATE 'AND POSITION = ' REC_CNT INTO WA

SEPARATED BY SPACE.

APPEND WA TO ITAB.

ENDIF.

APPEND 'AND AS4LOCAL = ''A'' .' TO ITAB.

APPEND 'IF SY-SUBRC EQ 0.' TO ITAB.

APPEND 'COUNT = COUNT + 1.' TO ITAB.

APPEND 'ELSE.' TO ITAB.

APPEND 'CONTINUE.' TO ITAB.

APPEND 'ENDIF.' TO ITAB.

ENDDO.

CONCATENATE 'IF COUNT =' '$' P4 '.' INTO WA SEPARATED BY SPACE.

REPLACE '$' WITH SPACE INTO WA.

APPEND WA TO ITAB.

APPEND 'CLEAR IT_MATCH.' TO ITAB.

APPEND 'IT_MATCH-TABNAME = IT_STRUCNAME-TABNAME.' TO ITAB.

APPEND 'APPEND IT_MATCH.' TO ITAB.

APPEND 'ENDIF.' TO ITAB.

IF P6 = 'X'.

APPEND 'ENDIF.' TO ITAB.

ENDIF.

APPEND 'ENDLOOP.' TO ITAB.

APPEND 'SORT IT_MATCH BY TABNAME.' TO ITAB.

APPEND 'WRITE :/25' TO ITAB.

APPEND '''List of Structure(s) Matching the Criteria:''' TO ITAB.

APPEND 'COLOR 4 ON.' TO ITAB.

APPEND 'WRITE:/.' TO ITAB.

APPEND 'WRITE:/33(33) SY-ULINE .' TO ITAB.

APPEND'WRITE:/33 SY-VLINE,' TO ITAB.

APPEND '34 ''Structure Name'' COLOR 2 ON,65 SY-VLINE.'

TO ITAB.

APPEND 'WRITE:/33(33) SY-ULINE .' TO ITAB.

APPEND 'LOOP AT IT_MATCH.'

TO ITAB.

APPEND

'WRITE:/33 SY-VLINE,34'

TO ITAB.

APPEND

'IT_MATCH-TABNAME'

TO ITAB.

APPEND

',65 SY-VLINE. '

TO ITAB.

APPEND 'ENDLOOP.' TO ITAB.

APPEND 'WRITE:/33(33) SY-ULINE .' TO ITAB.

INSERT REPORT 'ZSEARCH' FROM ITAB.

IF P1 = 'X'.

TAB-ID = 'I'.

TAB-KEY = '001'.

TAB-ENTRY = 'Enter the Field Names to be Seached:'.

APPEND TAB.

ENDIF.

IF P2 = 'X'.

TAB-ID = 'I'.

TAB-KEY = '001'.

TAB-ENTRY = 'Enter the Data Elements to be Seached:'.

APPEND TAB.

ENDIF.

IF P3 = 'X'.

TAB-ID = 'I'.

TAB-KEY = '001'.

TAB-ENTRY = 'Enter the Data Types and Lengths to be Seached:'.

APPEND TAB.

ENDIF.

TAB-ID = 'R'.

TAB-KEY = SPACE.

TAB-ENTRY = 'Searches Structures/Tables'.

APPEND TAB.

INSERT TEXTPOOL 'ZSEARCH' FROM TAB LANGUAGE SY-LANGU.

SUBMIT ZSEARCH VIA SELECTION-SCREEN AND RETURN.

DELETE REPORT 'ZSEARCH'.

ENDFORM. " DYNAMIC_CODE

Plz reward points and close the thread..

gunjan