‎2006 Aug 02 11:46 AM
Hi experts,
can u plz help me with this.
Actuall my requirement is as follows.
I have two records.One is detailed and second one is Trailer record. These two records contain structure as given below. Now i want to create output file in text mode and print it to printer. I have written the below code and i am not able to move furthur with logic .Can u plz suggest me how the next code should be.
Regards,
siri
its very urgent ,points sure maximum
Comments: This program will create a custom postive pay report. The
report creates a file to be transmitted to the bank.
The file is encrypted and
sent to bank.Execution of the report is based on Company Code,
House Bank, Bank ID, Check Creation Date, Logical File Location,
and Printer Name.The created file is sent to printer.
*----
*----
REPORT ZRFI_POSITIVE_PAY.
----
Tables *
----
TABLES: T012K, "House Bank Accounts
PAYR. "Payment Medium File
----
Types *
----
TYPES: BEGIN OF ty_detail_result,
prefix(2) TYPE c,
bankn(12) TYPE c, "Bank account #
fval1(4) TYPE c,
fval2(2) TYPE c,
rwbtr LIKE payr-rwbtr, "Check amount
chect(10) TYPE c, "Check number
zaldt(6) TYPE c, "Check date
fval3(4) TYPE C,
fval4(12) TYPE C, "12 blanks
fval5(1) TYPE C, "Voided check or not
fval6(17) TYPE C, "17 zeros
fval7(1) TYPE C,
END OF ty_detail_result.
TYPES: BEGIN OF ty_trailer_result,
fval1(10) TYPE c,
fval2(8) TYPE n, "Total number of checks issued
fval3 LIKE payr-rwbtr, "Total checks issued amount
fval4(20) TYPE c, "20 zeros
fval5(8) TYPE n, "Total number of checks voided
fval6 LIKE payr-rwbtr, "Total amount of checks voided
fval7(10) TYPE c, "10 zeros
END OF ty_trailer_result.
----
Internal Tables *
----
DATA: t_details TYPE STANDARD TABLE OF ty_detail_result INITIAL SIZE 0.
DATA: t_trailer TYPE STANDARD TABLE OF ty_trailer_result INITIAL SIZE 0.
----
Work Areas *
----
DATA: wa_details TYPE ty_detail_result,
wa_trailer TYPE ty_trailer_result.
----
Variables *
----
DATA: LV_DETFILE LIKE wa_details.
----
S e l e c t O p t i o n s *
P a r a m e t e r s *
----
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE TEXT-001.
PARAMETERS: p_bukrs LIKE t001-bukrs, "Company Code
p_hbkid LIKE payr-hbkid, "House Bank
p_hktid LIKE payr-hktid. "Bank ID
SELECTION-SCREEN END OF BLOCK block1.
SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE TEXT-002.
PARAMETERS: p_zaldt LIKE payr-zaldt. "Check creation date
SELECTION-SCREEN END OF BLOCK block2.
SELECTION-SCREEN BEGIN OF BLOCK block3 WITH FRAME TITLE TEXT-003.
PARAMETERS: p_path LIKE v_path-pathextern, "Logical File Name
p_print LIKE v_t329d-ldest. "Printer Name
SELECTION-SCREEN END OF BLOCK block3.
************************************************************************
START-OF-SELECTION. *
************************************************************************
START-OF-SELECTION.
SELECT bukrs
hbkid
hktid
zaldt
FROM PAYR
INTO TABLE t_details
WHERE BUKRS = P_BUKRS
AND HBKID = P_HBKID
AND HKTID = P_HKTID
AND ZALDT = P_ZALDT.
SELECT bukrs
hbkid
hktid
FROM T012K
INTO TABLE t_details
WHERE BUKRS = P_BUKRS
AND HBKID = P_HBKID
AND HKTID = P_HKTID
AND ZALDT = P_ZALDT.
SELECT
OPEN DATASET 'POSPAY1100-20060515.TXT' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC <> 0.
WRITE: 'POSPAY1100-20060515.TXT', 'DATASET FAILED'.
ELSE.
LOOP AT t_details INTO wa_details.
LV_DETFILE = WA_DETAILS.
TRANSFER LV_DETFILE TO p_path .
ENDLOOP.
ENDIF.
‎2006 Aug 02 11:56 AM
Hello Siressha,
First of all there is no reference to getting data in trailer table and neither it is trying to transfer the data into dataset for it.
Secondly, for t_details table you are inserting the records from two tables into the same internal table better use SELECT...appending into table t_details (pls check the syntax in help).
I feel once you have the trailer table just loop at the trailer table after looping thru detail table and transfer the data to dataset.
Regards
Anurag
‎2006 Aug 02 12:16 PM
‎2006 Aug 02 12:22 PM
SELECT bukrs
hbkid
hktid
zaldt
FROM PAYR
INTO TABLE t_details
WHERE BUKRS = P_BUKRS
AND HBKID = P_HBKID
AND HKTID = P_HKTID
AND ZALDT = P_ZALDT.
SELECT bukrs
hbkid
hktid
FROM T012K
APPENDING INTO TABLE t_details
WHERE BUKRS = P_BUKRS
AND HBKID = P_HBKID
AND HKTID = P_HKTID
AND ZALDT = P_ZALDT.
That was for point 1 where you need to append into the t_details table
Secondly, there is no reference in your abap for t_trailer.
Regards
Anurag
‎2006 Aug 02 12:44 PM
yes Anurag there is no reference for t_trailer thats what i want to know how to proceed then?
can u help me with that
regards
Siri
‎2006 Aug 02 1:08 PM
‎2006 Aug 02 1:13 PM
As to the comments in your code for trailer record structure....you can calculate the details as follows.
TYPES: BEGIN OF ty_trailer_result,
fval1(10) TYPE c,
fval2(8) TYPE n, "Total number of checks issued
fval3 LIKE payr-rwbtr, "Total checks issued amount
fval4(20) TYPE c, "20 zeros
fval5(8) TYPE n, "Total number of checks voided
fval6 LIKE payr-rwbtr, "Total amount of checks voided
fval7(10) TYPE c, "10 zeros
END OF ty_trailer_result.
loop at t_details.
at new bankc. {it can be bankc or the field on which you wish to generate the file)
clear the variables.
endat.
if chect <> space. (please note u need to fill the t_details table with the particular fields)
l_cnt = l_cnt + 1. --> fval2
l_rwbtr = l_rwbtr + t_details-rwbtr. --> fval3
endif.
if voidr > 0 or voidd <> space or voidu <> space.
l_vcnt = l_vcnt + 1. -->favl5
l_vrwbtr = l_vrwbtr + t_details-rwbtr. --> fval6
endif.
at end of bankc.
transfer the trailer record.
endat.
endloop.
Surely, it also depends on the specification.
Regards
anurag