Tip

Download 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 =

    Requires Free Membership to View

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 first published in January 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.