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

Code Inspector

Former Member
0 Likes
1,116

This is my code.

if sy-subrc = 0.

message 'Data is Deleted Successfully' type 'S'.

clear zesi.

endif.

Am getting error message like

Char. strings w/o text elements will not be translated:

''Data is Deleted Successfully'' in code inspector

What is wrong in my code.

Regards,

Prajwal K.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,037

Hi

just there your writing the message as a hardcoded so that is showing that error

in SAP , allways SAP recomends to don'f use hardcoded messages

just define a text element like this

message text-001 type 's'.

double click on text-001 and write the message what ever you want there and activate it

thats all

8 REPLIES 8
Read only

Former Member
0 Likes
1,037

HI

Just put your text in the text elements T01

and then instead of your code put that Text element

reward points if helpful

Regards

hitesh

Read only

Former Member
0 Likes
1,038

Hi

just there your writing the message as a hardcoded so that is showing that error

in SAP , allways SAP recomends to don'f use hardcoded messages

just define a text element like this

message text-001 type 's'.

double click on text-001 and write the message what ever you want there and activate it

thats all

Read only

0 Likes
1,037

hi Naresh thanks a lot.

please tell me what happenes if i hardcode message. am getting same output.

Read only

0 Likes
1,037

Nothing happens if you hardcode a text. It's just a recomendation that you shouldn't hardcode them to have them all together in the text definitions and to change those texts more easily and keeping integrity. For example, if you use the same hardcode in 2 different parts of the program and then you are asked to change it, you may forget it's duplicated and only change it once. That error can easily pass though testing and get to Production. However if you have a repository of texts, you only have to change it once. It's like constants...

Regards,

Pablo

Read only

Former Member
0 Likes
1,037

hi prajwal

did u declare any message class ,message id?

Read only

JozsefSzikszai
Active Contributor
0 Likes
1,037

the problem is that you hardcoded your text and hardcoded text cannot be translated. You have to do:

message text-001 type 'S'.

text-001 will be a text symbol, which can be translated and the error won't be displayed in Code inspector.

hope this helps

ec

Read only

Former Member
0 Likes
1,037

Hi,

Define text element as

text-001 = 'Data is Deleted Successfully'. save & activate.

if sy-subrc = 0.

message text-001 type 'S'.

clear zesi.

endif.

hope this will help.

Thanks,

Anil.G

Read only

Former Member
0 Likes
1,037

Hi,

Just declare a message class as given below in the REPORT command.

REPORT z10_test

NO STANDARD PAGE HEADING

MESSAGE-ID z10_material

LINE-COUNT 0(2).

if sy-subrc = 0.

message S050.

clear zesi.

endif.

Activate the code and check in the CODE INSPECTOR you will not get the error.

Because the MESSAGE-ID Z10_MATERIAL will now maintain the language.Here, if the user dont want the message to be displayed in ENGLISH then he/she can change the language in MESSAGE-ID Z10_MATERIAL .

Hope this helps.