Select double * from database table?
Hi,
See the entries in the following database table.
TABLE1
F1 -- F2 -- F3 -- F4 -- F5 etc..,
AB 12 de effd 32e
CD 34 fr wref 45fr
EF 34 rfr wfrf wfwrf
Here I need to get the two values of F1 field. Those are AB and CD into two separate variables.
How can get these two values in to two variables with out DECLARING INTERNAL TABLE and with ONE SELECT QUERY?
--Naveen Inuganti.
Hi ,
Check the code , it will resolve the issue --
DATA : w_variable2 TYPE scarr-carrid,
w_variable1 TYPE scarr-carrid .
SELECT carrid UP TO 2 ROWS FROM scarr
INTO w_variable2 .
MOVE w_variable2 TO w_variable1.
ENDSELECT.
WRITE : w_variable1, w_variable2.
From your reference I created single silect query without internel table - -
DATA : w_variable2 TYPE dbtable-f1,
w_variable1 TYPE dbtable-f1 .
SELECT F1 UP TO 2 ROWS FROM dbtable
INTO w_variable2 .
MOVE w_variable2 TO w_variable1.
ENDSELECT.
WRITE : w_variable1, w_variable2.
Regards
Pinaki
Similar Messages
-
Select data from database tables with high performance
hi all,
how to select data from different database tables with high performance.
im using for all entries instead of inner joins, even though burden on data base tables is going very high ( 90 % in se30)
hw to increase the performance.
kindly, reply.
thnksAlso Check you are not using open sql much like distict order by group by , use abap techniques on internal table to acive the same.
also Dont use select endselect.
if possible use up to n rows claus....
taht will limit the data base hits.
also dont run select in siode any loops.
i guess these are some of the trics oyu can use to avoid frequent DATA BASE HITS AND ABVOID THE DATA BASE LAOD. -
Select record from database table
how to select a record from data-base table for current month in module-pool, i.e if current month is august then records selected should between 1/08/10 to 31/08/10.
And, i also want to select records for last month i.e if current month is august then records selected should be between 1/07/10 to 31/07/10.
And one thing more, it should work for every scenario. Like for months are changing then it should work according to that.
Example: If month changes to October then current month ll be October and last month ll become September.
Plz help me out.
Moderator message: you chose a better forum this time, but the question is still too basic to be asked here, please (re)search yourself first, these forums are not catering to beginners.
locked by: Thomas Zloch on Aug 8, 2010 9:41 PMHi Nishant,
You can use the option <b>ORDER BY </b> in your SELECT clause.
This is the SAP Documentation for <b>ORDER BY </b> option.
<i>Variant 1</i>
<b>...ORDER BY PRIMARY KEY</b>
<b>Effect</b>
Sorts the selected lines in ascending order by the primary key of the database table. This variant is only permitted for SELECT * ....
<i>Notes</i>
Since views do not have a primary key, specifying ORDER BY PRIMARY KEY only makes sense with database tables. If, however, you do specify ORDER BY PRIMARY KEY with a view, all fields of the view are sorted in ascending order.
<i>Variant 2</i>
<b>ORDER BY f1 ... fn</b>
<i>Effect</i>
Sorts the selected records in ascending order by the specified column references f1 ... fn. If a list is also specified in the SELECT clause, the column references f1, ..., fn must appear in this list.
By supplementing the statement with DESCENDING, you can sort in descending order using any of the fields f1, ..., fn.
The default sort sequence is ascending order, but you can make this explicit by adding the addition ASCENDING.
Consider this code this will select the latest 10 records form DB table(Note can use <b>Variant 2</b> for DB tables also.
REPORT zarun_1.
DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE.
START-OF-SELECTION.
SELECT * FROM mara
INTO TABLE it_mara
<b>UP TO 10 ROWS "No of rows you need(give 1 here)
ORDER BY matnr DESCENDING. "Specify the Key Fields here.</b>
LOOP AT it_mara.
WRITE : / it_mara-matnr,
it_mara-mtart.
ENDLOOP.
Regards,
Arun Sambargi.
Message was edited by: Arun Sambargi -
Dynamic record deletion from database table
Hi,
I need to delete selected records from database table(dynamic names). Table names are being passed from main program with some of their field names. The record to be deleted from the database table is being decided based on the fields passed for the table and their contains passed from the main program.
It is not possible to write dynamic where clause for DELETE statement directly.
So, I created a dynamic internal table and i am trying to fetch all records using SELECT statement(for which we can write dynamic where condition, something like...SELECT...WHERE (itab). ) which need to be deleted in the iternal table.
Piece of code :
CONCATENATE c_im v_tablefield1 INTO v_imprtfield1.
CONCATENATE v_tablefield1 c_in v_imprtfield1
into s_condition separated by space.
APPEND s_condition TO t_condition.
PERFORM GET_DYNAMIC_ITAB USING s_flds_agtab-tabname
changing t_itab.
ASSIGN t_itab->* TO <itab>.
*Select the data (to be deleted) from the database table
SELECT * FROM (s_flds_agtab-tabname) INTO TABLE <itab>
WHERE (t_condition).
*Delete the records from the table
IF SY-SUBRC = 0.
DELETE (s_flds_agtab-tabname) FROM TABLE <itab>.
ENDIF.
Here t_condition is of standard table of WHERETXT.
t_condition at the run time before giving dump was:
SPART IN IM_SPART
AND KUNNR IN IM_KUNNR
Here IM_SPART is renge type of SPART and IM_KUNNR is renge of KUNNR.
I am getting a DUMP:
The WHERE condition has an unexpected format.
Error analysis
The current ABAP/4 program attempted to execute an ABAP/4 Open SQL
statement containing a WHERE condition of the form WHERE (itab) or
WHERE ... AND (itab). The part of the WHERE condition specified at
runtime in the internal table itab contains the operator
IN (v1, ..., vn)
in incomplete form.
How to correct the error
If the error occurred in a non-modified SAP program, you may be
able to find a solution in the SAP note system.
If you have access to the note system yourself, use the following
search criteria:
"SAPSQL_IN_ILLEGAL_LIST"
"SAPLZSD_TAB_REFRESH " or "LZSD_TAB_REFRESHU01 "
"Z_SD_REFRESH_AGTABLES"
If you cannot solve the problem yourself, please send the
following documents to SAP:
I would like to know whether "IN" operator is allowed in (itab) of WHERE clause. While testing I changed the "IN" to "=" specifying a suitable value there. It worked. So please let me know if i can give "IN" operator using renge table in the dynamic where clause.
Thanking you,
SuryaHi again, so if you can not use the IN in a dynamic where clause you might be forced to dynamically build the entire select statement, Here is a sample program which may give you some ideas, notice that we are writing the select statement code, putting it in another program and generating the subroutine at runtime, then call this routine. I'm sure that this will help you see what you need to do.
report zrich_0003 .
tables: kna1.
types: t_source(72).
data: routine(32) value 'DYNAMIC_SELECT',
program(8),
message(128),
line type i.
data: isource type table of t_source,
xsource type t_source.
ranges:
r_kunnr for kna1-kunnr.
data: ikna1 type table of kna1.
data: xkna1 type kna1.
r_kunnr-sign = 'I'.
r_kunnr-option = 'EQ'.
r_kunnr-low = '0001000500'.
append r_kunnr.
xsource = 'REPORT ZTEMP.'.
insert xsource into isource index 1.
xsource = 'FORM dynamic_select'.
insert xsource into isource index 2.
xsource = 'Tables r_kunnr ikna1.'.
append xsource to isource.
xsource = 'select * into table ikna1 from kna1'.
append xsource to isource.
xsource = 'where kunnr in r_kunnr.'.
append xsource to isource.
xsource = 'ENDFORM.'.
append xsource to isource.
generate subroutine pool isource name program
message message
line line.
if sy-subrc = 0.
perform (routine) in program (program) tables r_kunnr
ikna1.
else.
write:/ message.
endif.
loop at ikna1 into xkna1.
write:/ xkna1-kunnr.
endloop.
Regards,
Rich Heilman -
Dear all experts,
I am able to populate all fields data from database table, using dynamic table creation.
eg,
SELECT * FROM (w_tabname) INTO TABLE <t_itab>.
where w_tabname is the table name given by the user, and t_itab is field symbol.
but some requirement is like that i need to pick up only few fields, <b>which user will give at the runtime.</b>
<b>I can</b> take those fields from file into any internal table,
but the problem is that instead of <b>select *</b>, i need to put selected the fields given by user.
i have tried with field symbol, it is not working (as per my knowledge.)
do i need to create any structures dynamically ?
Can anybody please help in this regards ?
Your help will be surely rewarded with points.
Waiting for reply..
Regards
VinayHi Vinay ,
Adding to the below code , you can use some more fields in the select stmt as below:-
REPORT ychatest.
PARAMETERS : p_field1 LIKE dd03l-fieldname,
P_field2 LIKE dd03l-fieldname,
p_table LIKE dd03l-tabname.
FIELD-SYMBOLS : <fs> TYPE STANDARD TABLE.
SELECT (p_field1) (p_field2) ( FROM (p_table) INTO TABLE <fs>.
Now p_field1 & p_field2 belong to the same table since you have give the user to enter only one table name.
This should work fine.
please try & let me know .
Thanks & Regards,
Daniel -
How to get string value from database table using Visual Studio 2005?
Hi,
Im developing plugin in illustrator cs3 using visual studio 2005. I need to get the values eneterd in database. Im able to get the integer values. But while getting string values it is returning empty value.
Im using the below code to get the values from database table
bool Table::Get(char* FieldName,int& FieldValue)
try
_variant_t vtValue;
vtValue = m_Rec->Fields->GetItem(FieldName)->GetValue();
FieldValue=vtValue.intVal;
CATCHERRGET
sprintf(m_ErrStr,"Success");
return 1;
Im using the below code to get the values.
AIErr getProjects()
char buf[5000];
int i;
std::string catName;
::CoInitialize(NULL);
Database db;
Table tbl;
errno_t err;
err = fopen(&file,"c:\\DBResult.txt","w");
fprintf(file, "Before Connection Established\n");
//MessageBox(NULL,CnnStr,"Connection String",0);
if(!db.Open(g->username,g->password,CnnStr))
db.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
fprintf(file, "After Connection Established\n");
if(!db.Execute("select ProjectID,ProjectName from projectsample",tbl))
db.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
int ProjectID;
int UserID;
int ProjectTitle;
char ProjectName[ProjectNameSize];
if(!tbl.ISEOF())
tbl.MoveFirst();
ProjectArrCnt=0;
for(i=0;i<128;i++)
buf[i]='\0';
int j=0;
while(!tbl.ISEOF())
if(tbl.Get("ProjectID",ProjectID))
fprintf(file,"Project ID: %d ",ProjectID);
ProjectInfo[ProjectArrCnt].ProjectID = ProjectID;
sprintf(buf,"%d",ProjectID);
//MessageBox(NULL, buf,"f ID", 0);
j++;
else
tbl.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
break;
//if(tbl.Get("ProjectTitle",ProjectName))
if(tbl.Get("ProjectName",ProjectName))
MessageBox(NULL,"Inside","",0);
fprintf(file,"ProjectTitle: %s\n",ProjectName);
//catName=CategoryName;
ProjectInfo[ProjectArrCnt].ProjectName=ProjectName;
//sprintf(buf,"%s",ProjectName);
MessageBox(NULL,(LPCSTR)ProjectName,"",0);
else
tbl.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
break;
ProjectArrCnt++;
//MessageBox(NULL, "While", "WIN API Test",0);
tbl.MoveNext();
//MessageBox(NULL, ProjectInfo[i].ProjectName.c_str(),"f Name", 0);
::CoUninitialize();
//sprintf(buf,"%s",file);
//MessageBox(NULL,buf,"File",0);
fprintf(file, "Connection closed\n");
fclose(file);
for(i=0;i<ProjectArrCnt;i++)
sprintf(buf,"%i",ProjectInfo[i].ProjectID);
//MessageBox(NULL,buf,"Proj ID",0);
//MessageBox(NULL,ProjectInfo[i].ProjectName.c_str(),"Project Name",0);
return 0;
In the above code im geeting project D which is an integer value. But not able to get the project name.
Please some one guide me.As I said in the other thread, this really isn't the place to ask questions about a database API unrelated to the Illustrator SDK. You're far more like to find people familliar with your problem on a forum that is dedicated to answering those kinds of questions instead.
-
Reconciilation from database table
Hi I have to reconcile data from database table. I am using OIM 10g and Oracle 11g R2.
I have created one GTC for Database Tables. And able to run th scheduled task for it.
Table name: recondb
there is one record present in table.but i saw on OIM server log it says no records.
Not able to figure out what is the problem.
log:
DEBUG,07 Mar 2011 13:51:02,678,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/initialize entered.
DEBUG,07 Mar 2011 13:51:02,695,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/initialize - Data: driver - Value: oracle.jdbc.driver.OracleDriver
DEBUG,07 Mar 2011 13:51:02,696,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/initialize - Data: url - Value: jdbc:oracle:thin:@10.88.176.155:1521:TRAININ
DEBUG,07 Mar 2011 13:51:02,697,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/initialize - Data: username - Value: oimuserpc
DEBUG,07 Mar 2011 13:51:02,699,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/initialize - Data: password - Value: *******
DEBUG,07 Mar 2011 13:51:02,700,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/initialize - Data: customizedQueries - Value:
DEBUG,07 Mar 2011 13:51:02,702,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/initialize - Data: useNativeQuery - Value: false
DEBUG,07 Mar 2011 13:51:02,704,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/initialize - Data: parentContainerName - Value: recondb
DEBUG,07 Mar 2011 13:51:02,705,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/convertCSVToArraylist entered.
DEBUG,07 Mar 2011 13:51:02,707,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/convertCSVToArraylist: providerParams:
DEBUG,07 Mar 2011 13:51:02,709,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/convertCSVToArraylist left.
DEBUG,07 Mar 2011 13:51:02,712,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/initialize - Data: childContainerTableNames - Value: []
DEBUG,07 Mar 2011 13:51:02,713,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/initialize - Data: parentContainerUniqueKey - Value: userid
DEBUG,07 Mar 2011 13:51:02,715,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/initialize - Data: incrementalReconAttribute - Value:
DEBUG,07 Mar 2011 13:51:02,756,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/initialize - Data: dbDateFormat - Value: yyyy/MM/dd hh:mm:ss z
DEBUG,07 Mar 2011 13:51:02,756,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/initialize left.
DEBUG,07 Mar 2011 13:51:02,769,[OIMCP.DATC],Class/Method: DBFacade/getConnectio
Prop entered.
DEBUG,07 Mar 2011 13:51:02,837,[OIMCP.DATC],Class/Method: DBFacade/getClumns -
ata: Columns: - Value: [com.thortech.xl.gc.impl.common.Column@1a15f06, com.tho
tech.xl.gc.impl.common.Column@1658cfb, com.thortech.xl.gc.impl.common.Column@ad
5b, com.thortech.xl.gc.impl.common.Column@1c0c692, com.thortech.xl.gc.impl.comm
n.Column@12cc218, com.thortech.xl.gc.impl.common.Column@17ae572, com.thortech.x
.gc.impl.common.Column@16db297, com.thortech.xl.gc.impl.common.Column@e7ebba]
DEBUG,07 Mar 2011 13:51:02,849,[OIMCP.DATC],Class/Method: DBFacade/getPrimaryKe
s - Data: Primary Keys - Value: []
DEBUG,07 Mar 2011 13:51:02,850,[OIMCP.DATC],Class/Method: DBFacade/getSchema -
ata: Parent Unique Key: - Value: [USERID]
DEBUG,07 Mar 2011 13:51:02,851,[OIMCP.DATC],Class/Method: DBReconTransportProvi
er/getFirstPage - Data: Filter Query - Value:
DEBUG,07 Mar 2011 13:51:02,861,[OIMCP.DATC],Class/Method: DBFacade/getRecord -
ata: SQL - Value: select * from oimuserpc.recondb
DEBUG,07 Mar 2011 13:51:02,881,[OIMCP.DATC],Class/Method: DBFacade/getRecord -
ata: startpage - Value: -1
DEBUG,07 Mar 2011 13:51:02,882,[OIMCP.DATC],Class/Method: DBFacade/getRecord -
ata: endpage - Value: -1
DEBUG,07 Mar 2011 13:51:02,883,[OIMCP.DATC],Class/Method: DBFacade/getRecord -
ata: Number of records - Value: 0I got Null Pointer Exception after User Password. I have checked mapping of Pasword field its correct.
Here is log:
DEBUG,08 Mar 2011 10:20:03,097,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/initialize entered.
DEBUG,08 Mar 2011 10:20:03,103,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/initialize - Data: driver - Value: oracle.jdbc.driver.OracleDriver
DEBUG,08 Mar 2011 10:20:03,103,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/initialize - Data: url - Value: jdbc:oracle:thin:@10.88.176.155:1521:TRAINING
DEBUG,08 Mar 2011 10:20:03,104,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/initialize - Data: username - Value: oimuserpc
DEBUG,08 Mar 2011 10:20:03,106,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/initialize - Data: password - Value: *******
DEBUG,08 Mar 2011 10:20:03,107,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/initialize - Data: customizedQueries - Value:
DEBUG,08 Mar 2011 10:20:03,109,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/initialize - Data: useNativeQuery - Value: false
DEBUG,08 Mar 2011 10:20:03,109,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/initialize - Data: parentContainerName - Value: recondb
DEBUG,08 Mar 2011 10:20:03,110,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/convertCSVToArraylist entered.
DEBUG,08 Mar 2011 10:20:03,111,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/convertCSVToArraylist: providerParams:
DEBUG,08 Mar 2011 10:20:03,112,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/convertCSVToArraylist left.
DEBUG,08 Mar 2011 10:20:03,114,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/initialize - Data: childContainerTableNames - Value: []
DEBUG,08 Mar 2011 10:20:03,115,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/initialize - Data: parentContainerUniqueKey - Value: userid
DEBUG,08 Mar 2011 10:20:03,116,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/initialize - Data: incrementalReconAttribute - Value:
DEBUG,08 Mar 2011 10:20:03,154,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/initialize - Data: dbDateFormat - Value: yyyy/MM/dd hh:mm:ss z
DEBUG,08 Mar 2011 10:20:03,154,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/initialize left.
DEBUG,08 Mar 2011 10:20:03,164,[OIMCP.DATC],Class/Method: DBFacade/getConnection
Prop entered.
DEBUG,08 Mar 2011 10:20:03,425,[OIMCP.DATC],Class/Method: DBFacade/getClumns - D
ata: Columns: - Value: [com.thortech.xl.gc.impl.common.Column@126232b, com.thor
tech.xl.gc.impl.common.Column@cef542, com.thortech.xl.gc.impl.common.Column@147e
045, com.thortech.xl.gc.impl.common.Column@1d4d4b8, com.thortech.xl.gc.impl.comm
on.Column@1d99597, com.thortech.xl.gc.impl.common.Column@1ebf294, com.thortech.x
l.gc.impl.common.Column@1831114, com.thortech.xl.gc.impl.common.Column@1d67244]
DEBUG,08 Mar 2011 10:20:03,460,[OIMCP.DATC],Class/Method: DBFacade/getPrimaryKey
s - Data: Primary Keys - Value: []
DEBUG,08 Mar 2011 10:20:03,461,[OIMCP.DATC],Class/Method: DBFacade/getSchema - D
ata: Parent Unique Key: - Value: [USERID]
DEBUG,08 Mar 2011 10:20:03,463,[OIMCP.DATC],Class/Method: DBReconTransportProvid
er/getFirstPage - Data: Filter Query - Value:
DEBUG,08 Mar 2011 10:20:03,473,[OIMCP.DATC],Class/Method: DBFacade/getRecord - D
ata: SQL - Value: select * from oimuserpc.recondb
DEBUG,08 Mar 2011 10:20:03,541,[OIMCP.DATC],Class/Method: DBFacade/getRecord - D
ata: startpage - Value: -1
DEBUG,08 Mar 2011 10:20:03,542,[OIMCP.DATC],Class/Method: DBFacade/getRecord - D
ata: endpage - Value: -1
DEBUG,08 Mar 2011 10:20:03,543,[OIMCP.DATC],Class/Method: DBFacade/getRecord - D
ata: Number of records - Value: 1
DEBUG,08 Mar 2011 10:20:03,721,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName entered.
DEBUG,08 Mar 2011 10:20:03,722,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName - Data: attr src - Value: User Profile Data
DEBUG,08 Mar 2011 10:20:03,723,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName - Data: display name - Value: Email
DEBUG,08 Mar 2011 10:20:03,724,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName left.
DEBUG,08 Mar 2011 10:20:03,730,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName entered.
DEBUG,08 Mar 2011 10:20:03,730,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName - Data: attr src - Value: User Profile Data
DEBUG,08 Mar 2011 10:20:03,732,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName - Data: display name - Value: First Name
DEBUG,08 Mar 2011 10:20:03,733,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName left.
DEBUG,08 Mar 2011 10:20:03,737,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName entered.
DEBUG,08 Mar 2011 10:20:03,738,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName - Data: attr src - Value: User Profile Data
DEBUG,08 Mar 2011 10:20:03,740,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName - Data: display name - Value: User Login
DEBUG,08 Mar 2011 10:20:03,741,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName left.
DEBUG,08 Mar 2011 10:20:03,745,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName entered.
DEBUG,08 Mar 2011 10:20:03,745,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName - Data: attr src - Value: User Profile Data
DEBUG,08 Mar 2011 10:20:03,746,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName - Data: display name - Value: Xellerate Type
DEBUG,08 Mar 2011 10:20:03,747,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName left.
DEBUG,08 Mar 2011 10:20:03,751,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName entered.
DEBUG,08 Mar 2011 10:20:03,751,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName - Data: attr src - Value: User Profile Data
DEBUG,08 Mar 2011 10:20:03,753,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName - Data: display name - Value: Role
DEBUG,08 Mar 2011 10:20:03,754,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName left.
DEBUG,08 Mar 2011 10:20:03,758,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName entered.
DEBUG,08 Mar 2011 10:20:03,759,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName - Data: attr src - Value: User Profile Data
DEBUG,08 Mar 2011 10:20:03,760,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName - Data: display name - Value: Organization Name
DEBUG,08 Mar 2011 10:20:03,761,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName left.
DEBUG,08 Mar 2011 10:20:03,765,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName entered.
DEBUG,08 Mar 2011 10:20:03,765,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName - Data: attr src - Value: User Profile Data
DEBUG,08 Mar 2011 10:20:03,766,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName - Data: display name - Value: User Password
DEBUG,08 Mar 2011 10:20:03,767,[XELLERATE.JAVACLIENT],Class/Method: tcAttributeS
ource/getAttrColumnName left.
ERROR,08 Mar 2011 10:20:03,770,[XELLERATE.APIS],Class/Method: tcReconciliationOp
erationsBean/ignoreEventData encounter some problems: {1}
java.lang.NullPointerException
at com.thortech.xl.dataobj.util.tcAttributeSource.getAttrColumnName(Unkn
own Source)
at com.thortech.xl.dataobj.util.tcReconciliationUtil.getRuleElementWhere
(Unknown Source)
at com.thortech.xl.dataobj.util.tcReconciliationUtil.getRuleWhere(Unknow
n Source)
at com.thortech.xl.dataobj.util.tcReconciliationUtil.getMatchedUserList(
Unknown Source)
at com.thortech.xl.dataobj.util.tcReconciliationUtil.getMatchedUserList(
Unknown Source)
at com.thortech.xl.dataobj.util.tcReconciliationUtil.ignoreEvent(Unknown
Source)
at com.thortech.xl.ejb.beansimpl.tcReconciliationOperationsBean.ignoreEv
entData(Unknown Source)
at com.thortech.xl.ejb.beansimpl.tcReconciliationOperationsBean.ignoreEv
ent(Unknown Source)
at com.thortech.xl.ejb.beans.tcReconciliationOperationsSession.ignoreEve
nt(Unknown Source)
at com.thortech.xl.ejb.beans.tcReconciliationOperations_gmh3ba_EOImpl.ig
noreEvent(tcReconciliationOperations_gmh3ba_EOImpl.java:546)
at Thor.API.Operations.tcReconciliationOperationsClient.ignoreEvent(Unkn
own Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at Thor.API.Base.SecurityInvocationHandler$1.run(Unknown Source)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.security.Security.runAs(Security.java:41)
at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(Unknown Sou
rce)
at Thor.API.Base.SecurityInvocationHandler.invoke(Unknown Source)
at $Proxy69.ignoreEvent(Unknown Source)
at com.thortech.xl.gc.runtime.GCScheduleTask.execute(Unknown Source)
at com.thortech.xl.scheduler.tasks.SchedulerBaseTask.run(Unknown Source)
at com.thortech.xl.scheduler.core.quartz.QuartzWrapper$TaskExecutionActi
on.run(Unknown Source)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.security.Security.runAs(Security.java:41)
at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(Unknown Sou
rce)
at com.thortech.xl.scheduler.core.quartz.QuartzWrapper.execute(Unknown S
ource)
at org.quartz.core.JobRunShell.run(JobRunShell.java:178)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.j
ava:477)
ERROR,08 Mar 2011 10:20:03,808,[XELLERATE.GC.FRAMEWORKRECONCILIATION],Reconcilia
tion Encountered error:
Thor.API.Exceptions.tcAPIException: java.lang.NullPointerException
at com.thortech.xl.ejb.beansimpl.tcReconciliationOperationsBean.ignoreEv
entData(Unknown Source)
at com.thortech.xl.ejb.beansimpl.tcReconciliationOperationsBean.ignoreEv
ent(Unknown Source)
at com.thortech.xl.ejb.beans.tcReconciliationOperationsSession.ignoreEve
nt(Unknown Source)
at com.thortech.xl.ejb.beans.tcReconciliationOperations_gmh3ba_EOImpl.ig
noreEvent(tcReconciliationOperations_gmh3ba_EOImpl.java:546)
at Thor.API.Operations.tcReconciliationOperationsClient.ignoreEvent(Unkn
own Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at Thor.API.Base.SecurityInvocationHandler$1.run(Unknown Source)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.security.Security.runAs(Security.java:41)
at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(Unknown Sou
rce)
at Thor.API.Base.SecurityInvocationHandler.invoke(Unknown Source)
at $Proxy69.ignoreEvent(Unknown Source)
at com.thortech.xl.gc.runtime.GCScheduleTask.execute(Unknown Source)
at com.thortech.xl.scheduler.tasks.SchedulerBaseTask.run(Unknown Source)
at com.thortech.xl.scheduler.core.quartz.QuartzWrapper$TaskExecutionActi
on.run(Unknown Source)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.security.Security.runAs(Security.java:41)
at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(Unknown Sou
rce)
at com.thortech.xl.scheduler.core.quartz.QuartzWrapper.execute(Unknown S
ource)
at org.quartz.core.JobRunShell.run(JobRunShell.java:178)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.j
ava:477)
WARN,08 Mar 2011 10:20:03,813,[XELLERATE.GC.FRAMEWORKRECONCILIATION],Though Rec
onciliation Scheduled task has encountered an error, Reconciliation Transport pr
oviders have been "ended" smoothly. Any provider operation that occurs during th
at "end" or "clean-up" phase would have been executed e.g. Data archival. In cas
e you want that data to be a part of next Reconciliation execution, restore it f
rom Staging. Provider logs must be containing details about storage entities tha
t would have been archived -
Delete entry from Database table
Hi,
I configured one PCR scenerio in SPRO node -> business Packakes/ funtional packages-> Manager self service-> Personal Change request -> Group Change request scenerio.
later I deleted that entry in backend, but still the same entry exist in db table "TWPC_PCR_Groups" .
How can we delete that entry?
thanksHi,
If you just want to delete a single entry from database table then you have to it in debug mode .
go to se11->Give table name->Press F7( ie: display table entries)-> Goto the table contents (CTRLSHIFTF10)->Select the entry you want to delete->Give /H in the command bar ->enter into debug mode-> Give code as DELE -> save it. and press enter. Your entry will be deleted from database.
Hope this helps.. -
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.
-
Fetch last record from database table
hi,
how to fetch last record from database table.
plz reply earliest.
Regards,
Jyotsna
Moderator message - Please search before asking - post locked
Edited by: Rob Burbank on Dec 11, 2009 9:44 AMabhi,
just imagine the table to be BSEG or FAGLFLEXA... then what would be performance of the code ?
any ways,
jyotsna, first check if you have a pattern to follow like if the primary key field have a increasing number range or it would be great if you find a date field which stores the inserted date or some thing..
you can select max or that field or order by descending using select single.
or get all data.. sort in descending order.(again you need some criteria like date).
read the first entry. using read itab index 1 -
SELECT STATEMENT FROM THIS TABLES
HI FRIENDS,
PLE HELP ME REGARDING THIS.
data from 3 tables
TABLES: CUST_CONT,CONT_CAT_FOLD,CONT_FOLD_***
cust_cont_pk (IS COMMON FIELD IN TABLE I AND 3)
cont_cat_fold_pk( IS COMMON FIELD IN TABLE 2 AND 3)
HOW CAN I WRITE SELECT STATEMENT
Thanking u
suneel.Hi
Join the two tables
CUST_CONT and CONT_FOLD_*** with cust_cont_pk field and
CONT_CAT_FOLD and CONT_FOLD_*** with cont_cat_fold_pk field
see the doc
Joins are used to fetch data fast from Database tables:
Tables are joined with the proper key fields to fetch the data properly.
If there are no proper key fields between tables don't use Joins;
Important thing is that don't USE JOINS FOR CLUSTER tableslike BSEG and KONV.
Only use for Transparenmt tables.
You can also use joins for the database VIews to fetch the data.
JOINS
... FROM tabref1 [INNER] JOIN tabref2 ON cond
Effect
The data is to be selected from transparent database tables and/or views determined by tabref1 and tabref2. tabref1 and tabref2 each have the same form as in variant 1 or are themselves Join expressions. The keyword INNER does not have to be specified. The database tables or views determined by tabref1 and tabref2 must be recognized by the ABAP Dictionary.
In a relational data structure, it is quite normal for data that belongs together to be split up across several tables to help the process of standardization (see relational databases). To regroup this information into a database query, you can link tables using the join command. This formulates conditions for the columns in the tables involved. The inner join contains all combinations of lines from the database table determined by tabref1 with lines from the table determined by tabref2, whose values together meet the logical condition (join condition) specified using ON>cond.
Inner join between table 1 and table 2, where column D in both tables in the join condition is set the same:
Table 1 Table 2
A
B
C
D
D
E
F
G
H
a1
b1
c1
1
1
e1
f1
g1
h1
a2
b2
c2
1
3
e2
f2
g2
h2
a3
b3
c3
2
4
e3
f3
g3
h3
a4
b4
c4
3
|--|||--|
Inner Join
A
B
C
D
D
E
F
G
H
a1
b1
c1
1
1
e1
f1
g1
h1
a2
b2
c2
1
1
e1
f1
g1
h1
a4
b4
c4
3
3
e2
f2
g2
h2
|--||||||||--|
Example
Output a list of all flights from Frankfurt to New York between September 10th and 20th, 2001 that are not sold out:
DATA: DATE LIKE SFLIGHT-FLDATE,
CARRID LIKE SFLIGHT-CARRID,
CONNID LIKE SFLIGHT-CONNID.
SELECT FCARRID FCONNID F~FLDATE
INTO (CARRID, CONNID, DATE)
FROM SFLIGHT AS F INNER JOIN SPFLI AS P
ON FCARRID = PCARRID AND
FCONNID = PCONNID
WHERE P~CITYFROM = 'FRANKFURT'
AND P~CITYTO = 'NEW YORK'
AND F~FLDATE BETWEEN '20010910' AND '20010920'
AND FSEATSOCC < FSEATSMAX.
WRITE: / DATE, CARRID, CONNID.
ENDSELECT.
If there are columns with the same name in both tables, you must distinguish between them by prefixing the field descriptor with the table name or a table alias.
Note
In order to determine the result of a SELECT command where the FROM clause contains a join, the database system first creates a temporary table containing the lines that meet the ON condition. The WHERE condition is then applied to the temporary table. It does not matter in an inner join whether the condition is in the ON or WHEREclause. The following example returns the same solution as the previous one.
Example
Output of a list of all flights from Frankfurt to New York between September 10th and 20th, 2001 that are not sold out:
DATA: DATE LIKE SFLIGHT-FLDATE,
CARRID LIKE SFLIGHT-CARRID,
CONNID LIKE SFLIGHT-CONNID.
SELECT FCARRID FCONNID F~FLDATE
INTO (CARRID, CONNID, DATE)
FROM SFLIGHT AS F INNER JOIN SPFLI AS P
ON FCARRID = PCARRID
WHERE FCONNID = PCONNID
AND P~CITYFROM = 'FRANKFURT'
AND P~CITYTO = 'NEW YORK'
AND F~FLDATE BETWEEN '20010910' AND '20010920'
AND FSEATSOCC < FSEATSMAX.
WRITE: / DATE, CARRID, CONNID.
ENDSELECT.
Note
Since not all of the database systems supported by SAP use the standard syntax for ON conditions, the syntax has been restricted. It only allows those joins that produce the same results on all of the supported database systems:
Only a table or view may appear to the right of the JOIN operator, not another join expression.
Only AND is possible in the ON condition as a logical operator.
Each comparison in the ON condition must contain a field from the right-hand table.
If an outer join occurs in the FROM clause, all the ON conditions must contain at least one "real" JOIN condition (a condition that contains a field from tabref1 amd a field from tabref2.
Note
In some cases, '*' may be specified in the SELECT clause, and an internal table or work area is entered into the INTO clause (instead of a list of fields). If so, the fields are written to the target area from left to right in the order in which the tables appear in the FROM clause, according to the structure of each table work area. There can then be gaps between table work areas if you use an Alignment Request. For this reason, you should define the target work area with reference to the types of the database tables, not simply by counting the total number of fields. For an example, see below:
Variant 3
... FROM tabref1 LEFT [OUTER] JOIN tabref2 ON cond
Effect
Selects the data from the transparent database tables and/or views specified in tabref1 and tabref2. tabref1 und tabref2 both have either the same form as in variant 1 or are themselves join expressions. The keyword OUTER can be omitted. The database tables or views specified in tabref1 and tabref2 must be recognized by the ABAP-Dictionary.
In order to determine the result of a SELECT command where the FROM clause contains a left outer join, the database system creates a temporary table containing the lines that meet the ON condition. The remaining fields from the left-hand table (tabref1) are then added to this table, and their corresponding fields from the right-hand table are filled with ZERO values. The system then applies the WHERE condition to the table.
Left outer join between table 1 and table 2 where column D in both tables set the join condition:
Table 1 Table 2
A
B
C
D
D
E
F
G
H
a1
b1
c1
1
1
e1
f1
g1
h1
a2
b2
c2
1
3
e2
f2
g2
h2
a3
b3
c3
2
4
e3
f3
g3
h3
a4
b4
c4
3
|--|||--|
Left Outer Join
A
B
C
D
D
E
F
G
H
a1
b1
c1
1
1
e1
f1
g1
h1
a2
b2
c2
1
1
e1
f1
g1
h1
a3
b3
c3
2
NULL
NULL
NULL
NULL
NULL
a4
b4
c4
3
3
e2
f2
g2
h2
|--||||||||--|
Example
Output a list of all custimers with their bookings for October 15th, 2001:
DATA: CUSTOMER TYPE SCUSTOM,
BOOKING TYPE SBOOK.
SELECT SCUSTOMNAME SCUSTOMPOSTCODE SCUSTOM~CITY
SBOOKFLDATE SBOOKCARRID SBOOKCONNID SBOOKBOOKID
INTO (CUSTOMER-NAME, CUSTOMER-POSTCODE, CUSTOMER-CITY,
BOOKING-FLDATE, BOOKING-CARRID, BOOKING-CONNID,
BOOKING-BOOKID)
FROM SCUSTOM LEFT OUTER JOIN SBOOK
ON SCUSTOMID = SBOOKCUSTOMID AND
SBOOK~FLDATE = '20011015'
ORDER BY SCUSTOMNAME SBOOKFLDATE.
WRITE: / CUSTOMER-NAME, CUSTOMER-POSTCODE, CUSTOMER-CITY,
BOOKING-FLDATE, BOOKING-CARRID, BOOKING-CONNID,
BOOKING-BOOKID.
ENDSELECT.
If there are columns with the same name in both tables, you must distinguish between them by prefixing the field descriptor with the table name or using an alias.
Note
For the resulting set of a SELECT command with a left outer join in the FROM clause, it is generally of crucial importance whether a logical condition is in the ON or WHERE condition. Since not all of the database systems supported by SAP themselves support the standard syntax and semantics of the left outer join, the syntax has been restricted to those cases that return the same solution in all database systems:
Only a table or view may come after the JOIN operator, not another join statement.
The only logical operator allowed in the ON condition is AND.
Each comparison in the ON condition must contain a field from the right-hand table.
Comparisons in the WHERE condition must not contain a field from the right-hand table.
The ON condition must contain at least one "real" JOIN condition (a condition in which a field from tabref1 as well as from tabref2 occurs).
Note
In some cases, '*' may be specivied as the field list in the SELECT clause, and an internal table or work area is entered in the INTO clause (instead of a list of fields). If so, the fields are written to the target area from left to right in the order in which the tables appear in the llen in der FROM clause, according to the structure of each table work area. There can be gaps between the table work areas if you use an Alignment Request. For this reason, you should define the target work area with reference to the types of the database tables, as in the following example (not simply by counting the total number of fields).
Example
Example of a JOIN with more than two tables: Select all flights from Frankfurt to New York between September 10th and 20th, 2001 where there are available places, and display the name of the airline.
DATA: BEGIN OF WA,
FLIGHT TYPE SFLIGHT,
PFLI TYPE SPFLI,
CARR TYPE SCARR,
END OF WA.
SELECT * INTO WA
FROM ( SFLIGHT AS F INNER JOIN SPFLI AS P
ON FCARRID = PCARRID AND
FCONNID = PCONNID )
INNER JOIN SCARR AS C
ON FCARRID = CCARRID
WHERE P~CITYFROM = 'FRANKFURT'
AND P~CITYTO = 'NEW YORK'
AND F~FLDATE BETWEEN '20010910' AND '20010920'
AND FSEATSOCC < FSEATSMAX.
WRITE: / WA-CARR-CARRNAME, WA-FLIGHT-FLDATE, WA-FLIGHT-CARRID,
WA-FLIGHT-CONNID.
ENDSELECT.
reward points if useful
regards
Anji -
How to select rows from database like 10 to 20 etc
Hi Experts,
I want to select rows from database like row number 10 to row number 20.How could it be done?HI,
First get the data into the INTERNAL TABLE from the FLAT FILE and read the internal table using the index.
ex: 1) Read table ITAB index 10.
2) Read table ITAB index 20.
or use as said by Srinivas Gurram, to get the range of records using where condition to the loop.
<REMOVED BY MODERATOR>
Edited by: Ravi Kumar on Jun 9, 2008 4:01 PM
Edited by: Alvaro Tejada Galindo on Jun 9, 2008 3:16 PM -
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 -- -
Copy selected values from a table control into another table control
hi there,
as seen in the subject i need to copy selected values from a table control into another table control in the same screen. as i dont know much about table controls i made 2 table controls with the wizard and started to change the code... right now im totally messed up. nothing works anymore and i don't know where to start over.
i looked up the forums and google, but there is nothing to help me with this problem (or i suck in searching the internet for solutions)
i have 2 buttons. one to push the selected data from the top table control into the bottom tc and the other button is to push selected data from the bottom tc into the top tc. does somebody has a sample code to do this?you're funny
i still don't get it... can't believe, there is no tutorial or sample code around how to copy multiple selected rows from a tc.
here's my code, maybe you can tell me exactly were i have to change it:
tc1 = upper table control
tc2 = lower table control
SCREEN 0100:
PROCESS BEFORE OUTPUT.
MODULE status_0100.
MODULE get_nfo. --> gets data from the dictionary table
MODULE tc1_change_tc_attr.
LOOP AT it_roles_tc1
INTO wa_roles_tc1
WITH CONTROL tc1
CURSOR tc1-current_line.
ENDLOOP.
MODULE tc2_change_tc_attr.
LOOP AT it_roles_tc2
INTO wa_roles_tc2l
WITH CONTROL tc2
CURSOR tc2-current_line.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT it_roles_tc1.
CHAIN.
FIELD wa_roles_tc1-agr_name.
FIELD wa_roles_tc1-text.
ENDCHAIN.
FIELD wa_roles_tc1-mark
MODULE tc1_mark ON REQUEST.
ENDLOOP.
LOOP AT it_roles_tc2.
CHAIN.
FIELD wa_roles_tc2-agr_name.
FIELD wa_roles_tc2-text.
ENDCHAIN.
FIELD wa_roles_tc2-mark
MODULE tc2_mark ON REQUEST.
ENDLOOP.
MODULE ok_code.
MODULE user_command_0100.
INCLUDE PAI:
MODULE tc1_mark INPUT.
IF tc1-line_sel_mode = 2
AND wa_roles_tc1-mark = 'X'.
LOOP AT it_roles_tc1 INTO g_tc1_wa2
WHERE mark = 'X'. -
> big problem here is, that no entry has an 'X' there
g_tc1_wa2-mark = ''.
MODIFY it_roles_tc1
FROM g_tc1_wa2
TRANSPORTING mark.
ENDLOOP.
ENDIF.
MODIFY it_roles_tc1
FROM wa_roles_tc1
INDEX tc1-current_line
TRANSPORTING mark.
ENDMODULE. "TC1_MARK INPUT
MODULE tc2_mark INPUT.
IF tc2-line_sel_mode = 2
AND wa_roles_tc2-mark = 'X'.
LOOP AT it_roles_tc2 INTO g_tc2_wa2
WHERE mark = 'X'. -
> same here, it doesn't gets any data
g_tc2_wa2-mark = ''.
MODIFY it_roles_tc2
FROM g_tc2_wa2
TRANSPORTING mark.
ENDLOOP.
ENDIF.
MODIFY it_roles_tc2
FROM wa_roles_tc2
INDEX tc2-current_line
TRANSPORTING mark.
ENDMODULE.
thx for anybody who can help with this! -
Get selected elements from a table
Hi all,
I have a requirement like i m enhancing standard component in that i have added one button on click of that i want fetch the selected line item from the table ( which is a normal table). selection mode is auto.
i tried with the following code.
DATA:lr_element TYPE REF TO if_wd_context_element,
lv_index TYPE i.
*--Get selected element
lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
****Here itself its throughing dump because lr_element is initial***************
*--get selected element index.
lv_index = lr_element->get_index( ).
can any one help me what is the wrong.. else suggest me how to get the selected elements from a table....
Thanks in advance.*--Get selected element
lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
if lr_element is bound.
lv_index = lr_element->get_index( ).
endif.
Instead you can directly read the node if that row is a lead selected one.
lo_node = wd_context->get_child_node( name = 'EMP' ). "Emp is node name
lo_ele = lo_node->get_lead_selection( ).
or
lv_index = lo_node->get_lead_selection_index( ).
where is the above code written..is it written in OnLeadSelect event of the TABLE..
can any one help me what is the wrong.. else suggest me how to get the selected elements from a table....
As the selection mode is Auto there is no multiple selection..hence try to use the lead selection only.
Edited by: Lekha on Jan 3, 2012 6:47 PM
Maybe you are looking for
-
I have my Mac Book Pro with the OS Yesomite since a month and I am feeling that my mac is getting slower than before a month. I want to install OS Lion on my mac. I think i have a DVD of OS Lion which comes when i bougnt Mac laptop in 2011. Should i
-
Webutil not working properly after applying application server patch
i have applied patch Patch 5983622 my application server verion is upgrade to 10.1.2.3 . patch is applied sucessfully but.foms which have webutil library not working. can any one tell me what should i do for make them working again.
-
Creating 'fill in forms' in Word 2011
I have created a fill in form in Word 2011 and protected it as required but PC users cannot fill in the boxes. Any one had experience creating these forms? Is there another step i have to take?
-
Delete Datapackage in start routine
hello Gurus I need to load data for 204 and 205 costcenters but i need to delete records in between costelements 611000 - 613999. so i have writen the code . plz suggest the corrections in the code. data: lt_dp type standard table of data_package_str
-
HT2729 A purchased movie did not back up from iPad to computer when synced performed
I tried to sync a purchased movie. Did not back up to computer. Also lost artwork for movie picture. Show like a white tv screen