2006 Dec 12 8:46 AM
hi
can any body give good material regarding files handling in application server.
ie, reading files from application server,writing files to application server
thanks in advance.
hi
can any body give good material regarding files handling in application server.
ie, reading files from application server,writing files to application server
thanks in advance.
2006 Dec 12 8:52 AM
2006 Dec 12 8:54 AM
hi siva,
some more inputs that may help u.
Open Dataset is used to read or write on to application server ... other than that i am not sure that there exists any way to do the same ... here is a short description for that
FILE HANDLING IN SAP
Introduction
Files on application server are sequential files.
Files on presentation server / workstation are local files.
A sequential file is also called a dataset.
Handling of Sequential file
Three steps are involved in sequential file handling
OPEN
PROCESS
CLOSE
Here processing of file can be READING a file or WRITING on to a file.
OPEN FILE
Before data can be processed, a file needs to be opened.
After processing file is closed.
Syntax:
OPEN DATASET <file name> FOR {OUTPUT/INPUT/APPENDING}
IN {TEXT/BINARY} MODE
This statement returns SY_SUBRC as 0 for successful opening of file or 8, if unsuccessful.
OUTPUT: Opens the file for writing. If the dataset already exists, this will place the cursor at the start of the dataset,
the old contents get deleted at the end of the program or when the CLOSE DATASET is encountered.
INPUT: Opens a file for READ and places the cursor at the beginning of the file.
FOR APPENDING: Opens the file for writing and places the cursor at the end of file. If the file does not exist, it is generated.
BINARY MODE: The READ or TRANSFER will be character wise. Each time n characters are READ or transferred.
The next READ or TRANSFER will start from the next character position and not on the next line.
IN TEXT MODE: The READ or TRANSFER will start at the beginning of a new line each time.
If for READ, the destination is shorter than the source, it gets truncated.
If destination is longer, then it is padded with spaces.
Defaults: If nothing is mentioned, then defaults are FOR INPUT and in BINARY MODE.
PROCESS FILE:
Processing a file involves READing the file or Writing on to file TRANSFER.
TRANSFER Statement
Syntax:
TRANSFER <field> TO <file name>.
<Field> can also be a field string / work area / DDIC structure.
Each transfer statement writes a statement to the dataset. In binary mode, it writes the length of the field to the dataset.
In text mode, it writes one line to the dataset.
If the file is not already open, TRANSFER tries to OPEN file FOR OUTPUT (IN BINARY MODE) or using the last OPEN DATASET statement for this file.
IF FILE HANDLING, TRANSFER IS THE ONLY STATEMENT WHICH DOES NOT RETURN SY-SUBRC
READ Statement
Syntax:
READ DATASET <file name> INTO <field>.
<Field> can also be a field string / work area / DDIC structure.
Each READ will get one record from the dataset.
In binary mode it reads the length of the field and in text mode it reads each line.
CLOSE FILE:
The program will close all sequential files, which are open at the end of the program.
However, it is a good programming practice to explicitly close all the datasets that were opened.
Syntax:
CLOSE DATASET <file name>.
SY-SUBRC will be set to 0 or 8 depending on whether the CLOSE is successful or not.
DELETE FILE:
A dataset can be deleted.
Syntax:
DELETE DATASET <file name>.
SY-SUBRC will be set to 0 or 8 depending on whether the DELETE is successful or not.
Pseudo logic for processing the sequential files:
For reading:
Open dataset for input in a particular mode.
Start DO loop.
Read dataset into a field.
If READ is not successful.
Exit the loop.
Endif.
Do relevant processing for that record.
End the do loop.
Close the dataset.
For writing:
Open dataset for output / Appending in a particular mode.
Populate the field that is to be transferred.
TRANSFER the filed to a dataset.
Close the dataset.
Rgds
Anver
2006 Dec 12 8:55 AM
we use OPEN DATASET and CLOSE DATASET commands for creating a file on application server.
u can see them in AL11.
OPEN DATASET <filename> FOR INPUT IN TEXT MODE.
LOOP...
TRANSFER <itab> to <filename>
ENDLOOP.
CLOSE DATASET <filename>.
******************************************
Use OPEN DATASET Stmt.
parameters: p_file like rlgrap-filename obligatory
default '/usr/sap/upload.xls'.
types: begin of t_data,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
werks like vbap-werks,
megne like vbap-zmeng,
end of t_data.
data: it_data type standard table of t_data,
wa_data type t_data.
open dataset p_file for output in text mode encoding default.
if sy-subrc ne 0.
write:/ 'Unable to open file:', p_file.
else.
do.
read dataset p_file into wa_data.
if sy-subrc ne 0.
exit.
else.
append wa_data to it_data.
endif.
enddo.
close dataset p_file.
endif.
***************************************
Check below links...
http://www.sapdevelopment.co.uk/file/file_downloadsap.htm
*****************************************
For not appending the file already present in the application server check the code present in the link,
http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3cc0358411d1829f0000e829fbfe/content.htm
For appending the data in the file,
http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3ccd358411d1829f0000e829fbfe/content.htm
Try this if you want in binary mode,
OPEN DATASET FNAME FOR OUTPUT In binary mode .
Try this if you want in text mode,
OPEN DATASET FNAME FOR OUTPUT In text mode encoding default .
************************************************
p_file is the filename.
1. APPENDING MODE:
open dataset p_file for APPENDING in text mode encoding default.
Here, if p_file already exists it is opened to append the exisiting data in the file. If the file does not exist it is open a new file.
2. OUTPUT MODE:
open dataset p_file for OUTPUT in text mode encoding default.
Here everytime the file is opened as a new one.
**********************************************************
REPORT z_check_ach NO STANDARD PAGE HEADING
LINE-SIZE 120
MESSAGE-ID zz.
TABLES : dfkkko, "Header Data in Open Item Accounting Document
dfkkop, "Items in contract account document
dfkkcr. "Repository For Checks
*-- include containing the declarations
INCLUDE zf_inc_chk_ach.
----
S E L E C T I O N S C R E E N *
----
----
S E L E C T O P T I O N S *
----
Block for File Path
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_opbel FOR dfkkko-opbel ,
s_cpudt FOR dfkkko-cpudt.
PARAMETERS:
Radio Button for Presentation Server
rb_pres RADIOBUTTON GROUP file ,
PC File Name
p_pfile LIKE rlgrap-filename,
p_pfile1 LIKE rlgrap-filename,
Radio Button for Application Server
rb_unix RADIOBUTTON GROUP file DEFAULT 'X',
*Application Server File Name
p_afile LIKE rlgrap-filename ,
" default '/global/data/transfer/3520/pub/OUT' .
p_afile1 LIKE rlgrap-filename .
" default '/global/data/transfer/3503/pub/OUT' .
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION SCREEN
AT SELECTION-SCREEN.
Validate File Name based on the Server Selected
PERFORM validate_filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_pfile.
F4 help for file path of Presentation Server
PERFORM get_val_help USING p_pfile.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_pfile1.
F4 help for file path of Presentation Server
PERFORM get_val_help USING p_pfile1.
INITIALIZATION .
INITIALIZATION.
PERFORM build_file_names.
START-OF-SELECTION.
Get required Data from Database Tables
PERFORM get_data.
**Process data
PERFORM process_data .
Download the data into Application server
PERFORM download_data.
&----
*& Form validate_filename
&----
File validation
----
FORM validate_filename .
Initialize Error Flag
CLEAR v_error_flag.
IF rb_pres = c_x.
Mandatory Entry for Filename
IF p_pfile IS INITIAL.
MESSAGE i009 .
Set Error Flag
v_error_flag = c_x.
Go to the End of Selection Event
STOP.
ENDIF.
Mandatory Entry for Filename
IF p_pfile1 IS INITIAL.
MESSAGE i009 .
Set Error Flag
v_error_flag = c_x.
Go to the End of Selection Event
STOP.
ENDIF.
Check for any Invalid Characters & Others for PC File
IF ( p_pfile CA c_invalid_pc ) OR
( p_pfile0(1) = '\' AND p_pfile1(120) = space ).
MESSAGE i010. "Invalid PC File Name
Set Error Flag
v_error_flag = c_x.
Go to the End of Selection Event
STOP.
ENDIF.
Check for any Invalid Characters & Others for PC File
IF ( p_pfile1 CA c_invalid_pc ) OR
( p_pfile10(1) = '\' AND p_pfile11(120) = space ).
MESSAGE i010. "Invalid PC File Name
Set Error Flag
v_error_flag = c_x.
Go to the End of Selection Event
STOP.
ENDIF.
ELSE.
IF p_afile IS INITIAL.
Mandatory Entry for Filename
MESSAGE i011. "Enter Unix File Name.
Set Error Flag
v_error_flag = c_x.
Go to the End of Selection Event
STOP.
ENDIF.
IF p_afile1 IS INITIAL.
Mandatory Entry for Filename
MESSAGE i011. "Enter Unix File Name.
Set Error Flag
v_error_flag = c_x.
Go to the End of Selection Event
STOP.
ENDIF.
Check for any Invalid Characters
IF ( p_afile CA '\' ).
MESSAGE i012. "Invalid Unix File Name
Set Error Flag
v_error_flag = c_x.
Go to the End of Selection Event
STOP.
ENDIF.
Check for any Invalid Characters
IF ( p_afile1 CA '\' ).
MESSAGE i012. "Invalid Unix File Name
Set Error Flag
v_error_flag = c_x.
Go to the End of Selection Event
STOP.
ENDIF.
ENDIF.
ENDFORM. " validate_filename
&----
*& Form get_val_help
&----
Selection of probable file name from presentation server
----
FORM get_val_help USING l_file LIKE p_pfile.
Function Module for F4 Help of File Name
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = sy-cprog
dynpro_number = sy-dynnr
IMPORTING
file_name = l_file.
ENDFORM. " get_val_help
&----
*& Form get_data
&----
Extract the data
----
FORM get_data.
DATA: wa_vlxx_mwtot LIKE vlxx_mwtot.
DATA: lt_dfkkop TYPE TABLE OF ty_ach WITH HEADER LINE.
*Default the date to todays date -1 because it is expected to run after
*midnight and it is suppose to pick up all the payments for the previous
day
IF s_cpudt[] IS INITIAL.
s_cpudt-sign = 'I'.
s_cpudt-option = 'EQ'.
s_cpudt-low = sy-datum - 1.
APPEND s_cpudt.
ENDIF.
*Select data from DFKKKO
SELECT opbel cpudt blart herkf INTO TABLE it_dfkkko FROM dfkkko
WHERE opbel IN s_opbel
AND cpudt IN s_cpudt.
SELECT opbel augbl INTO TABLE it_dfkkko_orig FROM dfkkop
FOR ALL ENTRIES IN it_dfkkko
WHERE augbl = it_dfkkko-opbel
.
IF NOT it_dfkkko_orig[] IS INITIAL.
Select the data from DFKKOP
SELECT opbel
zzposnrop
gpart
vtref
augbd
augbl
augbt
kontl
kontt
pymet
blart
INTO TABLE lt_dfkkop
FROM dfkkop FOR ALL ENTRIES IN it_dfkkko_orig
WHERE opbel = it_dfkkko_orig-opbel " AND
AND blart = '10'
AND augst = '9'. "only paid items
IF sy-subrc = 0.
SORT lt_dfkkop. "by opbel augdt.
ELSE.
EXIT.
ENDIF.
Extraction of Data Source by using the function module DECODE_KONTL.
REFRESH it_ach_nonach.
LOOP AT lt_dfkkop.
IF NOT lt_dfkkop-augbl IS INITIAL.
CLEAR wa_vlxx_mwtot.
CALL FUNCTION 'DECODE_KONTL'
EXPORTING
i_kontt = lt_dfkkop-kontt
i_kontl = lt_dfkkop-kontl
IMPORTING
e_vlxx_mwtot = wa_vlxx_mwtot.
IF ( wa_vlxx_mwtot-zdatsrc = c_3520 OR
wa_vlxx_mwtot-zdatsrc = c_3503 ).
CLEAR it_ach_nonach.
it_ach_nonach-opbel = lt_dfkkop-opbel.
it_ach_nonach-augbd = lt_dfkkop-augbd.
it_ach_nonach-augbl = lt_dfkkop-augbl.
it_ach_nonach-augbt = lt_dfkkop-augbt.
it_ach_nonach-kontl = lt_dfkkop-kontl.
it_ach_nonach-zdatsrc = wa_vlxx_mwtot-zdatsrc.
it_ach_nonach-gpart = lt_dfkkop-gpart.
it_ach_nonach-vtref = lt_dfkkop-vtref.
it_ach_nonach-zzposnrop = lt_dfkkop-zzposnrop.
it_ach_nonach-blart = lt_dfkkop-blart.
APPEND it_ach_nonach.
ENDIF.
IF lt_dfkkop-pymet = 'C'.
IF NOT lt_dfkkop-augbl IS INITIAL.
it_non_ach-doc1r = lt_dfkkop-augbl.
APPEND it_non_ach.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
SORT it_ach_nonach.
Get the Check payment related data.
IF NOT it_non_ach[] IS INITIAL.
SELECT ztnum
doc1r
rwbtr
budat
FROM dfkkcr
INTO TABLE it_check
FOR ALL ENTRIES IN it_non_ach
WHERE doc1r EQ it_non_ach-doc1r.
IF sy-subrc = 0.
SORT it_check .
ENDIF.
ENDIF.
To get the entry code, Leg check no
IF NOT lt_dfkkop[] IS INITIAL.
SELECT gpart
vtref
posnr
zzentrcod
zzsrc_pay_reqno
INTO TABLE it_vvsc
FROM zzvvscpos
FOR ALL ENTRIES IN lt_dfkkop
WHERE gpart = lt_dfkkop-gpart
AND vtref = lt_dfkkop-vtref
AND posnr = lt_dfkkop-zzposnrop .
SORT it_vvsc.
ENDIF.
ENDIF.
ENDFORM. " get_data
&----
*& Form process_data
&----
Process data
----
FORM process_data .
DATA l_doc1r TYPE dfkkcr-doc1r.
SELECT * FROM zfpc_code_map INTO TABLE it_code_map
WHERE app_code = 'CHECKSTOP'
OR app_code = 'CHECKVOID'.
it_ach_nonach_temp[] = it_ach_nonach[].
it_vvsc_temp[] = it_vvsc[].
PERFORM remove_oroginal_for_voids.
LOOP AT it_ach_nonach.
CLEAR it_code_map.
it_final-zdatsrc = it_ach_nonach-zdatsrc.
READ TABLE it_vvsc WITH KEY gpart = it_ach_nonach-gpart
"it_ach-opbel
vtref = it_ach_nonach-vtref
posnr = it_ach_nonach-zzposnrop.
IF sy-subrc = 0.
it_final-zzentrcod = it_vvsc-zzentrcod.
it_final-chckn = it_vvsc-zzsrc_pay_reqno.
READ TABLE it_code_map WITH KEY
entry_code_id = it_final-zzentrcod.
IF it_code_map-app_code = 'CHECKSTOP'
OR it_code_map-app_code = 'CHECKVOID'.
LOOP AT it_vvsc_temp WHERE
zzsrc_pay_reqno = it_vvsc-zzsrc_pay_reqno AND
zzentrcod <> it_final-zzentrcod.
ENDLOOP.
IF sy-subrc = 0.
READ TABLE it_ach_nonach_temp WITH KEY
zzposnrop = it_vvsc_temp-posnr.
IF sy-subrc = 0.
SELECT SINGLE * FROM dfkkrapt WHERE
opbel = it_ach_nonach_temp-opbel.
IF sy-subrc = 0.
SELECT SINGLE * FROM dfkkcr
WHERE doc1r = dfkkrapt-augbl.
IF sy-subrc = 0.
it_final-ztnum = dfkkcr-ztnum.
it_final-budat = dfkkcr-budat.
it_final-rwbtr = dfkkcr-rwbtr.
it_final-rec_type = 'C'.
APPEND it_final.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
READ TABLE it_check WITH KEY doc1r = it_ach_nonach-augbl.
IF sy-subrc = 0.
l_doc1r = it_ach_nonach-opbel.
it_final-ztnum = it_check-ztnum.
it_final-budat = it_check-budat.
it_final-rwbtr = it_check-rwbtr.
it_final-rec_type = 'C'.
ELSE.
it_final-augbd = it_ach_nonach-augbd.
it_final-augbl = it_ach_nonach-augbl.
it_final-augbt = it_ach_nonach-augbt.
it_final-rec_type = 'A'.
ENDIF.
APPEND it_final.
ENDIF.
ENDIF.
ENDLOOP..
PERFORM process_output_file.
ENDFORM. " process_data
&----
*& Form download_data
&----
Download the data into pc and unix
----
FORM download_data .
DATA: w_fname TYPE string,
w_fname1 TYPE string.
w_fname = p_pfile.
w_fname1 = p_pfile1.
Presentation Server is Selected
IF rb_pres = c_x.
Download final Data to PC
PERFORM download_data_to_pc USING w_fname w_fname1.
App. Server is Selected
ELSEIF rb_unix = c_x.
Download final Data to Application Server
PERFORM build_unix_filename.
PERFORM download_data_to_app_serv.
ENDIF.
ENDIF.
ENDFORM. " download_data
&----
*& Form download_data_to_pc
&----
Download file into presentation server
----
FORM download_data_to_pc USING l_pfile TYPE string
l_pfile1 TYPE string.
*IF NOT it_file[] is initial .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_pfile
filetype = 'ASC'
write_field_separator = 'X'
TABLES
data_tab = it_file[]
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 i014. "Unable to write file on Presentation Server
ENDIF.
*elseif NOT it_file1[] is initial.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_pfile1
filetype = 'ASC'
write_field_separator = 'X'
TABLES
data_tab = it_file1[]
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 i014. "Unable to write file on Presentation Server
ENDIF.
*endif.
ENDFORM. " download_data_to_pc
&----
*& Form download_data_to_app_serv
&----
Transfer data to Application server
----
FORM download_data_to_app_serv.
Open the unix file for writing the extracted information.
OPEN DATASET v_unix_path FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
Populate Final Data to the required Path
LOOP AT it_file.
TRANSFER it_file TO v_unix_path .
ENDLOOP.
Close Dataset
CLOSE DATASET v_unix_path.
ELSE.
Message : Error in downloading the data
MESSAGE i013. "Unable to Open file on Application Server
ENDIF.
open the unix file for writing the extracted information.
OPEN DATASET v_unix_path1 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
Populate Final Data to the required Path
LOOP AT it_file1.
TRANSFER it_file1 TO v_unix_path1 .
ENDLOOP.
Close Dataset
CLOSE DATASET v_unix_path1.
ELSE.
Message : Error in downloading the data
MESSAGE i013. "Unable to Open file on Application Server
ENDIF.
ENDFORM. " download_data_to_app_serv
&----
*& Form build_unix_filename
&----
Unix file name with date and time
----
FORM build_unix_filename .
DATA: l_file_3520 LIKE rlgrap-filename,
l_file_3503 LIKE rlgrap-filename.
DATA: l_path1 LIKE rlgrap-filename VALUE '/global/data/transfer/',
l_path2 LIKE rlgrap-filename VALUE '/3520/pub/out/',
l_path3 LIKE rlgrap-filename VALUE '/3503/pub/out/'.
CONCATENATE l_path1 sy-sysid l_path2 INTO l_file_3520.
CONCATENATE l_path1 sy-sysid l_path3 INTO l_file_3503.
File name of Source code of 3520 file name.
CLEAR v_unix_path.
CLEAR v_unix_path1.
CONCATENATE l_file_3520 "p_afile
'3329'
'-'
'BA'
'-'
'01'
'-'
sy-datum
'-'
sy-uzeit+0(4)
'.OUT'
INTO v_unix_path.
File name of Source code of 3503 file name.
CONCATENATE l_file_3503 "p_afile
'3329'
'-'
'BA'
'-'
'02'
'-'
sy-datum
'-'
sy-uzeit+0(4)
'.OUT'
INTO v_unix_path1.
CONDENSE v_unix_path1.
ENDFORM. " build_unix_filename
&----
*& Form process_output_file
&----
output file
----
FORM process_output_file .
DATA : v_amt TYPE i,
v_temp12 TYPE string.
DATA: l_amt(16) TYPE n,
l_amount(16).
v_error_msg = text-002.
Populating the the data for Data Source value.
LOOP AT it_final WHERE zdatsrc EQ c_3520 OR
zdatsrc EQ c_3503.
Original Check request from Source System
WRITE it_final-chckn RIGHT-JUSTIFIED TO v_leg_chk_no.
v_string+0(10) = v_leg_chk_no.
IF v_leg_chk_no IS INITIAL OR v_leg_chk_no = ' '.
CONTINUE.
ENDIF.
CLEAR v_checkno.
For Check payment date
IF it_final-rec_type = 'C'.
FSCD Check number
WRITE it_final-ztnum RIGHT-JUSTIFIED TO v_checkno.
UNPACK v_checkno TO v_checkno.
v_string+10(10) = v_checkno.
CONCATENATE it_final-budat+4(2)
it_final-budat+6(2)
it_final-budat+2(2)
INTO v_date_check.
v_string+20(6) = v_date_check.
l_amt = it_final-rwbtr.
PACK l_amt TO l_amount.
CONDENSE l_amount.
v_string+26(13) = l_amount.
CONDENSE v_string+26(13).
UNPACK v_string26(13) TO v_string26(13).
ACH payment date
ELSE. "ACH
ACH Check number
MOVE it_final-augbl TO v_checkno.
v_string+10(10) = v_checkno.
CONCATENATE it_final-augbd+4(2)
it_final-augbd+6(2)
it_final-augbd+2(2)
INTO v_date_check.
v_string+20(6) = v_date_check.
l_amt = it_final-augbt.
PACK l_amt TO l_amount.
CONDENSE l_amount.
v_string+26(13) = l_amount.
CONDENSE v_string+26(13).
UNPACK v_string26(13) TO v_string26(13).
ENDIF.
CONDENSE v_checkno.
IF v_checkno IS INITIAL.
v_string+39(60) = v_error_msg.
ENDIF.
READ TABLE it_code_map WITH KEY entry_code_id = it_final-zzentrcod.
IF sy-subrc = 0.
CASE it_code_map-app_code.
WHEN 'CHECKSTOP'.
v_tran_type = 3. "Paid/Stop/Void
v_string+99(1) = v_tran_type.
WHEN 'CHECKVOID'.
v_tran_type = 2. "Paid/Stop/Void
v_string+99(1) = v_tran_type.
ENDCASE.
ELSE.
v_tran_type = 1. " Paid
v_string+99(1) = v_tran_type.
ENDIF.
IF it_final-zdatsrc EQ c_3520.
it_file-vline = v_string.
APPEND it_file.
CLEAR it_file.
CLEAR: l_amt, l_amount.
ELSEIF it_final-zdatsrc EQ c_3503.
it_file1-vline = v_string.
APPEND it_file1.
CLEAR it_file1.
CLEAR: l_amt, l_amount.
ENDIF.
ENDLOOP.
ENDFORM. " process_output_file
&----
*& Form build_file_names
&----
Build file names
----
FORM build_file_names .
File convention for 3520.
CONCATENATE '3329'
'-'
'BA'
'-'
'01'
'-'
sy-datum
'-'
sy-uzeit+0(4)
'.OUT'
INTO p_afile.
File convention for 3503.
CONCATENATE '3329'
'-'
'BA'
'-'
'02'
'-'
sy-datum
'-'
sy-uzeit+0(4)
'.OUT'
INTO p_afile1.
ENDFORM. " build_file_names
&----
*& Form remove_oroginal_for_voids
&----
text
----
--> p1 text
<-- p2 text
----
FORM remove_oroginal_for_voids .
DATA v_tabix LIKE sy-tabix.
LOOP AT it_ach_nonach.
v_tabix = sy-tabix.
CLEAR it_code_map.
it_final-zdatsrc = it_ach_nonach-zdatsrc.
READ TABLE it_vvsc WITH KEY gpart = it_ach_nonach-gpart
"it_ach-opbel
vtref = it_ach_nonach-vtref
posnr = it_ach_nonach-zzposnrop.
IF sy-subrc = 0.
it_final-zzentrcod = it_vvsc-zzentrcod.
it_final-chckn = it_vvsc-zzsrc_pay_reqno.
READ TABLE it_code_map WITH KEY
entry_code_id = it_final-zzentrcod.
IF it_code_map-app_code = 'CHECKSTOP'
OR it_code_map-app_code = 'CHECKVOID'.
LOOP AT it_vvsc_temp WHERE
zzsrc_pay_reqno = it_vvsc-zzsrc_pay_reqno AND
zzentrcod <> it_final-zzentrcod.
ENDLOOP.
IF sy-subrc = 0.
READ TABLE it_ach_nonach_temp WITH KEY
zzposnrop = it_vvsc_temp-posnr.
IF sy-subrc = 0.
DELETE it_ach_nonach where opbel = it_ach_nonach_temp-opbel.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " remove_oroginal_for_voids
2006 Dec 12 8:55 AM