Sunday, December 26, 2010
This sample program creates dynamic internal table based on table given on selection. It reads data from database, downloads data to provided path.

REPORT ztest_program.
DATA: gv_dref TYPE REF TO data,
file_name TYPE string.
*FIELD-SYMBOLS
FIELD-SYMBOLS:  <tab> TYPE STANDARD TABLE.
PARAMETERS:p_table TYPE rsrd1-tbma_val.
*" START-OF-SELECTION
START-OF-SELECTION.

  CREATE DATA gv_dref TYPE TABLE OF (p_table).
  ASSIGN gv_dref->* TO <tab>.
  SELECT * FROM (p_table) INTO TABLE <tab> UP TO 10 ROWS.
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename              = 'C:\temp\test.txt'
      filetype              = 'ASC'
      WRITE_FIELD_SEPARATOR = 'X'
    TABLES
      data_tab              = <tab>.
  IF sy-subrc = 0.
    WRITE 'successfully downloaded'.
  ENDIF.

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.