Craete a simple abap object to select data from a table and display
Hi,
I know the concept of abap objects but i never worked on it,
can any one give me simple example of how to create an abap object to display data from mara table.also please send me documents or info regd ABAP OBJECTS.
I want to write a simple report in terms of abap object
Regards,
Sowjanya
hi,
Here is hte sample program in se38.
REPORT ZFGLI00003
*-- Include for data declarations and performs
include ZFGLI00003_f01.
*--Include for Classes and their Implementation
include ZFGLI00003_cl.
* selection-screen *
*-- Selection Values : Block1
selection-screen begin of block b1 with frame title text-001.
*-- Ledger
parameters: p_rldnr like zzprodnt-rldnr default 'NP'.
*-- Fiscal year
parameters: p_ryear like zzprodnt-ryear.
*-- Period(month)
parameters: p_rpmax like zzprodnt-rpmax.
selection-screen end of block b1.
*-- Selection Values : Block2
selection-screen begin of block b2 with frame title text-002.
*-- Company ID's
select-options : s_glcomp for ZZPRODNT-ROBUKRS .
*-- Profit Center
select-options : s_prctr for ZZPRODNT-RPRCTR .
*-- Product Assignment
select-options : s_prasn for ZZPRODNT-RZZWWZ01 .
*-- Corporate Brand
select-options : s_crpbd for ZZPRODNT-RZZWWZ05 .
selection-screen end of block b2.
*-- Selection Values : Block3 Download Options
selection-screen begin of block b3 with frame title text-003.
parameters : p_local radiobutton group 1,
p_unix radiobutton group 1,
p_path like rlgrap-filename obligatory
default 'C:P20Z_Formatted.txt'(009).
selection-screen end of block b3.
* At Selection-Selection on value-request for file path *
at selection-screen on value-request for p_path.
if p_unix <> 'X'.
*-- Getting F4 help for output file
perform get_filename changing p_path.
else.
message i999(zi) with
'Sorry !! Function not available for UNIX file.'(i01).
endif.
*-- At selection screen validations
at selection-screen on p_path.
if p_unix <> 'X'.
*-- Validate local file
if p_path+1(2) <> ':'.
message e999(zi) with 'Invalid file path'(006).
endif.
else.
*-- Validate unix file
if p_path+0(1) <> '/'.
message e999(zi) with 'Invalid file path'(006).
endif.
endif.
* Initialization *
initialization.
*-- Initialize the period
perform init_period changing p_rpmax p_ryear.
* start-of-selection *
start-of-selection.
data : o_tm1_intf type ref to lcl_tm1_intf.
create object o_tm1_intf.
*-- Extract the data from ZZPRODNT
call method o_tm1_intf->get_data exporting e_rldnr = p_rldnr
e_ryear = p_ryear
e_rpmax = p_rpmax
e_glcomp = s_glcomp[]
e_prctr = s_prctr[]
e_prasn = s_prasn[]
e_crpbd = s_crpbd[]
importing i_subrc = v_subrc.
* INCLUDE ZFGLI00003_CL *
* CLASS lcl_tm1_intf IMPLEMENTATION
class lcl_tm1_intf definition.
public section.
*-- Data Declaration
data : lv_date type sy-datum, "Date
lv_time type sy-uzeit, "Time
lv_count type i, "Count for total records
lv_acsline type zfgl014-acsline,"ACS line code
lv_amt_curr type zzprodnt-kslvt, "current month amount
lv_amt_ytd type zzprodnt-kslvt, "YTD Amount
lv_check, "check if any record is
"downloaded
lv_msg(100), "message
lv_count_s(5) , "Count for total(char)
lv_amt_curr_s(23), "Current month amount(char)
lv_amt_ytd_s(23), "YTD Amount(char)
lv_ksl_pd(17), "KSLxx
lv_period(2) type n. "month(period)
*-- Types Declaration
types : ty_rldnr type zzprodnt-rldnr, "Type for Ledger
ty_ryear type zzprodnt-ryear, "Type for Fiscal Year
ty_rpmax type zzprodnt-rpmax, "Type for Period
ty_glcomp type range of char4, "Type for company selection
ty_prctr type range of char10, "Type for profit center sel
ty_prasn type range of char6, "Type for prod assignmt sel
ty_crpbd type range of char4, "Type for Corp Brand sel
begin of ty_file, "Type for File
line(150),
end of ty_file,
begin of ty_ZZPRODNT, "Type-ledger summary table
company type OBUKR, "Company
gl_acct type RACCT, "GL Account
cst_ctr type KOSTL, "Cost Center
prt_ctr type PRCTR, "Profit Center
rfarea type FKBER, "Functional Area
wbs_ele type PS_POSID, "WBS Element
prd_*** type RKEG_WWZ01, "Product Assignment
corp_bd type RKEG_WWZ05, "Corporate Brand
ksl01 type KSLXX9, "Total of transactions - 01
ksl02 type KSLXX9, "Total of transactions - 02
ksl03 type KSLXX9, "Total of transactions - 03
ksl04 type KSLXX9, "Total of transactions - 04
ksl05 type KSLXX9, "Total of transactions - 05
ksl06 type KSLXX9, "Total of transactions - 06
ksl07 type KSLXX9, "Total of transactions - 07
ksl08 type KSLXX9, "Total of transactions - 08
ksl09 type KSLXX9, "Total of transactions - 09
ksl10 type KSLXX9, "Total of transactions - 10
ksl11 type KSLXX9, "Total of transactions - 11
ksl12 type KSLXX9, "Total of transactions - 12
ksl13 type KSLXX9, "Total of transactions - 13
ksl14 type KSLXX9, "Total of transactions - 14
ksl15 type KSLXX9, "Total of transactions - 15
ksl16 type KSLXX9, "Total of transactions - 16
end of ty_ZZPRODNT.
*-- Structure Declaration
* Structure for final file
data : x_file type ty_file,
* Structure for Product Ledger Summary table
x_ZZPRODNT type ty_ZZPRODNT,
* Structure for Functional Area to ACS line mapping
x_zfgl014 type zfgl014.
*-- Internal Table Declaration
* Table for records of Product Ledger Summary table
data : it_ZZPRODNT type table of ty_ZZPRODNT,
* Table for final file
it_file type table of ty_file,
* Table for Functional Area to ACS line mapping
it_zfgl014 type table of zfgl014.
*-- Method Declaration.
methods : get_data importing e_rldnr type ty_rldnr
e_ryear type ty_ryear
e_rpmax type ty_rpmax
e_glcomp type ty_glcomp
e_prctr type ty_prctr
e_prasn type ty_prasn
e_crpbd type ty_crpbd
exporting i_subrc type sy-subrc.
endclass. "lcl_tm1_intf DEFINITION
* CLASS lcl_tm1_intf IMPLEMENTATION
class lcl_tm1_intf implementation.
*-- Method get_data selects the North American Product Ledger Summary
* table data and then maps the Functional Area to ACS line to get
* the ACS line code
method get_data.
*-- Local Variable
DATA: L_ZZPRODNT TYPE TY_ZZPRODNT.
*-- Get the data from North American Product Ledger Summary table
select robukrs
racct
rcntr
rprctr
rfarea
rzzwbs_el
rzzwwz01
rzzwwz05
ksl01
ksl02
ksl03
ksl04
ksl05
ksl06
ksl07
ksl08
ksl09
ksl10
ksl11
ksl12
ksl13
ksl14
ksl15
ksl16
from zzprodnt
into table it_ZZPRODNT
where rldnr = e_rldnr
and ryear = e_ryear
and rpmax = e_rpmax
and ROBUKRS in e_glcomp
and RPRCTR in e_prctr
and RZZWWZ01 in e_prasn
and RZZWWZ05 in e_crpbd.
if sy-subrc = 0.
loop at it_ZZPRODNT into l_zzprodnt.
condense l_ZZPRODNT-rfarea no-gaps.
if l_ZZPRODNT-rfarea is initial.
delete it_ZZPRODNT.
endif.
endloop.
*-- Get the Functional Area to ACS line code mapping data
select *
from zfgl014
into table it_zfgl014
for all entries in it_ZZPRODNT
where fkber = it_ZZPRODNT-rfarea .
if sy-subrc = 0.
endif.
endif.
i_subrc = sy-subrc.
endmethod. "get_data
endclass. "lcl_tm1_intf IMPLEMENTATION
* INCLUDE ZFGLI00003_F01 *
* Table
tables : zzprodnt.
* Data Declaration
data : v_subrc type sy-subrc.
*& Form get_filename
* Description : This subroutine is used for F4 Prompting
form get_filename changing p_path like rlgrap-filename.
*-- Local variables
data : lv_file like ibipparms-path, "Local file for upload/download
lv_repid like syst-cprog, "ABAP program, caller in external
"procedures
lv_dynnr type syst-dynnr. "Current screen No
lv_repid = syst-cprog.
lv_dynnr = syst-dynnr.
*-- Function module used for F4 help
call function 'F4_FILENAME'
exporting
program_name = lv_repid
dynpro_number = lv_dynnr
importing
file_name = lv_file.
move lv_file to p_path.
endform. " get_filename
*& Form init_period
FORM init_period changing p_rpmax p_ryear.
if sy-datum+4(2) = 01.
p_rpmax = 12.
p_ryear = sy-datum+0(4) - 1.
else.
p_rpmax = sy-datum+4(2) - 1.
p_ryear = sy-datum+0(4).
endif.
ENDFORM. " init_period
Hope this helps.
Regards,
Richa
Similar Messages
-
Pull data from SQL Table and display it in mail
I have a requirement to pull the data from SQL table and send it in email. Currently I am sending the hard coded info in email but is it possible to pull some data from SQL Table and than format it and send it across in the same email?
Can you guide me with steps on this.
NeilThere are several ways to do this. First is to populate a file in a data flow and then send that as an attachment in the send mail task.
As far as including the results in the email body this becomes a bit trickier. To use a variable you would need to use an SSIS variable type of
Object, this is similar to a collection in .NET. The problem once the object is populated is that it isn't like a readable result set, but again more like an array or a collection. There is no native method to take the object variable and
specify .ToString() or cast its results as text. You would need to iterate through each row and append it to another variable of type string, this could be done with a script task or ForEach container.
Also you mentioned formatting the results. What type of formatting were you looking for. A limitation of the SMTP send mail task is that the message body doesn't support HTML so if you were looking at creating a table within the mail body you
would have to use a script task or a custom component
David Dye My Blog -
Select data from a table and a view: field with same content and different type
hi all,
I need data from a table hrp1001 and a view V_USR_NAME. What they have in common are the content of the fields SOBID and BNAME .
It will be easier if those fields add a same type but they dont.
Any suggestions for a workaround?
ThanksHi Ramesh,
Specify the date format as YYYYMMDD in where condition.
Dates are internally stored in SAP as YYYYMMDD only.
Change your date format in WHERE condition as follows.
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and bdatu = <b>'99991231'.</b>
I doubt check your data base table EQUK on this date for the existince of data.
Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and <b> bdatu <= '99991231'.</b>
Thanks,
Vinay
Thanks,
Vinay -
How do I retrieve all data from a table and display it on a text area?
I want to retrieve all the data from one of my MS Access data table and display them all in a text area. how do i go among doing this?
In my car table i have the fields lined up like this..
license,color,doors and year_made
I have an Object class called CAR that will contain methods to set the data from these fields when it gets retrieved.
here's what i go so far.....
statement = getDBConnection().createStatement();
rs = statement.executeQuery("select * from car");
boolean moreRS = rs.next();
if(moreRS)
car.setLicense(rs.getLong(1));
car.setColor(rs.getString(2));
car.setDoors(rs.getString(3));
car.setYearMade(rs.getString(4));
//but this will only get me one car. How do I get more car data?
HELP!!Vector cars = new Vector();
while (rs.next()) {
String license = rs.getLong(1);
String color = rs.getLong(2);
String doors = rs.getLong(3);
String year = rs.getLong(4);
myTextArea.append(license+"\t"+color+"\t"+doors+"\t"+year+"\n");
Car car = new Car();
car.setLicense(license);
car.setColor(color);
car.setDoors(doors);
car.setYearMade(year);
cars.add(car);
}t=tab
n=newline
Vector: http://java.sun.com/j2se/1.4.1/docs/api/java/util/Vector.html -
Fetching data from a table and displaying it on the text box
Hi,
I have created a dialog program in which created a container(text box) to enter data upto 1000 characters.
Iam capturing the data and storing it in a custom table. In PBO I want to fetch data from my custom table (if data is already present :1000 characters data) and display it on screen.
Please let me know how do i do it?hii Pavani,
declare this two sttements in Screen
MODULE STATUS_DATA.
MODULE SELECT_DATA.
In PBO, Under SELECT_DATA write Select query like:
(considering the DB field to be text and Screen Field to be SC_TEXT)
select text from <DB Table> into SC_TEXT where <condition>.
*note if u r selecting more than one field than write fields in ( ),eg. (f1....f2) )
Plz let me know for any further queries.
Regards,
Apoorv -
Error while selecting date from external table
Hello all,
I am getting the follwing error while selecting data from external table. Any idea why?
SQL> CREATE TABLE SE2_EXT (SE_REF_NO VARCHAR2(255),
2 SE_CUST_ID NUMBER(38),
3 SE_TRAN_AMT_LCY FLOAT(126),
4 SE_REVERSAL_MARKER VARCHAR2(255))
5 ORGANIZATION EXTERNAL (
6 TYPE ORACLE_LOADER
7 DEFAULT DIRECTORY ext_tables
8 ACCESS PARAMETERS (
9 RECORDS DELIMITED BY NEWLINE
10 FIELDS TERMINATED BY ','
11 MISSING FIELD VALUES ARE NULL
12 (
13 country_code CHAR(5),
14 country_name CHAR(50),
15 country_language CHAR(50)
16 )
17 )
18 LOCATION ('SE2.csv')
19 )
20 PARALLEL 5
21 REJECT LIMIT UNLIMITED;
Table created.
SQL> select * from se2_ext;
SQL> select count(*) from se2_ext;
select count(*) from se2_ext
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04043: table column not found in external source: SE_REF_NO
ORA-06512: at "SYS.ORACLE_LOADER", line 19It would appear that you external table definition and the external data file data do not match up. Post a few input records so someone can duplicate the problem and determine the fix.
HTH -- Mark D Powell -- -
How to select data from a table using a date field in the where condition?
How to select data from a table using a date field in the where condition?
For eg:
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and bdatu = '31129999'.
thanks.Hi Ramesh,
Specify the date format as YYYYMMDD in where condition.
Dates are internally stored in SAP as YYYYMMDD only.
Change your date format in WHERE condition as follows.
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and bdatu = <b>'99991231'.</b>
I doubt check your data base table EQUK on this date for the existince of data.
Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and <b> bdatu <= '99991231'.</b>
Thanks,
Vinay
Thanks,
Vinay -
How to select data from a table by passing document number from another tab
How to select data from a table by passing document number from another table.
for eg:-
I want to display name, adres, region from ADRC table
by using field delivery document number
Kind Regards,
Shanbagavalli.SHi Shanbagavalli,
There are multiple solutions to this questions a few i will try to answer and then you can take the best required for your requirements.
**Consider that you have a Internal table having document number from other table..
SELECT NAME ADRES REGION FROM ADRC
INTO IT_ADRC
FOR ALL ENTRIES IN IT_DOC
WHERE DOCUMENT_NO = IT_DOC-DOCUMENT_NO.
**Consider that you have 1 document number then
SELECT NAME ADRES REGION FROM ADRC
INTO IT_ADRC
WHERE DOCUMENT_NO = W_DOCUMENT_NO.
Hope this solves your problem.
Regards,
Kunjal -
Select data from two tables...!
HI Experts...!
i m a beginner user and i want to select data from two tables proj and prps.....using joins.....and internal tables i have written a code...
SELECT prps~pspnr
prps~objnr
prps~psphi
proj~ernam
proj~erdat
proj~pspnr
INTO table itab -
itab is internal table
FROM prps inner join proj
WHERE pspnr in p_no and prpspsphi = projpspnr.
but there is error in from clause ..please help me....
Advance thanx....Hi,
check the sample code bellow above two reply will solve out your problem but one more extra line in your code pointed out bellow.
TABLES: prps, proj.
TYPES: BEGIN OF ty_test,
pspnr LIKE prps-pspnr,
objnr LIKE prps-objnr,
psphi LIKE prps-psphi,
ernam LIKE proj-ernam,
erdat LIKE proj-erdat,
END OF ty_test.
DATA: itab TYPE STANDARD TABLE OF ty_test WITH HEADER LINE.
SELECT-OPTIONS: p_no FOR prps-pspnr.
SELECT prps~pspnr
prps~objnr
prps~psphi
proj~ernam
proj~erdat
* proj~pspnr " No need for this you have selected this in
* the first line because it is commone so you only need to select from any one
INTO TABLE itab
FROM prps INNER JOIN proj ON ( prps~pspnr = proj~pspnr )
WHERE prps~pspnr IN p_no.
Best Regards,
Faisal
Edited by: Rob Burbank on Dec 24, 2009 12:24 PM -
Selecting data from two tables
I am trying to select data from two tables. The only problem that I am running into, is that i am only seeing results from my 'uploads' table. there is also a record in documents where user = 1 that should show up. here is my sql:
$userIDNum = 1;
$sql="Select *
from uploads, documents
WHERE uploads.user = documents.user AND uploads.user = $userIDNum
ORDER BY uploads.title ASC, documents.title ASC";You'll need to explain a little more about your data and what you are trying to accomplish. Your current sql will select all columns from both the uploads and documents tables but only rows where the user id in both tables match, AND the user id equals 1. Is that not what you are seeing? Where's the code that outputs the results?
-
How to select data from cluster table
hi experts,
I have a report which picks data from bseg (cluster table ) for a month report it is taking around 4 minutes to process.I feel it is not good when take the report after some months.
how to select data from these table???how to declare itab for these cluster tables????can we include any search condition or any other kind of internal table???
please advice.
maniHi Manikandan,
The following code may be helpful to understand how to select the data from cluster table.
Types: Begin of ty_kna1,
Kunnr type kna1-kunnr,
adrnr type kna1-adrnr,
end of ty_kna1,
begin of ty_bseg,
belnr type bseg-belnr,
kunnr type bseg-kunnr,
end of ty_bseg,
begin of ty_final,
belnr type bseg-belnr,
kunnr type kna1-kunnr,
adrnr type kna1-adrnr,
end of ty_final.
Data: it_kna1 type table of ty_kna1,
wa_kna1 type ty_kna1,
it_bseg type table of ty_bseg,
wa_bseg type ty_bseg,
it_final type table of ty_final,
wa_final type ty_final.
Select kunnr adrnr from kna1 into table it_kna1 where....
if sy-subrc = 0.
select belnr kunnr into table it_bseg for all entries in it_kna1 where kunnr = it_kna1-kunnr.
endif.
sort it_kna1 by kunnr.
Loop at it_bseg into wa_bseg.
move wa_bseg-belnr to wa_final-belnr.
read table it_kna1 into wa_kna1 with kunnr = wa_bseg-kunnr binary search.
if sy-subrc = 0.
move: wa_kna1-kunnr to wa_final-kunnr,
wa_kna1-belnr to wa_final-belnr.
endif.
append wa_final to it_final.
clear wa_final.
endloop.
Loop at it_final into wa_final.
write: / wa_final-belnr, wa_final-kunnr, wa_final-adrnr.
endloop.
Reward if useful.
Thankyou,
Regards. -
Procedure to insert data into table by selecting data from another table
Hi all,
I have to create a procedure where i have to select the data from one table and insert it into another table. Any help on this. And i have to update the 2nd table also when ever new records got inserted in the 1st table then.
RegardsHi, you can try something like:
CREATE [OR REPLACE] PROCEDURE procedure_name
IS
BEGIN
INSERT INTO TABLE1
VALUES (SELECT * FROM TABLE2);
END;
For the other part you may create a trigger on the first table AFTER INSERT to insert the values in the second table too. -
Extract data from database tables and download in pdf and csv
extract data from database tables and download in pdf and csv
hi how can i re-write my old form procedure in adf java. the procedure used to extract data from diffirent table and dowload the data in pdf and csv.am not downloading image, i what to extract data from diffirent tables in my database and download that data in pdf and csv. i would like to write this in java adf.i just what direction am not asking anyone to do my work this is my learning curve
the form code is
function merge_header3 return varchar2 is
begin
return '~FACILITY DESCRIPTION~ACCOUNT NO~BRANCH CODE~BANK REF NO.~P/P/ AMOUNT~Postal Address 1~Postal Address 2~Box Postal Code~Dep. Date~Month~BANK NAME~BRANCH NAME~ACCOUNT TYPE~DESCRIPTION~OBJECTIVE DESCRIPTION';
end;
procedure download_file (i_pbat integer) is
dir varchar2(80);
file_name1 varchar2(80);
file_name2 varchar2(80);
appl_code varchar2(80);
fil1 client_text_io.file_type;
fil2 client_text_io.file_type;
dat varchar2(1000);
DATA VARCHAR2(1000);
bvspro varchar2(100);
ssch varchar2(100);
bvspro_total number(20,2);
ssch_total number(20,2);
grand_total number(20,2);
cnt integer;
cursor pbat is
select *
from sms_payment_batches
where id = i_pbat
cursor pay (pb_id integer) is
select *
from sms_payment_vw
where pbat_id = pb_id
order by subsidy ASC,programme,beneficiary_name
cursor cgref (low varchar2) is
select *
from cg_ref_codes
where rv_domain ='SMS'
and rv_low_value = low
success boolean;
begin
set_application_property(cursor_style,'busy');
appl_code := sms_global.ref_code('SMS','APP_CODE','SMS',0);
dir := sms_global.ref_code('SMS','PAY_DIR','c:\sms\batch_payments',0);
success := webutil_file.create_directory(dir);
if webutil_file.file_is_directory(dir) then
null;
-- message ('directory exists');
else
-- message ('create directory ');
success := webutil_file.create_directory(dir);
-- if success then message ('directory exists'); end if;
end if;
for c_pbat in pbat loop
file_name1 := dir ||'\' || appl_code||c_pbat.batch_number||'-'||to_char(c_pbat.batch_dt,'yyyymmdd')||'pay.txt';
file_name2 := dir ||'\' || appl_code||c_pbat.batch_number||'-'||to_char(c_pbat.batch_dt,'yyyymmdd')||'merge.txt';
--message('create files ');
-- fil1 := client_text_io.fopen (file_name1,'W');
-- fil2 := client_text_io.fopen (file_name2,'W');
fil1 := client_text_io.fopen (file_name1,'W','');
fil2 := client_text_io.fopen (file_name2,'W','');
dat := 'FROM ACCOUNT NUMBER'
||'~'||'FROM ACCOUNT DESCRIPTION'
||'~'||'MY STATEMENT DESCRIPTION'
||'~'||'BENEFICIARY ACCOUNT NUMBER'
||'~'||'BENEFICIARY SUB ACCOUNT NUMBER'
||'~'||'BENEFICIARY BRANCH CODE'
||'~'||'BENEFICIARY NAME'
||'~'||'BENEFICIARY STATEMENT DESCRIPTION'
||'~'||'AMOUNT';
-- client_text_io.put_line(fil1,dat);
bvspro:= null;
ssch := null;
cnt := 0;
dat := '~'||lpad('~',16,'~');
for c_pay in pay(c_pbat.id) loop
--message('cpay loop ' || cnt);
if bvspro is null then
dat := lpad('~',16,'~');
dat := utility.put_field(1,c_pay.programme,dat,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,c_pay.subsidy,dat,'~');
client_text_io.put_line(fil2,dat);
dat := merge_header3;
client_text_io.put_line(fil2,dat);
bvspro := c_pay.programme;
ssch := c_pay.subsidy;
grand_total := 0;
bvspro_total := 0;
ssch_total := 0;
end if;
if bvspro <> c_pay.programme then
dat := lpad('~',16,'~');
dat := utility.put_field(5,ssch_total,dat,'~');
dat := lpad('~',16,'~');
dat := utility.put_field(5,bvspro_total,dat,'~');
dat := utility.put_field(1,'Total:' || bvspro,dat,'~');
client_text_io.put_line(fil2,dat);
dat := lpad('~',16,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,c_pay.programme,dat,'~');
client_text_io.put_line(fil2,dat);
bvspro := c_pay.programme;
dat := utility.put_field(1,c_pay.subsidy,dat,'~');
client_text_io.put_line(fil2,dat);
dat := merge_header3;
client_text_io.put_line(fil2,dat);
bvspro := c_pay.programme;
ssch := c_pay.subsidy;
bvspro_total := 0;
ssch_total := 0;
cnt :=0;
end if;
if ssch <> c_pay.subsidy then
dat := lpad('~',16,'~');
dat := utility.put_field(5,ssch_total,dat,'~');
dat := lpad('~',16,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,c_pay.subsidy,dat,'~');
client_text_io.put_line(fil2,dat);
dat := merge_header3;
client_text_io.put_line(fil2,dat);
ssch := c_pay.subsidy;
ssch_total := 0;
cnt :=0;
end if;
bvspro_total := bvspro_total + c_pay.amount;
ssch_total := ssch_total + c_pay.amount;
grand_total := grand_total + c_pay.amount;
cnt := cnt +1;
--message('bfore write file 2 ' );
client_text_io.put_line(fil2
,cnt
||'~'|| c_pay.beneficiary_name
||'~'||c_pay.BENEFICIARY_ACCOUNT_NUMBER ||''
||'~'||c_pay.BRANCH_CODE ||''
||'~'|| c_pay.BENEFICIARY_STATEMENT_DESC
||'~'|| c_pay.AMOUNT
||'~'|| c_pay.address_line1
||'~'|| c_pay.address_line2
||'~'|| c_pay.postal_code
||'~'|| TO_CHAR(c_pay.deposit_date,'DD-Mon-YYYY')
||'~'|| c_pay.month
||'~'|| c_pay.bank
||'~'|| c_pay.bank_branch
||'~'|| c_pay.account_type
||'~'|| c_pay.subsidy
||'~'|| c_pay.programme)
DATA := c_pay.FROM_ACCOUNT_NUMBER
||'~'||c_pay.FROM_ACCOUNT_DESCR
||'~'||c_pay.MY_STATEMENT_DESCR
||'~'||c_pay.BENEFICIARY_ACCOUNT_NUMBER
||'~'
||'~'||c_pay.BRANCH_CODE
||'~'||c_pay.BENEFICIARY_NAME
||'~'||c_pay.BENEFICIARY_STATEMENT_DESC
||'~'||c_pay.AMOUNT;
DATA := REPLACE(DATA, ',' , ' ' );
DATA := REPLACE(DATA, '~' , ',' );
--message (cnt ||' ' || data);
--message('bfore write file 1 ' );
client_text_io.put_line(fil1, data);
end loop;
--message ('end of write');
dat := lpad('~',16,'~');
dat := utility.put_field(6,ssch_total,dat,'~');
dat := lpad('~',16,'~');
dat := utility.put_field(1,'Total:' || bvspro,dat,'~');
dat := utility.put_field(5,bvspro_total,dat,'~');
client_text_io.put_line(fil2,dat);
dat := lpad('~',16,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,'Grand Total:' ,dat,'~');
dat := utility.put_field(5,grand_total,dat,'~');
client_text_io.put_line(fil2,dat);
-- close file
for i in 1..50 loop
if substr(i,-1) = 0 then
message ('flush ' || i);
end if;
client_text_io.put_line(fil1, lpad(' ',2000));
client_text_io.put_line(fil2, lpad(' ',2000));
client_text_io.put_line(fil1, lpad(' ',2000));
client_text_io.put_line(fil2, lpad(' ',2000));
end loop;
client_text_io.fclose(fil1);
client_text_io.fclose(fil2);
end loop;
set_application_property(cursor_style,'default');
exception
when others then
message(sqlcode ||' ' ||sqlerrm);
end download_file; i try this but this code onlydownload image not data from database tables
public void downloadImage(FacesContext facesContext, OutputStream outputStream)
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
// get an ADF attributevalue from the ADF page definitions
AttributeBinding attr = (AttributeBinding) bindings.getControlBinding("DocumentImage");
if (attr == null)
return;
// the value is a BlobDomain data type
BlobDomain blob = (BlobDomain) attr.getInputValue();
try
{ // copy the data from the BlobDomain to the output stream
IOUtils.copy(blob.getInputStream(), outputStream);
// cloase the blob to release the recources
blob.closeInputStream();
// flush the output stream
outputStream.flush();
catch (IOException e)
// handle errors
e.printStackTrace();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), "");
FacesContext.getCurrentInstance().addMessage(null, msg);
}You should ask your forum in the ADF-forum.
-
How to retrieve data from catsdb table and convert into xml using BAPI
How to retrieve data from catsdb table and convert into xml using BAPI
Points will be rewarded,
Thank you,
Regards,
Jagrut BharatKumar ShuklaHi,
This is not your requirment but u can try this :
CREATE OR REPLACE DIRECTORY text_file AS 'D:\TEXT_FILE\';
GRANT READ ON DIRECTORY text_file TO fah;
GRANT WRITE ON DIRECTORY text_file TO fah;
DROP TABLE load_a;
CREATE TABLE load_a
(a1 varchar2(20),
a2 varchar2(200))
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER
DEFAULT DIRECTORY text_file
ACCESS PARAMETERS
(FIELDS TERMINATED BY ','
LOCATION ('data.txt')
select * from load_a;
CREATE TABLE A AS select * from load_a;
SELECT * FROM A
Regards
Faheem Latif -
Import data from few tables and export into the same tables on different db
I want to import data from few tables and export into the same tables on different database. But on the target database, additional columns have been added
to the same tables. how can i do the import?
Its urgent can anyone please help me do this?
Thanks.Hello Junior DBA,
maybe try it with the "copy command".
http://download.oracle.com/docs/cd/B14117_01/server.101/b12170/apb.htm
Have a look at the section "Understanding COPY Command Syntax".
Here is an example of a COPY command that copies only two columns from the source table, and copies only those rows in which the value of DEPARTMENT_ID is 30:Regards
Stefan
Maybe you are looking for
-
Purchase order and supplier details?
tables to included for listing purchase order details and the secondary list of information about supplier
-
Certain drawing or annotation tools cause adobe to crash - what can I do to fix this?
When I try to use certain drawing or annotation tools Adobe crashes. Why? What can I do to fix this?
-
Hi people, We would like to have the transaction CKM3 in mass (many materials). I know there are some SAP Note to apply to get the program, but at this moment I couldn´t find. Could you help me please? Thanks, Rosana.
-
Exporting Reports to multiple excel sheets
Hello experts, Our client has a requirement = There are four reports on one dashboard. the client wants export to excel links for each report. He also wants one separate export button. and when a user clicks this button, all the four reports should b
-
Itunes doesnt detect music, even though the file wasnt moved or changed
hi guys my itunes is annoying the **** out of me.... for some reason i get teh exclamation point next to my song files even though i never changed or move the actual song file.... is it because i have too many songs in the folder? is there like a pro