cancel
Showing results for 
Search instead for 
Did you mean: 

sending the string in text edit to internal table in backend

Former Member
0 Kudos

hai all,

I have a text edit in web dynpro where the user enters comments.I need to store the comments in database.Since string can hold only 256 characters an internal table has been created in database to hold this data.Now I need to pass each line entered in the text edit by the user in each row of the internal table to store it there.Plz do provide the codings and step by step procedure for doing this.

Thanks n Regards

Sharanya.R

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Why can't you use an import variable of "lchr" which can store more number of characters.

From webdynpro sent , a string from the textedit /textview and pass that to backend ,and update it .

In backend , If you want to store some string of more characters you do like this ,

Create 2 fields in the table.

The first field should of type ssize - INT4.

Second field should be of type str - LCHAR.

suppose u if set ,

ssize = 1000 .

str = "any number of characters......upto 1000 it will take"

See whether is it ok with your requirement.

Thanks ,

Srini

Thanks ,

Srini

Former Member
0 Kudos

Hello saranya,

Why can't you try by setting the size of the commentVariable data element property to char 255 and in front-end Text Edit control; set the maximum size of text( comment) allowed to 255. ( you can use the mouse enter action to check the length of the text that is entered)

It has to work.

Regards

-Vinod

*

Edited by: Vinod V on Apr 3, 2008 2:03 PM

Former Member
0 Kudos

hai Vinod ,

Thanks for the response.But the requirement is as such the users comment will exceed 255 characters definitely so we need to let them enter that.Plz help me with some solution for this.

Thanks n Regards

Sharanya.R

Former Member
0 Kudos

Hi ,

loop the String attribute holding the comments filed.

Break the String in to 255 length Strings and Send them to Internal table as rows.

When displaying them Loop through the table Concatenate the Strings and display in a TextEdit feild.

Regards,

Sunitha Hari.

Former Member
0 Kudos

hai Sunitha,

Thanks for the response.Can you provide me the coding to break the String into 255 characters length and pass to each row of table.I dont know how to break them that way..

Thanks n Regards

Sharanya.R

Former Member
0 Kudos

Hi ,

just check the code below... if u have any problem plz let me know....

String test = wdContext.currentContextElement().get<att>(); int length = test.length();

for(int i = 0 ; i<length ;i = i+255)

{

String str = test.substring(i , i+255);

tele = wdContext.create<IT_data>Element();

tele.set<att1>(str);

input.add(tele);

}

Regards,

Sunitha Hari

former_member182294
Active Contributor
0 Kudos
		String data = wdContext.currentContextElement().get<att>();
		String subData = null;
		int startIndex = 0;
		int endIndex   = 256;
		
		while(data.length()>0)
		{			
			if(data.length()<=256)
			{
				endIndex = data.length();
			}
			else
			{
				endIndex = 255;
			}
			
			subData = data.substring(0,endIndex);
			
			if(data.length()>0)
				data = data.substring(endIndex);

                                          //create new element and set the subData string to it
                                            element = wdContext.create<data>Element();
                                           element.set<att1>(subData );
                                          input.add(element);

		}		
	}
Former Member
0 Kudos

hai Sunitha and Abhilash,

Thanks for the coding.My context details are as follows.

zmmin_save_spec

|_It_remarks(internal table)

|_Td_Line(field)

Now plz say me how can i split the lines and pass it to each row of the above internal table.?

Sunitha whats that tele ?input?

Abhilash whats that input where you finally set the values?

Please provide me the coding to fulfill my requirement.

Thanks n Regards

Sharanya.R