Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

LSMW update vendor account just if the actual (old) is in the txt file

Former Member
0 Kudos
205

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

A2A123A321
A1A133B321
A3A144C321

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.

1 ACCEPTED SOLUTION

JL23
Active Contributor
0 Kudos
142

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.

3 REPLIES 3

JL23
Active Contributor
0 Kudos
143

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.

Former Member
0 Kudos
142

Ok and how can i do that?

the select in database inside the LSMW to move the findings and compare?

THank you

JL23
Active Contributor
0 Kudos
142

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.