Skip to Content
0
Former Member
Apr 10, 2008 at 08:41 PM

Help! transfer two different structure internal tables to one same Function

158 Views

We've got the following code trying to transfer two different structure of internal tables respectively to one same function as input parameter in one same form, but can't make them work and for the below code, get the error "itab has already been declared." at the 2nd statement to define itab "DATA: itab2 TYPE STANDARD TABLE OF ty2 WITH HEADER LINE.".

Any idea to make it work by transferring two different structure internal tables respectively to one same function in one same form?

<REMOVED BY MODERATOR>

TYPES: BEGIN OF ty1,
        f1 like ztab1-f1,
        f2 like ztab1-f2,
  END OF ty1.

DATA: itab1 TYPE STANDARD TABLE OF ty1 WITH HEADER LINE.

TYPES: BEGIN OF ty2,
        f3 like ztab2-f3,
  END OF ty1.

 DATA: itab2 TYPE STANDARD TABLE OF ty2 WITH HEADER LINE.


Fill in data to itab1...
Fill in data to itab2...

Perform Data_Download Using 1.
Perform Data_Download Using 2.

FORM Data_Download USING v type i.
If v = 1.
      DATA: itab TYPE STANDARD TABLE OF ty1 WITH HEADER LINE.
      itab = itab1.

  Else.
       DATA: itab TYPE STANDARD TABLE OF ty2 WITH HEADER LINE.
      itab = itab2.
 EndIf.

  CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    filename = 'xxx'
    write_field_separator = '|'
  TABLES
    data_tab = itab.

ENDFORM.  

Edited by: Alvaro Tejada Galindo on Apr 10, 2008 4:46 PM