How to delete space in an internal table
Hi All,
In internal table I want to compress the leading space
After searching I found Condense and SHIFT LEFT DELETE leading space commands work it is written...
but when I write code A single space is appreaing in between the two fields...can any body help me where I am going wrong??
Ex:
data: begin of itab occurs 1 ,
PSAtext TYPE CHAR15,
psa type btrtl,
end of itab.
now o/p BEFORE CHANGE IS :
SBI-CT |1023
After condense is SBI-CT |1023
bETWEEN SBI-CT AND | there is a additional space. How can we avoid that?
Sas
Edited by: saslove sap on Sep 29, 2010 7:43 AM
Well this is what I am going to solve this
data:begin of STRING OCCURS 1 ,
S1 TYPE STRING,
END OF STRING.
loop at itab.
concatenate itab-f1 itab-f2 into string-s1 seperated by '|'.
append string.
end of itab.
then I can transfer this string to Application server.
Thanks for all the contributions.
Regards
sas
Similar Messages
-
How to Delete a Column in Internal Table
Hi All,
Does any one know ,How to Delete a Column in Internal Table?Hi,
For deleting the column in the internal table, you have to eliminate the field which you want to delete.
loop at itab into wa.
move corresponding wa to wa1.
append wa1 to itab1.
clear wa1.
clear wa.
endloop.
wa1 is the workarea without the field which you want to delete.
itab1 is the internal table which consists of the deleted column. -
How to delete records from dynamic internal table.
Hi Experts,
Need urgent help!!!
Issue is with Dynamic internal tables.
Below is code written by me :
FORM select_query USING Lw_tabnam
TYPE t682i-kotabnr.
DATA : lw_line TYPE REF TO data,
lw_line1 TYPE REF TO data.
CREATE DATA Lw_line TYPE (lw_TABNAM).
ASSIGN Lw_line->* TO <WA_tbl>.
CREATE DATA LW_LINE TYPE STANDARD TABLE OF (Lw_tabnam)
WITH NON-UNIQUE DEFAULT KEY.
ASSIGN Lw_line->* TO <TBL>.
SELECT * FROM (Lw_tabnam)
INTO CORRESPONDING FIELDS OF TABLE <TBL>
WHERE (t_keys).
Endform.
code is working fine.
here even the table name and where condition are dynamic,everything is fine upto this point.
Now i have to delete some record from <TBL> based on some conditons.
for ex : ( here lc_fieldname is KUNNR)
loop at t_kunnr.
lw_tabix = sy-tabix.
Read table <tbl>
with key (lc_fieldname) = t_kunnr-kunnr ASSIGNING <wa_tbl>.
If sy-subrc = 0.
*Delete
delete <tbl> from <wa_tbl>
delete <tbl> index lw_tabix.
Endif.
Endloop.
The above delete statement doesn't work ,even we can't use index as it gives a syntax error " something related to "index is not allowed in standard table or hash table.
Can you help me ab't how to delete records in Dynamic internal table?
Other option that i am thinking of is to create a static table of type dynamic table.
means, data itab type standard table of <tbl> .I know the syntax is wrong ,however is there any way to do this?
Thanks in advance ,
If you have any suggestion ab't this then do let me know.
bye,
Gaurav.Hi
I wrote this code and it works fine:
DATA LW_TABNAM(10) VALUE 'LFA1'.
DATA : LW_LINES TYPE REF TO DATA,
LW_LINE TYPE REF TO DATA.
FIELD-SYMBOLS: <TABLE> TYPE TABLE,
<WA> TYPE ANY.
CREATE DATA LW_LINES TYPE TABLE OF (LW_TABNAM)
WITH NON-UNIQUE DEFAULT KEY.
ASSIGN LW_LINES->* TO <TABLE>.
CREATE DATA LW_LINE TYPE (LW_TABNAM).
ASSIGN LW_LINE->* TO <WA>.
DO 10 TIMES.
APPEND INITIAL LINE TO <TABLE>.
ENDDO.
SY-TABIX = 4.
DELETE <TABLE> INDEX SY-TABIX.
WRITE SY-SUBRC.
I hope it help you
Max -
Regarding how to delete the record in internal table
Hi experts ,
how to delete the record in intarnal table after validating the data,
if record contains invalid fields?
i am giving my code see this and give me the answer?
loop at it_data into wa_data .
Validate Cost Center
READ TABLE it_kostl INTO wa_kostl WITH KEY kostl = wa_data-kostl BINARY SEARCH.
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-004.
ENDIF.
Validate source file material ( material number )
loop at it_mara into wa_mara .
read table it_ausp into wa_ausp with key atwrt = wa_data-i_matnr .
if sy-subrc NE 0 .
PERFORM update_error_log USING wa_data
text-002.
delete it_data-objek .
else.
read table it_mara into wa_mara with key matnr = wa_ausp-objek .
if sy-subrc EQ 0 .
wa_data-objek = wa_mara-matnr.
wa_data-matkl = wa_mara-matkl.
ENDIF.
Modify it_data from wa_data .
endif.
*endloop.
Validate unit of measure (unit)
READ TABLE it_t006 INTO wa_t006 WITH KEY msehi = wa_data-unit .
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-003.
endif.
Validate delivery location ( storage location )
READ TABLE it_lgort INTO wa_lgort WITH KEY del_loc = wa_data-del_loc.
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-001.
if wa_data-flag ='x' .
delete it_data from wa_data .
endif.
ENDIF.
endloop.Hi Naren,
First get the index number of the IT_data table and store it in one variable whose declaration like this.
data: tabix type sy-tabix.
while reading the internal table it_data set the tabix variable.
tabix = sy-tabix.
Instead of the above use below one.
Delete it_data-objek
Use the Below statement it will delete the row from the internal table.
Delete it_data-objek index tabix
Thanks,
Chidanand -
How to delete data from dynamic internal table
Hi,
I have dynamic internal table and I have some slection screen fields , using these selection screen fields
(select -options), I have to filter the data? assigning will work with READ , but I have select options not the parametre,
and also delete will not work for dynamic table..
as we cannot use assigning with delete..
So how to do this?
and one more thing is , I cannot filter the data while selection( in select, I cannot filter the data-> as it's not coming directly from table, it's coming from buffer),
so now after selection of data, I need to filter the data from dynamic table.
Is there any way to do this?
Regards,
MrunalHi matt,
I tried with below code as you said. But I am getting dump. can you help?
here is my piece of code.
FIELD-SYMBOLS: <LS_DATA> type any,
<LT_DATA> TYPE table,
<L_FIELD> type any.
ASSIGN <l_buffer_entry>-dataptr->* TO <LS_DATA>.
ASSIGN <l_buffer_entry>-dataptr->* TO <LT_DATA>.
LOOP AT <LT_DATA> ASSIGNING <LS_DATA>.
ASSIGN COMPONENT 'BUKRS' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
IF <L_FIELD> NOT IN SO_BUKRS.
DELETE <LT_DATA>.
ENDIF.
UNASSIGN <L_FIELD>.
ASSIGN COMPONENT 'BELNR' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
IF <L_FIELD> NOT IN SO_BELNR.
DELETE <LT_DATA>.
ENDIF.
UNASSIGN <L_FIELD>.
ENDLOOP.
and here is the description of my dump:->>>
You attempted to access an unassigned field symbol
(data segment 32772).
This error may occur for any of the following reasons:
- You address a typed field symbol before it is set using ASSIGN
- You address a field symbol that points to a line in an internal table
that has been deleted
- You address a field symbol that had previously been reset using
UNASSIGN, or that pointed to a local field that no longer exists
- You address a global function interface parameter, even
though the relevant function module is not active,
that is it is not in the list of active calls. You can get the list
of active calls from the this short dump. -
How to delete entries in an internal table except for one entry
Hi all,
I have 4 records in my internal table and I need to delete all the records in the internal table except the last one.How do i do this?Any sample code?
Thanks.
Moderator message - Please do not ask or answer basic questions - thread locked
Edited by: Rob Burbank on Dec 16, 2009 3:23 PMHi,
use following logic:
DATA: lt_itab type standard table.
DATA: l_lines type i.
DESCRIBE TABLE lt_itab lines l_lines.
l_lines = l_lines - 1.
delete lt_itab from 1 to l_lines.
Regards,
Karol -
How to delete blank records in internal table
Hi.
please tell me how can i delete blank records in an internal table.
thnxIn that case
Suppose you have 10 fields in internal table and if any of them is blank, you need to delete record.
Try this command
delete itab where field1 is initial or
field2 is initial or
field10 is initial. -
How to delete the entries in internal table
Hi Experts,
I have 2 internal tables ,
if i find any same entries of 2 internal tables, i have to delete that entries in first internal table.
Regards,
Srinivasuhi check this..
report .
data:begin of itab occurs 0,
f1 type c ,
f2 type i,
end of itab .
data:begin of itab1 occurs 0,
f1 type c ,
end of itab1 .
itab-f1 = 'A'.
itab-f2 = 12.
append itab .
itab-f1 = 'b'.
itab-f2 = 12.
append itab .
itab-f1 = 'c'.
itab-f2 = 12.
append itab .
itab1-f1 = 'A'.
append itab1 .
loop at itab1 .
read table itab with key f1 = itab1-f1 .
if sy-subrc = 0.
delete itab where f1 = itab1-f1 .
endif .
endloop.
loop at itab.
write:/ itab-f1,itab-f2.
endloop. -
How to Download XML File to internal table
Hi Friends,
This is my urgent requirement. How to download XML File to Internal table.
regards
pauldharmaHai,
Please check this Link
http://www.sap-img.com/abap/upload-direct-excel.htm
PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
begcol TYPE i DEFAULT 1 NO-DISPLAY,
begrow TYPE i DEFAULT 1 NO-DISPLAY,
endcol TYPE i DEFAULT 100 NO-DISPLAY,
endrow TYPE i DEFAULT 32000 NO-DISPLAY.
* Tick don't append header
PARAMETERS: kzheader AS CHECKBOX.
DATA: BEGIN OF intern OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF intern.
DATA: BEGIN OF intern1 OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF intern1.
DATA: BEGIN OF t_col OCCURS 0,
col LIKE alsmex_tabline-col,
size TYPE i.
DATA: END OF t_col.
DATA: zwlen TYPE i,
zwlines TYPE i.
DATA: BEGIN OF fieldnames OCCURS 3,
title(60),
table(6),
field(10),
kz(1),
END OF fieldnames.
* No of columns
DATA: BEGIN OF data_tab OCCURS 0,
value_0001(50),
value_0002(50),
value_0003(50),
value_0004(50),
value_0005(50),
value_0006(50),
value_0007(50),
value_0008(50),
value_0009(50),
value_0010(50),
value_0011(50),
value_0012(50),
value_0013(50),
value_0014(50),
value_0015(50),
value_0016(50),
value_0017(50),
value_0018(50),
value_0019(50),
value_0020(50),
value_0021(50),
value_0022(50),
value_0023(50),
value_0024(50),
value_0025(50),
value_0026(50),
value_0027(50),
value_0028(50),
value_0029(50),
value_0030(50),
value_0031(50),
value_0032(50),
value_0033(50),
value_0034(50),
value_0035(50),
value_0036(50),
value_0037(50),
value_0038(50),
value_0039(50),
value_0040(50),
value_0041(50),
value_0042(50),
value_0043(50),
value_0044(50),
value_0045(50),
value_0046(50),
value_0047(50),
value_0048(50),
value_0049(50),
value_0050(50),
value_0051(50),
value_0052(50),
value_0053(50),
value_0054(50),
value_0055(50),
value_0056(50),
value_0057(50),
value_0058(50),
value_0059(50),
value_0060(50),
value_0061(50),
value_0062(50),
value_0063(50),
value_0064(50),
value_0065(50),
value_0066(50),
value_0067(50),
value_0068(50),
value_0069(50),
value_0070(50),
value_0071(50),
value_0072(50),
value_0073(50),
value_0074(50),
value_0075(50),
value_0076(50),
value_0077(50),
value_0078(50),
value_0079(50),
value_0080(50),
value_0081(50),
value_0082(50),
value_0083(50),
value_0084(50),
value_0085(50),
value_0086(50),
value_0087(50),
value_0088(50),
value_0089(50),
value_0090(50),
value_0091(50),
value_0092(50),
value_0093(50),
value_0094(50),
value_0095(50),
value_0096(50),
value_0097(50),
value_0098(50),
value_0099(50),
value_0100(50).
DATA: END OF data_tab.
DATA: tind(4) TYPE n.
DATA: zwfeld(19).
FIELD-SYMBOLS: <fs1>.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
mask = '*.xls'
static = 'X'
CHANGING
file_name = filename.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = filename
i_begin_col = begcol
i_begin_row = begrow
i_end_col = endcol
i_end_row = endrow
TABLES
intern = intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE:/ 'Upload Error ', SY-SUBRC.
ENDIF.
END-OF-SELECTION.
LOOP AT intern.
intern1 = intern.
CLEAR intern1-row.
APPEND intern1.
ENDLOOP.
SORT intern1 BY col.
LOOP AT intern1.
AT NEW col.
t_col-col = intern1-col.
APPEND t_col.
ENDAT.
zwlen = strlen( intern1-value ).
READ TABLE t_col WITH KEY col = intern1-col.
IF sy-subrc EQ 0.
IF zwlen > t_col-size.
t_col-size = zwlen.
* Internal Table, Current Row Index
MODIFY t_col INDEX sy-tabix.
ENDIF.
ENDIF.
ENDLOOP.
DESCRIBE TABLE t_col LINES zwlines.
SORT intern BY row col.
IF kzheader = 'X'.
LOOP AT intern.
fieldnames-title = intern-value.
APPEND fieldnames.
AT END OF row.
EXIT.
ENDAT.
ENDLOOP.
ELSE.
DO zwlines TIMES.
WRITE sy-index TO fieldnames-title.
APPEND fieldnames.
ENDDO.
ENDIF.
SORT intern BY row col.
LOOP AT intern.
IF kzheader = 'X'
AND intern-row = 1.
CONTINUE.
ENDIF.
tind = intern-col.
CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
ASSIGN (zwfeld) TO <fs1>.
<fs1> = intern-value.
AT END OF row.
APPEND data_tab.
CLEAR data_tab.
ENDAT.
ENDLOOP.
CALL FUNCTION 'DISPLAY_BASIC_LIST'
EXPORTING
file_name = filename
TABLES
data_tab = data_tab
fieldname_tab = fieldnames.
*-- End of Program
http://sap.ittoolbox.com/groups/technical-functional/sap-dev/excel-file-download-to-an-internal-table-in-sap-crm-1719453#
tables: zinv_release,
zpo_release.
** decleration of data
DATA: BEGIN OF my_tab OCCURS 0.
INCLUDE STRUCTURE zinv_release.
DATA: END OF my_tab.
*DATA: hex_tab TYPE x VALUE '09'.
DATA: rec(200)."'/usr/test.dat'.
DATA:
zhours(20) TYPE c,
MINS(20) type c. "decimals.
data: coma.
coma = ','.
SELECTION-SCREEN BEGIN OF BLOCK txt
WITH FRAME TITLE text-001.
PARAMETERS: dsn(60) DEFAULT '\\sapdev01\prod\'.
SELECTION-SCREEN END
OF BLOCK txt.
*using a dataset to get text
OPEN DATASET dsn FOR INPUT IN TEXT MODE.
IF sy-subrc = 0.
DO.
READ DATASET dsn INTO rec.
IF sy-subrc <> 0.
EXIT.
ENDIF.
split rec at coma into
zpo_release-REL_GRP
zpo_release-REL_CODE
zpo_release-RESPREL
zpo_release-ALTREL
zpo_release-MANAGER
ZHOURS
MINS
zpo_release-FROMTIME
zpo_release-TOTIME
zpo_release-EXCLWKENDS.
move zpo_release-REL_GRP to my_tab-REL_GRP.
move zpo_release-REL_CODE to my_tab-REL_CODE.
move zpo_release-RESPREL to my_tab-RESPREL.
move zpo_release-ALTREL to my_tab-ALTREL.
move zpo_release-MANAGER to my_tab-MANAGER.
move ZHOURS to my_tab-ZHOURS.
move MINS to my_tab-mins.
move zpo_release-FROMTIME to my_tab-fromtime.
move zpo_release-TOTIME to my_tab-totime.
move zpo_release-EXCLWKENDS to my_tab-exclwkends.
APPEND my_tab.
ENDDO.
INSERT zpo_release FROM TABLE my_tab ACCEPTING DUPLICATE KEYS.
** DELETE zmm_ppa_cc FROM TABLE tab.
** INSERT zzzak_emp FROM TABLE my_tab ACCEPTING DUPLICATE KEYS.
IF sy-subrc = 0.
MESSAGE i000(zv) WITH 'File Successful stored in DB.' '' '' ''.
** ELSE.
MESSAGE i000(zv) WITH 'File already stored in DB.' '' '' ''.
endif.
ENDIF.
reward if helpful
raam -
How to check duplicate entries in internal table??
Dear Friends,
How to check duplicate entries in internal table??
Exp: In my internal table if I am having the same records more then ones then I need to print the error message, here I am using steploop for selecting the values from screen, and the values are coming into my internal table if user enter the same value more then ones I need to print the error message.
Thanks,
SridharHi,
After storing the data into internal table say ITAb, move the data into another internal table.
t_dup[] = itab[].
LOOP AT itab.
count1 = count1 + 1.
itab-count1 = count1.
MODIFY itab.
ENDLOOP.
LOOP AT t_dup.
count2 = count2 + 1.
t_dup-count2 = count2.
MODIFY t_dup.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM itab.
LOOP AT t_dup.
record_dup = 'N'.
READ TABLE itab WITH KEY count1 = t_dup-count2.
IF sy-subrc = 0.
record_dup = 'Y'.
ENDIF.
IF record_dup NE 'Y'.
t_dup-message = 'DUPLICATE ENTRY'.
t_dup-flag = 1.
MODIFY t_dup.
ENDIF.
ENDLOOP.
Use this sample code.
Reward pts if it is helpfull.
Regards
Srimanta -
How to delete null values in a table
hi all,
tell me please any one how to delete null values in a table
example:
in emp table is there
empno ename job mgr sal deptno
7900 scott 7902 2000 10
7499 clerk 7900 20
7834 james manager 3000 30
like this in the above emp table there are some null values are there
so how to delete the null values in emp table
thanks,
regards.
Edited by: user9195968 on Feb 25, 2010 6:30 AMnot too sure what you mean, perhaps you could supply a table description and some sample data
but, consider
delete from table_1 where column_1 is null
commit
/ -
How to delete the data from partition table
Hi all,
Am very new to partition concepts in oracle..
here my question is how to delete the data from partition table.
is the below query will work ?
delete from table1 partition (P_2008_1212)
we have define range partition ...
or help me how to delete the data from partition table.
Thanks
Sree874823 wrote:
delete from table1 partition (P_2008_1212)This approach is wrong - as Andre pointed, this is not how partition tables should be used.
Oracle supports different structures for data and indexes. A table can be a hash table or index organised table. It can have B+tree index. It can have bitmap indexes. It can be partitioned. Etc.
How the table implements its structure is a physical design consideration.
Application code should only deal with the logical data structure. How that data structure is physically implemented has no bearing on application. Does your application need to know what the indexes are and the names of the indexes,in order to use a table? Obviously not. So why then does your application need to know that the table is partitioned?
When your application code starts referring directly to physical partitions, it needs to know HOW the table is partitioned. It needs to know WHAT partitions to use. It needs to know the names of the partitions. Etc.
And why? All this means is increased complexity in application code as this code now needs to know and understand the physical data structure. This app code is now more complex, has more moving parts, will have more bugs, and will be more complex to maintain.
Oracle can take an app SQL and it can determine (based on the predicates of the SQL), which partitions to use and not use for executing that SQL. All done totally transparently. The app does not need to know that the table is even partitioned.
This is a crucial concept to understand and get right. -
How to delete an item in the table
hi all ,
Is anyone there to give me an idea , how to delete the item in the table , by selecting the row. , for the what i have to do , is there any documentation to follow , guide me itys really urgent.Hai Madhu,
It is pretty simple.
First u define a button. and in onAction Event of the button write the following code.
process is as follows:
1)get the node
2)get the element
3)using the method remove_element() ,remove the element.
<u><b>The Sample Code is as follows</b></u>
DATA:
node_flighttab TYPE REF TO if_wd_context_node,
elem_flighttab TYPE REF TO if_wd_context_element.
node_flighttab = wd_context->get_child_node( 'FLIGHTTAB' ).
get element via lead selection
elem_flighttab = node_flighttab->get_element( ).
node_flighttab->remove_element( element = elem_flighttab ).
Follow the above code ,it will definately help you. -
How to delete a column from the table control in module pool?
Hi,
can any one please tell How to delete a column from the table control in module pool?
thanks in advance
warm regards
HareeshKumar Nhi hareesh,
I think it is better to hide it.
How to hide: You can check this link
Dynamic Hide column in table control -
How to delete some date in target table at a mapping?
How to delete some date in target table at a mapping?
I extract date from source tabel into target table,
but before extract date I want to delete some date from target?
how to do?Just to change a bit of terminology in the reply, within the mapping, click on operator properties and choose TRUNCATE/INSERT.
Note that truncate is dependent on constraints, so you probably must disable those before doing this. You can of course do DELETE/INSERT...
Jean-Pierre
Maybe you are looking for
-
Problem with IKE ASA 5510 VPN client
We are experiencing a problem getting the vpn clients to connect to the ASA. The Log shows this error: "12 12:14:08.413 05/15/08 Sev=Info/4 IKE/0x63000013 SENDING >>> ISAKMP OAK AG (Retransmission) to 10.10.101.2 Our Config is attached. Any thoughts?
-
How do i add a second display desktop to my macbok
How do I add a second display (desktop) to my macbook pro so when I swipe, there are three screen options, the one for widgets, the main one and then another desktop?
-
Hi, I have Illustrator 10 and am working on a Windows Vista machine. I have had intermittant problems with this combination, but have been able to make it work. Up to yesterday, I was able to save for web using ctrl-alt-shift-s command to bring up th
-
SMQS (QOUT Scheduler)
Hi All, Using SMQS transaction I Scheduled a new Outbound scheduler in which TRFC queues were getting created. For QRFC queues we can use SMQ1 to trace the volume of queues. Similar way how do we trace the volume and status of TRFC queues. Please ad
-
I'm using Oracle 9i Database R2 on Win 2000 I can start the OEM console with Management Server without problems. Even launching from a web browser is OK (it's the same console). But where do I find the "other" OEM web site, the one where I can manage