Htmldb_mail and multiple rows
I would like to send via email the result of a query that returns multiple rows. How can I achieve that ? The following code example explains in detail what I would like to have - but it doesn't work like that.
DECLARE
remp varchar2(4000);
BEGIN
remp := 'select name from employee';
htmldb_mail.send(
p_to => '[email protected]',
p_from => '[email protected]',
p_body => 'These are the employees: '||remp||'',
p_subj => 'mail test');
END;
Thanks Tobias
hi Tobias,
you need to use cursor, to collect all your employee names into one variable, after that include that variable in your mail body.
Declare
remp varchar2(4000);
CURSOR cur IS
SELECT name
FROM employee;
rec cur%ROWTYPE;
begin
OPEN cur;
LOOP
FETCH cur INTO rec;
EXIT WHEN cur%NOTFOUND;
remp:=remp||', '||rec.name;
END LOOP;
CLOSE cur;
htmldb_mail.send(
p_to => '[email protected]',
p_from => '[email protected]',
p_body => 'These are the employees: '||remp||'',
p_subj => 'mail test');
end;
hope this help.
Similar Messages
-
Updating multpile tables and multiple rows - JDBC adapter
Hi,
The scenario is like this. i receive an Idoc which has header information and various line items (multiple occurrance of a segment). the hearder details have to be sent to one table, TableA, and all line items has to go to another table, TableB, and for each line item, a new row has to be inserted in TableB.
How can i acheive this using JDBC adapter? how should my data type look like? what are the settings i need to do in adapter config?
Thanks and Regards,
RashmiHi Rashmi,
You can use the following link for the JDBC adapter call :
http://help.sap.com/saphelp_nw04/helpdata/en/ae/d03341771b4c0de10000000a1550b0/frameset.htm
You need to provide the JDBC Driver, Connection,User Name and the password.
The data type structure you can take from the Bhavesh blog:
JDBC Receiver Adapter -- Synchronous Select Step by Step
Since you just need to update the tables, take only the sender side of the blog, i.e. the request part and configure the scenario accordingly.
Regards,
Sanjeev. -
SQLLoader Record Types and Multiple Rows
Ugh! I'm trying to load some Options data (Calls and Puts) which is a single csv record with both Calls and Puts and a Change (% Change is price) field which contains 'pc', '--', or a number.
I've tried multiple NULLIF conditions to set the 'pc' and '--' to null while retaining the Change value. I've tried WHEN statements to test for each 'pc', '--', and Change values. How should this be coded?
In addition, the record has two segments (Calls and Puts), how should the INTO table and WHEN be coded to insert two rows for each record?
Control file....
options (skip=3)
load data
infile 'OEX18Nov05.csv' "str '\r\n'" replace
into table OEX_Options
when (change='pc')
fields terminated by ',' optionally enclosed by '"'
(class char,
last char,
change char nullif (change='pc'),
bid char,
ask char,
volume char,
openinterest char)
into table OEX_Options
when (change='pc')
(class char,
last char,
change char nullif (change='--'),
bid char,
ask char,
volume char,
openinterest char)
into table OEX_Options
when (change<>'pc') and (change<>'--')
(class char,
last char,
change char,
bid char,
ask char,
volume char,
openinterest char)
... repeat above for second part of the record?
.OEX (CBOE),574.69,+3.52
Nov 18 2005 @ 17:44 ET (Data 15 Minutes Delayed)
Calls,Last Sale,Net,Bid,Ask,Vol,Open Int,Puts,Last Sale,Net,Bid,Ask,Vol,Open Int
05 Nov 400.0 (OXB KT-E),0,pc,174.40,174.60,0,0,05 Nov 400.0 (OXB WT-E),0.05,pc,0,0.05,0,1000
05 Nov 420.0 (OXB KD-E),0,pc,154.40,154.60,0,0,05 Nov 420.0 (OXB WD-E),0.05,pc,0,0.05,0,1680
05 Nov 440.0 (OXB KH-E),0,pc,134.40,134.60,0,0,05 Nov 440.0 (OXB WH-E),0.05,pc,0,0.05,0,6683
05 Nov 575.0 (OEB KO-E),0.05,-0.10,0,0.05,23911,32185,05 Nov 575.0 (OEB WO-E),0.30,-3.70,0.30,0.35,12116,1714
05 Nov 580.0 (OEB KP-E),0.05,--,0,0.05,1177,15520,05 Nov 580.0 (OEB WP-E),8.00,-1.10,5.20,5.40,127,300
05 Dec 570.0 (OEB LN-E),8.80,+1.70,8.80,9.10,4482,5083,05 Dec 570.0 (OEB XN-E),3.70,-1.50,3.70,4.10,4259,3658
05 Dec 575.0 (OEB LO-E),5.60,+1.20,5.60,5.90,4581,5895,05 Dec 575.0 (OEB XO-E),5.90,-1.80,5.70,5.90,1647,184
05 Dec 580.0 (OEB LP-E),3.20,+0.90,3.10,3.30,5500,10710,05 Dec 580.0 (OEB XP-E),8.70,-2.90,8.20,8.70,268,1384
Thanks,
LEOUgh! I'm trying to load some Options data (Calls and Puts) which is a single csv record with both Calls and Puts and a Change (% Change is price) field which contains 'pc', '--', or a number.
I've tried multiple NULLIF conditions to set the 'pc' and '--' to null while retaining the Change value. I've tried WHEN statements to test for each 'pc', '--', and Change values. How should this be coded?
In addition, the record has two segments (Calls and Puts), how should the INTO table and WHEN be coded to insert two rows for each record?
Control file....
options (skip=3)
load data
infile 'OEX18Nov05.csv' "str '\r\n'" replace
into table OEX_Options
when (change='pc')
fields terminated by ',' optionally enclosed by '"'
(class char,
last char,
change char nullif (change='pc'),
bid char,
ask char,
volume char,
openinterest char)
into table OEX_Options
when (change='pc')
(class char,
last char,
change char nullif (change='--'),
bid char,
ask char,
volume char,
openinterest char)
into table OEX_Options
when (change<>'pc') and (change<>'--')
(class char,
last char,
change char,
bid char,
ask char,
volume char,
openinterest char)
... repeat above for second part of the record?
.OEX (CBOE),574.69,+3.52
Nov 18 2005 @ 17:44 ET (Data 15 Minutes Delayed)
Calls,Last Sale,Net,Bid,Ask,Vol,Open Int,Puts,Last Sale,Net,Bid,Ask,Vol,Open Int
05 Nov 400.0 (OXB KT-E),0,pc,174.40,174.60,0,0,05 Nov 400.0 (OXB WT-E),0.05,pc,0,0.05,0,1000
05 Nov 420.0 (OXB KD-E),0,pc,154.40,154.60,0,0,05 Nov 420.0 (OXB WD-E),0.05,pc,0,0.05,0,1680
05 Nov 440.0 (OXB KH-E),0,pc,134.40,134.60,0,0,05 Nov 440.0 (OXB WH-E),0.05,pc,0,0.05,0,6683
05 Nov 575.0 (OEB KO-E),0.05,-0.10,0,0.05,23911,32185,05 Nov 575.0 (OEB WO-E),0.30,-3.70,0.30,0.35,12116,1714
05 Nov 580.0 (OEB KP-E),0.05,--,0,0.05,1177,15520,05 Nov 580.0 (OEB WP-E),8.00,-1.10,5.20,5.40,127,300
05 Dec 570.0 (OEB LN-E),8.80,+1.70,8.80,9.10,4482,5083,05 Dec 570.0 (OEB XN-E),3.70,-1.50,3.70,4.10,4259,3658
05 Dec 575.0 (OEB LO-E),5.60,+1.20,5.60,5.90,4581,5895,05 Dec 575.0 (OEB XO-E),5.90,-1.80,5.70,5.90,1647,184
05 Dec 580.0 (OEB LP-E),3.20,+0.90,3.10,3.30,5500,10710,05 Dec 580.0 (OEB XP-E),8.70,-2.90,8.20,8.70,268,1384
Thanks,
LEO -
How to Make FUNCTION to return multiple column and multiple row output
Hi All,
Kindly Share ur Idea;Thanks in Advance;
i Have Table Demo.
table DEMO:
id name
1 a10
1 a11
1 a12
2 b10
2 b11
3 ccc
and the function is like:
create or replace function (p1 number) return varchar2 as
vid number;
vname varchar2(20);
begin
select id,name into vid,vname from demo where id=p1;
return v1;
end;
this function returns output for id=3;
BUT,
i need output as (for input as 1)
vid vname
1 a10
1 a11
1 a12A function returns a single datatype.
That datatype may be an atomic datatype (varchar2, number etc.) or it may be an object/record datatype, or even a collection datatype.
Where are you going to use this function? In PL/SQL or SQL?
If you are wanting to use it in SQL, then you would need a pipelined function e.g.
SQL> CREATE OR REPLACE TYPE myemp AS OBJECT
2 ( empno number,
3 ename varchar2(10),
4 job varchar2(10),
5 mgr number,
6 hiredate date,
7 sal number,
8 comm number,
9 deptno number
10 )
11 /
Type created.
SQL> CREATE OR REPLACE TYPE myrectable AS TABLE OF myemp
2 /
Type created.
SQL> CREATE OR REPLACE FUNCTION pipedata(p_min_row number, p_max_row number) RETURN myrectable PIPELINED IS
2 v_obj myemp := myemp(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
3 BEGIN
4 FOR e IN (select *
5 from (
6 select e.*
7 ,rownum rn
8 from (select * from emp order by empno) e
9 )
10 where rn between p_min_row and p_max_row)
11 LOOP
12 v_obj.empno := e.empno;
13 v_obj.ename := e.ename;
14 v_obj.job := e.job;
15 v_obj.mgr := e.mgr;
16 v_obj.hiredate := e.hiredate;
17 v_obj.sal := e.sal;
18 v_obj.comm := e.comm;
19 v_obj.deptno := e.deptno;
20 PIPE ROW (v_obj);
21 END LOOP;
22 RETURN;
23 END;
24 /
Function created.
SQL> select * from table(pipedata(1,5));
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-1980 00:00:00 800 20
7499 ALLEN SALESMAN 7698 20-FEB-1981 00:00:00 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-1981 00:00:00 1250 500 30
7566 JONES MANAGER 7839 02-APR-1981 00:00:00 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-1981 00:00:00 1250 1400 30
SQL> select * from table(pipedata(6,10));
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7698 BLAKE MANAGER 7839 01-MAY-1981 00:00:00 2850 30
7782 CLARK MANAGER 7839 09-JUN-1981 00:00:00 2450 10
7788 SCOTT ANALYST 7566 19-APR-1987 00:00:00 3000 20
7839 KING PRESIDENT 17-NOV-1981 00:00:00 5000 10
7844 TURNER SALESMAN 7698 08-SEP-1981 00:00:00 1500 0 30
SQL> select * from table(pipedata(11,15));
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7876 ADAMS CLERK 7788 23-MAY-1987 00:00:00 1100 20
7900 JAMES CLERK 7698 03-DEC-1981 00:00:00 950 30
7902 FORD ANALYST 7566 03-DEC-1981 00:00:00 3000 20
7934 MILLER CLERK 7782 23-JAN-1982 00:00:00 1300 10
SQL>If you are using it in PL/SQL then just populating a collection datatype and returning that will do. Though you should question why you want to pass large amounts of data around like that first.
Explain your purpose and what you are intending to do and we can recommend the best way.
{message:id=9360002} -
Help :add multiple rows from Resultset to ArrayList ?
My query returns one column and multiple rows. In Java code , I am trying to get this data in array or arraylist through ResultSet
ex:
item_num
p001
p002
p003
when I print, it only gets the item in the first row.
ArrayList myArrayList = new ArrayList();
resultset = preparedstatement.executeQuery();
if (resultset.next())
myArrayList.add(new String(resultset.getString("item_num")));
Print:
for (int j = 0 ; j < myArrayList.size() ; j++ )
System.out.println((String)myArrayList.get(j)); --this prints only the first item.
can someone assist ?changing if to while fixed it.
-
Multiple rows Converge to Single row and join
Hi Folks,
I am facing a tricky challenge to join a table with multiple rows and converge into a single row (based on ID, period) and join with another table to get a single row. Let me explain.
Table 1: DTL_TABLE (id, period, course, names, title, type)
1 2010 mat john null null
1 2010 mat jim null null
1 2010 cam null officer null
1 2010 cam null Prof null
1 2010 phy null null Inclass
1 2010 phy null null Online
Join with
Table 2: ID_TABLE(id, period, Loc, Dept, Code)
1 2010 nj 101 CC.
Output format (id, period, course, names, title, type, Loc, Dept, Code)
result : 1 2010 mat,cam,phy john,jim officer,prof inclass,online nj 101 CC
I have created all the DDLs and DMLs if that help. Kindly let me know if a Join SQL query is possible.
Thank you,
Aj
CREATE TABLE DTL_TABLE
ids VARCHAR2 (10),
period VARCHAR2 (10),
course VARCHAR2 (10),
names VARCHAR2 (10),
title VARCHAR2 (10),
TYPE VARCHAR2 (10)
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'mat',
'jim',
NULL,
NULL);
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'mat',
'john',
NULL,
NULL);
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'mat',
'kale',
NULL,
NULL);
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'cam',
NULL,
'officer',
NULL);
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'cam',
NULL,
'prof',
NULL);
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'phy',
NULL,
NULL,
'inclass');
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'phy',
NULL,
NULL,
'online');
COMMIT;
CREATE TABLE id_table
ids VARCHAR2 (10),
period VARCHAR2 (10),
loc VARCHAR2 (10),
dept VARCHAR2 (10),
code VARCHAR2 (10)
INSERT INTO id_table
VALUES ('1',
'2010',
'nj',
'101',
'cc');
COMMIT;Aj09 wrote:
Hi Folks,
I am facing a tricky challenge to join a table with multiple rows and converge into a single row (based on ID, period) and join with another table to get a single row. Let me explain.
Table 1: DTL_TABLE (id, period, course, names, title, type)
1 2010 mat john null null
1 2010 mat jim null null
1 2010 cam null officer null
1 2010 cam null Prof null
1 2010 phy null null Inclass
1 2010 phy null null Online
Join with
Table 2: ID_TABLE(id, period, Loc, Dept, Code)
1 2010 nj 101 CC.
Output format (id, period, course, names, title, type, Loc, Dept, Code)
result : 1 2010 mat,cam,phy john,jim officer,prof inclass,online nj 101 CC
I have created all the DDLs and DMLs if that help. Kindly let me know if a Join SQL query is possible.
SELECT TBL.id,
DTLperiod,
course,
names,
title,
TYPE,
Loc,
Dept,
Code
FROM ID_TABLE TBL,
DTL_TABLE DTL
WHERE TBL.ID = DTL.ID
AND TBL.PERIOD = DTL.PERIOD; it not good to use RESERVED WORDS like "ID" or "TYPE" as column names -
I have a excel with multiple
sheets with data as shown below
SHEET 1
A 1
B 2
C 3
SHEET 2
B 1
C 2
A 3
SHEET 3
C 1
A 2
B 3
My
query is splitted into 3 categories
I want to have a formula to do math calculation such that data of "A" of SHEET 1 is calculated with "A" of SHEET2 irrespective of the location of "A".
When I include SHEET3, the formula should automatically identify the location of "A" or "B" or "C" and give the result corresponding to A, B or C. Since I want to bifurcate daily report and output printed. I want to use another
excel for output. How to link multiple sheets of one excel and print the output of above in
another excel?
Assume, I have 4 SHEETS, "SHEET 1", "SHEET 2", "SHEET 3" and "SHEET 4". Math calculation need to be done using all 4 sheets. If
I include "SHEET 5", the formula should ignore SHEET 1 automatically and give the results of SHEETS 2 to 5. Similarly, if I include SHEET 6, SHEET 1 and 2 need to be ignored for further calculation and SHEET 3-6 need to be used. How to write
such formula?
How to get pop up alert for multiple rows, if a specific condition is hit?Maybe VBA Code should be a good option for you. I suggest you post you issue to
Excel for Developers forum.
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
Thanks for your understanding.
Best Regards,
Wind -
How to extract multiple rows from a query and how to populate it in form.
hi all,
i want to populate multiple rows fetched from a cursor into form.
i write this procedur.
PROCEDURE populate_q (v_t_no IN number) IS
cursor ext_q is
select test_question.no, q_no, text, ans1
from test_question , question
where test_question.no = v_t_no;
BEGIN
for ext_rec in ext_q loop
:take_detail.q_no := ext_rec.q_no;
:take_detail.question := ext_rec.text;
EXIT WHEN ext_q%notfound;
end loop;
END;
and call this WHEN-NEW-BLOCK-INSTANCE trigger.
this don't return all the rows only the lost one is populated
and shown in form.
thanks
Muhammad Nadeem
Mardan (pakistan)
[email protected]Hi,
look for the next_record built-in. Your cusror only addresses the current row, but you want to create new rows as you go
Frank -
TO DRAW A TABLE WITH MULTIPLE ROWS AND MULTIPLE COLOUMNS IN FORM
Hi,
How to draw a table with multiple rows and columns seperated by lines in form printing?check this
http://sap-img.com/ts003.htm
Regards
Prabhu -
Join tables and replicate (multiple rows)
Hi,
i have two tables TAB1 (A, B, C) and TAB2 (C, D)
i want to join the tables and replicat such that the resultant table TAB3 has columns A, B, D
select x.a, x.b, y.d from tab1 x join tab2 y on x.c=y.c where y.d=1;
but the problem here is that the above command gives multiple rows and i need all those to be in the target table. When i am using SQLEXEC-QUERY in the mapping, only the first search result is being entered into the TAB3. Then i Found out that sqlexec will return only one value. But i need all the search results to be replicated.
What alternatives are there and what GG recommend in such use case?
Any helpful advice is much appreciated.
thanks,
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Productionthe problem to use SP to check every time before insert/update is that there will be around 15 tables not 2 and there will be lakhs of rows in each table, SP which checks every insert will cause a lot of overhead and lag. I cannot afford that.
More over there will be around 60 values of D and or each value of D there will be Lakhs of rows associated in TAB1
I need to set up different extract and replicat processes for each set of rows associated with each value of D
for example the values of column D are 1-30
for D=1 there are 1.5lakh rows in TAB1 and EXT1, REP1 for this set of rows
D=2 => 2lakhs rows in TAB2 and EXT2, REP2 for this set of rows
D=3 => 1lakhs rows in TAB2 and EXT3, REP3 for this set of rows...etc
this is to ensure that if i want to stop replicating data associated with D=1(which i need to do) i can stop only REP1 and keep the rest of the data associated with D=2-30 in sync
As far as materialized views are concerned, i need to do it with goldengate only
Thanks -
Updating and deleting multiple rows
Hi!
I have a form on a table with report page where I can filter data through columns.
1. Is it possible to create a button that will delete all the filtered data?
2. Also, I would like to be able to update any column of the filtered dataset to a certain value (that needs to be input somehow). Is that possible?
So far I can only update or delete one row at a time, which isn't useful as I sometimes need to change 100 rows at a time with the same value or delete them.
When I use tabular form, I can't filter rows, but I can delete multiple rows...
Also if there are similar examples, could you please send me a link; I can't seem to find any.
I'm using Apex 4.2.2.
Best Regards,
IvanDeleting multiple rows - [url https://forums.oracle.com/forums/thread.jspa?threadID=2159983]common question
Best answered with Martin's example
http://www.talkapex.com/2009/01/apex-report-with-checkboxes-advanced.html
Depends how you filter your data. You could identify all your limiting variables, and reverse the where clause in a delete process.
As for point 2, you can define a button that redirects to the page, and you can defined all the item values you like using the Action link.
There is likely an example in the supplied package applications.
Scott -
Multiple rows and multiple cols inone report
Hi
All
I have a req where i need to build a report with multiple rows and multiple columns
.... ....................... 2009 jan , 2009 feb , 2009 march , 2009 april...........................
............................ dim3 mem1 , dim3 mem1 , dim3 mem1, dim3 mem1..........................
dim1 mem1
dim2 mem1
calc value
dim1 mem2
dim2 mem1
calc value
dim1 mem3
dim2 mem1
calc value
please advice if i can use the colkey range and rowkeyranges for this type of expansion and how?
thanks
Edited by: bpc_now on Oct 21, 2010 6:40 AMHi,
If you need multiple dimensions, then the first thing is to specify EVDRE("mXn")
where m = number of dimensions in column
n = number of dimensions in the row.
If the EVDRE has already been built and you wnat to change it, then you need to change the rowkeyrange and colkeyrange. And accordingly, you should have 4 expansions - 2 for rows and 2 for columns.
Hope it helps. -
MULTIPLE-ROW drag and drop between 2 ALV grids
Hi,
Can anybody help me with acheiving MULTIPLE-ROW drag and drop functionality between 2 ALV grids.hi Prakash,
Actually I'm trying to develop multiple drag and drop between 2 ALV's. To understand the events properly, I started working on this sample program where it uses 1 ALV and splits it into 2 and uses single row drag and drop between them. Now I'm making it to work for multiple drag and drop, so that I can use it on my application. This is the code which I'm working on..
*& Report Z_ALV_GRID_CONTROLS_DRAG_DROP *
REPORT z_alv_grid_controls_drag_drop.
DATA : i_ztransactions TYPE TABLE OF ztransactions
WITH HEADER LINE.
DATA : i_ztransactions2 TYPE TABLE OF ztransactions
WITH HEADER LINE.
DATA : ok_code LIKE sy-ucomm .
DATA : mcontainer TYPE REF TO cl_gui_custom_container .
DATA : mcontleft TYPE REF TO cl_gui_container .
DATA : mcontright TYPE REF TO cl_gui_container .
DATA : msplitcont TYPE REF TO
cl_gui_easy_splitter_container .
DATA : malv_left TYPE REF TO cl_gui_alv_grid .
DATA : malv_right TYPE REF TO cl_gui_alv_grid .
DATA : mrow TYPE lvc_s_row .
DATA : gt_outtab_source TYPE ztransactions.
DATA : gt_outtab_target TYPE ztransactions.
DATA : g_repid LIKE sy-repid.
DATA: gs_layout TYPE lvc_s_layo ,
g_behaviour_alv TYPE REF TO cl_dragdrop .
DATA : mlines TYPE i .
CLASS lcl_dragdropobj DEFINITION
This is the Class of Drag Drop Object .
This Object is used as a temporary storage means
of the information extracted with drag
CLASS lcl_dragdropobj DEFINITION.
PUBLIC SECTION.
DATA: i_ztransactions TYPE ztransactions ,
index TYPE i ,
original_table(5) TYPE c ,
proceed_trans(1) TYPE c .
ENDCLASS. "lcl_dragdropobj DEFINITION
DATA : mdata TYPE REF TO lcl_dragdropobj .
CLASS DND_TOOLS DEFINITION
This class contains the methods responding to the
events ONDRAG , ONDROP , ONDROPCOMPLETE
of the ALV Grid Controls
CLASS dnd_tools DEFINITION .
PUBLIC SECTION .
METHODS:handle_user_command
FOR EVENT user_command OF
cl_gui_alv_grid
IMPORTING
e_ucomm.
METHODS : handle_drag_from_left
FOR EVENT ondrag OF
cl_gui_alv_grid
IMPORTING
e_row
e_dragdropobj .
METHODS : handle_dropcomplete_from_left
FOR EVENT ondropcomplete OF
cl_gui_alv_grid
IMPORTING
e_row
e_dragdropobj .
METHODS : handle_drag_from_right
FOR EVENT ondrag OF
cl_gui_alv_grid
IMPORTING
e_row
e_dragdropobj .
METHODS : handle_dropcomplete_from_right
FOR EVENT ondropcomplete OF
cl_gui_alv_grid
IMPORTING
e_row
e_dragdropobj .
METHODS : handle_drop_to_left
FOR EVENT ondrop OF
cl_gui_alv_grid
IMPORTING
e_dragdropobj .
METHODS : handle_drop_to_right
FOR EVENT ondrop OF
cl_gui_alv_grid
IMPORTING
e_dragdropobj .
ENDCLASS . "DND_TOOLS DEFINITION
CLASS DND_TOOLS IMPLEMENTATION
CLASS dnd_tools IMPLEMENTATION .
METHOD handle_drag_from_left .
METHOD handle_user_command.
DATA: lt_rows TYPE lvc_t_row.
DATA: lt_rows TYPE lvc_t_roid.
DATA: lt_row TYPE lvc_s_roid.
DATA: mdata TYPE REF TO lcl_dragdropobj .
DATA: dragdropobj TYPE REF TO lcl_dragdropobj .
get selected row
CALL METHOD malv_left->get_selected_rows
IMPORTING
et_row_no = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
ENDIF.
CREATE OBJECT mdata.
LOOP AT lt_rows INTO lt_row.
mrow = lt_row .
READ TABLE i_ztransactions INDEX lt_row-row_id INTO
i_ztransactions.
MOVE i_ztransactions TO mdata->i_ztransactions .
MOVE lt_row-row_id TO mdata->index.
MOVE 'LEFT' TO mdata->original_table .
e_dragdropobj->object = mdata .
ENDLOOP.
ENDMETHOD. "handle_user_command
METHOD handle_dropcomplete_from_left .
NB : the following data object MDATA is local to
the method and contains the information from the
import parameter of the method E_DRAGDROPOBJ
DATA : mdata TYPE REF TO lcl_dragdropobj .
DATA: lt_rows TYPE lvc_t_roid.
DATA: lt_row TYPE lvc_s_roid.
CALL METHOD malv_left->get_selected_rows
IMPORTING
et_row_no = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
ENDIF.
LOOP AT lt_rows INTO lt_row.
mdata ?= e_dragdropobj->object .
CHECK mdata->proceed_trans = 'X' .
mrow = mdata->index.
DELETE i_ztransactions INDEX mrow .
APPEND mdata->i_ztransactions TO i_ztransactions2 .
SORT i_ztransactions2 BY kunnr belnr .
DELETE i_ztransactions2 WHERE kunnr IS INITIAL .
DESCRIBE TABLE i_ztransactions LINES mlines .
IF mlines EQ 0 .
CLEAR i_ztransactions .
APPEND i_ztransactions TO i_ztransactions .
ENDIF .
ENDLOOP.
CALL METHOD malv_left->refresh_table_display.
CALL METHOD malv_right->refresh_table_display.
ENDMETHOD . "HANDLE_DROPCOMPLETE_FROM_LEFT
METHOD handle_drag_from_right.
mrow = e_row-index .
READ TABLE i_ztransactions2 INDEX mrow INTO
i_ztransactions2 .
CREATE OBJECT mdata .
MOVE i_ztransactions2 TO mdata->i_ztransactions .
MOVE mrow TO mdata->index .
MOVE 'RIGHT' TO mdata->original_table .
e_dragdropobj->object = mdata .
ENDMETHOD . "HANDLE_DRAG_FROM_RIGHT
METHOD handle_dropcomplete_from_right .
DATA : mdata TYPE REF TO lcl_dragdropobj .
mdata ?= e_dragdropobj->object .
CHECK mdata->proceed_trans = 'X' .
mrow = mdata->index .
DELETE i_ztransactions2 INDEX mrow .
APPEND mdata->i_ztransactions TO i_ztransactions .
SORT i_ztransactions BY kunnr belnr .
DELETE i_ztransactions WHERE kunnr IS INITIAL .
DESCRIBE TABLE i_ztransactions2 LINES mlines .
IF mlines EQ 0 .
CLEAR i_ztransactions2 .
APPEND i_ztransactions2 TO i_ztransactions2 .
ENDIF .
CALL METHOD malv_left->refresh_table_display.
CALL METHOD malv_right->refresh_table_display.
ENDMETHOD . "HANDLE_DROPCOMPLETE_FROM_RIGHT
METHOD handle_drop_to_left .
DATA : mdata TYPE REF TO lcl_dragdropobj .
mdata ?= e_dragdropobj->object .
IF mdata->original_table = 'RIGHT' .
mdata->proceed_trans = 'X' .
ELSE .
mdata->proceed_trans = ' ' .
ENDIF .
e_dragdropobj->object = mdata .
ENDMETHOD . "HANDLE_DROP_TO_LEFT
METHOD handle_drop_to_right .
DATA : mdata TYPE REF TO lcl_dragdropobj .
DATA: lt_rows TYPE lvc_t_roid.
DATA: lt_row TYPE lvc_s_roid.
CALL METHOD malv_left->get_selected_rows
IMPORTING
et_row_no = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
ENDIF.
LOOP AT lt_rows INTO lt_row.
mdata ?= e_dragdropobj->object .
IF mdata->original_table = 'LEFT' .
mdata->proceed_trans = 'X' .
ELSE .
mdata->proceed_trans = ' ' .
ENDIF .
e_dragdropobj->object = mdata .
ENDLOOP.
ENDMETHOD . "HANDLE_DROP_TO_RIGHT
ENDCLASS . "DND_TOOLS IMPLEMENTATION
DATA : mlistener TYPE REF TO dnd_tools .
======================================================
START OF SELECTION
======================================================
START-OF-SELECTION .
PERFORM get_data .
CALL SCREEN 100 .
The screen 100 has the custom control MCONTAINER and
on the flow logic has the following modules :
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
MODULE PREPARE_SCREEN .
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
(Off course not commented out in the real flow logic)
FORM GET_DATA *
FOR THIS EXAMPLE THE DATA SELECTION IS HARD CODED
FORM get_data .
CLEAR : i_ztransactions , i_ztransactions[] .
i_ztransactions-mandt = sy-mandt .
i_ztransactions-waers = 'EUR ' .
i_ztransactions-kunnr = '0000000001' .
i_ztransactions-belnr = '0000000001' .
i_ztransactions-bldat = '20030101' .
i_ztransactions-dmbtr = '1000' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000002' .
i_ztransactions-bldat = '20030202' .
i_ztransactions-dmbtr = '1010' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000003' .
i_ztransactions-bldat = '20030323' .
i_ztransactions-dmbtr = '1020' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000004' .
i_ztransactions-bldat = '20030404' .
i_ztransactions-dmbtr = '1030' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000005' .
i_ztransactions-bldat = '20030505' .
i_ztransactions-dmbtr = '1040' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000006' .
i_ztransactions-bldat = '20030606' .
i_ztransactions-dmbtr = '1050' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000007' .
i_ztransactions-bldat = '20030707' .
i_ztransactions-dmbtr = '1060' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000008' .
i_ztransactions-bldat = '20030808' .
i_ztransactions-dmbtr = '1070' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000009' .
i_ztransactions-bldat = '20030909' .
i_ztransactions-dmbtr = '1080' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000010' .
i_ztransactions-bldat = '20031010' .
i_ztransactions-dmbtr = '1090' .
APPEND i_ztransactions .
CLEAR : i_ztransactions2 , i_ztransactions2[] .
APPEND i_ztransactions2 .
ENDFORM . "GET_DATA
*& Module STATUS_0100 OUTPUT
The PF STATUS STATUS100 called from the module below,
has on the Standard toolbar the buttons
BACK , EXIT and CANCEL .
These buttons are provided with function code = 'EXIT'
MODULE status_0100 OUTPUT.
SET TITLEBAR 'TITLEDRAGDROP' .
SET PF-STATUS 'STATUS100'.
ENDMODULE. " STATUS_0100 OUTPUT
Module USER_COMMAND_0100 INPUT
The following module checks the User Command and ends
the program
MODULE user_command_0100 INPUT.
IF ok_code = 'EXIT' .
CLEAR : mcontainer ,
mcontleft ,
mcontright ,
msplitcont ,
malv_left ,
malv_right .
LEAVE TO SCREEN 0 .
ENDIF .
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module PREPARE_SCREEN OUTPUT
MODULE prepare_screen OUTPUT.
IF mcontainer IS INITIAL .
CREATE OBJECT mcontainer
EXPORTING
container_name = 'MCONTAINER' .
CREATE OBJECT msplitcont
EXPORTING
parent = mcontainer
orientation = 1 .
mcontleft = msplitcont->top_left_container .
mcontright = msplitcont->bottom_right_container .
CREATE OBJECT malv_left
EXPORTING i_parent = mcontleft .
gs_layout-sel_mode = 'D'.
CREATE OBJECT malv_right
EXPORTING i_parent = mcontright .
gs_layout-sel_mode = 'D'.
PERFORM set_layout_capable_of_drag_dro
USING 'X' 'X' .
CALL METHOD malv_left->set_table_for_first_display
EXPORTING
i_structure_name = 'ZTRANSACTIONS'
is_layout = gs_layout
CHANGING
it_outtab = i_ztransactions[].
CALL METHOD malv_right->set_table_for_first_display
EXPORTING
i_structure_name = 'ZTRANSACTIONS'
is_layout = gs_layout
CHANGING
it_outtab = i_ztransactions2[].
CREATE OBJECT mlistener .
CALL METHOD malv_left->set_toolbar_interactive.
SET HANDLER mlistener->handle_drag_from_left
FOR malv_left .
SET HANDLER mlistener->handle_dropcomplete_from_left
FOR malv_left .
SET HANDLER mlistener->handle_drag_from_right
FOR malv_right.
SET HANDLER mlistener->handle_dropcomplete_from_right
FOR malv_right .
SET HANDLER mlistener->handle_drop_to_right
FOR malv_right .
SET HANDLER mlistener->handle_drop_to_left
FOR malv_left .
ENDIF .
ENDMODULE. " PREPARE_SCREEN OUTPUT
Form SET_LAYOUT_CAPABLE_OF_DRAG_DRO
Definition of a Drag & Drop behaviour for the ALV
grid
FORM set_layout_capable_of_drag_dro USING drag drop.
DATA : effect TYPE i ,
handle_alv TYPE i .
CREATE OBJECT g_behaviour_alv.
effect = cl_dragdrop=>move + cl_dragdrop=>copy .
CALL METHOD g_behaviour_alv->add
EXPORTING
flavor = 'Line'
dragsrc = drag
droptarget = drop
effect = effect.
CALL METHOD g_behaviour_alv->get_handle
IMPORTING
handle = handle_alv.
gs_layout-s_dragdrop-row_ddid = handle_alv.
ENDFORM. " SET_LAYOUT_CAPABLE_OF_DRAG_DRO -
Adding and Deleting Multiple Rows or Columns
How do you add or delete more than one row or column at a time.
Robby! wrote:
That's a great finding!
I just wrote a feedback requesting a shortcut like this.
It is a pity though that they desing it to work only if you select the header of the row/column. It should be enabled to work from within any cell in the table.
Who wrote such an error ?
These interesting shortcuts behave flawlessly even if the cursor was in D18 for instance.
(a) I never saw them in the delivered resources.
(b) they aren't responding to the OP's question which was about "Adding and Deleting Multiple Rows and Columns"
Yvan KOENIG (from FRANCE vendredi 3 octobre 2008 18:39:01) -
Downloading .xls file with multiple rows and Columns
Hi ALL,
I need to genarate .xls file with multiple rows and and Columns and sent as an email.Since our customer having Problem with .CSV files need to genarate .XLS file.
Please do the needful.
Thanks
MadhuHi Madhu,
You might also consider using Excel Spreadsheet XML as the target structure (namespace is urn:schemas-microsoft-com:office:spreadsheet). When you double-click the resulting xml on a PC it automatically opens with Excel. So, users don't see a difference. It will open up a lot of options with formatting including creating multiple worksheets if you wanted to. Best of all you can stick with XML.
See my response in this thread:
Re: Convert XML data into XLS
Thanks,
-Russ
Maybe you are looking for
-
Weblogic Server 6.1 SP2 is running fine. But unable to get XAConnections! I am getting following error java.sql.SQLException: Internal error: Cannot obtain XAConnection Creation of XAConnection for pool ibesXaConnection Pool failed after waitSecs:300
-
Menu not working on some players
Hi everyone, I created a DVD complete with menus and sent copies to two different people. Before I sent the DVD I checked that the disk worked on my mac's DVD player and a standalone player. A Panasonic I think but I'm not sure. Anyway, both parties
-
I just purchased a new IPAD (16GB + 4G cell) I am trying to get it to connect to the wifi hotspot at the apartment where I live. The wifi signal requires a username and password. How do I get the IPAD to prompt for the username and password? Any
-
Function Module to calculate pallets
Hi, I need a Function Module to calculate pallets for free of charge articles while creating a sales order. can someone name any FM for this purpose. Thanks in advance
-
I can't find any of my albums, or see a way to create a new album, in PSE12 organizer. -- Larry