cancel
Showing results for 
Search instead for 
Did you mean: 

handling language dependend texts from on-premise in the ABAP Environment

sebastian_wilhelm1
Participant
269

Hi experts!

I'm creating a custom app on BTP, ABAP Environment. I read articleIDs (mara-matnr) from the on-premise system via oData and store them as part of my CDS model. I also need to display the article name (makt-maktx) but as they are user language dependent, it doesn't make sense to store them as well. I must read them when a user adds a new article and for existing articles, when the user opens the application.

How can I do that? Is there a best practice?

Thanks and regards,

Sebastian

Accepted Solutions (0)

Answers (2)

Answers (2)

MattDion
Participant
0 Kudos

Hi Sebastian,

I understand your issue completely; we have the same exact requirement.

We ended up creating our own OData service on the backend system that receives a range of matnrs along with the BTP user's logon language and returns a table of the matnrs with their descriptions in the user's language. Then we created a service consumption model from the OData service to make it available in the BTP ABAP environment. Finally, in the app where the matnrs are used, we added a virtual field in the projection view for the description. The implementation class of the projection view is responsible for calling the service consumption model and writing the material description to the virtual field.

Hope this helps,

Matt

sebastian_wilhelm1
Participant
0 Kudos

Hi Matt! Thanks for you answer. Unfortunately, we can't create an oData Service on the on-premise system of the customer as we don't have access to the customer system. Companies can subscribe the service, for whom we are no implementation partner. So I have to use SAP Standard oData services.

One question regarding the use of virtual fields. You wrote, that the implementation class of the projection view (I guess the behavior implementation class) is responsible for writing the description into the virtual field. According to my understanding, the virtual field can only be manipulated via the calculation method!? This calculation method is called with every roundtrip (whenever a user presses a button or hitting enter. How did you fill the field respectively how did you prevent, that the oData Service is called on every roundtrip?

Thanks, Sebastian

MattDion
Participant
0 Kudos

Hi sebastian.wilhelm1,

Bummer about the OData service! Then I guess the answer very much depends on the backend systems that you're looking to support with your app. For ECC I'm not sure but maybe there's an RFC enabled call you can make. For S/4HANA, I would think the material description should already available in an API.

Re: the virtual field, based on our debugging your understanding is not quite accurate. The virtual field is only calculated when:

  1. It is first requested, and
  2. Whenever a side effect tells RAP that it needs to be recalculated

We do not see the virtual field being called with every user interaction. The only special thing we did was to make certain that we're not triggering the calculation of the descriptions within a loop of the data passed to the calculation method. Basically we're looping over the it_original_data table once to build the input of for the OData service call, then calling the OData service once, then looping over the it_original_data again to build the calculated results. This is not important if you only have the field displayed on an object page, but if it can be displayed in a list report then this technique ensures that you're only calling the OData service once per list report page retrieval, instead of per record.

In our case the part number is read-only once it has been set so we do not worry about side effects. But, if the user could change the part number then you would obviously want to trigger the side effect to recalculate that record's virtual field as a result.

Regards,

Matt

sebastian_wilhelm1
Participant
0 Kudos

Hi Matt,

thanks for you comment. As described above, we want to offer a service to existing and potential new customers with an oData connection. That means, we cannot implement something on their system (only receiving article information) and we cannot replicate the data via SLT.

I don't know why, but when I set a breakpoint in the calculation method of the virtual field, the method is called several times.

I discovered, that it is not possible to search for virtual fields, so storing the article information in a virtual field is not an option for us.

sebastian_wilhelm1
Participant
0 Kudos

Hi Matt,

you wrote: The implementation class of the projection view is writing the description to the virtual field.

Can you tell me how you do that? As for my understanding, the virtual field can only be manipulated via the calculation method!?

Thanks,

Sebastian

MattDion
Participant
0 Kudos

Hi Sebastian,

I meant the implementation class of the virtual field, not the behavior projection. As I mentioned, our experience regarding when virtual fields are calculated does not match your understanding.

Regards,

Matt

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Sebastian,

please check the following pages in our online help

Editing Language-Dependent Fields | SAP Help Portal

Operation Augmentation | SAP Help Portal

Kind regards,

Andre

sebastian_wilhelm1
Participant
0 Kudos

Hi Andre,

thanks for you answer. I already checked the help pages and implemented the text table. This worked.

But this doesn't solve my problem. As the service is not a greenfield standalone app like the flight/travel app which stores texts in text-tables in the ABAP Environment but is working with the data from the customers on-premise system. I need to get the texts from the on-premise system in the current user language, before the articles are displayed after pressing the "go" button.

I think, this is a most common scenario, as we always have language dependend texts and the ABAP Environment is ment to provide services for data which is located on the on-premise system of a customer who subscribes to a service.

Theoretically, I could mirror the customer tables on the ABAP Environment. However, we cannot assume that potential customers subscribe to a service that requires the service provider to first replicate the customers master data just to display article names in the correct language. Or am I wrong?

Do you know, what is the approach from SAP for this?

I would be realy thankfull for an answer, as I don't know how to solve this issue, which will be relevant for every new service we are building.

Thanks,

Sebastian