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

Ignore Hard coding in S4HANA Cloud

shashankagg
Participant
0 Likes
2,546

Is there an option where we could ignore hard coding in custom app - CUSTOM LOGIC just like TVARVC within S4 HANA CLOUD.

Accepted Solutions (0)

Answers (2)

Answers (2)

k_vadym
Product and Topic Expert
Product and Topic Expert

Hi, the possible solution is to avoid hardcode in Custom Logic using custom constant interface. It`s using will be not avaiable in the app initially, so you need to release the interface at first to make it avaiable for using. Follow such steps:

  1. Create and activate a constant interface in your system.
  2. Navigate to it`s propeties and click on API State tab.k_vadym_2-1711012295324.png 
  3. Click on green '+' icon on the Use System-Internally (Contract C1) tab.

  4. Select Use in Key User Apps checkbox and click on Next until the end of a dialogue.

    k_vadym_3-1711012540641.png 
  5. That`s all, now you are able to use the interface in the Custom Logic App. 

    k_vadym_4-1711012861667.png

It will work for custom classes as well, so you also can create some kind of singletone buffer-class to store dynamic values. That`s up to your needs.

 

sergei_gook
Discoverer
This is just hardcode in another place. I need something to change easily in production systems, like stvarv.
Jerry_Lowery
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Shashank

I am not sure the question is clear -could you provide some clarification?

We are assuming you have a custom logic implemented in Badi extension point via the Custom Logic app.

In that case, why do you have hard coding you want to ignore?

If you have hard coding that is optional, you should add some if/then or order logic to check for the conditions that should ignore it and then exit the badi before the hard coding executes.

OR- check for the conditions that should have the hard coding and the do the hard coding only in that case.

Thank you
Jerry

sergei_gook
Discoverer
0 Likes
Hard code mean when for example you specified number of storage location in the code, instead if using tvarvc parameter.
sergei_gook
Discoverer
0 Likes
For example I have BADI BADI_MMIM_CHECK_MATDOC_ITEM and can add custom logic in cloud app to block material mvt to specific storage location without reservation. I want to have parameter in tvarvc to change SL any time in prod system. As tvarvc table is not available in tvarvc I can use only hardcoding of SL number in code, that is not good.
Jerry_Lowery
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi sergei_gook

Looks like we missed the comments until recently.

To be honest I am not very familiar with the TVARVC table or those transactions.

But I can say we don't have the table exposed in SAP S/4HANA Cloud Public Edition.

If I understood the use case, you would like to, for example, develop a BAdI in Custom Logic to look up a value for a storage location, however if that SL changes in the future, you don't want to change the code, you want to just update a table.

In this type of case, looking up a value mapping for example, it sounds like the perfect use case for a Custom Business Object

https://help.sap.com/docs/SAP_S4HANA_CLOUD/0f69f8fb28ac4bf48d2b57b9637e81fa/b45696ca0d9143cba040797e...

There are lots of blogs and posts in the extensibility community about CBOs as well.

I hope this helps

Jerry