Internal table length
Hi Experts ,
Please look at the decleration below
types: BEGIN OF TY_FINAL ,
TEXT(300) ,
END OF TY_FINAL .
what is more intresting is that it is not able to hold value in field TEXT with
more length
for example i am trying to store below value
PX,"0000000000","000010","0000002","07/26/2007@00:00:01","07/26/2007@23:59:00","07/26/2007@00:00:01","07/26/2007@23:59:59",000.000,000.000,000000.000,0000000.4360,0000020.0000,00000000000.00,00000000000.00,0000020.0000,0000000000000.0000,0000002,0000001,0000.0000,111.0000,00000.0000,00000
BUT INTERNAL TABLE IS HOLDING value till
PX,"0000000000","000010","0000002","07/26/2007@00:00:01","07/26/2007@23:59:00","07/26/2007@00:00:01","07/26/2007@23:59:59",000.000,000.000,000000.000,0000000.4360,0000020.0000,00000000000.00,00000000000.00,0000020.0000,0000000000000.0000,0000002,0000001
even though i increase the size of the internal table nothing is happening
it's giving me error
"T_FINAL" cannot be a table, a reference, a string, or contain any of
these objects
when i declared in manner in which you said
Similar Messages
-
Application server file length to internal table
i am having a flat file in the appliaction server and it is 350 characters length stored for each line.
i mean like purchase order,matner,material text, kunnr,customer address etc, this all will be 365 chars including spaces.
I have decalred the file path like
file(150) type c.
so in file i store the physical path.
Now i used the statement to read the data into by itab , which has all the fields of applicaion server file .
Do
Read dataset file into waitab.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND waitab TO itab.
CLEAR waitab.
ENDDO.
1)My doubt is that
experts
i am simply using Read dataset file into waitab. and i did not mentioned the lenght of the file anywhere in the program? Will the system move all the 365 chars into waitab?
Or do i need to mention the lenght of the file?
2)Suppose my file is like this
1212222 2283838 2839293 383839283 38e439 3u39393 3839839 383993 2837383 38739378 3u873983
Now my itab will be
filed1(10),file2(7),field3(8),field4(7),filed5(8).
so in this case the first 10 chars of the file will be placed in field1,
next 7chars will be placed in field2, is it including spaces?
Here my file lenght is more than the itab, in this case what will happen?Beacuse my need is to have file first line into one record of itab , second line into another record , etc?Hi,
<li>Try this way. This sample program is used to download TAB delimited file from application server.
REPORT ztest_program.
DATA: BEGIN OF it_t001 OCCURS 0,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
ort01 TYPE t001-ort01,
land1 TYPE t001-land1,
waers TYPE t001-waers,
spras TYPE t001-spras,
ktopl TYPE t001-ktopl,
waabw TYPE t001-waabw,
END OF it_t001.
DATA: BEGIN OF it_app_file OCCURS 0,
data TYPE string,
END OF it_app_file.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS:hor_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
PARAMETERS : p_file(150) TYPE c.
START-OF-SELECTION.
"Open file for reading
OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
DO.
READ DATASET p_file INTO it_app_file-data.
IF it_app_file IS INITIAL.
"If file ends or if does not have data
EXIT.
ELSE.
"Splitting TAB delimited data into into internal table
SPLIT it_app_file-data AT hor_tab INTO it_t001-bukrs
it_t001-butxt
it_t001-ort01
it_t001-land1
it_t001-waers
it_t001-spras
it_t001-ktopl
it_t001-waabw.
APPEND it_t001.
CLEAR it_t001.
ENDIF.
ENDDO.
ENDIF.
"close file
CLOSE DATASET p_file.
LOOP AT it_t001.
WRITE:/ it_t001-bukrs,
it_t001-butxt,
it_t001-ort01,
it_t001-land1,
it_t001-waers,
it_t001-spras,
it_t001-ktopl,
it_t001-waabw.
ENDLOOP.
<li>Let me know if you have any problem in doing.
Thanks
Venkat.O -
Maximum record length in internal table?
Is there a maximum record length in an internal table? Please note: My question is NOT related to table space. I'm referring only to the length of an individual record (A.K.A. row length).
I am using a work area to insert data into an internal table. Both the work area and internal table are defined by the same structure.
The structure has a total length of 672 bytes. For the sake of this discussion I'll point out that at the end of the structure, bytes 669, 670, 671, and 672 are four separate fields of 1 character each.
When viewing the work area record in the debugger I'm seeing all the fields and all the values. When viewing the internal table in the debugger after a record is inserted, the internal table ends with the field defined at Byte 670. The internal table does not include the two fields defined at Bytes 671 and 672.
Am I to assume from the above explanation that the length of a record ( A.K.A. row) in an internal table cannot exceed 670 bytes?
Thank you.Manish,
False alarm! While, technically, you didn't answer my question, your request for code ended up helping me answer my own question.
To provide you with some code I wrote a simple test program using the record layout referred to above, with a DO loop to put some records into the internal table, followed by a LOOP AT, with accompanying WRITE statements to display the contents of the internal table and demonstrate that the last two fields weren't being stored.
However, when I ran the test program, the last two fields were being displayed.
It was at that point, when stepping through the debugger that I noticed the scroll arrows above the last column of my internal table that allowed me to scroll to the right and see my final two fields.
Apparently, because of the large number of fields in my internal table I had reached the default display length of the debugger. While I was obviously aware of the scroll bar found at the bottom of the display, I had never worked with an internal table of that width in the past and hadn't even noticed the scroll arrows above the last column before.
Thanks for taking the time to respond helping me get to the solution. -
What is the best way to declare field length 500 in internal table?
Hi all,
what is the best way to declare field length 500(constant value allways) in internal table?
I am trying to send data from internal table to file format, and I have a field in internal table with 500 length (constant value always). So how do I can declare and append this field value to table?
Thanks
MuraliHi. Please see the following example program, notice how I am filling the field with the constant value.
report zrich_0001.
* CLASS lcl_main DEFINITION
class lcl_main definition.
public section.
types: begin of ttab,
fld1(500) type c,
end of ttab.
data: itab type table of ttab.
data: xtab type ttab.
methods: constructor,
write_itab.
endclass.
* CLASS lcl_main IMPLEMENTATION
class lcl_main implementation.
method constructor.
<b>
xtab-fld1 =
'This is one part of the total string which needs to be really' &
' long and this is a constant and we need to move it to a work' &
' area and then append it to the internal table which has a' &
' field with a length of five hundred characters'.
append xtab to itab.</b>
endmethod.
method write_itab.
loop at itab into xtab.
write:/ xtab-fld1.
endloop.
endmethod.
endclass.
data: o_main type ref to lcl_main.
start-of-selection.
create object o_main.
call method o_main->write_itab.
Regards,
Rich Heilman -
Hi,
I am using GUI_UPLOAD to upload the file from presentation server to my internal table. My problem is that the one of the records of testfile is 3000 in length. The internal table is not showing all the data from the testfile. is there any limitation to the record length of an internal table??
DATA: FILENAME(100) VALUE 'C:\testfile.txt',
G_FILE TYPE STRING.
DATA: BEGIN OF T_DATATAB OCCURS 0,
LINE(3000) type c,
END OF T_DATATAB.
G_FILE = FILENAME.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = G_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = T_DATATAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
SBhi,
are you imitating lsmw direct input program.
don't include the all structures. only use the required fields which you are going to populate.,
thanks
vijay
check the below code..
*& Report Z__DIRECT__MAT___CREAT *
REPORT Z__DIRECT__MAT___CREAT .
INCLUDE Z_INCLUDE_MAT_CREAT.
* SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002.
PARAMETERS:P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1 .
* AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
IMPORTING
FILE_NAME = P_FILE.
*START-OF-SELECTION
START-OF-SELECTION.
*Perform to upload the data from Presentation Server
V_FILE = P_FILE.
PERFORM UPLOAD_DATA.
*Transfer the Data to the structure BGR00 BMMH1 BMM00
PERFORM CONVERT_0000. " BGR00
PERFORM POPULATE_DATA CHANGING BMM00.
PERFORM POPULATE_DATA CHANGING BMMH1.
**Looping the flat file data and updating the structures BMM00 & BMMH1
LOOP AT MATERIAL_MASTER.
*Writing the Data to the Application Server in a proper Format
OPEN DATASET C_ZTEST FOR APPENDING IN TEXT MODE ENCODING
DEFAULT.
*Transfer the Data to the structure BMM00
PERFORM CONVERT_0002. " BMM00
*Transfer the Data to the structure BMMh1
PERFORM CONVERT_0003. " BMMH1
**Closing the dataset after transfering the data
CLOSE DATASET C_ZTEST.
ENDLOOP. "Endloop of MATERIAL_MASTER
*END-OF-SELECTION
END-OF-SELECTION.
**Calling the Direct Input Program to Create the material
SUBMIT RMDATIND WITH %%%_R_P = C_X
WITH %%%_PHY = C_ZTEST
WITH SPERR = C_N.
*& Include Z_INCLUDE_MAT_CREAT *
**Tables Used To Create the Material
TABLES:
BGR00,
BMM00,
BMMH1.
DATA:C_ZTEST(60) type c,
C_X TYPE C,
C_N TYPE C,
V_file type string.
C_ZTEST = 'Ztest.lsmw.conv'(001).
C_X = 'X'(003).
C_N = 'N'(004).
**FILED SYMBOLS
FIELD-SYMBOLS: <F> .
**Structure to Hold the Flat File
data:
begin of LSMW_MATERIAL_MASTER,
MATNR(018) type C, "Material number
MTART(004) type C, "Material type
MBRSH(001) type C, "Industry sector
WERKS(004) type C, "Plant
MAKTX(040) type C, "Material description
DISMM(002) type C, "Extra Field Added In the Program as it is required
MEINS(003) type C, "Base unit of measure
MATKL(009) type C, "Material group
SPART(002) type C, "Division
LABOR(003) type C, "Lab/office
PRDHA(018) type C, "Product hierarchy
MSTAE(002) type C, "X-plant matl status
MTPOS_MARA(004) type C, "Gen item cat group
BRGEW(017) type C, "Gross weight
GEWEI(003) type C, "Weight unit
NTGEW(017) type C, "Net weight
GROES(032) type C, "Size/Dimensions
MAGRV(004) type C, "Matl grp pack matls
BISMT(018) type C, "Old material number
WRKST(048) type C, "Basic material
PROFL(003) type C, "DG indicator profile
KZUMW(001) type C, "Environmentally rlvt
BSTME(003) type C, "Order unit
VABME(001) type C,
EKGRP(003) type C, "Purchasing group
XCHPF(001) type C, "Batch management
EKWSL(004) type C, "Purchasing key value
WEBAZ(003) type C, "GR processing time
MFRPN(040) type C, "Manufacturer part number
MFRNR(010) type C, "Manufacturer number
VPRSV(001) type C, "Price control indicator
STPRS(015) type C, "Standard price
BWPRH(014) type C, "Commercial price1
end of LSMW_MATERIAL_MASTER.
**InternalTable to HOld the Flat File Data
DATA:
BEGIN OF MATERIAL_MASTER OCCURS 0.
INCLUDE STRUCTURE LSMW_MATERIAL_MASTER.
DATA:
END OF MATERIAL_MASTER.
*& Form upload_data From Presentation Server
FORM UPLOAD_DATA.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = V_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
DATA_TAB = MATERIAL_MASTER
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC = 0.
DELETE MATERIAL_MASTER INDEX 1.
ENDIF.
ENDFORM. "upload_data
*& Updating the BGR00 Structure
FORM CONVERT_0000. " BGR00
**Opening the Data Set to write the data to Application Server
OPEN DATASET C_ZTEST FOR OUTPUT IN TEXT MODE ENCODING DEFAULT
MOVE: '0' TO BGR00-STYPE,
'ZTEST' TO BGR00-GROUP,
SY-MANDT TO BGR00-MANDT,
SY-UNAME TO BGR00-USNAM,
'X' TO BGR00-XKEEP,
'/' TO BGR00-NODATA.
*Transefering the Data To the Application Server File
TRANSFER BGR00 TO C_ZTEST.
*Closing the Dataset after Transfer
CLOSE DATASET C_ZTEST.
ENDFORM. "convert_0001
*& Updating BMM00 Structure
FORM CONVERT_0002. " BMM00
* --- BMM00-STYPE
BMM00-STYPE = '1'.
* --- BMM00-TCODE
BMM00-TCODE = 'MM01'.
* --- BMM00-MATNR
IF NOT MATERIAL_MASTER-MATNR IS INITIAL.
BMM00-MATNR = MATERIAL_MASTER-MATNR.
ELSE.
BMM00-MATNR = '/'.
ENDIF.
* --- BMM00-MBRSH
IF NOT MATERIAL_MASTER-MBRSH IS INITIAL.
BMM00-MBRSH = MATERIAL_MASTER-MBRSH.
ELSE.
BMM00-MBRSH = '/'.
ENDIF.
* --- BMM00-MTART
IF NOT MATERIAL_MASTER-MTART IS INITIAL.
BMM00-MTART = MATERIAL_MASTER-MTART.
ELSE.
BMM00-MTART = '/'.
ENDIF.
* --- BMM00-WERKS
IF NOT MATERIAL_MASTER-WERKS IS INITIAL.
BMM00-WERKS = MATERIAL_MASTER-WERKS.
ELSE.
BMM00-WERKS = '/'.
ENDIF.
BMM00-XEIB1 = 'X'. " BMM00-xeib1 = '/'.
BMM00-XEIE1 = 'X'. " BMM00-xeie1 = '/'.
BMM00-XEIK1 = 'X'. " BMM00-xeik1 = '/'.
**Transfer the data to the Application Server File
TRANSFER BMM00 TO C_ZTEST.
ENDFORM. "convert_0002
*& UPdating BMMH1 Structure
FORM CONVERT_0003. " BMMH1
* --- BMMH1-STYPE
BMMH1-STYPE = '2'.
* --- BMMH1-MEINS
IF NOT MATERIAL_MASTER-MEINS IS INITIAL.
BMMH1-MEINS = MATERIAL_MASTER-MEINS.
ELSE.
BMMH1-MEINS = '/'.
ENDIF.
* --- BMMH1-MAKTX
IF NOT MATERIAL_MASTER-MAKTX IS INITIAL.
BMMH1-MAKTX = MATERIAL_MASTER-MAKTX.
ELSE.
BMMH1-MAKTX = '/'.
ENDIF.
* --- BMMH1-MATKL
IF NOT MATERIAL_MASTER-MATKL IS INITIAL.
BMMH1-MATKL = MATERIAL_MASTER-MATKL.
ELSE.
BMMH1-MATKL = '/'.
ENDIF.
* --- BMMH1-BISMT
IF NOT MATERIAL_MASTER-BISMT IS INITIAL.
BMMH1-BISMT = MATERIAL_MASTER-BISMT.
ELSE.
BMMH1-BISMT = '/'.
ENDIF.
* --- BMMH1-LABOR
IF NOT MATERIAL_MASTER-LABOR IS INITIAL.
BMMH1-LABOR = MATERIAL_MASTER-LABOR.
ELSE.
BMMH1-LABOR = '/'.
ENDIF.
* --- BMMH1-WRKST
IF NOT MATERIAL_MASTER-WRKST IS INITIAL.
BMMH1-WRKST = MATERIAL_MASTER-WRKST.
ELSE.
BMMH1-WRKST = '/'.
ENDIF.
* --- BMMH1-BRGEW
IF NOT MATERIAL_MASTER-BRGEW IS INITIAL.
BMMH1-BRGEW = MATERIAL_MASTER-BRGEW.
ELSE.
BMMH1-BRGEW = '/'.
ENDIF.
* --- BMMH1-NTGEW
IF NOT MATERIAL_MASTER-NTGEW IS INITIAL.
BMMH1-NTGEW = MATERIAL_MASTER-NTGEW.
ELSE.
BMMH1-NTGEW = '/'.
ENDIF.
* --- BMMH1-GEWEI
IF NOT MATERIAL_MASTER-GEWEI IS INITIAL.
BMMH1-GEWEI = MATERIAL_MASTER-GEWEI.
ELSE.
BMMH1-GEWEI = '/'.
ENDIF.
* --- BMMH1-GROES
IF NOT MATERIAL_MASTER-GROES IS INITIAL.
BMMH1-GROES = MATERIAL_MASTER-GROES.
ELSE.
BMMH1-GROES = '/'.
ENDIF.
* --- BMMH1-SPART
IF NOT MATERIAL_MASTER-SPART IS INITIAL.
BMMH1-SPART = MATERIAL_MASTER-SPART.
ELSE.
BMMH1-SPART = '/'.
ENDIF.
* --- BMMH1-BSTME
IF NOT MATERIAL_MASTER-BSTME IS INITIAL.
BMMH1-BSTME = MATERIAL_MASTER-BSTME.
ELSE.
BMMH1-BSTME = '/'.
ENDIF.
* --- BMMH1-EKWSL
IF NOT MATERIAL_MASTER-EKWSL IS INITIAL.
BMMH1-EKWSL = MATERIAL_MASTER-EKWSL.
ELSE.
BMMH1-EKWSL = '/'.
ENDIF.
* --- BMMH1-EKGRP
IF NOT MATERIAL_MASTER-EKGRP IS INITIAL.
BMMH1-EKGRP = MATERIAL_MASTER-EKGRP.
ELSE.
BMMH1-EKGRP = '/'.
ENDIF.
* --- BMMH1-XCHPF
IF NOT MATERIAL_MASTER-XCHPF IS INITIAL.
BMMH1-XCHPF = MATERIAL_MASTER-XCHPF.
ELSE.
BMMH1-XCHPF = '/'.
ENDIF.
* --- BMMH1-WEBAZ
IF NOT MATERIAL_MASTER-WEBAZ IS INITIAL.
BMMH1-WEBAZ = MATERIAL_MASTER-WEBAZ.
ELSE.
BMMH1-WEBAZ = '/'.
ENDIF.
IF NOT MATERIAL_MASTER-DISMM IS INITIAL.
BMMH1-DISMM = MATERIAL_MASTER-DISMM.
ELSE.
BMMH1-DISMM = '/'.
ENDIF.
* --- BMMH1-VPRSV
IF NOT MATERIAL_MASTER-VPRSV IS INITIAL.
BMMH1-VPRSV = MATERIAL_MASTER-VPRSV.
ELSE.
BMMH1-VPRSV = '/'.
ENDIF.
BMMH1-VERPR = '/'.
* --- BMMH1-STPRS
IF NOT MATERIAL_MASTER-STPRS IS INITIAL.
BMMH1-STPRS = MATERIAL_MASTER-STPRS.
ELSE.
BMMH1-STPRS = '/'.
ENDIF.
* --- BMMH1-BWPRH
IF NOT MATERIAL_MASTER-BWPRH IS INITIAL.
BMMH1-BWPRH = MATERIAL_MASTER-BWPRH.
ELSE.
BMMH1-BWPRH = '/'.
ENDIF.
* --- BMMH1-PRDHA
IF NOT MATERIAL_MASTER-PRDHA IS INITIAL.
BMMH1-PRDHA = MATERIAL_MASTER-PRDHA.
ELSE.
BMMH1-PRDHA = '/'.
ENDIF.
* --- BMMH1-VABME
IF NOT MATERIAL_MASTER-VABME IS INITIAL.
BMMH1-VABME = MATERIAL_MASTER-VABME.
ELSE.
BMMH1-VABME = '/'.
ENDIF.
* --- BMMH1-MAGRV
IF NOT MATERIAL_MASTER-MAGRV IS INITIAL.
BMMH1-MAGRV = MATERIAL_MASTER-MAGRV.
ELSE.
BMMH1-MAGRV = '/'.
ENDIF.
* --- BMMH1-KZUMW
IF NOT MATERIAL_MASTER-KZUMW IS INITIAL.
BMMH1-KZUMW = MATERIAL_MASTER-KZUMW.
ELSE.
BMMH1-KZUMW = '/'.
ENDIF.
* --- BMMH1-MFRNR
IF NOT MATERIAL_MASTER-MFRNR IS INITIAL.
BMMH1-MFRNR = MATERIAL_MASTER-MFRNR.
ELSE.
BMMH1-MFRNR = '/'.
ENDIF.
* --- BMMH1-MFRPN
IF NOT MATERIAL_MASTER-MFRPN IS INITIAL.
BMMH1-MFRPN = MATERIAL_MASTER-MFRPN.
ELSE.
BMMH1-MFRPN = '/'.
ENDIF.
BMMH1-MPROF = '/'.
* --- BMMH1-MSTAE
IF NOT MATERIAL_MASTER-MSTAE IS INITIAL.
BMMH1-MSTAE = MATERIAL_MASTER-MSTAE.
ELSE.
BMMH1-MSTAE = '/'.
ENDIF.
* --- BMMH1-PROFL
IF NOT MATERIAL_MASTER-PROFL IS INITIAL.
BMMH1-PROFL = MATERIAL_MASTER-PROFL.
ELSE.
BMMH1-PROFL = '/'.
ENDIF.
* --- BMMH1-MTPOS_MARA
IF NOT MATERIAL_MASTER-MTPOS_MARA IS INITIAL.
BMMH1-MTPOS_MARA = MATERIAL_MASTER-MTPOS_MARA.
ELSE.
BMMH1-MTPOS_MARA = '/'.
ENDIF.
**Transfer the Data to Application Server File
TRANSFER BMMH1 TO C_ZTEST.
ENDFORM. "convert_0003
*& Form POPULATE_DATA
* text
* <--P_BLF text
FORM POPULATE_DATA CHANGING P_BLF.
DATA: L_NUM TYPE I.
DO.
L_NUM = L_NUM + 1.
ASSIGN COMPONENT L_NUM OF STRUCTURE P_BLF TO <F>.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
MOVE BGR00-NODATA TO <F>.
ENDDO.
ENDFORM. " POPULATE_DATA -
Length of value of c field in internal table
Hi experts,
how do I find out the lenght of the value which is an CHARACTER field in an internal table.
I get a .XLS file from the customer. To check where the real entries starts I need to know the length of one field in the internal table.
How do I do this?
I tried it with DESCRIBE, but it doesn't work because the c field is interpreted hexadecimal.
Example:
all fields in my table are c(30), the value in one column is max. 3 letters. I want to find out the row where the entry in this field is 3 letters long.
Edited by: Heiko Kany on Sep 3, 2008 8:49 AMHi Heiko,
You can find the length using the STRLEN function as given below;
DATA : ipstr TYPE string.
DATA : len TYPE i VALUE 0.
ipstr = 'Sample String'.
len = STRLEN( ipstr )
After execution len will contain 13.
Regards
Karthik D -
Field length in internal table
hi,
how to selt field length in internal table?.
i have created on report the report out puts down load to using download function .
the out format is:
op1 op2 op3 op4
1 3 4
i want
op1 op2 op3 op4
1 3 4
how to set this please give sample code.HI,
Give internal table like this.
DATA: BEGIN OF itab OCCURS 100,
op1(04),
op2(04),
op3(04),
op4(04),
END OF itab.
So it will allocate space between 1, 3 and 4.
Reward if it useful.
Thanks. -
Identifying the maximum length of a record in internal table
Hi,
Im using an internal table for a string for some requirement.
Now, at later point of time i need to use for CHAR variable to copy the data from the above internal table.
I need to identify the max length of the record stored in this internal table so that i can assign that much length to this CHAR variable.
Is there any standard fm or any abap stmts.
Thanks
rohithYou have to Loop the entire Itab to find the Maximum length of the record stored.
Just like this:
data: begin of itab occurs 0,
v_str1 type string,
end of itab.
data: v_len type i.
data: v_len1 type i.
itab-v_str1 = 'mahesh sap abap'.
append itab. clear itab.
itab-v_str1 = 'mahesh'.
append itab. clear itab.
itab-v_str1 = 'mahesh sap'.
append itab. clear itab.
loop at itab.
v_len = strlen( itab-v_str1 ).
if v_len > v_len1.
v_len1 = v_len.
else.
continue.
endif.
clear: v_len.
endloop.
write:/ 'Max Length', v_len1. -
How to increase the length of internal table dynamically
How to increase the length of internal table dynamically depending on the number of fields fetched into the internal table ?
The requirement code :
types: begin of t_data,
form like zscr_data_hdr-form,
werks like zscr_data_hdr-werks,
matnr like zscr_data_hdr-matnr,
verid like zscr_data_hdr-verid,
lot like zscr_data_hdr-lot,
lot_qty like zscr_data_hdr-lot_qty,
udate like zscr_data_hdr-udate,
utime like zscr_data_hdr-utime,
zuser like zscr_data_hdr-zuser,
processed like zscr_data_hdr-processed,
defect like zscr_defect_data-defect,
vornr like zscr_route_data-vornr,
fld1 like zscr_defect_data-defect_val,
fld2 like zscr_defect_data-defect_val,
fld3 like zscr_defect_data-defect_val,
fld4 like zscr_defect_data-defect_val,
fld5 like zscr_defect_data-defect_val,
fld6 like zscr_defect_data-defect_val,
fld7 like zscr_defect_data-defect_val,
fld8 like zscr_defect_data-defect_val,
fld9 like zscr_defect_data-defect_val,
fld10 like zscr_defect_data-defect_val,
fld11 like zscr_defect_data-defect_val,
fld12 like zscr_defect_data-defect_val,
fld13 like zscr_defect_data-defect_val,
fld14 like zscr_defect_data-defect_val,
fld15 like zscr_defect_data-defect_val,
fld16 like zscr_defect_data-defect_val,
fld17 like zscr_defect_data-defect_val,
fld18 like zscr_defect_data-defect_val,
fld19 like zscr_defect_data-defect_val,
fld20 like zscr_defect_data-defect_val,
fld21 like zscr_defect_data-defect_val,
fld22 like zscr_defect_data-defect_val,
fld23 like zscr_defect_data-defect_val,
fld24 like zscr_defect_data-defect_val,
fld25 like zscr_defect_data-defect_val,
fld26 like zscr_defect_data-defect_val,
fld27 like zscr_defect_data-defect_val,
fld28 like zscr_defect_data-defect_val,
fld29 like zscr_defect_data-defect_val,
fld30 like zscr_defect_data-defect_val,
fld31 like zscr_defect_data-defect_val,
fld32 like zscr_defect_data-defect_val,
fld33 like zscr_defect_data-defect_val,
fld34 like zscr_defect_data-defect_val,
fld35 like zscr_defect_data-defect_val,
fld36 like zscr_defect_data-defect_val,
fld37 like zscr_defect_data-defect_val,
fld38 like zscr_defect_data-defect_val,
fld39 like zscr_defect_data-defect_val,
fld40 like zscr_defect_data-defect_val,
fld41 like zscr_defect_data-defect_val,
fld42 like zscr_defect_data-defect_val,
fld43 like zscr_defect_data-defect_val,
fld44 like zscr_defect_data-defect_val,
fld45 like zscr_defect_data-defect_val,
fld46 like zscr_defect_data-defect_val,
fld47 like zscr_defect_data-defect_val,
fld48 like zscr_defect_data-defect_val,
fld49 like zscr_defect_data-defect_val,
fld50 like zscr_defect_data-defect_val,
fld51 like zscr_defect_data-defect_val,
fld52 like zscr_defect_data-defect_val,
fld53 like zscr_defect_data-defect_val,
fld54 like zscr_defect_data-defect_val,
fld55 like zscr_defect_data-defect_val,
fld56 like zscr_defect_data-defect_val,
fld57 like zscr_defect_data-defect_val,
fld58 like zscr_defect_data-defect_val,
fld59 like zscr_defect_data-defect_val,
fld60 like zscr_defect_data-defect_val,
fld61 like zscr_defect_data-defect_val,
fld62 like zscr_defect_data-defect_val,
fld63 like zscr_defect_data-defect_val,
fld64 like zscr_defect_data-defect_val,
fld65 like zscr_defect_data-defect_val,
fld66 like zscr_defect_data-defect_val,
fld67 like zscr_defect_data-defect_val,
fld68 like zscr_defect_data-defect_val,
fld69 like zscr_defect_data-defect_val,
fld70 like zscr_defect_data-defect_val,
fld71 like zscr_defect_data-defect_val,
fld72 like zscr_defect_data-defect_val,
fld73 like zscr_defect_data-defect_val,
fld74 like zscr_defect_data-defect_val,
fld75 like zscr_defect_data-defect_val,
fld76 like zscr_defect_data-defect_val,
fld77 like zscr_defect_data-defect_val,
fld78 like zscr_defect_data-defect_val,
fld79 like zscr_defect_data-defect_val,
fld80 like zscr_defect_data-defect_val,
fld81 like zscr_defect_data-defect_val,
fld82 like zscr_defect_data-defect_val,
fld83 like zscr_defect_data-defect_val,
fld84 like zscr_defect_data-defect_val,
fld85 like zscr_defect_data-defect_val,
fld86 like zscr_defect_data-defect_val,
fld87 like zscr_defect_data-defect_val,
fld88 like zscr_defect_data-defect_val,
fld89 like zscr_defect_data-defect_val,
fld90 like zscr_defect_data-defect_val,
fld91 like zscr_defect_data-defect_val,
fld92 like zscr_defect_data-defect_val,
fld93 like zscr_defect_data-defect_val,
fld94 like zscr_defect_data-defect_val,
fld95 like zscr_defect_data-defect_val,
fld96 like zscr_defect_data-defect_val,
fld97 like zscr_defect_data-defect_val,
fld98 like zscr_defect_data-defect_val,
fld99 like zscr_defect_data-defect_val,
fld100 like zscr_defect_data-defect_val,
fld101 like zscr_defect_data-defect_val,
fld102 like zscr_defect_data-defect_val,
fld103 like zscr_defect_data-defect_val,
fld104 like zscr_defect_data-defect_val,
fld105 like zscr_defect_data-defect_val,
fld106 like zscr_defect_data-defect_val,
fld107 like zscr_defect_data-defect_val,
fld108 like zscr_defect_data-defect_val,
fld109 like zscr_defect_data-defect_val,
fld110 like zscr_defect_data-defect_val,
fld111 like zscr_defect_data-defect_val,
fld112 like zscr_defect_data-defect_val,
fld113 like zscr_defect_data-defect_val,
fld114 like zscr_defect_data-defect_val,
fld115 like zscr_defect_data-defect_val,
fld116 like zscr_defect_data-defect_val,
fld117 like zscr_defect_data-defect_val,
fld118 like zscr_defect_data-defect_val,
fld119 like zscr_defect_data-defect_val,
fld120 like zscr_defect_data-defect_val,
fld121 like zscr_defect_data-defect_val,
fld122 like zscr_defect_data-defect_val,
fld123 like zscr_defect_data-defect_val,
fld124 like zscr_defect_data-defect_val,
fld125 like zscr_defect_data-defect_val,
fld126 like zscr_defect_data-defect_val,
fld127 like zscr_defect_data-defect_val,
fld128 like zscr_defect_data-defect_val,
fld129 like zscr_defect_data-defect_val,
fld130 like zscr_defect_data-defect_val,
fld131 like zscr_defect_data-defect_val,
fld132 like zscr_defect_data-defect_val,
fld133 like zscr_defect_data-defect_val,
fld134 like zscr_defect_data-defect_val,
fld135 like zscr_defect_data-defect_val,
dayst like zscr_data_hdr-dayst,
end of t_data.
In this fld1 to fld135 are defined in internal table.
But if the number of fields are more than 135 then the program is going to short dump.
Some times fld1 to fid170 or more fields will be there in my internal table.
Please suggest me how to make my requirement dynamic and display this data fetched into this internal table onto a .XLS file in the presentation server ?Hi
You can try to use the type string:
form like zscr_data_hdr-form,
werks like zscr_data_hdr-werks,
matnr like zscr_data_hdr-matnr,
verid like zscr_data_hdr-verid,
lot like zscr_data_hdr-lot,
lot_qty like zscr_data_hdr-lot_qty,
udate like zscr_data_hdr-udate,
utime like zscr_data_hdr-utime,
zuser like zscr_data_hdr-zuser,
processed like zscr_data_hdr-processed,
defect like zscr_defect_data-defect,
vornr like zscr_route_data-vornr,
fieldxx type string,
dayst like zscr_data_hdr-dayst,
end of t_data.
So you can save you informations of every fld<n> concatenating their values into fieldxx.
Max -
How to know the length of internal table...
Hello experts,
How can I know the line size of my internal table since it will be dynamic
and I am just writing my report manually(not ALV) so I will be using sy-uline,
sy-vline, sy-linsz, etc.
So I can declare my sy-ulines according to the total length of my output.
Also, is this possible in ALV:
Header 1 *
Header 2 *
-OUTPUT-
Thanks again!Hi
You can use the DESCRIBE statement to get the number of lines in an internal table:
DATA: num_lines TYPE i.
DESCRIBE TABLE itab LINES num_lines.
num_lines will now hold the number of lines in your table.
I don't believe you can have multiple header rows in ALV you will probably need to group your records or summarise them to achieve a similar result.
Hope this helps
Andy
Message was edited by: Andrew Wright
Sorry, I misunderstood your requirement, using the DESCRIBE TABLE statement will fill the system field sy-tleng with the line size so immediately after doing DESCRIBE... just pass sy-tleng to an integer type variable.
Kind regards
Andy -
What is the maximal line length of type any internal table
Dear all,
who can tell me what is the maximal line length of type any internal table.
Thanks!There is no limit to the record length of an internal table.
There is overall memory limit for every program (as setup by your basis). So, depending on the width of the ITAB, the number of records in ITAB is limited by the assigned memory. -
Problem to upload the data into internal table record length more than 6000
Hi all
I stuck with this problem from past 3 days. I have to upload the data from excel sheet. iam making it tab delimited and trying to upload from gui_upload. but in the structure of file, we have, one field of 4000 characters, and other fields of 255 characters.
how can i upload this into internal table . From excel sheet or from tab delimeted or any other format? or any special function module is there? while iam doing this its truncating the datat 255 characters and not uploading the other fields also...
can any one of you help me out. ASAP
thnks in advancefrom one of the forum iam just pasting code which it is used in lsmw, try the same logic in ur code hope it can work.
you have to create multiple lines with do...enddo loop., like this:
(assuming excel_long_text-text is 924 characters long, 7 lines X 132 char)
__GLOBAL_DATA__
data: offset type i,
text_132(132) type c.
__BEGIN_OF_RECORD__ Before Using Conversion Rules
Rule : Default Settings Modified
Code: /sapdmc/ltxtl = init_/sapdmc/ltxtl.
CLEAR offset.
DO 7 TIMES.
text_132 = excel_long_text-text+offset(132).
offset = offset + 132.
__END_OF_RECORD__ After Using Conversion Rules
Rule : Default Settings Modified
Code: transfer_record.
ENDDO.
also check this
COMMIT_TEXT
To load long text into SAP
READ_TEXT
To load long text into SAP -
Longest length of a data type in an internal table in abap
Hi everyone,
I have a requirement for a client in which i want to read a standard text from SO10 which can be up to 5000 words, store that into an internal table & display it in an excel sheet in a single column in a single field.
I have tried declaring my field as:
field(65535) TYPE c,
edidd-sdata,
char1024,
/SDF/CCM_XSTRING, etc. But the field does not store morre than 128 characters.
Im attaching a screen shot of my final requirement.
can anybody help in this regard??Hi Vinnet,
Declare field with string type and use below sample code to display in a single row or colum.
CONSTANTS: "Char
lc_char1 TYPE char2 VALUE '"' ,
AT NEW esnum. "#EC AT_LOOP_WH
CONCATENATE lc_char1 l_string
INTO l_string
SEPARATED BY space.
ENDAT.
CONCATENATE l_string <field_name>
INTO l_string
SEPARATED BY space.
* Check for last line item to get payment note
AT END OF esnum. "#EC AT_LOOP_WH
CONCATENATE l_string lc_char1
INTO l_string
SEPARATED BY space.
ENDAT.
reward if it helpfull. -
Reg: Max length of internal table field(GUI_UPLOAD)
Hi All,
In my internal table there is a field for long text(free text/string), when i using GUI_UPLOAD the field max char is 255, so i couldnt get the full text, eventhough i declared that particular long text as string. Can any one tell me how to get the free text.
And i am uploading data from presentation server, not from app server.
Thanks in advance.
Arun
Edited by: arun on Mar 18, 2010 7:01 AMYou have to cook your own logic. But what is the reason for not sorting the table?
If you do not want to disturb the main intrenal table, you can move the contents into a temporary internal table, and sort it by descending order. The first record would have the maximum value.
here is a logic to find the maximum value.
loop at itab.
if itab-value > v_max.
v_max = itab-value.
endif.
endlop.
V_max would have the maximum value at the end lo the loop.
Regards,
Ravi -
Uploading excel file into internal table with field length more than 255
I am trying to upload the data from an excel file through function module 'TEXT_CONVERT_XLS_TO_SAP'.
I have tested by changing the field type from string, and char2000.
But it is accepting only 255 chars from the cell content.
How to get the total content of the field if it is more than 255 char.hi,
you can use any of the following procedures:
For uploading data from excel to internal table refer standard report RC1TCG3Z in se38 :
or
You can use the FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' itself. Please check if you have done it this way . But, this FM can be a little time consuming if the excel has large data, so you can use the FM u2018GUI_UPLOADu2019.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file1
i_begin_col = l_b1
i_begin_row = l_c1
i_end_col = l_b2
i_end_row = l_c2
TABLES
intern = lt_data
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE e018 DISPLAY LIKE 'i'.
ENDIF.
*---Removing the first heading fields from the file.
IF NOT lt_data[] IS INITIAL.
LOOP AT lt_data INTO lwa_data WHERE row = '0001'.
DELETE lt_data.
CLEAR lwa_data.
ENDLOOP.
*---Inserting the data from file the internal table
LOOP AT lt_data INTO lwa_data.
CASE lwa_data-col.
WHEN 1.
wa_file_wicopa-serial = lwa_data-value.
WHEN 2.
wa_file_wicopa-blart = lwa_data-value.
WHEN 3.
wa_file_wicopa-bldat = lwa_data-value.
WHEN 4.
wa_file_wicopa-budat = lwa_data-value.
ENDCASE.
AT END OF row.
APPEND wa_file_wicopa TO gt_file_wicopa.
CLEAR wa_file_wicopa.
ENDAT.
CLEAR lwa_data.
ENDLOOP.
ENDIF.
ENDIF.
or
DATA: it_test TYPE STANDARD TABLE OF alsmex_tabline WITH HEADER LINE.
DATA :v_start_col TYPE i VALUE '1',
v_start_row TYPE i VALUE '1',
v_end_col TYPE i VALUE '256',
v_end_row TYPE i VALUE '65536',
v_text TYPE repti.
* Funtion Module to upload values from excel to the Internal table
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = v_start_col
i_begin_row = v_start_row
i_end_col = v_end_col
i_end_row = v_end_row
TABLES
intern = it_test
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Or
You can use FM u201CTEXT_CONVERT_XLS_TO_SAPu201D.
DATA : i_raw TYPE truxs_t_text_data.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_tab_raw_data = i_raw
i_filename = p_path
TABLES
i_tab_converted_data = itab
EXCEPTIONS
conversion_failed = 1
OTHERS = 2
hope it will help u
regards
rahul
Maybe you are looking for
-
How to reinstall OS without a functioning CD Drive
I just got a Quicksilver tower and I sloppily copied my laptop's system into the Tower's. Now it won't start up (giving me the system folder with question mark icon). Problem is, the cd drive on the tower isn't working. I took it apart and the gears
-
How does the Touch screen look in direct / indirect sunlight?
Was sitting on the LIRR heading home when I had this thought... after watching some guy playing with his PSP, as the sun was falling on his screen.... hhmmmm, I wondered how my Touch, which is now enroute from Anchorage, is going to handle the sunlig
-
MC40: Some materials don't have ABC Indicator
Hi Experts, I run MC40 in background with 13000+ materials using usage value in % strategy, most of it has its ABC indicator updated while some are still blank. Are there any indications (in Material Master or anywhere) that those materials with "bla
-
How can I get Flash to work with my N-trig stylus on my Surface Pro 3?
Flash doesn't work at all with the N-trig stylus on the Surface Pro 3 with the latest WinTab drivers installed. The only freehand marks I can make create large useless lines that extend way beyond the lower-right corner the stage. Is Adobe aware of t
-
RSS: XML Transformation exception
I want to use the XMLProvider to make a rss channel. I know how to do this. But most of the time the channel does not work it says 'There has been an error while transforming the XML file!'. But sometimes the page does show my rss feed. The rss feed