cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to avoid hard coding for if condition.

0 Kudos
569

Hi all,

i am writing code to check sales org condition IF VBAK-VKORG = '0090' , and after checking that if it is true, then i am checking IF   VBAK-AUART = 'some types'. if true, Then my logic.

This is working properly,

but now i want to avoid this hard coding method, and want to implement using some custom table things.

i had a custom table Z_tab in this i had fields like zprogname , zparaname , zseralno , zparameter1 zparameter2...3..4..  etc .

can you guide me how can i implement this using that table.

and all this things are a small part for an enhancement in some SAP standard program.

Thanks in advance.

Best regards,

Praveen

 

View Entire Topic
AbhishekSharma
Active Contributor

Hi @Praveen_Sankaraddi 

Its not a standard solution but a suggestion which is flexible for future changes in condition checking as well...

You may have a custom table which may have multiple Key Fields to identify records. Ex:

You may have warehouse no or Plant as 1 key and WRICEF no as another key and Functionality name (chkSalesOrg) column. and You maintain values. If you maintain values like this you have flexibility to maintain another sales org as second line with same Warehouse No, Plant.

Before checking any condition with hardcoded values you read this table values and match with your data and make decision.

Hope this helps...

Thanks-

0 Kudos
Hi Abhishek, i implemented this logic similar to your explanation. It worked Thank you for your suggestion.
AbhishekSharma
Active Contributor
0 Kudos
Awesome…