Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

New Syntax

0 Likes
3,079

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.

1 ACCEPTED SOLUTION
Read only

MateuszAdamus
Active Contributor
2,853

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

10 REPLIES 10
Read only

MateuszAdamus
Active Contributor
2,854

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

Read only

matt
Active Contributor
0 Likes
2,853

Not just do you assure that a value will be assigned, you've also documented (at least in one language!) the meaning.

Read only

former_member1716
Active Contributor
0 Likes
2,853

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.

Both 7.4 and 7.5 Comparison

Regards!

Read only

0 Likes
2,853

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

Read only

2,853
anudeep3117 There is no "new syntax" for text symbols.
Read only

Former Member
2,853

Apart from mateuszadamus reply,I think there is no new syntax for text symbols as such.

Read only

Sandra_Rossi
Active Contributor
2,853

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.

Read only

0 Likes
2,853

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..)

Read only

Sandra_Rossi
Active Contributor
2,853

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!

Read only

0 Likes
2,853

Yup Sandra, But thank you so much for your kind assistance on this!!

Regrads,

AJ