2014 May 11 11:17 PM
I want to update the vendor account but just if it is the same I have in the txt file.
My txt file is the fllowing for example:
Vendor - Old Account - New Account
A2 | A123 | A321 | |
A1 | A133 | B321 | |
A3 | A144 | C321 |
So, for each vendor if the actual bank account number is (old account in the file) replace the actual (old account) with the new account.
In the CODE text for LSMW (check my attach) I have this:
IF FK02A-BANKN_01 = CTAS-BANKN. FK02A-BANKN_01 = CTAS-BANKNNUEVO. ENDIF.
Where:
FK02A-BANKN_01 is the FK02 text for vendor account
CTAS-BANKN is in my file and structure defined the OLD ACCOUNT
CTAS-BANKNUEVO in my file and structure defined the NEW ACCOUNT (the one should be now)
But it is not replacing, if i check converted data, this field is empty. So the if is not working. Ideas?
I changed it by
FK02A-BANKN_01 = CTAS-BANKN
or
FK02A-BANKN_01 = CTAS-BANKNNUEVO
and it works, but put the old or the new code of course, not doing the comparation with the old and replacing with the new.
2014 May 11 11:45 PM
you are directly checking IF FK02A-BANKN_01 = CTAS-BANKN
but how should FK02A-BANKN_01 got its value?
This is a target field and made empty at the start of each new record.
you have to do a select on the database and move your findings into FK02A-BANKN to compare the value with your source file value.
2014 May 11 11:45 PM
you are directly checking IF FK02A-BANKN_01 = CTAS-BANKN
but how should FK02A-BANKN_01 got its value?
This is a target field and made empty at the start of each new record.
you have to do a select on the database and move your findings into FK02A-BANKN to compare the value with your source file value.
2014 May 12 1:06 AM
Ok and how can i do that?
the select in database inside the LSMW to move the findings and compare?
THank you
2014 May 12 6:19 AM
exact, similar to what I showed and described in my blog
and you must not forget that the account in the database is stored with leading zeros in case of numeric account and less than 10 long, so there is another potential risk that it wont match without doing an extra conversion of your source field content.