2006 Aug 11 6:22 AM
Hello Experts,
In our SAP system a file is uploaded to the FTP server through some program.The structure of the file is
MATNR & Net Weight
8-108-447-283|0,521
8-104-930-756|4,489
8-108-222-232|0,022
8-104-546-656|0,042
8-104-546-657|0,051
8-104-937-094|5,417
8-104-919-598|0,308
8-104-146-444|0,195
But when is it uploaded to the Apllication server.It displays like this:
8-108-447-283 0,521#
8-104-930-756 4,489#
8-108-222-232 0,022#
8-104-546-656 0,042#
8-104-546-657 0,051#
8-104-937-094 5,417#
8-104-919-598 0,308#
8-104-146-444 0,195#
8-104-145-877 5,316#
This # symbol is added at the end of every line.
My task is to update the Netweight of the Material thro' BAPI and it is working fine.
Because of this # I am getting dump when I am translating the Char format of weight to Quantity format.
If I try to replace the # symbol by space, The hash symbol is not reconginsed.
Please tell me a solution to avoid the hash symbol when uploading into my report.
Thanks in Advance.
Vasanth
2006 Aug 11 6:46 AM
Hi Vasanth
I guess the problem is the codepage mismatch between the source system and your system.
If you are working on Unicode System and the source system is NON-UNICODE, open the dataset with addition NON-UNICODE.
Unicode enabled system will show CR & LF characters as # when you try to view them in debugging.
Kind Regards
Eswar
Note: Reward for helpful answers
Dear Sridhar
You statement works if our SAP system and the system sending data both are of same type(UNICODE/NON-UNICODE) when itz different like ours UNICODE and the source NON-UNICODE your statement will not work.
Above is just for your information.
Kind Regards
Eswar
2006 Aug 11 6:36 AM
Hi Vasanth,
As per me I have taken the structure that you have specified and done a little bit of programming so rather that passing the sturcture that you have specified specify the structure as
8-108-447-283 0,521
8-104-930-756 4,489
8-108-222-232 0,022
8-104-546-656 0,042
8-104-546-657 0,051
8-104-937-094 5,417
8-104-919-598 0,308
8-104-146-444 0,195
here the funda is to pass the material as 18 characters. though it includes only 13 characters that you have passed in the flat file.
Cheers,
Pedhadodi Sudhakar
2006 Aug 11 6:46 AM
Hi Vasanth
I guess the problem is the codepage mismatch between the source system and your system.
If you are working on Unicode System and the source system is NON-UNICODE, open the dataset with addition NON-UNICODE.
Unicode enabled system will show CR & LF characters as # when you try to view them in debugging.
Kind Regards
Eswar
Note: Reward for helpful answers
2006 Aug 11 6:59 AM
Hi Vasanth,
Does the file from the application server has fixed length with 21 chars per line(including Hash)?
Have u tried with this
REPLACE FIRST OCCURRENCE OF '#' IN NetWeight WITH ''.
Regards,
Sridhar
2006 Aug 11 7:12 AM
Hi Sridhar,
I have tried like this.
<b>SPLIT L_F_LINE AT '|' INTO G_T_DATA-MATNR G_T_DATA-BRGEW.
REPLACE ALL OCCURRENCES OF '#' IN G_T_DATA-BRGEW WITH SPACE.</b>
But the problem is the # symbol is not recongised by the system.
Could u please tell me the solution for this.
Thanks
Vasanth
2006 Aug 11 7:28 AM
HI
'#' will not be recognized when you try to replace as it shows CR and LF as '#' characters in debugging whereas they are different characters. This is due to character type conversion in UNICODE enabled systems.
Kind Regards
Eswar
2006 Aug 11 7:32 AM
Hi Vasanth,
I have tried this and its working ...
data : G_T_DATA-MATNR type matnr,
G_T_DATA-BRGEW(6) type c.
data s1 type string.
s1 = 'abcdefgh | 23456#'.
SPLIT S1 AT '|' INTO G_T_DATA-MATNR G_T_DATA-BRGEW.
*REPLACE ALL OCCURRENCES OF '#' IN G_T_DATA-BRGEW WITH SPACE.
REPLACE FIRST OCCURRENCE OF '#' IN G_T_DATA-BRGEW WITH ''.
write G_T_DATA-BRGEW.
Regards,
Sridhar
2006 Aug 11 7:32 AM
Hello Eswar,
I am using this code to open the file from Application server
<b> CLEAR: G_T_DATA,L_F_LINE.
REFRESH: G_T_DATA.
OPEN DATASET P_FILE FOR INPUT IN TEXT MODE ENCODING NON-UNICODE.
*DEFAULT.
IF SY-SUBRC EQ 0.
DO.
READ DATASET P_FILE INTO L_F_LINE.
IF SY-SUBRC = 0.
rpd2kor 09.08.06 -sm
G_T_DATA-MATNR = L_F_LINE(13).
WRITE L_F_LINE+14 TO G_T_DATA-BRGEW.
SHIFT G_T_DATA-BRGEW RIGHT DELETING TRAILING SPACE.
SPLIT L_F_LINE AT '|' INTO G_T_DATA-MATNR G_T_DATA-BRGEW.
REPLACE ALL OCCURRENCES OF '#' IN G_T_DATA-BRGEW WITH SPACE.
rpd2kor 09.08.06 -em
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = G_T_DATA-MATNR
IMPORTING
OUTPUT = G_T_DATA-MATNR.
APPEND G_T_DATA.
CLEAR: G_T_DATA,L_F_LINE.</b>
Now what happends is when I am reading the line from <b>P_FILE the L_F_LINE = 8-108-447-283|0,521#</b>
What woulb be the probable error of the issue.
Thanks
Vasanth
2006 Aug 11 7:45 AM
Hello Sridhar,
As u said Its working for me if the I pass the string as
s1 = 'abcdefgh | 23456#'.
Since here s1 is having the hash symbol. But the # is not actually available when the file is imported to FTP server from CAD system. When it is added to the FTP server of the SAP system, the # symbol is automatically added at the end of the each line.
Thanks
Vasanth
2006 Aug 11 7:48 AM
Hi Vasanth,
Try using this statement...
<b>OPEN DATASET P_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.</b>
DO.
READ DATASET P_FILE INTO v_string.
-->now use ur code either with REPLACE or the Function module
IF sy-subrc <> 0.
EXIT.
ENDIF.
Regards ,
Sridhar
2006 Aug 11 7:49 AM
Hi Vasanth
Can you try adding "IGNORING CONVERSION ERRORS". Also check if source system sends data in NON-UNICODE or UTF-8/16 format.
Kind Regards
Eswar
2006 Aug 11 7:51 AM
Dear Sridhar
You statement works if our SAP system and the system sending data both are of same type(UNICODE/NON-UNICODE) when itz different like ours UNICODE and the source NON-UNICODE your statement will not work.
Above is just for your information.
Kind Regards
Eswar
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |