cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion File in data manager package BPC 10.1

Former Member
0 Kudos

Dear All,

In my source transaction data I have following :

GL accountAmount
A.123
A.234
B.111
C.123

The result that I want is:

if GL account=A* then map it to 888

if GL account<>A* then map it to the 3 digits of last characters.

in the conversion file I maintain as follow :

externalinternal
A*888

Question:

How do I maintain the conversion file to say

"if GL account<>A* then map it to the 3 digits of last characters."


Thank you in advance for your sharing.

Accepted Solutions (1)

Accepted Solutions (1)

gajendra_moond
Contributor
0 Kudos

You might not need conversion file at all.

Use this in the transformation file and you should be good.

Your_field = *IF(GL_ACCOUNT(1:1)=*STR(A) then *STR(888);*STR(XYZ))

gajendra_moond
Contributor
0 Kudos

Assuming length of the incoming field is constant = 5 as per illustration.

Your_field = *IF(GL_ACCOUNT(1:1)=*STR(A) then *STR(888);GL_ACCOUNT(3:5))

Former Member
0 Kudos

Hi Gajendra,

Thank you for your prompt feedback.

but that's what I want

your "IF" formula will map all non "A" account to the fixed account XYZ. I need to map it to the last 3 characters of external account. For example if external account is B111 then the system should map it to internal=111, if external account is C123 then system should map it to the internal=123.

Furthermore, the "IF" formula in the transformation is limited to few IF only.

My real scenario requires more that 15 "IF". Sample scenario above is only simple sample to explain my question

Former Member
0 Kudos

ops sorry..posted the previous reply and just notice this message.

yes ...it will work....but I have more that 15 "IF" (conditions) to be mapped and the "IF" formula in the transformation is limited to few conditions only. That's why I am thinking to do it in the conversion file.

Any idea?

Ankur_Jain
Product and Topic Expert
Product and Topic Expert
0 Kudos

Try this

B*** = ***

C*** = ***

etc

Regards,

Ankur

gajendra_moond
Contributor
0 Kudos

I am not very clear about your requirement.

As per your original post, you have accounts starting with A as exception and to be assigned a constant value 888. For all other accounts, you need last 3 characters of the account. Assuming the length is constant and for all accounts not beginning with A, the formula should work. Why would you need multiple IFs. The conditions you have are - IF=A* and IF<>A* for which formula is good enough.

Kindly provide more details if I have missed something.

Former Member
0 Kudos

in my sample scenario, it is only IF=A* and IF<>A*... and IF in the transformation as per your formula will work perfectly.

in actual scenario, I have more than 15 IF conditions . Hence IF in the transformation will not work because IF in the transformation are limited (can not reach 15 IF). Please correct my understanding on this.

Apologize it my sample scenario is misleading...

gajendra_moond
Contributor
0 Kudos

Okay. I understand now. Thanks for clarifying.

Could you consider calling End Routine BADI in your transformation file? It would be faster and effective for a complex scenario.

Former Member
0 Kudos

Hi Ankur,

do you mean if I have A until Z then I have to maintain 26 rows?

is there any way to say like this :

for 15 conditions (let say A to O), i maintain the mapping in the conversion file.

for other conditions just take the last 3 characters?

so perhaps i can only maintain 16 rows in the conversion file???

Thank you in advance.

gajendra_moond
Contributor
0 Kudos

Try this:

List 15 conditions in your Conversion file and the last one (used imaginary values):

A*** = 888

H*** = 999

...

....

...

T*** = 111

?***=***

Former Member
0 Kudos

There is only one issue with BADI... we don't have ABAPER to do it

how much is the effort to call BADI in the transformation file?

is that the only option?

Ankur_Jain
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

You may try this though I am not very sure whether it will work. Just give it a try and let me know if it works.

16 rows for A to O like

A*** = ***

B*** = ***

.

..

...

O*** = ***

and one line for others...

??*** = ***

considering lenght is 5.

Regards,

Ankur


Former Member
0 Kudos

what's the different between "*" and "?"   ?

?***=*** is used to map the internal account with last 3 characters when the external account has 4 chars

???*****=***** does it mean to map internal account with last 5 chars when the external account has 8 chars?

?***? = *** does it mean "map the internal account with second,third, fourth characters" ?

Ankur_Jain
Product and Topic Expert
Product and Topic Expert
0 Kudos

Basically * represents any number of characters and ? represents one character.

A* = *

This means that any string starting with A will be mapped to same string but A will be truncated. For eg.

A12345 will be mapped to 12345.

? means one character. For e.g.

??* = *

A12345 will be mapped to 2345. In this case initial 2 places will be truncated represented by two ??

I hope this is clear.

Ankur_Jain
Product and Topic Expert
Product and Topic Expert
0 Kudos

You can use the following for your requirement

A* = 888

B* = 999 (or whatever you want to map after truncating B)

Similarly, do all the mappings till O

and then one line for others

??* = * (?? will account for 2 places and * will account for 3 places). If length is 6 characters then use ???*=*

gajendra_moond
Contributor
0 Kudos

This worked for me:

Conversion File (lets say length is 5), write your 16 conditions as follows:

A****=888

..

..

..

..

..

..

O****=999

**???=???           This one will get you your last three characters for rest of the cases.

Former Member
0 Kudos

Hi U-One,

Let me give you 2 line solution that will work for problem.

ignore other beginner suggestions.

A*             888

*               %external%.toString.substr(3,5)

Andy

gajendra_moond
Contributor
0 Kudos

Hi Andy

My understanding is that your solution would only suffice for one case where GL_ACCOUNT=A* and <>A*. You will need to include similar conditions for other 14 conditions too - say GL_ACCOUNT=P* and <>P* and so on.

Had there been one condition only, you would not even need conversion file. See transformation mapping suggested above.

Former Member
0 Kudos

Hi Gajendra,

Then sorry to inform you that your understanding is wrong!

* means all characters.

go try it on your system before you telling me its not correct.

Andy

gajendra_moond
Contributor
0 Kudos

Okay. I will try.

Help me understand the following.

If GL_ACCOUNT=A* then result=888 else last three characters. (Your logic satisfies this)

Second condition

GL_ACCOUNT=B* then result=999 else last three characters. (I do not see first part of it happening)

And there will be 13 more conditions like this. For discussion sake say GL_ACCOUNT=C*,D*,E* and so on with each of them say need to have a fixed value like 666,777,111 etc.

Former Member
0 Kudos

Hi Gajendra,

If the author want to valid more account then just add more mapping, ie:

A*             888

B*             777

C*             666

.                 .

.                 .

.                 .

*               %external%.toString.substr(3,5)

As long the * is on the last line then it will work.

Andy

gajendra_moond
Contributor
0 Kudos

Correct. That is the main concern here which we all are trying to resolve. Glad we are on the same page.

The solutions provided by me, you and Ankur will have 16 lines for 15 conditions - 15 for constant values and one condition for getting last three characters. Vadim indicated a one-line conversion statement which will be interesting to learn.

former_member186338
Active Contributor
0 Kudos

%external%.toString.search(/[A-F]\./)==0 ? "999888777555666444".substr("ABCDEF".search(%external%.toString[0])*3,3) : %external%.toString.slice(2)

Vadim

Former Member
0 Kudos

I see you learned some new tricks hehe.

very impressive.

former_member186338
Active Contributor
0 Kudos

I have used the same approach in Excel formulas to perform string to string table conversion...

Answers (1)

Answers (1)

former_member186338
Active Contributor
0 Kudos

You can use very complex id transformation logic in the conversion file with javascript!

Vadim

P.S. Please describe full logic!

former_member186338
Active Contributor
0 Kudos

P.P.S. Single line in conversion file

Former Member
0 Kudos

Dear All,

Thank you for your sharing and idea.

It's really helpful.