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

String and char issue - while saving in a 'Z' table

Former Member
0 Likes
1,651

Hello Experts,

I am working on a requirement where I need to trigger a SMS to customer when billing document is saved. While I am coding my user exit, I have created a custom 'Z' table to capture SMS related data. Here I also have the actual SMS as the link, followed by the text.

for eg: http://127.0.0.1/send_sms?user=amit&pswd=amit123&sender=client&text=hihoware+you&phonenumber=9123456789

I am facing 2 issues here.

1) While I create my 'Z' table to hold the above link, I declare a field of type string. But while i declare my internal table like

TYPES: BEGIN OF IT_SMS.

INCLUDE STRUCURE ZSMS_DATA.

TYPES: END OF IT_SMS.

It gives me an error(flat structures allowed,etc).

I changed the table data type to CHAR(255), which is the max allowed, but my link in the program is a STRING.

when I write

wa_sms-sms = sms.

OR

move sms to wa_sms-sms.

It is moving only the 1st line shown in the string under debugger mode, and table is also updated that way.

I want the whole URL to be saved in the 'Z' table.

Please help.

Regards,

Amit

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,271

Hi,

Try using the data element CHAR1250

Regards

Ansari

Hello Experts,

I am working on a requirement where I need to trigger a SMS to customer when billing document is saved. While I am coding my user exit, I have created a custom 'Z' table to capture SMS related data. Here I also have the actual SMS as the link, followed by the text.

for eg: http://127.0.0.1/send_sms?user=amit&pswd=amit123&sender=client&text=hihoware+you&phonenumber=9123456789

I am facing 2 issues here.

1) While I create my 'Z' table to hold the above link, I declare a field of type string. But while i declare my internal table like

TYPES: BEGIN OF IT_SMS.

INCLUDE STRUCURE ZSMS_DATA.

TYPES: END OF IT_SMS.

It gives me an error(flat structures allowed,etc).

I changed the table data type to CHAR(255), which is the max allowed, but my link in the program is a STRING.

when I write

wa_sms-sms = sms.

OR

move sms to wa_sms-sms.

It is moving only the 1st line shown in the string under debugger mode, and table is also updated that way.

I want the whole URL to be saved in the 'Z' table.

Please help.

Regards,

Amit

8 REPLIES 8
Read only

Former Member
0 Likes
1,272

Hi,

Try using the data element CHAR1250

Regards

Ansari

Read only

0 Likes
1,271

Hi,

CHAR1250 in table or program?

My error msg is as follows:

"ZSMS_DATA" must be a flat structure. You cannot use internal tables,

strings, references, or structures as components. -

IF I DECLARE THE TABLE FIELD TYPE AS STRING.

Regards,

Amit

Edited by: Amit Iyer on Sep 2, 2009 12:40 PM

Read only

0 Likes
1,271

both

you can just directly write:

data: itab type starndard table of ztable,
         is type ztable.

pass values to itab.

and 
modify ztable from table itab.

Read only

0 Likes
1,271

Hi Soumya,

Now my program is working fine and in wa_sms-sms it shows up the complete URL as a string.

But when I write

INSERT zsms_data FROM TABLE it_sms.

COMMIT work.

The table is updated but it doesnt show the complete URL.

Regards,

Amit

Read only

0 Likes
1,271

how have you defined the ztable (in data dictionary/SE11)

what is the type of the field for URL?

is it string?

string can only take up 255 chars. you can take a bigger data type like char1250

Read only

0 Likes
1,271

Hi Soumya,

My SMS field is declared as string in the 'z' table.

I assume.

CHAR takes value from 0-255.

STRING should take any value of variable length.

I am not able to declare the data type as RAW.

ERROR: Field SMS (Length > 255 for RAW only allowed for non-DB tables)

Regards,

Amit

Read only

santosh_kumarm
Participant
0 Likes
1,271

Hi Amit ,

for SMS purpose. You have to create text in tcode S010 using the function module CREATE_TEXT and store the Text-ID in the custom 'Z' table.

when you want to retrieve the SMS for display purpose. you pick the TEXT-ID from the 'Z' table and pass the same to function module READ_TEXT and get the long text.

use table to store limited data for better performance and more readability. for long text you have to use SO10 tcode.

Hope it shall be useful

Regards

Santosh

Read only

0 Likes
1,271

Hi,

Resolved.

Thanx Soumya and Santosh.

Regards,

Amit