Download data to 'DBF' file

This tip presenets a simple program to explain how you can download your data to 'DBF' FILE.

A simple program to explain how you can download your data to 'DBF' FILE ('DBF' file is support dbase III+,dbase...

IV and FOXPRO also.)


REPORT ZTABLEDBF.
********************************************************************
* Developer        : S.Srini.
* Location         : Chennai,
*                  : Tamil Nadu,
*                  : India.
********************************************************************
TABLES: USR03,DD02L.

DATA: ZX030L LIKE X030L.

DATA BEGIN OF ZDFIES OCCURS 0.
     INCLUDE STRUCTURE DFIES.
DATA END OF ZDFIES.

DATA: BEGIN OF FLDITAB OCCURS 0,
      FLDNAME(11) TYPE C,
      END OF FLDITAB.

DATA ITABUSR03 LIKE USR03 OCCURS 0 WITH HEADER LINE.


DATA TNAME LIKE DD02L-TABNAME.

SELECT * FROM USR03 INTO TABLE ITABUSR03.

TNAME = 'USR03'.
PERFORM GETFIELEDS.
PERFORM DWDBFFILE.
********************************************
FORM GETFIELEDS.
     CALL FUNCTION 'GET_FIELDTAB'
      EXPORTING
          LANGU              = SY-LANGU
          ONLY               = SPACE
          TABNAME            = TNAME
          WITHTEXT           = 'X'
      IMPORTING
          HEADER             = ZX030L
      TABLES
          FIELDTAB           = ZDFIES
      EXCEPTIONS
          INTERNAL_ERROR      = 01
          NO_TEXTS_FOUND      = 02
          TABLE_HAS_NO_FIELDS = 03
          TABLE_NOT_ACTIV     = 04.

     CASE SY-SUBRC.
        WHEN 0.
          LOOP AT ZDFIES.
               FLDITAB-FLDNAME = ZDFIES-FIELDNAME.
               APPEND FLDITAB.
          ENDLOOP.
        WHEN OTHERS.
             MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              with  SY-SUBRC.
      ENDCASE.

ENDFORM.
***********************************
FORM DWDBFFILE.

CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
          FILENAME               = 'C:USR03.DBF'
          FILETYPE               = 'DBF'
     TABLES
          DATA_TAB               = ITABUSR03
          FIELDNAMES             = FLDITAB
    EXCEPTIONS
         FILE_OPEN_ERROR         = 1
         FILE_WRITE_ERROR        = 2
         INVALID_FILESIZE        = 3
         INVALID_TYPE            = 4
         NO_BATCH                = 5
         UNKNOWN_ERROR           = 6
         INVALID_TABLE_WIDTH     = 7
         GUI_REFUSE_FILETRANSFER = 8
         CUSTOMER_ERROR          = 9
         OTHERS                  = 10
          .
IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.



ENDFORM.

		
		
This was last published in January 2002

Dig Deeper on SAP Basis administration and NetWeaver administration

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close