My Problem is to integrate an if-statement into a string template.
mt_fields = VALUE #(
( name = 'HI' label = 'Greeting' )
( name = 'PERSON' label = 'Who' )
( name = 'RESULT' label = 'Sentence' result = |Say \{HI\} to \{PERSON\}.| )
)
(That kind of construction does not make much sense, it's just for an MWE.)
What I want to get: Some times there is no data for PERSON. In that case, the result variable will get the string 'Say hello to .' (if 'hello' is the value for HI).
I dont want to have this. If there is no person, I want to get an empty string as result. So I have to filter first, whether there is some value for PERSON or not. I need to get an if-condition into the string assignment.
In Python I would write something like
( name = 'RESULT' label = 'Sentence' result = 'Say {HI} to {PERSON}.' IF PERSON != '' ELSE '' )
But how to do this in ABAP?
Thanks a lot!
Aucun commentaire:
Enregistrer un commentaire