2013 Aug 13 6:22 AM
Dear,
In Excel, one field contains long text. There is more than 2000 characters present in this field. I have already created Zalsm_excel_to_internal_table fm and Zalsmex_tabline. in ZALSMEX_TABLINE , value field is CHAR1024. but it mainly takes 255 characters. whats the solution??
Regards
Sabyasachi
2015 Jun 24 11:07 PM
Hi All,
Copy this FM ALSM_EXCEL_TO_INTERNAL_TABLE and Structure ALSMEX_TABLINE to Z objects.
And change the VALUE type to store up to 3000 or 4000 in structure.. Whatever the length you wanted.
And update the table Parameter with Z structure.
And try to save the FM then you will find syntax issues at these performs. Change the types to our Z structure types and activate the FM..
separated_to_intern_convert
line_to_cell_separat
line_to_cell_esc_sep
Now this Z FM will upload the text you wanted.
Thanks,
Srinu Marapureddi
2013 Aug 13 7:09 AM
Hi ,
the visible length is 255 char thats the reason it is showing like that , but it contains data when ever you want the data of that field then take like this..
ex:
a = wa_tab-field+0(255).
b = wa_tab-field+256(256).
..
..
try this .
Regards,
Krishna
2013 Aug 13 7:48 AM
Hi,
I got your point. i used like this:
loop at tab_serv.
gv_l1 = tab_serv-text+0(255).
gv_l2 = tab_serv-text+256(255).
gv_l3 = tab_serv-text+511(255).
gv_l4 = tab_serv-text+766(255).
gv_l5 = tab_serv-text+1021(255).
gv_l6 = tab_serv-text+1276(255).
gv_l7 = tab_serv-text+1531(255).
gv_l8 = tab_serv-text+1786(255).
gv_l9 = tab_serv-text+2041(255).
gv_l10 = tab_serv-text+2296(255).
CONCATENATE gv_l1 gv_l2 gv_l3 gv_l4 gv_l5 gv_l6 gv_l7 gv_l8 gv_l9 gv_l10 INTO text_total SEPARATED BY space.
Here i take
text_total 3000 char. but after concatenate it takes 255 characters...
IF NOT SERVICE IS INITIAL.
HEADER-TDOBJECT = 'ASMD'.
HEADER-TDNAME = SERVICE.
HEADER-TDID = 'LTXT'.
HEADER-TDSPRAS = SY-LANGU.
LINES-TDFORMAT = '*'.
LINES-TDLINE = text_total.
APPEND LINES.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
HEADER = HEADER
SAVEMODE_DIRECT = 'X'
TABLES
LINES = LINES[]
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
2013 Aug 13 8:17 AM
Hi,
the output length of the field is set as 255 char only. why your adding again into one field , better you keep it into one table with different fields then check , while displaying also use same logic.
Thanks in advance,
Krishna
2013 Aug 13 9:01 AM
Hi Krishna,
for creating Text I use SAVE_TEXT fm. check this fm. i have to pass internal table to TLINE.
But you mentioned that
krishna k wrote:
better you keep it into one table with different fields then check , while displaying also use same logic.
So how its possible??
Regards
Sabyasachi
2013 Aug 13 9:54 AM
Hi ,
as per my understanding, your having the data in excel file then that data your converting into internal table then storing into standard table(means into SAP), if it is correct then you 've to check what is the target table field length .
ex : if your having the data into internal table of 500 characters, but the target field length is 120 character then you have to pass 4times. how to overcome this scenario is , we know the target field length & its fixed also , so based on that we 've to manage our field lengths.
so our itab field length is 125 characters and in excel we are having around 500 chars then you have to loop 4 times .
1 sales order is there , while saving the data you have to use so num as a basic primary key and line items you can increase in run time make it as a item no.
so,
125 1 255char
2 255char
..
..
like this data you have to pass
regards,
krishna
2013 Aug 13 8:40 AM
You can use string as the type for declaring the field to store such data.
In Database table you need to maintain a length field of type int2 before this data
field of type string which is required to store the length of the data present in
the data field.
In code insert the contents of the fields in work area and insert it to the
database table.
For instance, if 'length' is the type int2 field and 'data' is the type
string field declared in the database table then:
Concatenate 'hello'
'how are you'
'We are trying to resolve the issue'
'lets work together on this issue'
into wa_ztable-data.
wa_ztable-length = strlen ( wa_ztable-data)
Insert ztable from wa.
2013 Aug 13 8:58 AM
Hello,
it does not store any database table....for this text id, text object present.
tcode : AC03.
in Excel, 2000 characters present.
here i use save_text fm.
Regards
SAbyasachi
2013 Aug 13 10:05 AM
2013 Aug 13 1:40 PM
Hello,.
My problem is solved............Thanks all of you.
Regards
Sabyasachi
2013 Aug 13 1:42 PM
Hi Sabysachi,
Please explain us how you solved your problem?
Regards,
Marina.
2015 Jun 24 11:07 PM
Hi All,
Copy this FM ALSM_EXCEL_TO_INTERNAL_TABLE and Structure ALSMEX_TABLINE to Z objects.
And change the VALUE type to store up to 3000 or 4000 in structure.. Whatever the length you wanted.
And update the table Parameter with Z structure.
And try to save the FM then you will find syntax issues at these performs. Change the types to our Z structure types and activate the FM..
separated_to_intern_convert
line_to_cell_separat
line_to_cell_esc_sep
Now this Z FM will upload the text you wanted.
Thanks,
Srinu Marapureddi