07-04-2013 6:51 PM
Hi,
I am facing issue while moving string having around 1000 characters to internal table.
It is only transferring first 255 charcters to internal table. In loop if I concatenate and append to internal after 255 characters it appends it to next line.
I tried using string data type and other data types (like edid4-sdata or idocline). It is not wroking.
Thanks,
Sanjana
07-04-2013 10:33 PM
Hi Sanjana,
Could you elaborate more your issue; perhaps you could post some code or tell us why do you think it is not working.
I've done something similar to what you need and it has worked.
Martin
07-04-2013 11:56 PM
Hi,
Please give the code looks like very basic issue of string getting truncated may be the internal table field to which you are trying to copy is not 1000 characters long.
itab-field = your_str.
This would work provided both have 1000 characters length.
Cheers,
Arindam
07-05-2013 2:57 AM
HI,
With below test code, i can see that variable length is 1000 in both lv_text and lv_text1. I've used data type EDI_SDATA and it worked for me.
DATA lv_text TYPE edi_sdata.
DATA lv_text1 TYPE edi_sdata.
DATA lv_len TYPE i.
DO 1024 TIMES.
CONCATENATE '1' lv_text1 INTO lv_text1.
ENDDO.
lv_len = strlen( lv_text1 ).
lv_text = lv_text1.
CLEAR: lv_len.
lv_len = strlen( lv_text1 ).
WRITE lv_text.
Just make sure that both fields (field containing string and filed in which string needs to be passed) is of data type with than 1000 characters.
Regards,
Ravi
05-19-2022 7:53 AM
Hi,
This solution has worked for me. I have just declared an variable with
type EDI_SDATA and appended lines from SO10 text in the variable having more
than 255 characters and it's displaying all the lines correctly.
Thanks.
--
Rupali Patil
07-05-2013 4:51 AM
Hi Sanjana,
See this code, it may help you
data : a type string,
b type string,
lenth type i.
do 167 times.
CONCATENATE 'ramesh' a into a.
ENDDO.
lenth = strlen( a ).
write : / 'a - Length', lenth.
write : / a.
b = a.
clear: a, lenth.
lenth = strlen( b ).
write : / 'b - Length', lenth.
write : / b.
OutPut
07-05-2013 6:47 AM
Hi Sanjana,
if you have long description more than 3000 to append it to an internal table
do likewise
DATA: long_text(3000).
DATA: Lv_len(2000).
first get the Length of the long_text
Lv_len = strlen(long_text).
MOVE: Lv_len TO Itab-long_field,
long_text TO Itab- long_field.
APPEND ITab.
TO INSERT INTO TABLE
Thanks,
Asit
07-05-2013 3:42 PM
I need to pass one row having approx. 1000 characters to a single line of internal table.
When I try to do that characters more than 255 chars. are truncated and line gets appended.
I need all characters in single line of internal table and not splited.
Any idea will be helpful.
Thanks.
07-05-2013 4:22 PM
Hi Sanjana,
Could you post your code?
The examples provided before should do what you need.
Martin
07-06-2013 6:58 AM
Hi Sanjana,
Have the field of work area of your final internal table with type as String and it works perfectly fine.
Previous comments have already given this,
still -
Working code
TYPES : BEGIN OF ty_char,
record TYPE string,
END OF ty_char.
DATA : ls_char TYPE ty_char,
lt_char TYPE STANDARD TABLE OF ty_char.
do 256 times.
concatenate 'A' 'A' 'A' 'A' ls_char-record into ls_char-record.
enddo.
append ls_char to lt_char.
-> LT_CHAR will have 1024 characters.
BR.
07-06-2013 7:03 AM
Hi Sanjana,
I presume you are passing some kind of long text into internal table! Well you are right, more than 255 Characters will get truncated in internal table.
What you can do is - concatenate the whole 1000 characters or more into a string, and then break the string using a function module - SWA_STRING_SPLIT. In this function module you can set the length as to where it should break, 132, 500, 1000 respectively i.e., if you pass length as 132 then internal table will store a records having 132 characters respectively.
Do find a sample code for you reference -
DATA : GV_INPUT_STRING TYPE STRING, " STRING VARIABLE
GIT_SWASTRTAB TYPE STANDARD TABLE OF SWASTRTAB,
GWA_SWASTRTAB TYPE SWASTRTAB.
CLEAR GV_INPUT_STRING.
CONCATENATE text_line " TEXT_LINE HAVING YOUR N NUMBER OF CHARACTERS
INTO gv_input_string.
CALL FUNCTION 'SWA_STRING_SPLIT'
EXPORTING
input_string = gv_input_string " or you can directly pass your string no need for CONCATENATE st.
max_component_length = '132' " SET YOUR LENGTH for splitting
* TERMINATING_SEPARATORS =
* OPENING_SEPARATORS =
TABLES
string_components = GIT_SWASTRTAB " INTERNAL TABLE
EXCEPTIONS
max_component_length_invalid = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid
TYPE sy-msgty
NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2.
ELSE.
CLEAR GWA_SWASTRTAB.
LOOP AT GIT_SWASTRTAB INTO GWA_SWASTRTAB.
" DO YOUR EXTRACTION
GWA_FINAL-TEXT = GWA_SWASTRTAB-STR. " Appending REQUIRED LENGTH INTO FINAL TABLE
APPEND GWA_FINAL TO GIT_FINAL.
ENDLOOP.
Do ping if any.
Rgds,
Varun Sahu
07-05-2013 4:36 PM
May be just try this:
Assign field symbol to the value of 1000 chars and append the field symbol as a line of internal table.
07-05-2013 11:33 PM
When I append this field symbol to internal table , I am not able to do it only first 255 characters are transferred to internal table.
Even if field symbol or work area contains 1000 characters , after appending a row to internal table only 255 characters are getting transferred and rest data is truncated.
I have tried internal table of type string, edid4-sdata and idocline.
but none of the above worked, also in debug mode if I try to enter more than 255 characters in a line of internal table , it gives me warning only 255 characters will be transferred.
Thanks,
Sanjana
07-06-2013 7:40 AM
hi sanjana,
check this sample code.
REPORT ZSCN_TEST3 LINE-SIZE 1023.
TYPES: begin of ty_tab,
name TYPE string,
END OF ty_tab.
data : it_tab TYPE STANDARD TABLE OF ty_tab,
wa_tab TYPE ty_tab.
DATA : name TYPE string.
do 250 times.
concatenate 'A' 'B' 'C' 'D' name into name.
enddo.
wa_tab-name = name.
APPEND wa_tab to it_tab.
LOOP at it_tab INTO wa_tab.
WRITE : / wa_tab-name.
ENDLOOP.
In this 'name' field in internal table 'it_tab' stores 1000 character in single line .
Reward points if it's helpful.
Regards,
PRABHAKARAN
Moderator Message - Asking for points is against the forums' RoE. Please read the RoE before posting.
Message was edited by: Suhas Saha
07-06-2013 10:44 PM
Hi Prabhakaran,
solution provided by you worked but there is one more issue.
Type of my internal table is idocline and i am not able to transfer 1000 chars to single of internal table having data type idocline.
is there anyway we can append line of 1000 characters to the internal table line of type idocline?
Thanks.
07-07-2013 2:40 AM
04-08-2021 1:53 PM