on 02-10-2006 4:29 PM
I am conducting a flat file (excel sheet saved as a CSV file) data load. The flat file contains a date field and the value is '12/18/1988'. In transfer rule for this field, I use a function call to transfer this value to '19881218' which corresponds to BW DATS format, but the monitor of the InfoPackage shows red error:
"Value '1981218' of characteristic 0DATE is not a number with 000008 spaces".
Somehow, the last digit or character of the year 1988 was cut and the year grabbed is 198 other than 1988. The function code is (see below in between two * lines):
**********************************************************
FUNCTION ZDM_CONVERT_DATE.
*"----
""Local Interface:
*" IMPORTING
*" REFERENCE(CHARDATE) TYPE STRING
*" EXPORTING
*" REFERENCE(DATE) TYPE D
*"----
DATA:
c_date(2) TYPE c,
c_month(2) TYPE c,
c_year(4) TYPE c,
c_date_combined(8) TYPE c.
data: text(10).
text = chardate.
search text for '/'.
if sy-fdpos = 1.
concatenate '0' text into text.
endif.
c_month = text(2).
c_date = text+3(2).
c_year = text+6(4).
CONCATENATE c_year c_month c_date INTO c_date_combined.
date = c_date_combined.
ENDFUNCTION.
**********************************************************
Could experts here tell me what's wrong and also tell me on how to debug a transfer rule during data load?
Thanks
Hi Kevin,
To debug: In the monitor go to the details tab and open up to the Data package. You get the option to Simulate Update (on the right click). Here it gives you the option to set debugging for the Transfer and/or Update rules.
Is it possible for you to chnage the format of the date before load?
Hope this helps...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hey Bhanu,
Under the details tab, there are all msgs, can't find the Data package. How to locate a Data package under the details tab of the monitor? Yeh, I know I can change the date format in the excel sheet. But I don't want to do that and just want to test how the transfer rule works.
Thanks
hey Bhanu/AHP,
I find the reason. Originally, I set the character length for the date InfoObject ZCHARDAT1 to 9, then I find the date field value (12/18/1988)length is 10. Then I modified the InfoObject ZCHARDAT1 length from 9 to 10 and activated it already. But when defining the transfer rule for this field, before the code screen, click the radio button "Selected Fields" and pick the filed /BIC/ZCHARDAT1, then continue to go to the transfer rule code screen, but find the declaration lines for the infoObject /BIC/ZCHARDAT1 is as following:
InfoObject ZCHARDAT1: CHAR - 000009
/BIC/ZCHARDAT1(000009) TYPE C,
That means even if I've modified the length to 10 for the InfoObject and activated it, but somehow the transfer rule code screen always takes the old length 9. Any idea to have it fixed to take the length 10 in the transfer rule code screen defination?
Thanks
hi Kevin,
you are always welcome
i just recall, what we have done in this kind of problem is a free coding way
try in excel, click the column date (A or B or...) and right click 'format cells', in tab 'number' choose 'custom' and for 'type' type in 'YYYYMMDD', you will see the date in yyyymmdd format already.
then save again the csv file, to make sure open the file again with notepad, check if it's in YYYYMMDD format already.
hope this is a good news for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Kevin,
the vb macro also just very simple code,
menu tools->macro->macro, type in macro name e.g 'Convert_date' and 'create', then put this code
Sub Convert_date()
Columns("A:A").Select
Selection.NumberFormat = "yyyymmdd"
End Sub
where A is the column,
to edit tools->macro->visual basic editor
remind to run macro, security must at least 'medium'-will ask confirmation for enable macro, or 'low'-enable macro without asking (tools->macro->security)
hope this helps.
hey AHP,
It does work! But after I run it and close the excel sheet and reopen it, find the macro code is gone! I try to edit tools->macro->visual basic editor and other logical ways, but still can't find the code. Maybe that's the way the macro works that as long as it done for the running then there is no reason for it to exist any more?
Thanks
hi Kevin,
yes, psa as original, as mentioned with option debug transfer rules you will then be able to go through the coding ...
the date format will always mm/dd/yyyy ?
is it possible for you to manipulate it in your excel (with a little vb-macro or just a little formula) to change the date format ?
hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi AHP,
Eventually all the problems got resolved and I am really appreciate your guys' help! However I find data load with only two lines of data is slow that it spends 1 minutes because of the transfer rule which also calls a function. I think maybe it's a good idea to use some vb-macro or just a little formula as you suggested over the excel sheet that we don't have to use the transfer rules. Could you show me the step by step procedure on how to use vb-macro or formula in Excel Sheet?
Thanks
hi Kevin,
to debug, put a break-point
and from psa->simulate update->mark transfer rules and/or update rules ...
data: text(10).
<b>break-point.</b>
text = chardate.
search text for '/'.
or you can put the code in a program with date value feed in program and run in debug mode.
...
data: text(10).
text = '12/18/1998'. (?)
...
meanwhile will try to analyze your code ...
i'm thinking you may use abap 'split at '/' into' to simplify the string manipulation...
hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
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.