Length of a table
desc IMP_TABLE
NAME_OF_TABLE VARCHAR2(2000)
is it possible to get length from dictionary of table name NAME_OF_TABLE?
select owner, segment_name
, sum(bytes) bytes
, round(sum(bytes)/1024/1024) mb
from dba_segments
where owner like upper('OWNER')
and segment_name like upper('TABLE_NAME')
and segment_type = 'table'
group by owner,segment_name;
Similar Messages
-
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. -
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 -
Calculating a record length of a table
Hi All,
In SAP 4.6C Oracle 9g I need to find a record length of a table.For that I am using :
Table name is ABC.
Tablespace in KBytes of ABC X
Total no records in ABC Y
Single record length in Kbytes (Z) = Tablespace (X) / Total no of records(Y)
I would like to know weather is this the correct way to calculate in approximation.I would also like to know any other methods of knowing it.
Any inputs are appreciated.
Thanks,
Priya.Hello,
>> I know that after major deletion frm db its necessary to do reorganization to enhance the db utilization.
Not mandatory ... it depends on many factors...
>> Pls help me to understand your statement that freed space isnt used by next entries.
It maybe not used for the next inserts... that depends on your tablespace (if it uses the ASMM feature) and essentially on the following parameters
- PCTUSED
- PCTFREE
Oracle Link: http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/logical.htm
=> The PCTFREE parameter sets the minimum percentage of a data block to be reserved as free space for possible updates to rows that already exist in that block
=> The PCTUSED parameter sets the minimum percentage of a block that can be used for row data plus overhead before new rows are added to the block. After a data block is filled to the limit determined by PCTFREE, Oracle Database considers the block unavailable for the insertion of new rows until the percentage of that block falls beneath the parameter PCTUSED. Until this value is achieved, Oracle Database uses the free space of the data block only for updates to rows already contained in the data block.
Both parameters are used in a NON-ASSM tablespace and with an ASSM tablespace only PCTFREE is used.
Regards
Stefan -
Does length of CBO table's field is shorter than structure field?
HI
length of CBO tables's field name is 16 and structure field name 30.
how this happen?
I was trying to make CBO table include some structure.
and that says field name is too long.
is this not possible all structucture can include CBO table?
or should I change table properties like tech. settings?
does anyone can solve this problem?
thanks.
Regards.
KimHi!
Unfortunately there is no way to enter more than 16 chars long names into tables. Nor with an included a structure.
As the sap help sais:
"There are some restrictions for certain objects. These objects are included in the following list together with the maximum length allowed:
Transparent tables and their fields: 16"
Correct the names within your structure (use less than 16 characters for the field names).
Best regards
Tamá -
Hi All,
I am new to oracle and I have to find the average row length for all tables in a schema.
Could anyone please help me.
What is the difference between data length and row length.
Thanks in advance
Anu
Message was edited by:
user448373look at dba_tables
-
Hi,
I created one table, in that table i have 101 field, total length of the table is 430, but i could not able to create 102nd field because it's saying total length of the table is exceed. How i can increase table length?The total length of the fields is limited to 1962 in case of Transparent tables.
Please check if one of the following constraints is causing the problem
<b>Constraints</b>
All the key fields of a table must be stored together at the beginning of the table. A non-key field may not occur between two key fields.
A maximum of 16 key fields per table is permitted. The maximum length of the table key is 255.
If the key length is greater than 120, there are restrictions when transporting table entries. The key can only be specified up to a maximum of 120 places in a transport. If the key is larger than 120, table entries must be transported generically.
A table may not have more than 249 fields. The sum of all field lengths is limited to 1962 (whereby fields with data type LRAW and LCHR are not counted).
Fields of types LRAW or LCHR must be at the end of the table. Only one such field is allowed per table. There must also be a field of type INT2 directly in front of such a field. The actual length of the field can be entered there by the database interface. -
Hi:
- I am currently prototyping a plug-in but I have some questions:
- 1) At the 'All Metrics' table, what is the intent of the 'Last Upload' field,
and how is this field updated?
- I have created some metrics but for some metrics the 'Last Upload' field
has a timestamp but for other metrics there is no data.
As far as I know, the metrics are similar but I do not know why the behaviour is different.
- 2) Is there a maximum string length that the Oracle agent can accept?
- I have a script which just returns all the environment variables into one cell.
In emagent.trc, the Oracle agent issues the following warning:
2009-08-27 12:38:47 Thread-76336 WARN upload: Truncating value of "STRING_VALUE" from "AGENT_HOME=
- Is the truncation an issue?
- 3) I have created some dynamic tables from performing an snmp walk, but the key that I use
is the index of the SNMP table. The data is collected correctly, but I am not sure that using
the table index as the key for OEM is a good idea because the metrics are stored according to the SNMP table index.
Should the OEM key be the something like 'object name' instead of the index number from performing an SNMP walk ?
For example, when I click a metric, the metric name is: Sensor Index 1.
But should it not be something like 'Fan #1' ?
Thanks JohnMetrics are collected at certain intervals, the Last Upload field indicates the date and time of the last time a metric collection was uploaded. The quicker the interval, the more recent that date should be. If you don't specify a CollectionItem in your default collection file for your metrics, they won't be collected or uploaded.
If your metric column is a STRING type, it is stored in a VARCHAR2(4000)
I'm not sure I understand your last problem... You have a table metric with a set of columns. The column you use as the key is just some tracking index which doesn't really mean anything. As long as your key column(s) make the row unique, the agent will be satisfied. If you want something more meaningful as your key, then it's something you will have to inject into your dataset if it isn't already there. -
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. -
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 -
How to Increase the Length of Condition table in OV20
While creating a condition table in T.code OV20 if fields length is more that 50 bytes table is not getting generated.it gives error as Too Many Fields Selected(More than 50 Bytes).
Actually i need to create a tabel with Basic Material(WRKST) which has length of 48 bytes.
Is there a solution on how to increase the length so that error is avoided.
There is no such error occuring while crating condition table in V/03Hi,
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.
Regards -
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 -
How to Compare Data length of staging table with base table definition
Hi,
I've two tables :staging table and base table.
I'm getting data from flatfiles into staging table, as per requirement structure of staging table and base table(length of each and every column in staging table is 25% more to dump data without any errors) are different for ex :if we've city column with varchar length 40 in staging table it has 25 in base table.Once data is dumped into staging table I want to compare actual data length of each and every column in staging table with definition of base table(data_length for each and every column from all_tab_columns) and if any column differs length I need to update the corresponding row in staging table which also has a flag called err_length.
so for this I'm using cursor c1 is select length(a.id),length(a.name)... from staging_table;
cursor c2(name varchar2) is select data_length from all_tab_columns where table_name='BASE_TABLE' and column_name=name;
But we're getting data atonce in first query whereas in second cursor I need to get each and every column and then compare with first ?
Can anyone tell me how to get desired results?
Thanks,
Mahender.This is a shot in the dark but, take a look at this example below:
SQL> DROP TABLE STAGING;
Table dropped.
SQL> DROP TABLE BASE;
Table dropped.
SQL> CREATE TABLE STAGING
2 (
3 ID NUMBER
4 , A VARCHAR2(40)
5 , B VARCHAR2(40)
6 , ERR_LENGTH VARCHAR2(1)
7 );
Table created.
SQL> CREATE TABLE BASE
2 (
3 ID NUMBER
4 , A VARCHAR2(25)
5 , B VARCHAR2(25)
6 );
Table created.
SQL> INSERT INTO STAGING VALUES (1,RPAD('X',26,'X'),RPAD('X',25,'X'),NULL);
1 row created.
SQL> INSERT INTO STAGING VALUES (2,RPAD('X',25,'X'),RPAD('X',26,'X'),NULL);
1 row created.
SQL> INSERT INTO STAGING VALUES (3,RPAD('X',25,'X'),RPAD('X',25,'X'),NULL);
1 row created.
SQL> COMMIT;
Commit complete.
SQL> SELECT * FROM STAGING;
ID A B E
1 XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX
2 XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
3 XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX
SQL> UPDATE STAGING ST
2 SET ERR_LENGTH = 'Y'
3 WHERE EXISTS
4 (
5 WITH columns_in_staging AS
6 (
7 /* Retrieve all the columns names for the staging table with the exception of the primary key column
8 * and order them alphabetically.
9 */
10 SELECT COLUMN_NAME
11 , ROW_NUMBER() OVER (ORDER BY COLUMN_NAME) RN
12 FROM ALL_TAB_COLUMNS
13 WHERE TABLE_NAME='STAGING'
14 AND COLUMN_NAME != 'ID'
15 ORDER BY 1
16 ), staging_unpivot AS
17 (
18 /* Using the columns_in_staging above UNPIVOT the result set so you get a record for each COLUMN value
19 * for each record. The DECODE performs the unpivot and it works if the decode specifies the columns
20 * in the same order as the ROW_NUMBER() function in columns_in_staging
21 */
22 SELECT ID
23 , COLUMN_NAME
24 , DECODE
25 (
26 RN
27 , 1,A
28 , 2,B
29 ) AS VAL
30 FROM STAGING
31 CROSS JOIN COLUMNS_IN_STAGING
32 )
33 /* Only return IDs for records that have at least one column value that exceeds the length. */
34 SELECT ID
35 FROM
36 (
37 /* Join the unpivoted staging table to the ALL_TAB_COLUMNS table on the column names. Here we perform
38 * the check to see if there are any differences in the length if so set a flag.
39 */
40 SELECT STAGING_UNPIVOT.ID
41 , (CASE WHEN ATC.DATA_LENGTH < LENGTH(STAGING_UNPIVOT.VAL) THEN 'Y' END) AS ERR_LENGTH_A
42 , (CASE WHEN ATC.DATA_LENGTH < LENGTH(STAGING_UNPIVOT.VAL) THEN 'Y' END) AS ERR_LENGTH_B
43 FROM STAGING_UNPIVOT
44 JOIN ALL_TAB_COLUMNS ATC ON ATC.COLUMN_NAME = STAGING_UNPIVOT.COLUMN_NAME
45 WHERE ATC.TABLE_NAME='BASE'
46 ) A
47 WHERE COALESCE(ERR_LENGTH_A,ERR_LENGTH_B) IS NOT NULL
48 AND ST.ID = A.ID
49 )
50 /
2 rows updated.
SQL> SELECT * FROM STAGING;
ID A B E
1 XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX Y
2 XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX Y
3 XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXHopefully the comments make sense. If you have any questions please let me know.
This assumes the column names are the same between the staging and base tables. In addition as you add more columns to this table you'll have to add more CASE statements to check the length and update the COALESCE check as necessary.
Thanks! -
Dear everyone,
I tried to add an aplhanumeric UDF and set it to 4. The system returns an error "Aplhanumeric column size cannot be decreased". If i linked that UDF to another UDT, the length is limited in 8. How could i solve the above problem??
Regards,
KitThis is a known bug in 2005 SP1, SAP Note 960134 details it and a workaround.
Simply using the DI API to create the field will also get round the problem.
Another simple workaround I found was to:-
a) set the new field to alpha size 1
b) tick and then untick the "set linked table" checkbox
c) now set the field size to whatever you want and click on add
John.
Maybe you are looking for
-
Ipad3 will not open or shutoff
I have been having problems of my iPad 3 in starting. It now shows the home screen with no number pad to open with my password. The "slide to unlock" is there and moves but will not slede open. I will not shut down with the power button and although
-
I accidentally made my hard drive an image of Mac OS X 10.6.3
I accidentally made my hard drive an image of Mac OS X 10.6.3, and I cant erase the hard drive anymore. Please tell me there is a way to be able to erase the image on the hard drive and put it back to the original settings?
-
In trying to get into the Linksys WRT-120N router's management utility browser, I was unable to sign in. After resetting the router multiple times and exhausted all the variants of the username/password combination that I can find and think of, I was
-
TDS Certificate, Challan Payment Issue and BSR Code Issue
Hi All, I have configured Extended withholding tax as follows and encountered some issues 1. Specify Document Type (Accounts Payable): Here I have given Document type as SA and I am able to Pay the remittance challan through Post Vendor challan trans
-
Can anyone suggest the best way to grab a frame from a video to then use it in an iDVD menu or print it for the cover of the DVD? There seem to be two ways but so far the only success I have had is to grab a frame as a still clip then remove .dv befo