10-07-2007 7:19 AM
Hi,
Can we assign the size of the character field dynamically at run time?
Thanks,
Smitha.
10-07-2007 7:23 AM
Yes.
Using field symbol you can achieve this.
EX:
FIELD-SYMBOLS: <l_field> TYPE ANY.
<l_field> = <Your dynamic value>.
please reward if this is useful.
Regards,
Siva
10-07-2007 7:30 AM
Hi Siva,
I tried filed-symbols. But it did'nt help me.
The requirement is:
Iam trying to output a DME file by changing the Std.Prog as per the requirement. Each record is transfred to a memory buffer which is a long string with line feed at the end of the string. I have declared the string as 100 char. Considering that we have only 50 char to ouput with a line feed at the end of 50 char. It works well, but leaving the other 50 char as spaces which I dont want to display.
I hope Iam clear in explaing you the requirement. If no please let me know.
Thanks,
Smitha.
10-07-2007 8:11 AM
Hi Smitha,
While passing the string to the file compress the string and pass it to the file.
I think it will help you.
Reward if useful.
Sastry.
10-07-2007 9:35 AM
Hi,
I think you have declared like
DATA : l_text(100) TYPE C.
declare as a string like
Data : l_text TYPE STRING.
if you store l_text = ' Test '.
the l_text will hold 'Test' only. the traling space will be eliminated.
Reward if this is useful.
regards,
Siva
10-07-2007 10:36 AM
Siva,
Thanks for the response and was close to the solution and rewarded 6 points too..
Unfortunately STRING is not supported when Iam storing the data in buffer.
It gives SY-SUBRC as 16. Any suggestion why does it do like that? Here is the code that fails. Here (buffer) is the place where I store the STRING as you said:
It was working for CHAR type. I donno why it fails for STRING. Can you throw some light on what is 'C_RSTS_WRITE' and how buffer works????
****************************************************************************
FORM temse_schreiben USING value(buffer).
DATA: _rc(5),
_errmsg(100).
CALL 'C_RSTS_WRITE'
ID 'HANDLE' FIELD hlp_handle
ID 'BUFF' FIELD buffer
ID 'RC' FIELD _rc
ID 'ERRMSG' FIELD errmsg. "#EC CICCALL
IF sy-subrc NE 0. "Fehler beim Schreiben
IF sy-batch EQ space.
MESSAGE a229.
ELSE.
MESSAGE s229.
STOP.
ENDIF.
ENDIF.
ENDFORM. "TEMSE_SCHREIBEN
****************************************************************************
Smitha..
10-07-2007 4:14 PM
10-07-2007 5:40 PM
Hi,
Iam still confused.
Is that the (buffer) parameter always expects CHAR type? If not why it fails for STRING format. Can anyone please explain?
Thanks,
Smitha.
10-23-2007 3:15 AM
02-25-2014 2:58 PM
Hello Smitha,
Can you share with me how you solved?
I think I am having same problem. If my datatype is char40 and I am passing 'Test', then 'Test' (and then 34 spaces) and then next comma (delimiter) is appearing.
Thanks,
Ashish