‎2009 Dec 08 5:56 AM
Hi All,
I have an issue with gui_download function module that it is creating one extra line while downloading my internal table data into text file,which i donot want.i have searched for various threads but couldnot get the proper reply.Or please provide me some other Function Module which will not create one extra line.Please help.
‎2009 Dec 15 7:14 AM
Hi Ankita
Just try this and your problem will be solved.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = FILEPATH
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = IT_OUTPUT
‎2009 Dec 08 6:04 AM
Hi Ankita,
Is it adding a blank line or line with some data?
Can you plz share your code with us so that we can check if there is any problem with your call?
Regards
Avinash
‎2009 Dec 08 6:04 AM
Hello,
GUI_DOWNLOAD only uses data from your internal table to download. So check in the debugging mode if there is a addition blank line in the internal table before passing it to GUI_DOWNLOAD.
Vikranth
‎2009 Dec 08 6:48 AM
Hi,
No my internal table does not contain any extra line.I have already checked it.
‎2009 Dec 08 6:50 AM
Hello,
What is the type of the file you are trying to download? Also post how you are calling GUI_DOWNLOAD. That might give a clue as to identify whats wrong.
Vikranth
‎2009 Dec 08 7:14 AM
Hi,
Plz check my code below
APPEND IT_OUTPUT -
this is my internal table.
DESCRIBE TABLE IT_OUTPUT LINES ln.
FILE_LEN = LN.----
I am passinf the internal table legth
CLEAR IT_OUTPUT.
IF IT_OUTPUT[] IS NOT INITIAL.
CONCATENATE FLN SY-DATUM SY-UZEIT '.txt'
INTO FILEPATH.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = FILEPATH
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
TRUNC_TRAILING_BLANKS = 'X'
WK1_T_SIZE = FILE_LEN
TRUNC_TRAILING_BLANKS_EOL = ''
WRITE_LF = ''
WRITE_LF_AFTER_LAST_LINE = ''
TABLES
DATA_TAB = IT_OUTPUT
OTHERS = 22
‎2009 Dec 08 7:16 AM
Can you post your original code how you are filling the internal table and what aexactly are y9ou doing.So we can copy to our systems and check for the same.
Sas
‎2009 Dec 08 7:21 AM
Hello,
I dont see the use for using the file length here. May be thats the reason for the extra line. Try removing it and check
APPEND IT_OUTPUT ---------this is my internal table.
CLEAR IT_OUTPUT.
IF IT_OUTPUT[] IS NOT INITIAL.
CONCATENATE FLN SY-DATUM SY-UZEIT '.txt'
INTO FILEPATH.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = FILEPATH
FILETYPE = 'ASC'
* WRITE_FIELD_SEPARATOR = 'X'
TRUNC_TRAILING_BLANKS = 'X'
*WK1_T_SIZE = FILE_LEN " Comment this and check
* TRUNC_TRAILING_BLANKS_EOL = ''
* WRITE_LF = ''
* WRITE_LF_AFTER_LAST_LINE = ''
TABLES
DATA_TAB = IT_OUTPUT
* OTHERS = 22
Vikranth
‎2009 Dec 08 7:23 AM
Hi Ankita,
Is there any requirement to pass the file length?
Usually it is not necessary to pass file length.Try by removing that.
Regards
Avinash
‎2009 Dec 08 7:34 AM
Hi Ankita,
The problem is in your file.
Try using a field separator = 'X' and try.This will only create one tab space and problem will get solved.
Regards,
Subhashini
‎2009 Dec 08 8:43 AM
Clear/ Refresh the internal table before you use it.
Regs, Arka
‎2009 Dec 08 9:12 AM
Hi ,
Please check for radio button R4
Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code. And use code tags.
Edited by: Rob Burbank on Dec 8, 2009 9:23 AM
‎2009 Dec 08 9:17 AM
‎2009 Dec 08 10:32 AM
Hi,
Why are you using WK1_T_SIZE. That is the column width of Text columns. Comment out this and it should work fine. By the way you were passing the number of rows to WK1_T_SIZE and not the size of the table. For getting the size of the table you should multiply the rows * column width
Regards,
‎2009 Dec 08 6:05 AM
its not with gui_download..
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_fullpath
filetype = 'ASC'
append = 'X'
TABLES
data_tab = t_output " check this table, this would have the extra line...
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.
‎2009 Dec 08 6:05 AM
Hi,
Is it creating a blank line at the end of file?
Regards,
Subhashini
‎2009 Dec 08 7:07 AM
‎2009 Dec 08 7:10 AM
Ankita 1 points :
1)Can you post your code for easy analaysis...
Sas
‎2009 Dec 08 7:10 AM
‎2009 Dec 08 7:46 AM
‎2009 Dec 08 9:26 AM
‎2009 Dec 08 9:22 AM
dont loose your time.
define a new iternal table with the same structure as the other.
loop at old_it.
if old_it-field1 <> ' '. "is not initial
move-corresponding old_it to new_it.
append new_it.
clear new_it.
endloop.i dont know how to post the opposit of ( = ). second line of code before ' '.
‎2009 Dec 08 9:33 AM
‎2009 Dec 08 9:37 AM
debug it before the FM. if your iternal table has an empty line the problem is in your table else something with your FM
‎2009 Dec 08 9:40 AM
You are downloading it as a Text file. What do you mean by a blank line at the end here?
‎2009 Dec 08 9:51 AM
i mean to say one extra blank line is coming along with my data in the text file which i donot want.how can i get rid of this blank line.
‎2009 Dec 08 9:54 AM
Hi Ankita,
I) have you tried setting parameter 'write_lf_after_last_line' to 'space'
if the above does not work you can use one work around. Its rather lengthy solution .
1. The following settings were needed to stop all line feed /carriage returns in the file creation and
remove new unwanted spacing .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = g_file
filetype = 'ASC'
trunc_trailing_blanks = 'X' "PREVENT EXTRA SPACES
write_lf = ' ' "PREVENT LINE FEED
2. Then set up your own carriage returns via hexadecimal symbols like below:
*holds hexadecimal carriage return character
DATA: BEGIN OF xt,
xx(1) TYPE x,
END OF xt.
INITIALIZATION.
*set carriage return value
xt-xx = '0D'. "carriage return '0D', line feed '0A'
3. Finallyyou need to insert the carriage return before saving it to the data table to be output to file.
CONCATENATE w_dtl xt INTO w_dat-data.
This should be done to every record except the last one .
‎2009 Dec 08 10:00 AM
ankita
if you are getting data
pernr begda endda
1 12/01/09 12/31/99
2 11/01/09 12/31/99
3 12/02/09 12/31/99
Now where is the extra space concept in txt file?
Please use
{code)
(code}
to post code.When i copy your code its too hard to make it line by line
and remember if it exceeds certain 2500 character try to break the code and paste by parts (post by post)
Sas
‎2009 Dec 08 10:19 AM
Hi,
Please elaborate your point.because i didnot get you completely.
‎2009 Dec 08 10:21 AM
Hi Ankita,
In GUI_DOWNLOAD, there is a parameter called 'write_lf_after_last_line' . Try setting that to space.
write_lf_after_last_line = ' '
If the above also does not work you can go for the work around mentioned in my previous reply.
I hope its clear. Else, let me know .
‎2009 Dec 08 11:23 AM
Hi Vasuki,
I tried using WRITE_LF_AFTER_LAST_LINE = ' '. But not working.
‎2009 Dec 09 8:27 AM
Hi Ankita,
You can try the work around suggested in my earlier post
1) Remove all line feed /carriage returns in the file and
remove new unwanted spacing . Use the FM parameters as follows :
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = g_file
filetype = 'ASC'
trunc_trailing_blanks = 'X' "PREVENT EXTRA SPACES
write_lf = ' ' "PREVENT LINE FEED
2. Then set up your own carriage returns via hexadecimal symbols like below:
DATA: BEGIN OF xt,
xx(1) TYPE x,
END OF xt.
INITIALIZATION.
xt-xx = '0D'. "carriage return '0D', line feed '0A'
3. Finallyyou need to insert the carriage return before saving it to the data table to be output to file.
CONCATENATE w_dtl xt INTO w_dat-data.
This should be done to every record *except the last one * .
This will solve your issue.
‎2009 Dec 09 9:15 AM
Hi Vasuki,
I tried your code but it is giving me dump as well as it is not taking hexadecimals it is asking for character or numeric type.
‎2009 Dec 09 9:18 AM
Last call for you...................
Paste your code in blocks (2 or 3 posts) using codes
So that any one can copy code into their posts and guide you better .........All trail and error are completed.
Best of luck
Sas
‎2009 Dec 09 9:23 AM
Code part 1.
**Data Declaration:-**
TABLES: PERNR,
PCL1,
PCL2,
PA0001,
PA0009,
T549Q, T511.
INFOTYPES: 0000,0009,0001,0008,0003.
*DATA BEGIN OF PHIFI OCCURS 1.
INCLUDE STRUCTURE PERNR.
*DATA END OF PHIFI.
DATA BEGIN OF EVP OCCURS 1.
INCLUDE STRUCTURE PEVPT.
DATA END OF EVP.
DATA : HIRE LIKE SY-DATUM,
FIRE LIKE SY-DATUM.
DATA : BEGIN OF ITAB1 OCCURS 0,
SNO TYPE N,
ENO LIKE PERNR-PERNR,
NAM LIKE P0001-ENAME,
BAC LIKE P0009-BANKN,
DEP LIKE P0001-KOSTL,
BTFR LIKE P0008-BET01 VALUE 0,
BKEY LIKE P0009-BANKL,
PDT LIKE SY-DATUM,
BETRG LIKE P0009-BETRG,"CHANGES BY ANKITA.
TAXID(10),"CHANGES BY ANKITA.
END OF ITAB1.
DATA : BEGIN OF ITCC OCCURS 0,
SNO TYPE N,
DEP LIKE P0001-KOSTL,
BTFR LIKE P0008-BET01 VALUE 0,
END OF ITCC.
DATA : ITCOL LIKE ITCC OCCURS 0 WITH HEADER LINE.
DATA: BERTG_TOT(16) TYPE N.
DATA : BEGIN OF ITTF OCCURS 0,
ROW(37),
END OF ITTF.
DATA : BEGIN OF IT_FAIL OCCURS 0,
EN LIKE PERNR-PERNR,
BA LIKE P0009-BANKN,
END OF IT_FAIL.
DATA : LIN TYPE I VALUE 0,
FILE_LEN TYPE I VALUE 160,
FILEPATH TYPE STRING,
FR_DT LIKE SY-DATUM,
TO_DT LIKE SY-DATUM,
V_BAC LIKE P0009-BANKN,
SN TYPE N VALUE 0,
STR(37) TYPE C,
LEN TYPE I,
P11(11) TYPE C,
P3(3) TYPE C,
P13(13) TYPE N,
P6(6) TYPE C,
TO_P(6),
FR_P(6),
YEAR(4),
MONTH(2),
DAY(2),
LN TYPE C.
DATA:BEGIN OF IT_BANK OCCURS 0,
EMPID(10),
BANKN(14) TYPE N,
BANKL(07) TYPE N,
BETRG(10) TYPE N,
TAXID(10),
END OF IT_BANK.
DATA: F_NAME TYPE STRING,
ORG_NO(07) TYPE N,
HEADER(3),
DATACODE(6),
DEPT_CODE(5),
CUST_ID(18),
IRN(16),
FILLER(74),
TRANS_DAY TYPE SY-DATUM,
TRANS_DAY1(4) TYPE N,
TIME TYPE SY-UZEIT,
STR1 TYPE STRING,
STR3 TYPE STRING,
STR2 TYPE STRING,
TYPE(1) TYPE C VALUE 'N',
SEQNO(06) TYPE N,
SEQ(08) TYPE N,
RETURN_CODE(02) VALUE '00',
PRES_CODE(01) VALUE 'B',
STR7 TYPE STRING,
COMP_CODE(06),
PRE_DAT(08) TYPE N VALUE '00000000',
PRE_SEQ(06) TYPE N VALUE '000000',
PRE_CODE(01),
STR4 TYPE STRING,
STR5 TYPE STRING,
STR6 TYPE STRING,
FOOTER(03) VALUE 'EOF'.
DATA:BEGIN OF IT_OUTPUT OCCURS 0,
OUT_ROW(160) TYPE C,
END OF IT_OUTPUT. " eoc BY ANKITA
DATA:BEGIN OF IT_OUTPUT_new OCCURS 0,
OUT_ROW(160) TYPE C,
END OF IT_OUTPUT_new.
PARAMETERS: PRD LIKE PC260-FPPER OBLIGATORY DEFAULT '200804'.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(12) TEXT-002 FOR FIELD R1.
PARAMETERS: R1 RADIOBUTTON GROUP RG1 DEFAULT 'X' USER-COMMAND RB.
SELECTION-SCREEN COMMENT 25(19) TEXT-003 FOR FIELD R2.
PARAMETERS: R2 RADIOBUTTON GROUP RG1.
SELECTION-SCREEN COMMENT 55(17) TEXT-004 FOR FIELD R3.
PARAMETERS: R3 RADIOBUTTON GROUP RG1.
SELECTION-SCREEN COMMENT 79(22) TEXT-005 FOR FIELD R4.
PARAMETERS: R4 RADIOBUTTON GROUP RG1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B1.
PARAMETERS: PREPBY(30) TYPE C.
PARAMETERS: APROBY(30) TYPE C.
PARAMETERS: BTC(3) TYPE C OBLIGATORY DEFAULT '014'.
PARAMETERS: FLN LIKE RLGRAP-FILENAME DEFAULT 'C:\BankTransfer'.
*SELECTION-SCREEN COMMENT /5(60) TEXT-006 FOR FIELD PY_DT.
PARAMETERS: PY_DT LIKE PA0009-BEGDA OBLIGATORY.
PARAMETERS: ORG_AC(14) TYPE N OBLIGATORY,
ORG_ID(10) TYPE C OBLIGATORY,
PRS_BNK(07) TYPE N OBLIGATORY DEFAULT '0810016',
DEPT_CD(5) TYPE C OBLIGATORY DEFAULT '00000',
REF_NO(10) TYPE C OBLIGATORY,
TRANS_TY(02) TYPE C OBLIGATORY,
TRANS_ID(03) TYPE C OBLIGATORY,
TRANS_RK(44) TYPE C OBLIGATORY.
‎2009 Dec 09 9:25 AM
part 2
INCLUDE RPPPXD00.
DATA : BEGIN OF COMMON PART A.
INCLUDE RPPPXD10.
DATA : END OF COMMON PART.
INCLUDE PC2RXTW0.
INCLUDE RPC2RX00.
DATA : BEGIN OF COMMON PART B.
INCLUDE RPC2CD00.
DATA : END OF COMMON PART.
INCLUDE RPPPXM00.
INCLUDE RPCMGR00.
*******************************************************************
AT SELECTION-SCREEN OUTPUT.
CONCATENATE SY-DATUM2(6) SY-UZEIT0(4) INTO REF_NO.
LOOP AT SCREEN.
IF R1 = 'X'.
IF SCREEN-NAME = 'FLN' OR SCREEN-NAME = '%_FLN_%_APP_%-TEXT' OR
SCREEN-NAME = 'BTC' OR SCREEN-NAME = '%_BTC_%_APP_%-TEXT' OR
SCREEN-NAME = 'PY_DT' OR SCREEN-NAME = '%_PY_DT_%_APP_%-TEXT'"SOC BY ANKITA"
OR SCREEN-NAME = 'ORG_ID' OR SCREEN-NAME = '%_ORG_ID_%_APP_%-TEXT'
OR SCREEN-NAME = 'ORG_AC' OR SCREEN-NAME = '%_ORG_AC_%_APP_%-TEXT'
OR SCREEN-NAME = 'DEPT_CD' OR SCREEN-NAME = '%_DEPT_CD_%_APP_%-TEXT'
OR SCREEN-NAME = 'REF_NO' OR SCREEN-NAME = '%_REF_NO_%_APP_%-TEXT'
OR SCREEN-NAME = 'PRS_BNK' OR SCREEN-NAME = '%_PRS_BNK_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_TY' OR SCREEN-NAME = '%_TRANS_TY_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_ID' OR SCREEN-NAME = '%_TRANS_ID_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_RK' OR SCREEN-NAME = '%_TRANS_RK_%_APP_%-TEXT'."EOC BY ANKITA
SCREEN-ACTIVE = 0.
ENDIF.
ENDIF.
IF R2 = 'X'.
IF SCREEN-NAME = 'FLN' OR SCREEN-NAME = '%_FLN_%_APP_%-TEXT' OR
SCREEN-NAME = 'BTC' OR SCREEN-NAME = '%_BTC_%_APP_%-TEXT' OR
SCREEN-NAME = 'PREPBY' OR SCREEN-NAME = '%_PREPBY_%_APP_%-TEXT'
OR SCREEN-NAME = 'APROBY' OR SCREEN-NAME = '%_APROBY_%_APP_%-TEXT'
OR SCREEN-NAME = 'PY_DT' OR SCREEN-NAME = '%_PY_DT_%_APP_%-TEXT' "SOC BY ANKITA
OR SCREEN-NAME = 'ORG_ID' OR SCREEN-NAME = '%_ORG_ID_%_APP_%-TEXT'
OR SCREEN-NAME = 'ORG_AC' OR SCREEN-NAME = '%_ORG_AC_%_APP_%-TEXT'
OR SCREEN-NAME = 'DEPT_CD' OR SCREEN-NAME = '%_DEPT_CD_%_APP_%-TEXT'
OR SCREEN-NAME = 'REF_NO' OR SCREEN-NAME = '%_REF_NO_%_APP_%-TEXT'
OR SCREEN-NAME = 'PRS_BNK' OR SCREEN-NAME = '%_PRS_BNK_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_TY' OR SCREEN-NAME = '%_TRANS_TY_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_ID' OR SCREEN-NAME = '%_TRANS_ID_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_RK' OR SCREEN-NAME = '%_TRANS_RK_%_APP_%-TEXT'."EOC BY ANKITA
SCREEN-ACTIVE = 0.
ENDIF.
ENDIF.
IF R3 = 'X'.
IF SCREEN-NAME = 'PREPBY' OR SCREEN-NAME = '%_PREPBY_%_APP_%-TEXT'
OR SCREEN-NAME = 'APROBY' OR SCREEN-NAME = '%_APROBY_%_APP_%-TEXT'
OR SCREEN-NAME = 'PY_DT' OR SCREEN-NAME = '%_PY_DT_%_APP_%-TEXT' "SOC BY ANKITA
OR SCREEN-NAME = 'ORG_ID' OR SCREEN-NAME = '%_ORG_ID_%_APP_%-TEXT'
OR SCREEN-NAME = 'ORG_AC' OR SCREEN-NAME = '%_ORG_AC_%_APP_%-TEXT'
OR SCREEN-NAME = 'REF_NO' OR SCREEN-NAME = '%_REF_NO_%_APP_%-TEXT'
OR SCREEN-NAME = 'DEPT_CD' OR SCREEN-NAME = '%_DEPT_CD_%_APP_%-TEXT'
OR SCREEN-NAME = 'PRS_BNK' OR SCREEN-NAME = '%_PRS_BNK_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_TY' OR SCREEN-NAME = '%_TRANS_TY_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_ID' OR SCREEN-NAME = '%_TRANS_ID_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_RK' OR SCREEN-NAME = '%_TRANS_RK_%_APP_%-TEXT'."EOC BY ANKITA
SCREEN-ACTIVE = 0.
ENDIF.
ENDIF.
IF R4 = 'X'.
IF SCREEN-NAME = 'PREPBY' OR SCREEN-NAME = '%_PREPBY_%_APP_%-TEXT'"SOC BY ANKITA
OR SCREEN-NAME = 'APROBY' OR SCREEN-NAME = '%_APROBY_%_APP_%-TEXT'
OR SCREEN-NAME = 'BTC' OR SCREEN-NAME = '%_BTC_%_APP_%-TEXT'."EOC BY ANKITA
SCREEN-ACTIVE = 0.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
START-OF-SELECTION.
SELECT SINGLE * FROM T549Q WHERE PERMO = '01'
AND PABRJ = PRD+0(4)
AND PABRP = PRD+4(2).
FR_DT = T549Q-BEGDA.
TO_DT = T549Q-ENDDA.
CONCATENATE FR_DT0(4) FR_DT4(2) INTO FR_P.
CONCATENATE TO_DT0(4) TO_DT4(2) INTO TO_P.
PN-PAPER = PRD.
PN-PERMO = '01'.
GET PERNR.
RP-PROVIDE-FROM-LAST P0003 SPACE PN-BEGDA PN-ENDDA.
RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ 1.
SN = SN + 1.
ITAB1-SNO = SN.
ITCC-SNO = SN.
ITAB1-ENO = PERNR-PERNR.
ITAB1-NAM = PERNR-ENAME.
ELSE.
REJECT.
ENDIF.
RP-INIT-BUFFER.
RP-SEL-CALC.
CALL FUNCTION 'RP_EVALUATION_PERIODS'
EXPORTING
LAST_CALCULATED_DAY = P0003-ABRDT
LAST_DAY_IN_PERIOD = TO_DT
RETROCALCULATED_DAY = RP-SEL-CALC-RRDAT
TABLES
DIR = RGDIR
EVP = EVP
EXCEPTIONS
RGDIR_EMPTY = 1
INTERNAL_ERROR = 2
OTHERS = 3.
DESCRIBE TABLE EVP LINES LIN.
IF LIN > 0.
LOOP AT EVP.
IF EVP-IAPER = TO_P AND EVP-PAPER = TO_P.
RX-KEY-PERNR = PERNR-PERNR.
UNPACK EVP-SEQNR TO RX-KEY-SEQNO.
RP-IMP-C2-TN.
READ TABLE BT INDEX 1.
READ TABLE WPBP INDEX 1.
READ TABLE TAX INDEX 1."CHANGES BY ANKITA
ITAB1-BAC = BT-BANKN.
ITAB1-BKEY = BT-BANKL .
ITAB1-DEP = WPBP-KOSTL.
ITAB1-BETRG = BT-BETRG."CHANGES BY ANKITA
ITAB1-TAXID = TAX-TAXID."CHANGES BY ANKITA
YEAR = VERSC-PAYDT+0(4) - 11.
MONTH = VERSC-PAYDT+4(2).
DAY = VERSC-PAYDT+6(2).
CONCATENATE YEAR MONTH DAY INTO ITAB1-PDT.
ITAB1-PDT = VERSC-PAYDT - 110000.
ITCC-DEP = WPBP-KOSTL.
LOOP AT RT WHERE LGART = '/559'.
ITAB1-BTFR = RT-BETRG.
ITCC-BTFR = RT-BETRG.
IF EVP-SRTZA = 'P'.
ITAB1-BTFR = ITAB1-BTFR - RT-BETRG.
ELSE.
ITAB1-BTFR = ITAB1-BTFR + RT-BETRG.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDIF.
APPEND: ITAB1, ITCC.
CLEAR: ITAB1, ITCC.
END-OF-SELECTION.
CONCATENATE 'Prepared By:' ` ` PREPBY INTO PREPBY.
CONCATENATE 'Approved By:' ` ` APROBY INTO APROBY.
IF R1 = 'X'.
FORMAT COLOR 2.
ULINE (127).
NEW-LINE.
WRITE: 2 'Sr No.', 10 'Emp Num', 27 'Name'.
WRITE: 57 'Department'.
WRITE: 72 ' Transfer Amount' RIGHT-JUSTIFIED.
WRITE: 92 'Bank Key', 107 'Bank AC. Number'.
WRITE:1 '|', 8 '|', 25 '|', 55 '|', 70 '|', 90 '|', 105 '|', 127 '|'.
NEW-LINE.
ULINE (127).
NEW-LINE.
FORMAT COLOR OFF.
LOOP AT ITAB1.
SN = SY-TABIX.
WRITE: 2 SN, 10 ITAB1-ENO, 27 ITAB1-NAM.
WRITE: 57 ITAB1-DEP.
WRITE: 72 ITAB1-BTFR.
WRITE: 92 ITAB1-BKEY, 107 ITAB1-BAC.
WRITE: 1 '|', 8 '|', 25 '|', 55 '|', 70 '|', 90 '|', 105 '|', 127 '|'.
ULINE (127).
NEW-LINE.
ENDLOOP.
SKIP 4.
ULINE 90(32).
NEW-LINE.
WRITE: 90 PREPBY.
SKIP 4.
ULINE 90(32).
NEW-LINE.
WRITE: 90 APROBY.
ENDIF.
IF R2 = 'X'.
LOOP AT ITCC.
COLLECT ITCC INTO ITCOL.
ENDLOOP.
FORMAT COLOR 2.
ULINE (44).
NEW-LINE.
WRITE:2 'Sr No.', 9 'Department'.
WRITE: 27 'Transfer Amount ' RIGHT-JUSTIFIED.
WRITE:1 '|', 8 '|', 25 '|', 44 '|'.
NEW-LINE.
ULINE (44).
NEW-LINE.
FORMAT COLOR OFF.
LOOP AT ITCOL.
SN = SY-TABIX.
WRITE: 2 SN, 9 ITCOL-DEP, 27 ITCOL-BTFR.
WRITE:1 '|', 8 '|', 25 '|', 44 '|'.
NEW-LINE.
ULINE (44).
NEW-LINE.
ENDLOOP.
ENDIF.
IF R3 = 'X'.
LOOP AT ITAB1.
CLEAR: ITTF, P3, P11, P13, P6, V_BAC.
LEN = STRLEN( ITAB1-BKEY ).
IF LEN < 3.
CONCATENATE ITAB1-BKEY '***' INTO P3.
ELSE.
LEN = LEN - 3.
LEN = 3.
P3 = ITAB1-BKEY+LEN(3).
ENDIF.
CLEAR LEN.
V_BAC = ITAB1-BAC.
REPLACE ALL OCCURRENCES OF '-' IN ITAB1-BAC WITH ''.
CONDENSE ITAB1-BAC NO-GAPS.
LEN = STRLEN( ITAB1-BAC )."if length of acc num > limit
IF LEN > 11.
IT_FAIL-EN = ITAB1-ENO.
IT_FAIL-BA = V_BAC.
APPEND IT_FAIL.
CLEAR: IT_FAIL.
CONTINUE.
ENDIF.
P11 = ITAB1-BAC.
CONCATENATE P11 '***********' INTO P11.
above step is for putting '' in place of unfilled chars of P11.
P13 = ITAB1-BTFR * 100.
P6 = ITAB1-PDT+2(6).
CONCATENATE ` ` P3 P11 BTC P13 P6 INTO STR.
ITTF-ROW = STR.
APPEND ITTF.
ENDLOOP.
IF ITTF[] IS NOT INITIAL.
CONCATENATE FLN SY-DATUM SY-UZEIT '.txt' INTO FILEPATH.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = FILEPATH
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = ITTF
OTHERS = 22
.
SKIP 2.
IF SY-SUBRC <> 0.
WRITE:/ 'Unable to Download file at ', FILEPATH.
ELSE.
WRITE:/ 'File with following data downloaded at ', FILEPATH.
NEW-LINE.
SKIP 2.
LOOP AT ITTF.
WRITE:/ ITTF.
ENDLOOP.
ENDIF.
ELSE.
WRITE 'No Data, no file was downloaded'.
ENDIF.
IF IT_FAIL[] IS NOT INITIAL.
SKIP 2.
FORMAT COLOR 2.
WRITE 'Acc. No. of following employees exceeded the length limit'.
WRITE:/ 'So their entry was not created in the file'.
SKIP 1.
WRITE : 'Employee Number', 20 'Bank Acc. No.'.
FORMAT COLOR OFF.
LOOP AT IT_FAIL.
NEW-LINE.
WRITE : IT_FAIL-EN, 20 IT_FAIL-BA.
ENDLOOP.
ENDIF.
ENDIF.
IF R4 = 'X'."CHANGES BY ANKITA
WRITE:/ 'ERROR LOG - BANK A/C NO. CONTAINS ALPHANUMERIC'.
WRITE:/ 'EMPID' COLOR COL_POSITIVE,12 '|',15 'Receiving Bank Code' COLOR COL_POSITIVE,
40 '|','Receiver A/C No' COLOR COL_POSITIVE.
PERFORM EXTRACT_DATA.
SKIP 2.
ENDIF."EOC
RP-READ-PAYROLL-DIR.
Edited by: ANKITA BHARDWAJ on Dec 9, 2009 10:36 AM
‎2009 Dec 09 9:26 AM
Hello Sas,
I think you must be able to understand the code easily now
Vikranth
‎2009 Dec 09 9:29 AM
part 3.
Please test for when R4 = 'X'.
FORM EXTRACT_DATA .
CLEAR IT_BANK.
REFRESH IT_BANK.
**************************CLUSTER BT DATA GET***************************
LOOP AT ITAB1.
REPLACE ALL OCCURRENCES OF '-' IN ITAB1-BKEY WITH SPACE.
REPLACE ALL OCCURRENCES OF '-' IN ITAB1-BAC WITH SPACE.
IF ITAB1-BKEY CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' OR ITAB1-BAC CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' .
WRITE:/ ITAB1-ENO,12'|',15 ITAB1-BKEY,40'|', ITAB1-BAC.
CONTINUE.
ELSE.
IT_BANK-BANKL = ITAB1-BKEY.
IT_BANK-EMPID = ITAB1-ENO.
IT_BANK-BETRG = ITAB1-BETRG.
IT_BANK-TAXID = ITAB1-TAXID.
SHIFT IT_BANK-TAXID LEFT DELETING LEADING SPACE.
IT_BANK-BANKN = ITAB1-BAC.
BERTG_TOT = BERTG_TOT + ITAB1-BETRG.
APPEND IT_BANK.
ENDIF.
ENDLOOP.
***************************************HEADER DATA****************************************************
HEADER = 'BOF'.
DATACODE = 'ACHP01'.
TRANS_DAY1 = PY_DT+0(4) - 1911.
CONCATENATE TRANS_DAY1 PY_DT+4(2) PY_DT+6(2) INTO TRANS_DAY.
TIME = SY-UZEIT.
ORG_NO = ORG_AC+3(7) .
CUST_ID = `CNHBAPGCN001417336`.
IRN = ''.
FILLER = ''.
IT_OUTPUT-OUT_ROW+0(3) = HEADER.
IT_OUTPUT-OUT_ROW+3(6) = DATACODE.
IT_OUTPUT-OUT_ROW+9(8) = TRANS_DAY.
IT_OUTPUT-OUT_ROW+17(6) = TIME.
IT_OUTPUT-OUT_ROW+23(7) = ORG_NO.
IT_OUTPUT-OUT_ROW+30(7) = PRS_BNK.
IT_OUTPUT-OUT_ROW+37(5) = DEPT_CD.
IT_OUTPUT-OUT_ROW+42(10) = REF_NO.
IT_OUTPUT-OUT_ROW+52(18) = CUST_ID.
* CONCATENATE HEADER DATACODE TRANS_DAY TIME ORG_NO PRS_BNK ` ` REF_NO INTO STR1.
* IT_OUTPUT-OUT_ROW = STR1.
APPEND IT_OUTPUT.
CLEAR IT_OUTPUT.
*************************DATA RECORD*******************************************************************
LOOP AT IT_BANK.
SEQNO = SEQNO + 1.
* CONDENSE SEQNO NO-GAPS.
*
* CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
* EXPORTING
* INPUT = ORG_AC
* IMPORTING
* OUTPUT = ORG_AC
* .
IT_OUTPUT-OUT_ROW+0(1) = TYPE.
IT_OUTPUT-OUT_ROW+1(2) = TRANS_TY.
IT_OUTPUT-OUT_ROW+3(3) = TRANS_ID.
IT_OUTPUT-OUT_ROW+6(6) = SEQNO.
IT_OUTPUT-OUT_ROW+12(7) = PRS_BNK.
IT_OUTPUT-OUT_ROW+19(14) = ORG_AC.
IT_OUTPUT-OUT_ROW+33(7) = IT_BANK-BANKL.
IT_OUTPUT-OUT_ROW+40(14) = IT_BANK-BANKN.
IT_OUTPUT-OUT_ROW+54(10) = IT_BANK-BETRG.
IT_OUTPUT-OUT_ROW+64(2) = RETURN_CODE.
IT_OUTPUT-OUT_ROW+66(1) = PRES_CODE.
IT_OUTPUT-OUT_ROW+67(10) = ORG_ID.
TRANSLATE IT_BANK-TAXID TO UPPER CASE.
IT_OUTPUT-OUT_ROW+77(10) = IT_BANK-TAXID.
IT_OUTPUT-OUT_ROW+87(6) = SPACE.
IT_OUTPUT-OUT_ROW+93(8) = PRE_DAT.
IT_OUTPUT-OUT_ROW+101(6) = PRE_SEQ.
IT_OUTPUT-OUT_ROW+107(1) = SPACE.
IT_OUTPUT-OUT_ROW+108(44) = TRANS_RK .
IT_OUTPUT-OUT_ROW+152(8) = SPACE.
*CONCATENATE TYPE TRANS_TY TRANS_ID SEQNO PRS_BNK ORG_AC IT_BANK-BANKL
* IT_BANK-BANKN IT_BANK-BETRG RETURN_CODE PRES_CODE
* ORG_ID IT_BANK-TAXID ` ` PRE_DAT PRE_SEQ ` `
* TRANS_RK ` ` INTO STR4.
*
*IT_OUTPUT-OUT_ROW = STR4.
APPEND IT_OUTPUT.
ENDLOOP.
CLEAR IT_OUTPUT.
*******************FOOTER RECORD****************************************
IT_OUTPUT-OUT_ROW+0(3) = FOOTER.
IT_OUTPUT-OUT_ROW+3(6) = DATACODE.
IT_OUTPUT-OUT_ROW+9(8) = TRANS_DAY.
IT_OUTPUT-OUT_ROW+17(7) = ORG_AC+3(7).
IT_OUTPUT-OUT_ROW+24(7) = PRS_BNK.
SEQ = SEQNO.
IT_OUTPUT-OUT_ROW+31(8) = SEQ.
IT_OUTPUT-OUT_ROW+39(16) = BERTG_TOT.
IT_OUTPUT-OUT_ROW+55(105) = SPACE.
APPEND IT_OUTPUT.
CLEAR IT_OUTPUT.
IF IT_OUTPUT[] IS NOT INITIAL.
CONCATENATE FLN SY-DATUM SY-UZEIT '.txt'
INTO FILEPATH.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = FILEPATH
FILETYPE = 'ASC'
* WRITE_FIELD_SEPARATOR = 'X'
* WRITE_FIELD_SEPARATOR = 'X'
TRUNC_TRAILING_BLANKS = 'X'
WK1_T_SIZE = FILE_LEN
* TRUNC_TRAILING_BLANKS_EOL = ''
* WRITE_LF = ''
WRITE_LF_AFTER_LAST_LINE = ''
TABLES
DATA_TAB = IT_OUTPUT
* OTHERS = 22
.
SKIP 2.
IF SY-SUBRC <> 0.
WRITE:/ 'Unable to Download file at ', FILEPATH.
ELSE.
WRITE:/ 'File with following data downloaded at ', FILEPATH.
NEW-LINE.
SKIP 2.
LOOP AT IT_OUTPUT.
WRITE:/ IT_OUTPUT.
ENDLOOP.
ENDIF.
ELSE.
WRITE:/ 'No Data, no file was downloaded'.
ENDIF.
ENDFORM.
‎2009 Dec 09 9:50 AM
Ya Vikranth pity for her
Hello any mod help her how paste properly
Sas
‎2009 Dec 09 10:00 AM
Hi sas,
I tried with code but not working.i donot know why please help me so that i be able to post code properly.
Edited by: ANKITA BHARDWAJ on Dec 9, 2009 11:04 AM