cancel
Showing results for 
Search instead for 
Did you mean: 

How to debug a transfer rule during data load?

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member188975
Active Contributor
0 Kudos

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...

Former Member
0 Kudos

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

former_member188975
Active Contributor
0 Kudos

On the Details tab you can see: Overall Status, then under that Requests, Extraction, Transfer and Processing. Under Processing you can see the Data Package. Right click and choose Simulate Update.

Hope this helps...

0 Kudos

hi Kevin,

in monitor, tab 'details', expand last node, data processing something, there you will see package.

hope this helps.

Former Member
0 Kudos

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

former_member188975
Active Contributor
0 Kudos

Hi Kevin,

Try to recreate the transfer rule for this object: remove. Activate. Put it back.

Hope this helps...

Answers (3)

Answers (3)

0 Kudos

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.

Former Member
0 Kudos

hey AHP,

I know the format cell thing in Excel Sheet and it does work as what you say. But i still want to know on how to use vb-macro or formula in Excel Sheet, do you have some examples?

Thanks

0 Kudos

hi Kevin,

it should work, i just tried again here and it works like charm. 12/18/98 will be translated as '19981218', eventhough if you just have data '1', it will be translated as '19000101'. can know why it doesn't work in your site ?

Former Member
0 Kudos

hey AHP,

Yeh, it does work and I tested, sorry I didn't clarify my point. But I still want to know how the vb-macro or formula work for Excel Sheet though.

Thanks

0 Kudos

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.

Former Member
0 Kudos

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

0 Kudos

hi Kevin,

have you save the file again after you put the macro ?

the macro should keep exist with the file.

hope this helps.

0 Kudos

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.

0 Kudos

hi Kevin,

check in 'transfer structure', for that infoobject ZCHARDAT1, type CHAR and length, change the length to 10. ( i think it's still 9 there )

then activate transfer rules again. hope this helps.

Former Member
0 Kudos

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

0 Kudos

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.

Former Member
0 Kudos

hey AHP,

I know how to set a breakpoint in a function. You say to debug from PSA. But I don't think you are right since I check the PSA data and find that PSA data has not experienced the transfer rule and it's just original data as in excel sheet.

Any idea?

Thanks