on 2006 Jul 27 8:03 AM
Hi Guys
Here is the problem, I have an update rule its has Charecteristic "Customer Number". The file coming in has customer numbers obviously. A few customer number coming in are correct which should go through and few are not correct. Now i should run a validation to accept the correct number and if there are any wrong customer number i shuld update it with the new number given.
I need to write a routine which does this validations. Could some one help me with the code ASAP.
Regards
Chris
Hi chris,
if you have stored Correct (A) and Not Correct (B) Customer Number in a Master Data (C) to make the check you can use Start Routine of the Update Rules. Here a sample code.
data: begin of t_C occurs 0,
B like C-B,
A like C-A,
end of t_C.
select * into corresponding fields of table t_C
from C where not B is null and OBJVERS = 'A'.
LOOP AT DATA_PACKAGE.
IF DATA_PACKAGE-B IS NOT INITIAL.
read table t_C with key B = DATA_PACKAGE-B.
IF sy-subrc = 0.
DATA_PACKAGE-B = t_C-A.
ENDIF.
MODIFY DATA_PACKAGE.
ENDIF.
ENDLOOP.
Ciao.
Riccardo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chris,
logically you have to create a Master Data based on InfoObject B, that map the Non Correct, and with the attribute InfoObject A that map the Correct, but I think it is the best solution.
In particular consider that a Start Routine has better performance respect to a single Update Roules.
Ciao.
Riccardo.
Hi Chris,
in startroutine:
data begin of t_cust,
old(10),
new(10),
end of t_cust.
data indx like sy-tabix.
fill old new customer
t_cust-old = '0000004711'. t_cust-new = '1000004711'.
append t_cust.
t_cust-old = '0000004714'. t_cust-new = '1000004714'.
append t_cust.
sort t_cust.
loop at data_package.
indx = sy-tabix.
read table t_cust with key old = data_package-customer
binary search.
if sy-subrc = 0. "found cust to replace.
data_package-customer = t_cust-new.
modify data_package index indx.
endif.
endloop.
/manfred
Anyway, you should insert this type of cleansing operation in your transfer rules...
What I'm not exactly understanding is why you cannot solve your issue at the root...it seems that, since if you can recognize a specific kind of error (otherwise how are you able to give the correct number in your code ???), it would be better to adjust directly customer field when records coming into BW...
Bye,
Roberto
Hi Chris,
The code would be similar to this:
If comm_structure-Customer No = 'wrong no 1' or 'wrong no 2' or 'wrong no 3'.
Result = 'new number'.
endif.
else.
Result = comm_structure-Customer No.
endif.
Bye
Dinesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
67 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.