‎2010 Sep 13 4:48 PM
Hello,
I have created an LSMW to post customers thorugh FD01 which works great. However, I would like to enter an IF statement somewhere to avoid duplicate postings. Does anyone know if this is possible and where I could enter the code?
Thanks for your help
Stephanie
‎2010 Sep 13 5:07 PM
Thanks for the reply. This would be Step number 5 correct? And I would like to base this off of the Customers Previous Account Number (ALTKN) Right now this is all it shows on the code:
1 ZCUSTPAY-ALTKN = ZAR_CUSTOMERS-ALTKN.
Is it here I need to add the IF statement?
Thanks again for your time and help
Stephanie
‎2010 Sep 13 4:59 PM
You can add code to any particular field mapping. Here it would make sense to add code to the customer number conversion, checking if an entry in KNA1 already exists, then use "skip_transaction".
This is the simple scenario, it can get more complex if you have internal numbering or multiple company codes or sales areas per customer.
Thomas
‎2010 Sep 13 5:07 PM
Thanks for the reply. This would be Step number 5 correct? And I would like to base this off of the Customers Previous Account Number (ALTKN) Right now this is all it shows on the code:
1 ZCUSTPAY-ALTKN = ZAR_CUSTOMERS-ALTKN.
Is it here I need to add the IF statement?
Thanks again for your time and help
Stephanie
‎2010 Sep 13 5:25 PM
Step 5, yes. You would add a SELECT on KNB1-ALTKN, and if entry found, use code line "skip_transaction". Please check with a local ABAPer, as this is very basic coding, and I might get smacked by a moderator if I'd give you the complete code
Also check LSMW documentation for "skip_transaction" and similar macros.
Thomas
‎2010 Sep 13 5:28 PM
‎2010 Sep 17 7:11 AM
I would say to write your code between begin of transaction event and end of transaction event on the field you want to check.You can even attch the errors in a internal table which can be displayed in the end.