What type is a hard-coded string?

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Post Reply
YuriT
Posts: 885
Joined: Fri Feb 03, 2006 6:40 am
Location: Basel/Riga

What type is a hard-coded string?

Post by YuriT » Wed Oct 16, 2013 6:19 am

Hey there. Tricky one. Do you know what type is a hardcoded string in ABAP? String? Char(length)? Any way to know for sure?

Yuri

Grogan
Posts: 365
Joined: Thu Aug 04, 2005 7:16 pm
Location: Australia

Re: What type is a hard-coded string?

Post by Grogan » Wed Oct 16, 2013 4:01 pm

If the literal is enclosed by 'single quotes' then it is of type C and the length of the specified characters.

If the literal is enclosed by `back quotes` then it is of type STRING.

This is described in the ABAP Glossary here.

You can prove this by looking at the value and its type in the debugger where the literal has been used directly as an input parameter to a form and the parameter is declared in the form as type SIMPLE, ANY or undeclared.

Code: Select all

PERFORM see_literal_type USING 'single quotes'.
PERFORM test_form USING `back quotes`.

FORM see_literal_type USING iv_text type SIMPLE.
  BREAK-POINT.
ENDFORM.
Grogan

Award cash if useful.

YuriT
Posts: 885
Joined: Fri Feb 03, 2006 6:40 am
Location: Basel/Riga

Re: What type is a hard-coded string?

Post by YuriT » Mon Oct 21, 2013 12:29 pm

Thanks!

Post Reply