‎2020 May 15 4:12 PM
Hi Gurus,
I am trying to create a new zreport where i am passing my TEXT ELEMENTS to Work area using the old syntax. But while reviewer is reviewing the code he suggested me to use new abap syntax instead of old syntax. So i went looking into couple of blogs avaliable in SCN but i could not able to find the exact syntax to use.
Code Example :
gs_final-billing_doc = text-013.
gs_final-company_code = text-014.
gs_final-data_type = text-015.
gs_final-datum = text-016.
Could some one help me to change the current syntax to update syntax will help me a lot.
Thanks in Advance.
Regards,
Anudeep.
‎2020 May 15 4:19 PM
Hi anudeep3117
When it comes to text elements the new syntax is as follows:
gs_final-billing_doc = 'Billing doc'(013).This means that by default, even if the text is not created in the report, the "Billing doc" value will be assigned to the GS_FINAL-BILLING_DOC variable.
If you define the text in the text elements of the report, then that defined value will be used instead.
This way you're safe, a text value will always be assigned to the variable.
regards,
Mateusz
‎2020 May 15 4:19 PM
Hi anudeep3117
When it comes to text elements the new syntax is as follows:
gs_final-billing_doc = 'Billing doc'(013).This means that by default, even if the text is not created in the report, the "Billing doc" value will be assigned to the GS_FINAL-BILLING_DOC variable.
If you define the text in the text elements of the report, then that defined value will be used instead.
This way you're safe, a text value will always be assigned to the variable.
regards,
Mateusz
‎2020 May 25 6:04 PM
Not just do you assure that a value will be assigned, you've also documented (at least in one language!) the meaning.
‎2020 May 15 4:23 PM
anudeep3117,
Its always better to use the latest coding in the entire program. The coding syntax will be based on the ABAP releases.
You can go through the below blogs for latest coding techniques:
ABAP 7.4 --> Syntax that is part of ABAP 7.4 release.
Regards!
‎2020 May 15 4:33 PM
Hi Satish,
Thank you so much for you reply on this!!
Yes, I have changed every part of into new syntax, but only text symbols i could not able define in new abap syntax
‎2020 May 15 6:00 PM
‎2020 May 16 9:02 AM
Apart from mateuszadamus reply,I think there is no new syntax for text symbols as such.
‎2020 May 16 5:10 PM
A valid ABAP 7.40 syntax could be (if the eventual rest of components are to be initial):
gs_final = VALUE #(
billing_doc = 'Text for BILLING_DOC'(013)
company_code = 'Text for COMPANY_CODE'(014)
data_type = 'Text for DATA_TYPE'(015)
datum = 'Text for DATUM'(016) ).NB: my best practice for field symbols is the same as Mateusz, i.e. use the form 'text'(###) - the texts are to be in the original language of the program. But I don't find any official recommendation to do so.
‎2020 May 25 12:31 PM
Hi All,
Thank you so much for your valuable suggestions, I have made my changes as below.
gt_final = VALUE #( ( billing_doc = text-013 company_code = text-014 etc..)
‎2020 May 25 2:31 PM
Oh, I didn't pay attention that you used text symbols for literals that shouldn't be translated.
Bad, bad, bad... !
Text symbols must be used only for texts that are to be translated!
‎2020 May 25 2:40 PM
Yup Sandra, But thank you so much for your kind assistance on this!!
Regrads,
AJ