‎2014 Sep 02 4:03 PM
Hi,
While trying to work with field symbols using static ASSIGN and Offset/Length Specification, got the error as mentioned below.
So unless I mention the explicit length of the Offset or '*', I get the error. I was reading through the following link for some information & working through the code snippets when I ran into the issue,
https://help.sap.com/saphelp_nw04/helpdata/en/fc/eb38d5358411d1829f0000e829fbfe/content.htm
Any information on the same would be very helpful.
Thanks
Srujana
‎2014 Sep 03 8:46 AM
You have to have it as follows:
FIELD-SYMBOLS <fs> TYPE ANY.
DATA: BEGIN OF line,
string1(10) VALUE '0123456789',
string2(10) VALUE 'abcdefghij',
END OF line.
WRITE / line-string1+5.
ASSIGN line-string1+5(5) TO <fs>.
WRITE / <fs>.
ASSIGN line-string1+5(*) TO <fs>.
WRITE / <fs>.
‎2014 Sep 03 10:23 AM
Thanks for the response.
I do not get any error when I mention specific length or '*' with the offset. The only problem is when you do not mention any length with the offset.
As per link below,
https://help.sap.com/saphelp_nw04/helpdata/en/fc/eb38d5358411d1829f0000e829fbfe/content.htm
Having WRITE after ASSIGN line-string1+5 TO <fs> should result in output, 56789abcde.
Explained as,
"In this example, you can see the difference between an offset specification in a WRITE statement and an offset specification in an ASSIGN statement. With WRITE, the output is truncated at the end of LINE-STRING1. Specifying an offset greater than 9 would lead to an error during the syntax check. In the first ASSIGN statement, the memory area of length 10 beginning with offset 5 in LINE-STRING1 is assigned to the field symbol <FS>. The output is meaningful because the memory area behind LINE-STRING1 belongs to LINE-STRING2. In the second ASSIGN statement, the length specification * prevents the system from addressing the memory area after LINE-STRING1."
Same mentioned under,
http://help.sap.com/saphelp_nw70/helpdata
So just trying to figure out if I am missing on something.