Checking length of a field in a table
Hi,
How can i use STRLEN to check the length of a field in a table... lets say i have to chek the length of the field VBELN in the table VBAK.
I will reward all the useful answers.
Thanks,
Mohit.
Hi Mohit,
I have a doubt: do you want to compute the length of a value stored in a field, or to compute the length of the definition of that field?
1. In the first case, just make sure that the field is filled OK, then compute
l_length = strlen( vbak-vbeln ).
2. In the second case, you will have to compute
describe field vbak-vbeln length l_length.
For example, if VBAK-VBELN = '1234', then the first case will result 4, but the second case will result 10.
I hope this helps. Best regards,
Alvaro
Similar Messages
-
What is the Length of a Field in a Table Control?
Hi,
I have a small question. I want to know, What could be the Maximum length that can be assigned to a field while creating a Table Control? Any help would be highly appreciated.
Thanks in advance,
Exertive.Hi Exertive,
I've found that a simple field can have a maximum length of 128 characters.
To enter more text, use a custom textview control - use the text view class to build yourself a field that can hold a string variable - then you can have as long a value as you want. refer to class CL_GUI_TEXTEDIT.
Not sure about putting custom controls in a table control though!
Hope this helps slightly or gives you something to work with.
Cheers,
Chris -
For abap-hr i need datatype and length for the fields which i selected
hi seniors,
I got one task for which i have to get the data type and length for the fields of a table in abap-hr. I am using dd03l table, but my team leader told me to not to use this. So, please anybody can help, i will be thankfull.
I have to select PA30 fields in which pernr and choic, subty and whatever i have selected the infotypes fields. If there is any function module to find data type and length or else any other table.
thanks,
sekhar.Hi,
Try using the Function Module "DDIF_FIELDINFO_GET". You can use this for fetching the complete details of a structure or, a specific field.
Input:->
TABNAME PA0001
FIELDNAME PERNR
Output:->
Check the DFIES_TAB it will contain all the details you need for the specific field.
Sample--->
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
TABNAME = 'PA0001'
* FIELDNAME = ' '
* LANGU = SY-LANGU
* LFIELDNAME = ' '
* ALL_TYPES = ' '
* GROUP_NAMES = ' '
* UCLEN =
* DO_NOT_WRITE = ' '
* IMPORTING
* X030L_WA =
* DDOBJTYPE =
* DFIES_WA =
* LINES_DESCR =
TABLES
DFIES_TAB = MY_DFIES_TAB
* FIXED_VALUES =
* EXCEPTIONS
* NOT_FOUND = 1
* INTERNAL_ERROR = 2
* OTHERS = 3.
Hope this was of some help.
Best regards,
Sagar. -
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 -
Some users show that the sales docment external name is not printed completely in the form of delivery form printing, so I want to find how much length of the field is there through debugging. I am very expected to gain some suggestion from you.
for exploding the bom if you know header material use
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
CAPID = 'PP01'
DATUV = SY-DATUM
MEHRS = 'X'
MTNRV = P_MATNR
WERKS = P_WERKS
TABLES
STB = I_BOM
EXCEPTIONS
ALT_NOT_FOUND = 1
CALL_INVALID = 2
MATERIAL_NOT_FOUND = 3
MISSING_AUTHORIZATION = 4
NO_BOM_FOUND = 5
NO_PLANT_DATA = 6
NO_SUITABLE_BOM_FOUND = 7
CONVERSION_ERROR = 8
OTHERS = 9.
now check PLPO & PLKO table for routing or AFVC and AFVV for routing.
if production order created you have to check in afvc and afvv else check in plpo and plko.
for checking with plpo and plko you have to check MAPL table.
for bom and material link
MAST,STPO,STKO.
stlnr is the common field
regards
shiba dutta -
How to check the length of a field symbol value
hi all,
i have a problem with string function, i have assined table fields to a field symbol in a loop i want check the length of the assigned fields symbol value in every loop . i have written like ,,,,,len = strlen( <fs>). then i am getting the length of the field label what i ahve assigned to fiels symbol not the field value lenght ,
please advise me on this,
thanks,
sreI think you're on the right track. This should work:
data: len type i.
data: begin of itab OCCURS 1,
a type string value '1',
b type string value '12',
c type string value '123',
end of itab.
FIELD-SYMBOLS: <fs> type ANY.
do 3 times.
assign component sy-index of STRUCTURE itab to <fs>.
len = strlen( <fs> ).
enddo. -
Changing the length of a key field in a table
Hi,
I want to increase the length of the field from 2 to 4 in a standard SAP table and deliver it to the customers. This field is a key field in table. This field from this table is also used in view and view clusters.
What is the implication of changing the length to the customers. The customers would have already data in this field and they should not loose any data. Will the existing data for customers remain at length 2 or do they have to do some conversion?
Regards,
Srini.
Edited by: Srinivasa Raghavachar on Feb 7, 2008 12:45 PMhi,
The database table can be adjusted to the changed definition in the ABAP Dictionary in three different
ways:
By deleting the database table and creating it again. The table on the database is deleted, the inactive
table is activated in the ABAP Dictionary, and the table is created again on the database. Data
existing in the table is lost.
By changing the database catalog (ALTER TABLE). The definition of the table on the database is
simply changed. Existing data is retained. However, indexes on the table might have to be built again.
By converting the table. This is the most time-consuming way to adjust a structure.
If the table does not contain any data, it is deleted in the database and created again with its new
structure. If data exists in the table, there is an attempt to adjust the structure with ALTER TABLE. If the
database system used is not able to do so, the structure is adjusted by converting the table.
Field 1 Field 2, Field 3
NUMC,6 CHAR 8 CHAR, 60
Field 1 Field 2 Field 3
NUMC,6 CHAR, 8 CHAR,30
The following example shows the steps necessary during conversion.
Starting situation: Table TAB was changed in the ABAP Dictionary. The length of field 3 was reduced
from 60 to 30 places.
The ABAP Dictionary therefore has an active (field 3 has a length of 60 places) and an inactive (field 3
still has 30 places) version of the table.
The active version of the table was created in the database, which means that field 3 currently has 60
places in the database. A secondary index with the ID A11, which was also created in the database, is
defined for the table in the ABAP Dictionary.
The table already contains data.
Step 1: The table is locked against further structure changes. If the conversion terminates due to an
error, the table remains locked. This lock mechanism prevents further structure changes from being
made before the conversion has been completed correctly. Data could be lost in such a case.
Step 2: The table in the database is renamed. All the indexes on the table are deleted. The name of the
new (temporary) table is defined by the prefix QCM and the table name. The name of the temporary
Step 3: The inactive version of the table is activated in the ABAP Dictionary. The table is created on the
database with its new structure and with the primary index. The structure of the database table is the
same as the structure in the ABAP Dictinary after this step. The database table, however, does not
contain any data.
The system also tries to set a database lock for the table being converted. If the lock is set, application
programs cannot write to the table during the conversion.
The conversion is continued, however, even if the database lock cannot be set. In such a case
application programs can write to the table. Since in such a case not all of the data might have been
loaded back into the table, the table data might be inconsistent.
You should therefore always make sure that no applications access the table being converted
during the conversion process.
Step 4: The data is loaded back from the temporary table (QCM table) to the new table (with MOVECORRESPONDING).
The data exists in the database table and in the temporary table after this step.
When you reduce the size of fields, for example, the extra places are truncated when you reload the
data.
Since the data exists in both the original table and temporary table during the conversion, the storage
requirements increase during the process. You should therefore verify that sufficient space is available in
the corresponding tablespace before converting large tables.
There is a database commit after 16 MB when you copy the data from the QCM table to the original
table. A conversion process therefore needs 16 MB resources in the rollback segment. The existing
database lock is released with the Commit and then requested again before the next data area to be
converted is edited.
When you reduce the size of keys, only one record can be reloaded if there are several records whose
key cannot be distinguished. It is not possible to say which record this will be. In such a case you should
clean up the data of the table before converting.
Step 5: The secondary indexes defined in the ABAP Dictionary for the table are created again.
Step 6: The temporary table (QCM table) is deleted.
Step 7: The lock set at the beginning of the conversion is deleted.
If the conversion terminates, the table remains locked and a restart log is written.
Caution: The data of a table is not consistent during conversion. Programs therefore should not access
the table during conversion. Otherwise a program could for example use incorrect data when reading the
table since not all the records were copied back from the temporary table. Conversions therefore
should not run during production! You must at least deactivate all the applications that use tables to
be converted.
You must clean up terminated conversions. Programs that access the table might otherwise run
incorrectly. In this case you must find out why the conversion terminated (for example overflow of the
corresponding tablespace) and correct it. Then continue the terminated conversion.
Since the data exists in both the original table and temporary table during conversion, the storage
requirements increase during conversion. If the tablespace overflows when you reload the data from the
temporary table, the conversion will terminate. In this case you must extend the tablespace and start the
conversion in the database utility again.
If you shorten the key of a table (for example when you remove or shorten the field length of key fields),
you cannot distinguish between the new keys of existing records of the table. When you reload the data
from the temporary table, only one of these records can be loaded back into the table. It is not possible
to say which record this will be. If you want to copy certain records, you have to clean up the table
before the conversion.
During a conversion, the data is copied back to the database table from the temporary table with the
ABAP statement MOVE-CORRESPONDING. Therefore only those type changes that can be executed
with MOVE-CORRESPONDING are allowed. All other type changes cause the conversion to be
terminated when the data is loaded back into the original table. In this case you have to recreate the old
state prior to conversion. Using database tools, you have to delete the table, rename the QCM table to
its old name, reconstruct the runtime object (in the database utility), set the table structure in the
Dictionary back to its old state and then activate the table.
If a conversion terminates, the lock entry for the table set in the first step is retained. The table can no
longer be edited with the maintenance tools of the ABAP Dictionary (Transaction SE11).
A terminated conversion can be analyzed with the database utility (Transaction SE14) and then
resumed. The database utility provides an analysis tool with which you can find the cause of the error
and the current state of all the tables involved in the conversion.
You can usually find the precise reason for termination in the object log. If the object log does not
provide any information about the cause of the error, you have to analyze the syslog or the short dumps.
If there is a terminated conversion, two options are displayed as pushbuttons in the database utility:
After correcting the error, you can resume the conversion where it terminated with the Continue
adjustment option.
There is also the Unlock table option. This option only deletes the existing lock entry for the table .
You should never choose Unlock table for a terminated conversion if the data only exists in the
temporary table, i.e. if the conversion terminated in steps 3 or 4. table for table TAB is therefore QCMTAB.
Hope this is helpful,Do reward. -
How to check delta field in EDIDS table
Hi,
I have to create generic delta based on EDIDS (Status record) table. Since there is lot of data so i have to set delta point for this data-sources.
Could you please help to find delta field in this table?
Thanks & Regards
Devesh babuSeems like there is no other fields which an be relevant delta.
check docnum is possible to use as numeric pointer.
Numeric pointer can be used when table allows for entering new records only.
if there is no delta relevant field, go with full load every time.
Use dso inyour data flow. so that we can introduce delta between dso to cube.
data flow like this
data source---> Every time full load to PSA--->You use delta or full load. it pulls latest request which is full to dso---> dso to cube, load delta dtp.
Need to delete the psa request before every load.
thanks -
How to read table fields form a table having length of 7 characters
HI all,
could you please tell me how to read table fields from a table having length 7 characters, i have requirement that in my ztable i have 30 fields out of which 20 fields are location fields, i want to select 20 fields which have 7 characters length.
please could any body suggest me on this issue.
thanks,
sre.hi,
try like this
create a data variable of type i as
data: len type i.
create internal table for 20 fields as
data:begin of itab,
fld 1 type .......
end of itab.
data:itab type itab1 occurs 0 with header line.
loop at itab2. // original internal table which all fields.
read table itab2 with index sy-tabix.
len = strlen (itab2-fld).
if len eq 7.
move itab2 itab1.
append itab1.
endif.
endloop.
if helpful reward some points.
with regards,
Suresh.A -
How to check if a field in the table is same in all rows??
Hi Folks,
Is there a feature in abap where we can check if a field in a table is same in all rows.
Thanks,
MattThis can be easily self-programmed
read itab index 1. "get first row
"now check if exeists any entry with different value
read itab with key field1 ne itab-field1 transporting no fields.
if sy-subrc = 0.
"not all rows have the same value
else.
"all rows have the same value
endif.
Regards
Marcin
Right now I noticed that using NE operator is not allowed in READ TABLE statement, but you can do simple loop instead
read itab index 1 into l_field1. "get first row
loop at itab where field1 ne l_field1.
flag = 'X'.
exit.
endloop.
if flag = 'X'.
write: 'some fields are not equal'.
endif.
Edited by: Marcin Pciak on Oct 6, 2009 5:35 PM -
Implications of adding new key fields to existing table
Hi All,
I have searched forum regarding this. But didn't find exact answer.
We are planning to add new key fields to existing Ztable. I want to know the implications of this.
I have checked the where used list of table and found no impact. Only one point is making me to think again and again.
If we add key fields to existing table then we have to adjust the table from SE14 to activate it. But this adjustment doesn't ask for TR.
So if i release my TR, entries in other systems will also be adjusted accordingly??? Business is OK with the new fields values to be blank for existing entries.
Thanks,
Vinod.Yes the data in transported systems will also be adjusted. If this table contains too much data make transport at late hours because it will take long and table can't be used while it's adjusted. In this adjustment process data is copied to a temporary table and moved back to original table using move-corresponding command after key added. There will data loss if you remove a key or key fields field length but in your case it shouldn't be a problem.
Edited by: Gungor Ozcelebi on Jul 2, 2009 9:18 AM -
Search help for fields in custom table..
hi,
in my custom table i have two fields - table name and field name. when user selects table name as VBAP , for field names i need all the fields in VBAP to be displayed and for that I set the check table as DD03L and I am able to see all the fields. But i am not able to see the description of the fields rather seeing field name , other key fields of DD03L.
How do i get to display something like
field name - description - length (length of the field as defined in DDIC)
If search help will help then can u pl tell me how to create one ? or any standard can be used ?
thanksYes, you need to create search help and assign it to the field 'field name'
Please search SDN for how to create search help. There are 100's of threads with this
By the way the texts can be found in table DD03T for tables as well as for fields -
I have a table in SAP(PLM) where I need to change the existing 255 CHAR fields to 1250 CHAR long. There are six fields in the table that I need to change. All the BAPIs using the table are all created and so using LCHAR data type is not going to be very easy. I have changed the data types of these fields to STRING. But it seems like SAP would allow only three fields in a table to have STRING data type. All the three fields that I changed to STRING type are working good. Is there any other data type that I can use to fit 1250 characters?
Hi ,
i think any table can have maximum of 4000 char as its length( check for the exact no..)
If it crosses that it wont be activated.
and also see the following from sap help.
STRING
Character string of variable length. This type may not be used in database tables. In ABAP this type is implemented as a reference to a storage area of variable size.
RAWSTRING
Uninterpreted byte string of variable length. This type may not be used in database tables. In ABAP this type is implemented as a referece to a storage area of variable size.
so i think its better to display as char and required length.
Cheers,
Vasant.. -
FB03 - Increase length of the field "Account Short Text" in FB03
Dear Expert!
I understand that Tcode: FB03 is SAP standard tcode. However, i just want to ask, is it possible to increase length of the field "Account Short Text" to 42 characters in FB03? Because my vendor/customer name is quite long, and when i view via FB03, the field "Account Short Text" only displays 20 characters, not full vendor/customer name. Unless, i double click on the line item, then i can see full vendor/customer name. But i want the "Account Short Text" field can display full vendor/customer name.
Is that possible?
Thank you very much.
LeLinhHi,
there's a matadata table behind it RFPSD and for Account short text field KTEXT is used, which in fact has a length of 35 chars.
But on the other hand there's also a filed KTEXT_GL (G/L Account Short text) which is maybe applied here. It has a length of 20.
You can do some more checks on program to clear it finally
Regards -
How to see the dropdown option for field of a table during selection
Hello,
I am adding a new custom field in the table. Now when user goes to the screen after clicking the content button icon in se11, he sees all fields for selection.
That custom field is one character field. I want the user to see P and S option when he hits F4 (Dropdown).
How can I achieve this ?
Regards,
Rajesh.hi check this..
report .
TYPE-POOLS : vrm.
TABLES:vbak,vbap.
DATA : v(80) TYPE c.
DATA: wa_vbak TYPE vbak,
it_vbak TYPE vbak OCCURS 0 WITH HEADER LINE,
wa_vbap TYPE vbap,
it_vbap TYPE vbap OCCURS 0 WITH HEADER LINE.
DATA: l_name TYPE vrm_id,
li_list TYPE vrm_values ,
v_count TYPE i,
l_value LIKE LINE OF li_list.
PARAMETERS: p_test(20) AS LISTBOX VISIBLE LENGTH 60 MODIF ID DAT.
INITIALIZATION.
AT SELECTION-SCREEN OUTPUT.
PERFORM get_data.
LOOP AT it_vbak.
l_value-key = it_vbak-vbeln .
l_value-text = it_vbak-vbeln .
APPEND l_value TO li_list.
ENDLOOP.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_TEST'
values = li_list
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
AT SELECTION-SCREEN ON P_TEST.
clear : li_list , li_list[].
SELECT vbeln
matnr
meins
FROM vbap
INTO CORRESPONDING FIELDS OF TABLE it_vbap
WHERE vbeln = p_test.
START-OF-SELECTION.
SELECT vbeln
matnr
meins
FROM vbap
INTO CORRESPONDING FIELDS OF TABLE it_vbap
WHERE vbeln = p_test.
LOOP AT it_vbap.
WRITE :/ it_vbap-vbeln, it_vbap-matnr,it_vbap-meins.
ENDLOOP.
*& Form get_Data
text
--> p1 text
<-- p2 text
FORM get_data .
SELECT vbeln
FROM vbak
INTO CORRESPONDING FIELDS OF TABLE it_vbak.
ENDFORM. " get_Data
regards,
venkat
Maybe you are looking for
-
PCtr assignment to specific GL accounts
Hi all of you My client is asking to restrict the GL account postings from other PCtrs pertains to one Profit center. For example, one House bank is used in one profit center only, no way related with another PCtr and Cash journal also. How to fulfil
-
Connect Timesten server remotely without using timesten client
I know it's a silly question but this is what i want to do:- I have my java application and I want to connect to the timesten server present on remote machine and moreover I don't have the permission to intall any Timesten Client or App server(weblog
-
Record& playback option in LabVIEW
Dear All, I am trying to develop a Macro Recorder using labVIEW in which i need to listdown(record) all the front panel event change(eg.control data change) and aftersome time using the list it must be played back. I have put all front panel control
-
[SOLVED] How do I increase the size of an existing GPT ext4 partition?
I found some advice here http://ubuntuforums.org/showthread.php?t=1389429 but I'm not sure whether the information is correct 1 Run parted on your device: parted /dev/sdX 2 Change display unit to sectors: unit s 3 Print current partition table and no
-
Selection screen for submit in BSP
Hi Experts, I have gone throught the link to submit the program in BSP using varients, but i even want to see the selection screen for tht so tht user can post his own values over there. I tryed SUBMIT with different options but i am not able to see