Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

HI THIS IS ATUL. I WRITE ONE CODE FOR FETCHING DATA FROM NOTEPAD BUT ITS NOT WORKING PLEASE HELP ME. CODE IS AND NOTEPAD FILE IS HERE

$
0
0

REPORT  ZFETCH_DATA_FROM_NOTEPAD.
data: path type RLGRAP-FILENAME.
types:BEGIN OF b1,
        sno type zatul1-sno,
        name type zatul1-name,
        gender type zatul1-gender,
       end of b1.
data: itab type TABLE OF b1,
       lwa type b1.

SELECTION-SCREEN: BEGIN OF BLOCK b WITH FRAME.
PARAMETERS: p_file like RLGRAP-FILENAME.   "Select the path of the file to be read.
SELECTION-SCREEN: END OF BLOCK b.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'p_file'
IMPORTING
file_name = p_file.

path = p_file.

CALL function  'gui_upload'
EXPORTING
filename                = path
filetype                = 'ASC'
HAS_FIELD_SEPARATOR = ','
*HEADER_LENGTH = 0
*READ_BY_LINE = 'X'
*DAT_MODE = ' '
tables
data_tab                = itab
  EXCEPTIONS
    FILE_WRITE_ERROR                = 1
    NO_BATCH                        = 2
    GUI_REFUSE_FILETRANSFER         = 3
    INVALID_TYPE                    = 4
    NO_AUTHORITY                    = 5
    UNKNOWN_ERROR                   = 6
    HEADER_NOT_ALLOWED              = 7
    SEPARATOR_NOT_ALLOWED           = 8
    FILESIZE_NOT_ALLOWED            = 9
    HEADER_TOO_LONG                 = 10
    DP_ERROR_CREATE                 = 11
    DP_ERROR_SEND                   = 12
    DP_ERROR_WRITE                  = 13
    UNKNOWN_DP_ERROR                = 14
    ACCESS_DENIED                   = 15
    DP_OUT_OF_MEMORY                = 16
    DISK_FULL                       = 17
    DP_TIMEOUT                      = 18
    FILE_NOT_FOUND                  = 19
    DATAPROVIDER_EXCEPTION          = 20
    CONTROL_FLUSH_ERROR             = 21
    OTHERS                          = 22
           .
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

LOOP AT itab INTO lwa.
*Split the characters between the separators to individual fields.
*SPLIT lwa_file2 AT pa_sep INTO lwa-filed1
*                               lwa-filed2
*                               lwa-filed3.

*APPEND lwa TO itab.
*CLEAR lwa.
   write: / lwa.
  ENDLOOP.


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>