Register Login

GUI_DOWNLOAD: Data Downloading

Updated May 18, 2018

Downloading Data using GUI_DOWNLOAD

Hi All,

I want to download data from 3 internal tables into a single Text file on presentation Server.

I knew about the GUI_download function module with Appending options but my problem is that I want to distinguish 3 types of data present in my 3 internal tables

My 3 internal table contains following type of data:

  • 1st Internal table: Production schedule data
  • 2nd Internal Table: Material Master Data
  • 3rd Internal Table: BOM Data

So, I want some description between the 3 types of data downloaded to single file
Like:

01) Production Schedule
( Then production Schedule data)

02) Material Master
(Then Material Master Data)

03) BOM data
(The BOM data)

Please help me out

Thanks


Comments

  • 21 Sep 2008 1:27 pm SAPTechies Jobs Helpful Answer

    Hi, try it:

    types:begin of y_struc.
    types:idtable type char2, "field ID identify the line of table Ex:01 for table1...
    table1 type usr41, "example table1
    table2 type usr02, "example table1
    table3 type usr01. "example table1
    types:end of y_struc.

    data:gt_complete type y_struc,
    gs_complete type y_struc.

  • 19 Sep 2008 6:08 pm Luis Lucia
    Hi,

    You can do it only if you had have defined structure for your flat file, for example,

    The first record need an identifier "PS" for Production Scheduler,
    Second record need an identifier "MM" for Material Master and subsequent records need an identfifier too, "BD" for Bom Data.

    Then you have to think how to create a relation between these three tables (Some comon fields).

    This is an Idea:

    DATA: BEGIN OF it_ps OCCURS 0. "Production Schedule
    INCLUDE STRUCTURE PS.
    DATA: END OF it_ps.

    DATA: BEGIN OF it_mm OCCURS 0. "Material Master"
    INCLUDE STRUCTURE MM.
    DATA: END OF it_mm.

    DATA: BEGIN OF it_bd OCCURS 0. "BOM Data"
    INCLUDE STRUCTURE BD.
    DATA: END OF it_bd.

    * This is for the gui_download

    DATA: BEGIN OF it_outb OCCURS 0,
    LINE(200) TYPE c,
    END OF it_outb.

    ** Fill your internal tables with the data you need
    ** Sort your internal tables using hierarchies
    SORT it_ps BY key1 key2 ...
    SORT it_mm BY key1 key2 key3 ...
    SORT it_mm BY key1 key2 key3 key4 ...

    ** Make a Loop to fill your 4th internal table

    LOOP AT it_ps.
    READ TABLE it_mm WITH KEY key1 = it_ps-key1.
    l_tabix = sy-tabix.
    MOVE 'PS' TO it_outb-line+0(2).
    MOVE it_ps-key1 TO it_outb-line+2(4)
    .
    .
    APEND it_outb.
    LOOP AT it_mm FROM l_tabix.
    IF it_mm-key1 <> it_ps-key1.
    EXIT.
    ENDIF.
    MOVE 'MM' TO it_outb-line+0(2).
    MOVE it_mm-key2 TO it_outb-line+2(4)
    .
    .
    APPEND it_outb.
    READ TABLE it_bd WITH KEY key1 = it_ps-key1
    key2 = it_mm-key2.
    l_tabix = sy-tabix.
    LOOP AT it_bd FROM l_tabix.
    IF it_bd-key1 <> it_ps-key1 OR
    it_bd-key2 <> it_mm-key2.
    EXIT.
    ENDIF.
    MOVE 'BD' TO it_outb-line+0(2).
    MOVE it_bd-key3 TO it_outb-line+2(4)
    .
    .
    APPEND it_outb.
    ENDLOOP.
    ENDLOOP.
    ENDLOOP.

    * Now use your GUI_DOWNLOAD function
    * Passing it_outb table

    Hope this give you an clear idea

×