How to know no of records(in Internal Table) modified after using Modify statement
Hi Experts ,
I am using statement Modify internal table transporting XYZ FIELD.
I just wanted to know how many Records/Count (assuming more then 1 ) get updated just after successful execution of this command.
Is there any system field exist?
if yes please let me know?
Warm Regards,
Santosh
Hello Santosh,
Try like below and it works for me.
Count will have the number rows changed.
DATA: itab_mara TYPE STANDARD TABLE OF mara,
itab_mara1 TYPE STANDARD TABLE OF mara,
str_mara TYPE mara,
str_mara1 TYPE mara,
diff LIKE IREF-IIND,
count TYPE int2.
SELECT * FROM mara INTO TABLE itab_mara UP TO 10 ROWS.
itab_mara1[] = itab_mara[].
str_mara-lvorm = 'X'.
MODIFY itab_mara FROM str_mara TRANSPORTING lvorm WHERE VPSTA = 'KVB'.
LOOP AT itab_mara INTO str_mara.
READ TABLE itab_mara1 INTO str_mara1 WITH KEY matnr = str_mara-matnr.
CALL FUNCTION 'COMPARE_STRUCTURE_DATA'
EXPORTING
i_ddic_name = 'MARA'
i_rec_old = str_mara
i_rec_new = str_mara1
I_CHECK_MODE = 'Y'
IMPORTING
E_IS_DIFF = diff.
IF diff = 'X'.
count = count + 1.
ENDIF.
ENDLOOP.
WRITE:/ count.
Regards,
Thanga
Similar Messages
-
How to fetch the data to the internal table with out using mandt
Hi all,
Iam giving my code please observer... and give me the reasonable solution.
t_mar LIKE STANDARD TABLE OF z_mar.
SELECT mandt
werks " Plant
lifnr " Vendor
FROM z_mar
INTO TABLE t_mar
where sal = 2000.
By removing MANDT from select query, it is going to dump.
ex:
SELECT
werks " Plant
lifnr " Vendor
FROM z_mar
INTO TABLE t_mar
where sal = 2000.
> Now it is going to dump ( here i removed the mandt field ).
Please give me a solution to fetch the data by removing mandt in select statement, with out chaning the internal table structure.
Thanks,
Ravihi Ravi,
i also had to avoid move-corresponding and the following is what i did...its extra work and goes around but it will
do the needed work..............
t_mar LIKE STANDARD TABLE OF z_mar.
SELECT *
FROM z_mar
INTO TABLE t_mar
where sal = 2000.
the above gets you all the fields ...but if you still want to narrow it down to just two fields
*****Declaring structure with 2 fields
data:begin of fs_data.
data:werks type z_mar-werks,
lifnr type z_mar-lifnr ,
data:end of fs_data.
*******internal table of above
data:int_data like fs_data occurs 0 with headerline.
*****moving the only 2 required fields
loop at t_mar.
t_mar-werks = int_data-werks.
t_mar-lifnr = int_data-lifnr.
append int_data.
endloop.
Hope you found it useful...
Regards
Bx -
Delete internal table rows without using loop statement
i have an internal table which consists of 100 records.
i need to keep only first 5 records.
without using the loop statement i need to delete the rest of the records. how can we achieve this result.
i.e. delete itab1 where "recordno" > 5.
regards.
ZGHi,
Delete itab [FROM idx1] [TO idx2] {Where (log_exp)]
To delete several lines at once, you have to specify at least one of the additions FROM, TO, or WHERE. You can only use the additions FROM and TO with standard tables and sorted tables.
Delete itab [FROM idx1]
If you specify FROM, all the table rows from the table index idx1 onwards are included.
Delete itab [TO idx2]
If you specify TO, all the table rows from the table index idx2 onwards are included.
PARAMETERS: p_carrid TYPE sflight-carrid,
p_connid TYPE sflight-connid.
DATA: BEGIN OF seats,
fldate TYPE sflight-fldate,
seatsocc TYPE sflight-seatsocc,
seatsmax TYPE sflight-seatsmax,
seatsfree TYPE sflight-seatsocc,
END OF seats.
DATA seats_tab LIKE STANDARD TABLE OF seats.
SELECT fldate seatsocc seatsmax
FROM sflight
INTO TABLE seats_tab
WHERE carrid = p_carrid AND
connid = p_connid.
LOOP AT seats_tab INTO seats.
seats-seatsfree = seats-seatsmax - seats-seatsocc.
MODIFY seats_tab INDEX sy-tabix FROM seats.
ENDLOOP.
ENDLOOP.
SORT seats_tab BY seatsfree DESCENDING.
DELETE seats_tab FROM 5.
Thanks & Regards,
ShreeMohan
Edited by: ShreeMohan Pugalia on Jul 21, 2009 4:28 PM -
Copy records of one table into another using Update statement
Supposing I have 2 tables test and test1.
Test has columns col1 and col2. and test1 has only one table col1.
select * from test returns:
COL1 COL2
a
b
c
d
e
select * from test1 returns
COL1
p
q
r
s
t
Suppose i want to copy values of test1.col1 to test.col2 so tht final result of
select * from test should be
COL1 COL2
a p
b q
c r
d s
e t
I found a query in the OCP introduction book:
update test set col2=(select col1 from test11)
this works fine only when we have a single record in test1 table but fails otherwise.
how can this be achieved using the update statement ?SQL> desc test
Name Null? Type
COL1 VARCHAR2(10)
COL2 VARCHAR2(30)
SQL> desc test1
Name Null? Type
COL1 VARCHAR2(10)
SQL> insert into test values ('a','');
1 row created.
SQL> insert into test values ('b','');
1 row created.
SQL> insert into test values ('c','');
1 row created.
SQL> insert into test values ('d','');
1 row created.
SQL> insert into test1 values ('e');
1 row created.
SQL> insert into test1 values ('f');
1 row created.
SQL> insert into test1 values ('g');
1 row created.
SQL> insert into test1 values ('h');
1 row created.
SQL> commit;
Commit complete.
SQL> ed
Wrote file afiedt.buf
1 select a.col1, b.col1, a.rn from
2 (select row_number() over (order by col1) rn, col1 from test) a,
3 (select row_number() over (order by col1) rn, col1 from test1) b
4* where a.rn = b.rn
SQL> /
COL1 COL1 RN
a e 1
b f 2
c g 3
d h 4
SQL> ed
Wrote file afiedt.buf
1 update test set col1 =
2 (
3 select forupd from (
4 select a.col1, b.col1 test1col, a.col1||' '||b.col1 forupd, a.rn from
5 (select row_number() over (order by col1) rn, col1 from test) a,
6 (select row_number() over (order by col1) rn, col1 from test1) b
7 where a.rn = b.rn
8* ) z where z.col1 = test.col1)
SQL> /
4 rows updated.
SQL> commit;
Commit complete.
SQL> select * from test;
COL1 COL2
a e
b f
c g
d h
SQL>
This will work only if you have the same number of lines in COL1 in both tables. If you have different number of lines, then you need to code more at join (outer, inner).
But for complicated cases, please post sample data.
Michael
PS: And supossing that the values are distinct in TEST table. Else update will fail, because more rows will be retrived.
If more values in TEST table in COL1, then you need to assign a row number on TEST also, and in WHERE of query you need to place one more join condition:
something like:
8* ) z where z.col1 = test.col1
and z.rn = test.rn)
SQL> /
But as i said, get more specifications.
Message was edited by:
kjt
Added the PS. -
How to upload the flat file records into internal table by position?
Hi
I have a flat file which has 7 records in each row and they are NOT provided with CSV or Tab demilited...
They are continous text without spaces....
but i know the fixed length of each field Eg : 1st field 7 char and seconc field 3 char and so on...
How can i upload this file into internal table by reading positions of each field...I know we can use GUI_UPLOAD and Read dataset and Open dataset...
But please let me know to read the file with the fixed postions and load into internal table...
Thanks in advance
MMHi
As per my knowledge i dont think thr is some function module or so to read with a fixed positions.
You can use the below method if you think this is the best way.
Suppose your file has
types : begin of ty_itab,
field1 type char7,
field2 type char3,
field3 type chat3,
field4 type char3,
end of ty_itab.
types : begin of ty_upload,
str type string,
end of ty_upload.
data : it_itab type standatd table of ty_itab,
it_upload type standard table ot ty_upload,
wa_itab type ty_itab,
wa_upload type ty_upload.
use gui_upload.get the data in it_upload.
here you know that u have first 16 charcters makes a first row n then next 16 charcters next row
Loop at it_upload into wa_upload.
v_len = strlen ( wa_upload ).
v_len = v_len / 16.
You get number of rows per record ,if it is decimal value make it final value if 3.9 make to 4.
do v_len times.
wa_itab = wa_upload.
By this only first 16 characters are moved and respective fields will get a value.or else u can use offset
wa_upload+0(16).
append wa_itab to it_itab.
Now shift 16 characters using shift command in wa_upload.
enddo.
endloop.
Hope this syntax help you to resolve your issue.May be something i have missed .Right now i don't have sap system to send you the full correct syntax code.
Cheers
Joginder -
How to update Records from Internal table to u2018Zu2019 table?
Hi Friends,
How to update Records from Internal table to u2018Zu2019 table.
I have records in Internal table , that records want to update on u2018Zmarau2019 Table.
( my internal table & u2018 Zu2019 table structures are same.)
Thanking you.
Regards,
SubashHi,
loop at internal table.
modify <Z- table > from values < internal table Workarea>.
if sy-subrc = 0.
COMMIT work.
else.
ROLLBACK waork.
endif.
endloop.
or
UPDATE <Z- table > from table < internal table Workarea>.
if sy-subrc = 0.
COMMIT work.
else.
ROLLBACK waork.
endif.
Prabhudas -
How to transfer data from a dynamic internal table
Hi All
I want to transfer data from a dynamic internal table<dyn_table>
to a non dynamic internal table itab which should have the same structure as <dyn_table>.
How can this be done?
Regards,
Harshit RungtaAs stated earlier this can be done only through field symbols...
You cannot create an non dynamic internal table with ANY structure...using DATA statement
If the strucutre is defined well and good...you can create an non-dynamic internal table...
If you do not know the structure then the internal table has to be dynamic...and to be generated using field symbols
DATA: lv_ref TYPE REF TO data.
FIELD-SYMBOLS: <fs_dyn_table> TYPE STANDARD TABLE.
* You create a dynamic internal table...
CREATE DATA lv_ref LIKE (your_dynamic_internal_table).
ASSIGN lv_ref->* TO <fs_dyn_table>.
Now...do the transfer.
<fs_dyn_table> = "your_dynamic_internal_Table
Hope it helps! -
How to pass the contents of an internal table to the IDoc FIDCC2?
Hi,
I have an internal table. Using its contents, I have to create an Idoc and do GL posting.
I have to use FIDCC2 Idoc and the function module IDOC_INPUT_FIDCC2.
Can u please let me know how to pass the contents of the internal table into the idoc FIDCC2 and do the GL posting?
Regards,
Balaji. RHi balaji,
use function IDOC_INBOUND_FROM_FILE. This will do half the process.
Documentation is missing, but program RSEINB00 explains something,
also some links
[http://help.sap.com/saphelp_nw70/helpdata/EN/dc/6b7f1543d711d1893e0000e8323c4f/frameset.htm]
[RSEINB00 does not work in background]
[RSEINB00 flat file to idoc uploading in XI]
[Loading flat idoc via report RSEINB00 into integration server fails]
Hope it helps.
Regards,
Clemens -
Inserting records from internal table to database table
Hi all,
i want to insert records from internal table to zDatabase table, can u plz guide me which statement is better in performance to insert the records.
1) insert one by one record from internal table
loop at itab.
insert ztable from wa.
endloop.
2) insert total records at a time
INSERT <dbtabname> CLIENT SPECIFIED FROM TABLE itab.
or let me know if any other statement is there with high performance.
i internal table contains nearly 40000 records.
thanks.Hi,
Insert the entire table at atime rather than a record so as to increase the performance.
you can use INSERT <dbtabname> CLIENT SPECIFIED FROM TABLE itab.
or
MODIFY ZPRODUCT FROM TABLE GI_AFPO.
Regards,
Raj. -
How to find last inserted record in the table.
Version: Oracle 10g
I have a table called "Manufacture" and 3 columns as mfno,itemname,quantity.
How to find last inserted record in the table "Manufacture".
As i come to know that Rowid is not result perfect results. Please provide your inputs.user13416294 wrote:
Version: Oracle 10gThat is not a version. That is a product name. A version is 10.1.0.2 or 10.2.0.4, etc.
I have a table called "Manufacture" and 3 columns as mfno,itemname,quantity.
How to find last inserted record in the table "Manufacture".Not possible as your data model does not cater for it. That simple.
If there is a need to determine some order or associate some time to an entity, then that should be part of the data model - and a relationship, or one or more attributes are needed to represent that information. Thus your data model in this case is unable to meet your requirements.
If the requirements are valid, fix the data model. In other words - your question has nothing to do with Oracle and nothing to do with rowid, rowscn or other pseudo columns in Oracle. It is a pure data modeling issue. Nothing more. -
How to change co-ordinates of an internal table in page 1 & 2 using offline adobe forms?
Hello All,
How to change co-ordinates of an internal table(main window data) from page 2 onwards in offline adobe forms. For e.g., I need to print my internal table around 3-4 lines along with header&footer(only 1st page)in page 1. From 2nd page onwards Internal table should print header and use remaining page til end.
Thanks in advance for your help.
Thank you,
Janakiram.Issue resolved...need to use content area option to achieve the same.
Thanks,
Janakiram. -
How can i pass calculated value to internal table
Hi
i have to pass calculated value into internal table
below field are coming from database view and i' m passing view data into iznew1
fields of iznew1
LIFNR LIKE EKKO-LIFNR,
EBELN LIKE EKKO-EBELN,
VGABE LIKE EKBE-VGABE,
EBELP LIKE EKBE-EBELP,
BELNR LIKE EKBE-BELNR,
MATNR LIKE EKPO-MATNR,
TXZ01 LIKE EKPO-TXZ01,
PS_PSP_PNR LIKE EKKN-PS_PSP_PNR,
KOSTL LIKE EKKN-KOSTL,
NAME1 LIKE LFA1-NAME1,
NAME2 LIKE LFA1-NAME2,
WERKS LIKE EKPO-WERKS,
NETWR LIKE EKPO-NETWR,
KNUMV LIKE EKKO-KNUMV,
GJAHR LIKE EKBE-GJAHR,
and now i want to pass
one field ED1 which i has calculated separatly and i want to pass this value into iznew1
but error is coming that iznew1 is a table with out header line has no component like ED1.
so how can i pass calculated value to internal table iznew1,When you declare your internal table , make an addtion occurs 0
eg . data : begin of iznew occurs 0 ,
fields ...
add the field here ed1.
end of iznew.
now when you are calculating the value of ed1,
you can pass the corresponding value of ed1 and modify table iznew.
eg
loop at iznew.
iznew-ed1 = ed1.
modify iznew.
endloop. -
How to populate one internal table from another using field symbols
Hi Gurus,
I have a problem. I have to populate one internal table (sructure t_otput) from another internal table (sructure t_from) using field symbol.
Structure for from table.
types: begin of t_from,
year(4) type c,
ww(2) type c,
site type marc-werks,
demand type i,
end of t_from.
Structure for output table.
types: begin of t_display,
title(30),
WW1(10),
WW2(10),
WW3(10),
end of t_display.
The from table looks like this:
Year | WW | Site | Demand
2005 | 1 | OR1 | 12.00
2005 | 2 | OR1 | 13.00
2005 | 3 | OR1 | 14.00
The display table which has to be populated should look like this:
Title | WW1 | WW2 | WW3
OR1 | | |
Demand | 12.00 | 13.00 | 14.00
How to populate display table using field symbol?
Please give code snippets
Thanks,
GopalGopal,
Here is the code, however I am not vary clear about the ORG1 and Demand display that you have shown in the display. I am sure with this code it should not be a big deal to tweak in whatever manner you want.
TABLES : marc.
TYPES: BEGIN OF type_display,
title(30),
ww1(10),
ww2(10),
ww3(10),
END OF type_display.
TYPES: BEGIN OF type_from,
year(4) TYPE c,
ww(2) TYPE c,
site TYPE marc-werks,
demand TYPE i,
END OF type_from.
data : t_from type table of type_from,
t_display type table of type_display.
field-symbols : <fs_from> type type_from,
<fs_display> type type_display.
data : wa_from type type_From,
wa_display type type_display.
wa_from-year = '2005'.
wa_from-ww = '1'.
wa_from-site = 'OR1'.
wa_from-demand = '12.00'.
insert wa_from into table t_from.
wa_from-year = '2005'.
wa_from-ww = '2'.
wa_from-site = 'OR1'.
wa_from-demand = '13.00'.
insert wa_from into table t_from.
wa_from-year = '2005'.
wa_from-ww = '3'.
wa_from-site = 'OR1'.
wa_from-demand = '14.00'.
insert wa_from into table t_from.
data : variable(3) type c.
field-symbols : <fs_any> type any.
break-point.
Loop at t_from assigning <fs_from>.
variable = 'WW'.
wa_display-title = <fs_from>-site.
concatenate variable <fs_from>-ww into variable.
assign component variable of structure wa_display to <fs_any>.
<fs_any> = <fs_from>-demand.
endloop.
append wa_display to t_display.
clear wa_display.
loop at t_display assigning <Fs_display>.
write :/ <fs_display>.
endloop.
Note : Please award points if this helps you.
Regards,
Ravi -
How to store output of SQ01 into internal table.
Hello Experts
How to store output of SQ01 into internal table.
Thanks,
UmeshYou can't store the sq01 output into internal table.
Once you create the query it will generate the abap program, in that program you can see the contents.
Regards
Sasi -
How to insert select columns from one internal table to another
Hi,
How to insert select columns from one internal table to another based on condition as we do from a standart table to internal table.
regards,
SriramHi,
If your question is for copying data from 1 int table to other ;
we can use
APPEND LINES OF it_1 TO it_2.
or if they have different columns then:
loop at it_1 into wa_it1.
move wa_it1-data to wa_it2-d1.
apped wa_it2 to it_2.
clear wa_it2.
endloop.
thnxz
Maybe you are looking for
-
Further to my previous problem with my TV player not playing a PE9 made BD disk, I examined the disk with Imgburm and it reports that the disk status is 'incomplete'. The M2ts file plays through to the last fadeout on my computer and in a Panasonic T
-
NLS_LENGTH_SEMANTICS parameter...
Hi , I want to insert multilingual characters in an Oracle XE 10g Db. To do that i connected as sys and issued the command insert into dept(deptno , dname) values(90,'ΛΟΓΙΣΤΗΡΙΟ') ORA-12899: value too large for column "SCOTT"."DEPT"."DNAME" (actua
-
Problem compiling NAS 2.1 AppLogics on iAS 6.0 SP4 on Solaris
I'm currently trying to upgrade our live server from iAS 6.0 SP2 to iAS 6.0 SP4 (on Solaris 8) and ran into a problem in recompiling some NAS 2.1 AppLogics on my SP4 server. I made no modifications to the code or build.xml which runs fine on SP2. Her
-
Configuring LDAP authentication
I've configured my weblogic 6.0 server to use LDAP authentication. The LDAP server is NDS. Using the wl console, I can see users and groups from the LDAP server. I then added security constraints to my war file (in web.xml and weblogic.xml (see attac
-
Loading problem for Signed applet on MAC OS
Hi All I�m trying to test my application on MAC OS (For versions: 10.2.6 as well as 10.4.x) For MAC 10.2.6 OS Java version is 1.4.1_01 and For MAC 10.4.x OS Java version is 1.4.2_07 The code is compiled on Windows machine having Java version 1.4.2_07