on 11-07-2007 4:27 AM
Hi all,
My requirement is
1. Users will be using the file upload Tcode in BW ( This TCode access will be authorized to specifi users)
2. ABAP Program need to place the file in the specified folder. Use the Z_FLATFILE_UPLOAD as a start. Copy to New program and work witht he New program
3. The ABAP program should be able to sent Trigger event after placingt he file to start the Process Chain, in which The flat file should be able to load to the ODS.
4. On Successful completion of the Process chain, the specific user group should be able to recive the email Message that the uploaded file has been loaded and avaible for reporting.
The ABAP program should be able to handle the follwing:
1. If the File Format is not correct the user should get an error message that the file is not in the expected format.
2. Once the File upload complete, user should see the message that the file uploaded correctly.
3. on Successful completion of the FileUpload, The program should trigger event.
and the program Z_FLATFILE_UPLOAD is given below
REPORT Z_FLATFILE_UPLOAD message-id zx .
PARAMETERS: FILE_NM LIKE RLGRAP-FILENAME obligatory.
PARAMETERS: P2 LIKE RLGRAP-FILENAME
DEFAULT '/Userdata/IFIN/0557'.
DATA: INRECORD_COUNT TYPE i,
OUTRECORD_COUNT TYPE i.
DATA : MASK(20) TYPE C VALUE ',. ,..'.
DATA: BEGIN OF ITAB OCCURS 0,
RECORD(3000),
END OF ITAB.
AT selection screen help and F4 statements
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE_NM.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = ' '
DEF_PATH = FILE_NM
MASK = MASK
MODE = 'O'
TITLE = 'File Select'
IMPORTING
FILENAME = FILE_NM
EXCEPTIONS
INV_WINSYS = 04
NO_BATCH = 08
SELECTION_CANCEL = 12
SELECTION_ERROR = 16.
IF FILE_NM = ' ' AND SY-SUBRC = 12.
SET CURSOR FIELD 'FILE_NM'.
MESSAGE I000(ZX) with 'File Selection cancelled.'
'Please select a valid file to proceed'.
ELSEIF SY-SUBRC NE 0.
MESSAGE E000(ZX) WITH FILE_NM.
EXIT.
ENDIF.
START-OF-SELECTION.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = FILE_NM
TABLES
DATA_TAB = ITAB.
if sy-subrc <> 0.
message i000(ZX) with 'Upload Failed'.
LEAVE LIST-PROCESSING.
endif.
*editor-call for input_rec.
OPEN DATASET P2 FOR output IN text mode encoding default.
IF SY-SUBRC <> 0.
message i000(ZX) with 'COULD NOT OPEN THE FILE'.
LEAVE LIST-PROCESSING.
ENDIF.
INRECORD_COUNT = 0.
OUTRECORD_COUNT = 0.
LOOP AT ITAB. .
INRECORD_COUNT = INRECORD_COUNT + 1.
TRANSFER ITAB-RECORD TO P2.
OUTRECORD_COUNT = OUTRECORD_COUNT + 1.
ENDLOOP. "itab
END-OF-SELECTION.
CLOSE DATASET P2.
IF SY-SUBRC <> 0.
message e000(ZX) with 'COULD NOT OPEN THE FILE'.
ENDIF.
WRITE: / '# of records read ', INRECORD_COUNT,
/ '# of records transfered', OUTRECORD_COUNT.
WRITE:/ 'upload filename', FILE_NM.
WRITE:/ ' aix filename', P2.
after this code i need to trigger my event can any onle tell me the steps after this program and the code also please
thanks in advance
Sri
points will be assigned
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.