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

Text Elements

Former Member
0 Likes
5,283

Hi All,

       

         I am writing a select statement as shown below.Even though I maintained text element for 009 as 'A' but when I double click on below line it shows me as 009 not found.Why? How can I rectify it.Thanks in Advance.

         

Best Regards,

Chakradhar.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,947

Hi All,

Thanks for all for your replies.I already worked with constants but my tech lead asked it to change it for text element.I too do not know why exactly he asked to change.So, I changed it from constants to text elements but it is not working fine.

Regards,

Chakradhar.

20 REPLIES 20
Read only

Former Member
0 Likes
4,947

Hello,

Text elements always works with "Text-" prefix .

Read only

matt
Active Contributor
0 Likes
4,947

Wrong


data: some_text type c length 80.

some_text = 'This is my text'(001).

Perfectly valid, and certainly better than


data: some_text type c length 80.

some_text = text-001.

Read only

Former Member
0 Likes
4,947

Hi chakri ,

               i think text-symbols are not activated .

               goto->text_elements->text-symbols and activate .

if still doesnt work ,use se32 t-code to analyze and adjust the test_symbols .

and it is not advisable to use text-symbols in select query .

regards,

krishna.

Read only

0 Likes
4,947

Hi Krishna,

Thanks for you reply.I checked it whether it is in active mode or not.But it is not working yet.

Read only

0 Likes
4,947

Hi chakri,

              go through the link http://scn.sap.com/thread/200183 .

              if a text-symbol is maintained then after double-click ,it would navigate you to the                 text-symbols screen.

              Activate your code and goto text-symbols and click on compare text symbols .this will take you to se32 .and how to maintain the text-symbols is specified in the attached link .ELSE simply remove (009)  and write TEXT-009 and double click on it and provide description .

                                                 

Regards,

krishna

Read only

Former Member
0 Likes
4,947

Hi,

Why are you trying to use text elements for where conditions in your code?  If you want to tidy you the code you might be better using constants.

I really wouldn't advise to use text-elements in your select statements like this.

Cheers,

G.

Read only

Former Member
0 Likes
4,947

Hi ,

If you use text elements... The following will be the problem you will face,

The report created by you in EN language and user executes this it in other than EN language.

If you miss to maintain that corresponding text in that text element.

Your select statement will go wrong.

Please correct it.

Regards,

Ravi Shankar.L

Read only

Former Member
0 Likes
4,947

hi


Select kschl

          kozgf

          from t685

          into table i_t685

          where kvewe eq text-009

          and kappl eq 'v'

Read only

RaymondGiuseppi
Active Contributor
0 Likes
4,947

Remove the space between text litteral and text number 'A' (009) -> 'A'(009). I suppose the editor interpret it as a variable containing a list of fields...

Also define and activate this text if required. Usually, for such fields use text elements when translation required, here define a CONSTANT in your code declaratives.

Regards,

Raymond

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
4,947

Two very knowledgeable SCN members have already suggested to use a constant (and I couldn't agree more). Is there any specific reason to stick with a text element? As already pointed out, it doesn't make sense to use a text element in such context yet here we go again. It's starting to look borderline masochistic...

Read only

Former Member
0 Likes
4,948

Hi All,

Thanks for all for your replies.I already worked with constants but my tech lead asked it to change it for text element.I too do not know why exactly he asked to change.So, I changed it from constants to text elements but it is not working fine.

Regards,

Chakradhar.

Read only

0 Likes
4,945

I'm really confused what a tech lead would be basing their decision on... If it was something relevant to the translation then yes, I get it. But if you drill down to the domain for KVEWE field, I really don't see how could there be language-specific entries in the T681V table. Honestly, even replacing 'A' with a constant seems like a "tomato - tomahto" situation.

Anyway, it seems to work fine for me - double-click is working and no errors displayed.

 


SELECT single kschl into var1

from t685 where kvewe EQ 'A'(009).

Other than chosing a different language and not activating the texts, as already mentioned, not sure what else could possibly go wrong...

Read only

0 Likes
4,945

In that case, the best advice I can give you is to challenge your tech lead why they want you to use text elements for single character values that are being passed into the Where condition of an SQL statement.  At worst, I'd agree using constants would make some sense although as has already said, creating a constant of value "A" is (IMHO) a waste of time but that is a discussion for elsewhere...

Seriously, if you think constants are correct (and no-one here can think of any reason why text-elements make sense in this situation) you should really push back on your tech lead.  You'd get my vote, as in over 15 years of ABAP meddling I've never seen, used or had the desire to use text-elements in my SQL statements as you describe here.

From a wider perspective, I am seeing a worrying trend with ABAP teams of late where a "lead" of some description makes a blanket decision that makes no sense but they don't/won't/can't explain and justify how they stand by that decision.  It leads to bad practice, bad code, poor supportability and generally dilutes the skills and abilities of the developers being "led".

Just my thoughts

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
4,945

I am seeing a worrying trend with ABAP teams of late where a "lead" of some description makes a blanket decision that makes no sense but they don't/won't/can't explain and justify how they stand by that decision.

My fav topic - tech leads, QA reviewers.

Once a QA reviewer wanted me to change AUTHORITY-CHECK OBJECT 'F_BKPF_BUK' to AUTHORITY-CHECK OBJECT con_bkpf_buk As per his definition anything inside single quotes (') is a text, and hence to be declared as a constant.

I would not make such a stupid change & the QA reviewer would not release my code. The matter was escalated to higher level & the reviewer finally had to give in. My K.O. punch was if 'F_BKPF_BUK' is to be declared as constant, then 'REUSE_ALV_GRID_DISPLAY' should as well

Read only

0 Likes
4,945

Hi Jelena,

Thanks for your reply.If I write the select statement in START-OF-SELECTION event it is working fine but when I write the same select statement in the AT SELECTION-SCREEN ON VALUE-REQUEST in order to provide f4 help for the selection field(KSCHL) it is not working fine.Anyway I convinced my lead that I use constants in my program but I want to know that before the use of start-of-selection the text-elements will work or not.

Regards,

Chakradhar.

Read only

matt
Active Contributor
0 Likes
4,945

Of course, who uses quotes nowadays.

AUTHORITY-CHECK OBJECT |F_BKPF_BUK|.

Read only

rajucd81
Participant
0 Likes
4,945

Hi Chakri,

Even my advise is also use constants instead of Text elements in where condition .

Thanks

Raju C D

Read only

Former Member
0 Likes
4,945

Hi Chakri,

the advantage of text elements is, that they are translatable.

But for table access this is not useful. You don't want to access T685 table entries with KVEWE = 'A' if logon language is English and with KVEWE = 'B' if logon language is French.

Sorry, text elements for table access with key is no good idea.

Regards,

Klaus

Read only

Former Member
0 Likes
4,945

Hi All,

Thanks for your replies.At last I convinced my lead that I go with constants not with the text elements.

BR,

Chakradhar.

Read only

matt
Active Contributor
0 Likes
4,945

To prevent further answers, repeating the same information, I'm locking the thread now.