How to fetch the latest change number from CDPOS Table..?
Hi All,
im trying to fetch teh change number from CDPOS with the below select, but my requirement is always i wants to fetch the latest change number.
SELECT SINGLE objectid changenr FROM cdpos
INTO wa_cdpos
WHERE objectid = wa_e1kna1m-kunnr
AND ( tabname = 'KNA1' OR tabname = 'KNVV')
AND fname = 'AUFSD'
AND ( value_new = '01' OR value_new = space ).
Please let me know how to achive this..?
Ashok
try this way
" SELECT SINGLE objectid changenr FROM cdpos
" INTO wa_cdpos
SELECT objectid changenr FROM cdpos
INTO table t_cdpos
WHERE objectid = wa_e1kna1m-kunnr
AND ( tabname = 'KNA1' OR tabname = 'KNVV')
AND fname = 'AUFSD'
AND ( value_new = '01' OR value_new = space ).
SORT t_cdpos by changenr Descending.
read t_cdos index 1. "this is the latest change
Prabhudas
Similar Messages
-
How to fetch the VAT registration number of the ship to party from billing
Dear SDN Team
How to fetch the VAT registration number of the ship to party from the billing document. Can you proide some information for fetching the VAT registration number of the ship to party.
Normally only the payer VAT registration number will be displayed in the Invoice. But in my case the Ship to party VAT number is displayed.
I have resolved this problem by doing the customizing setting in order to have the payer vat registration number. But for the Old Billing documents it is more than 30,000 documents where it was printed with the ship to party VAT number. So i need to identify those documents.
Can you please help to resolve this problem.
With Regards,
JaiHi,
To get VAT from the ship to from Billing, You have to first fetch the BILLING NUMBER from the VBRK and then goto the Document flow in VBFA to get the SALES DOCUMENT NUMBER and with sales document you will get the SHIP TO number from the VBPA with the PARVW = SH
Once you got the SHIP TO , then goto the KNA1 and get the VAT ID in the field STCEG
so the logic will be as follows
VBRK---VBELN and then
VBFA--VBELN with the document Category as C
VBPA-VBELN and get the KUNNR with PARVW =SH
Now with KUNNR ( ship to ) get the VAT ID from KNA1-STCEG
regards,
santosh -
Hi Experts,
Pls. let me know that,
How to fetch the SAP Standard Prog. built internal table into my_z_prog.?
For more explannation, pls. see my other thread with name of yestrday,
SUBMIT RFGLBALANCE WITH selection criteria, then How to get resulted itab?
thanqHi
Suppose RFGLBALANCE is your standard program and you have an internal table named I_RFGLBALANCE.
And lets say your Z program name is Z_SRINIVAS.
First find out the type of the internal table you want in your Z-program in the standard program. And declare an internal table of similar type in your Z-program.
I hope you can do this much.
Later wherever you are putting the below mentioned code.
SUBMIT RFGLBALANCE WITH selection criteria
Write the code which i have written.Obviously modify it to suit your requirement.
Please show what is not working fine so that even anyone else can help you with the problem you are facing.
Regards,
Mayank -
How to get the latest Change date and time of a M.O. from View VIAUFKST
Hi All,
I want to get the latest date and time of a M.O. from view
VIAUFKST. I have written the query like this...
SELECT AUFNR
AEDAT " Changed Date
AEZEIT " Changed Time
FROM VIAUFKST
INTO TABLE I_VIAUFKST
WHERE AEDAT >= W_LASTRUN_DATE
ORDER BY AEDAT DESCENDING.
but its not giving me right results... Pls help me out on this or suggest me the right approach to achieve the same...As this is very critical issue...
Advance Thanks and Points Gauranteed...
Suresh> SELECT AUFNR
> AEDAT
> AEZEIT
> FROM VIAUFKST
> INTO TABLE I_VIAUFKST
> WHERE AEDAT >= W_LASTRUN_DATE.
>
> IF NOT I_VIAUFKST[] IS INITIAL.
> SORT I_VIAUFKST BY AEDAT AEZEIT DESCENDING.
> READ TABLE I_VIAUFKST INDEX 1.
> ENDIF.
>
> The above statement is giving me different results...
> such as...
>
> 1. 30/11/2005 19:20:11
> 2. 29/11/2005 22:10:09
> 3. 30/11/2005 20:56:09
> 4. 28/11/2005 23:10:09
>
> by using the above SORT statement i am getting the
> fourth record as the latest, where as it should give
> me the third record....
>
> Please advise,
> Suresh.
Hi Suresh,
The reason why you are getting this result is because the system is interpreting the DESCENDING only for AEZEIT not for both. Change it to
SORT I_VIAUFKST BY AEDAT DESCENDING AEZEIT DESCENDING -
How to get the last SCN number from catalog database
Hi All,
I have a catalog database where my PROD database is registered. Evereyday at 12AM rman takes the hot backup of PROD.
Now I want to create a auxillary database using the last RMAN backup, for this I want to restore using the SCN from the catalog views.
Please help me to get the SCN number from the RC_ views.
Regards,
Bikramasifkabirdba wrote:
Current SCN:
Use the dbms_flashback package to get the current SCN. This value will be used during instantiation at the destination site, as well as by RMAN when duplicating the database.
SET SERVEROUTPUT ON
DECLARE
until_scn NUMBER;
BEGIN
until_scn:=
DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER;
DBMS_OUTPUT.PUT_LINE('Until SCN: ' || until_scn);
END;
Regards
Asif KabirHello,
i am a bit confused,
SELECT CURRENT_SCN FROM V$DATABASE;
6272671324
and from your package
SET SERVEROUTPUT ON
DECLARE
until_scn NUMBER;
BEGIN
until_scn:=
DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER;
DBMS_OUTPUT.PUT_LINE('Until SCN: ' || until_scn);
END;Until SCN: 6272671267
why are they different, and why first result is lower than yours? can you explain please, thank you
Ugur MIHCI -
Urgent !!! How to get the Latest Exchange Rate from a list
Helo Gurus,
I want to get the latest exchange rate for all currencies in BI 7.0. Now when I checked in the table its showing all the exchange rates for various currencies according to the date. My client want the latest exchange rate in the report for all currencies. Now when I generating the currencies into the report the rate getting cumulated.
For certain currencies the rate is updated very recently. But for others two months back.
<b>How it is possible to take only the latest exchange rate for all currencies and can generate the report.</b>
I am working in BI 7.0 and the BEx using is of version 3.5.Mathew,
usually the currenies and other settings will be loaded nightly, but in your case if you want it urgently you can do this.
RSA1->Source System>Transfer Exchange Rates. This will open up a screen with two options Simulation and Update. You can verify with SImulation and needed you can update. It will not create any issues.
Hope this helps.
Alex (Arthur Samson) -
How to Fetch Sales Order Item Quantity from Customer table(ztable)?
Dear Guru's,
My scenario:
While creating Sales order the item quantity should be fetched from a Ztable. So iam using the Userexit "V46H0001 - - Customer functions for resource-related billing", in that i have implemented my code in the Function Exit - EXIT_SAPLV46H_001 and the FM documentation says
This function module allows you to change item information for generating a new item.
In order to achieve this, you must change the relevant field in the structure C_VBAPKOM.
So i activated that exit and wrote the following code to test it as follows;
break-point.
C_VBAPKOM-zmeng = 10.
But it seems not working, even it doesn't stop at the break-point when i type the material number for the item in the sales order and press enter...
Please guide me in this regard, am i correct in choosing the User-Exit? what else have to be done in order to fetch the item quantity from the ztable....
Please suggest if there is some other way to do this, i also heard that we can do this through Routines...
Thanks in Advance...
Regards
Karthik DI have solved this and you can found how i solved in the last reply of the following thread....
[SD UserExit - V46H0001 - Customer functions for resource-related billing|SD UserExit - V46H0001 - Customer functions for resource-related billing]
Thanks
Karthik D -
Need to fetch the last record/row from a table
Hi,
I have a requirement like fetching the closing balance of the last record of the table and inserting the same into the opening balance of the immediatetly created next record.
In simple words, I need to fetch a value from the last row of the record.
For example, I use the below query,
select rownum, empno, ename from emp
where rownum = (select count(rownum) from emp);
But, the above query does not return any of the record.
Hence, need help on this.
Regards,
Shivakumar A
Edited by: shiva on Mar 27, 2011 10:14 PMRows in a table are inherently unordered. In order to introduce the concept of "first" and "last", you would need to specify how to order the rows which would require that there was one or more columns in the table that you could order by in order to determine the "last" record.
In your closing balance example, if we assume that there is something like a BALANCE_DATE column,
SELECT account_number, balance_amount, balance_date
FROM (
SELECT account_number,
balance_amount,
balance_date,
rank() over (partition by account_number order by balance_date desc) rnk
FROM table_of_balances )
WHERE rnk = 1Justin -
Quick question: How to get the scrolled page number using af:table
Hi,
When using range paging on scrolled table, how to get the current scrolled page number(1,2,3...), for example when moving the table vertical scroll bar forward or backward, is there any method in ViewObjectImpl class that I can use to get such information? I have seen the method scrollToRangePage(int i), but when scrolled ("Fetching data..."), it doesn't not get into this method. So it is wrong usage for this method, right?
ThanksDidn't you just ask that question in this thread?: How to catch the page number when using scroll table in ADF 11g?
A bit of patience might be in order.
CM. -
How to remove the duplicate HR record from per_all_people_f table
Because of some mistake user has created two records for one employee one with start date 4th may 2010 and end date with 1st may 2011 and another with start date with 2nd may 2011 and end date is 31st of dec 2012.
When I go to enter and maintain employee i found the record which starts with 4th may 2010 and end date with 1st may 2011.
Please let me know how to remove the end date from this record.
when I ran the query
select * from PER_ALL_PEOPLE_F PAPF where upper(first_name)='UDAYA';
i have first four column for this type.I want to remove the first row from here
41246 02-MAY-11 31-DEC-12 81 1125
41246 04-MAY-10 01-MAY-11 81 1125
Please help.
Regards,
PrakashOkay, so you wish to just have one person record from the 4th May 2010 through to the 31st December 4712, right?
In that case, do this:
1) Query the person in the Enter & Maintain person form
2) Hit Delete on the toolbar
3) Select "Delete Next Change" from the date-track mode and save
4) Re-query
Now the date-track update from 2nd May is gone. -
How to get the last inserted record from a table ?
:-) Hiee E'body
I work on Oracle 8i and need to get the last
record inserted in a table.
I have tried using rownum and rowid pseudo-columns
but that doesn't work.
Can you please help me out ?
:-) Have a nice time
Vivek Kapoor.
IT, Atul Ltd.,
India.I'm not sure about 8i features.
I assume here that you don't have 'Date-Time' stamp columns on the table which is the easiest way to determine the last inserted row in the table.
If not try the following :-
select address, piece, SQL_TEXT
from V$SQLTEXT
where upper(sql_text) like '%INSERT INTO TABLE_NAME%'
Substiute the TABLE_NAME with the name of the actual table.
Have fun.
Regards,
Shailender
:-) Hiee E'body
I work on Oracle 8i and need to get the last
record inserted in a table.
I have tried using rownum and rowid pseudo-columns
but that doesn't work.
Can you please help me out ?
:-) Have a nice time
Vivek Kapoor.
IT, Atul Ltd.,
India. -
How to fetch the perticular line of a internal Table
Hi Friends,
I am using Function Module VC_I_GET_CONFIGURATION and I am passing the instance Number.
Now i am getting 18 records in my ITAB.Here from this ITAB i need only ATBEZ = RELAY TYPES & ATBEZ = CASE Records.Only for the mentioned conditions i require the records.
How Can i Proceed.Plz suggest.As CASE is the reserved word and Types also reserved Word.
Plz suggest.Hi,
Thanks for ur Reply and Can i Use Read statement for the same. My requirement is ATBEZ = 'RELAY TYPES' AND 'CASE'.
While Printing in smart form for one item there will be only one Relay type.How can i proceed.
If i write LOOP AT ITAB WHERE ATBEZ = 'RELAY TYPES' or ATBEZ = ' CASE'.
2 records r coming and only the secong recored is appending.First Record will not append.
How can i do.
Plz suggest. -
How to return the same SUM value from two tables
Hello,
I have the following data:
SQL> SELECT * FROM t1;
T1_ID T1_VALUE
1 500
1 500
SQL> SELECT * FROM t2;
T2_ID T2_VALUE
1 1000
SQL> SELECT t1_id, SUM(t1_value), SUM(t2_value)
2 FROM t1, t2
3 WHERE t1_id = t2_id
4 GROUP BY t1_id;
T1_ID SUM(T1_VALUE) SUM(T2_VALUE)
1 1000 2000How is it possible that SUM(T2_VALUE) returns also 1000.
Thank youHere's one way:
with t1 as (select 1 t1_id, 500 t1_value from dual union all
select 1 t1_id, 500 t1_value from dual),
t2 as (select 1 t2_id, 1000 t2_value from dual)
select t3.t3_id, t3.t3_sum, t4.t4_sum
from (select t1_id t3_id, sum(t1_value) t3_sum from t1
group by t1_id) t3,
(select t2_id t4_id, sum(t2_value) t4_sum from t2
group by t2_id) t4
where t3.t3_id = t4.t4_id -
How to delete the fist 10 recods from a table ? The problem is real.
Hi,
the code below shows that deleting a records using a cursor works well, if your table is out of a environment, but if you are using a environment the things goes different. Please help me, what i am doing wrong ?
This code is the most clean code i now to do.
// THE CODE (BEGIN).
// BDBTEST.cpp : Clean code.
#include "X:\include\berkeleydb\db_cxx.h"
#define DWORD unsigned long int
#define UINT unsigned int
#define DB_ENV_PATH "Z:\\Test"
#define DB_FULL_NAME "Z:\\Test\\Test.db"
typedef struct STRTEST
DWORD dwID;
char caTxt[64];
} strTest;
// Functions.
int compare_int ( Db *dbp,
const Dbt *a,
const Dbt *b);
void Save();
void Load();
void DeleteAll();
// Global variables.
DbEnv *g_penvDbEnv;
Db *g_pdbTest;
Dbc *g_pdbcCursor;
Dbt g_dbtTestKey;
Dbt g_dbtTestData;
UINT g_ui32ENVOpenFlags;
char g_caError[256];
int g_iResult;
// Main function.
int main(int argc, char* argv[])
g_penvDbEnv = NULL;
g_pdbTest = NULL;
// First we run without environment (NO ERROR USING g_pdbcCursor->Del(0)).
remove(DB_FULL_NAME);
Save();
Load();
DeleteAll();
Load();
// Now we run with environment ("Dbc::del: Invalid argument" (err_ = 22) - ERROR USING g_pdbcCursor->Del(0)).
try
g_penvDbEnv = new DbEnv(0);
if(g_penvDbEnv == NULL)
return 0;
catch(DbException &e)
sprintf(g_caError, "ERRO -> DSDBBD: %s\n", e.what());
return 0;
// Set the normal flags for a transactional subsystem. Note that
// we DO NOT specify DB_RECOVER.
g_ui32ENVOpenFlags = DB_CREATE | // If the environment does not exist, create it.
DB_INIT_LOCK | // Initialize locking.
DB_INIT_LOG | // Initialize logging.
DB_INIT_MPOOL | // Initialize the cache.
DB_THREAD | // Free-thread the env handle.
DB_INIT_TXN; // Initialize transactions.
// Open/Create environment.
try
// Environment settings.
g_iResult = g_penvDbEnv->set_encrypt("1234", DB_ENCRYPT_AES);
g_iResult = g_penvDbEnv->set_lg_bsize (1024 * 256); // LOG MEMORY FILE MAX SIZE.
g_iResult = g_penvDbEnv->set_cachesize(0, 1024 * 512, 0);
g_iResult = g_penvDbEnv->set_flags (DB_AUTO_COMMIT, 1);
g_iResult = g_penvDbEnv->set_flags (DB_LOG_AUTOREMOVE, 1);
g_iResult = g_penvDbEnv->set_lg_max (1025 * 1024); // LOG FILE MAX SIZE.
// Open the environment with full transactional support.
g_iResult = g_penvDbEnv->open(DB_ENV_PATH, g_ui32ENVOpenFlags, 0);
catch(DbException &e)
sprintf(g_caError, "ERRO -> DSDBBD: %s\n", e.what());
return 0;
remove(DB_FULL_NAME);
Save();
Load();
DeleteAll(); // Error goes here.
Load();
g_penvDbEnv->close(0);
delete g_penvDbEnv;
g_penvDbEnv = NULL;
return 0;
void Save()
int i;
int iResult;
DWORD dwID;
strTest sttTest;
if(g_penvDbEnv == NULL)
g_pdbTest = new Db(NULL, 0);
else
g_pdbTest = new Db(g_penvDbEnv, 0);
// Setting databases flags (Just use with environment).
g_pdbTest ->set_flags(DB_CHKSUM | DB_ENCRYPT);
if(g_penvDbEnv == NULL)
g_pdbTest ->set_encrypt("1234", DB_ENCRYPT_AES);
g_pdbTest->set_bt_compare(compare_int);
g_iResult = g_pdbTest->open(NULL, DB_FULL_NAME, NULL, DB_BTREE, DB_CREATE | DB_THREAD, 0);
dwID = 1;
for(i=0;i<100;i++)
sttTest.dwID = dwID;
sprintf(sttTest.caTxt, "ID = %04u", sttTest.dwID);
g_dbtTestKey .set_data((void*) &sttTest.dwID);
g_dbtTestKey .set_size(sizeof(DWORD));
g_dbtTestData .set_data((void*) &sttTest);
g_dbtTestData .set_size(sizeof(sttTest));
iResult = g_pdbTest->put(0, &g_dbtTestKey, &g_dbtTestData, DB_NOOVERWRITE);
dwID++;
g_pdbTest->sync(0);
g_pdbTest->close(0);
delete g_pdbTest;
g_pdbTest = NULL;
void Load()
strTest *psttTest;
if(g_penvDbEnv == NULL)
g_pdbTest = new Db(NULL, 0);
else
g_pdbTest = new Db(g_penvDbEnv, 0);
// Setting databases flags (Just use with environment).
g_pdbTest ->set_flags(DB_CHKSUM | DB_ENCRYPT);
if(g_penvDbEnv == NULL)
g_pdbTest ->set_encrypt("1234", DB_ENCRYPT_AES);
g_pdbTest->set_bt_compare(compare_int);
g_iResult = g_pdbTest->open(NULL, DB_FULL_NAME, NULL, DB_BTREE, DB_CREATE | DB_THREAD, 0);
// Get a cursor
g_pdbTest->cursor(NULL, &g_pdbcCursor, 0);
// Iterate over the database, retrieving each record in turn.
while((g_iResult = g_pdbcCursor->get(&g_dbtTestKey, &g_dbtTestData, DB_NEXT)) == 0)
// Get temp struct.
psttTest = (strTest*) g_dbtTestData.get_data();
g_pdbcCursor->close();
g_pdbTest->close(0);
delete g_pdbTest;
g_pdbTest = NULL;
void DeleteAll()
strTest *psttTest;
try
if(g_penvDbEnv == NULL)
g_pdbTest = new Db(NULL, 0);
else
g_pdbTest = new Db(g_penvDbEnv, 0);
// Setting databases flags (Just use with environment).
g_pdbTest ->set_flags(DB_CHKSUM | DB_ENCRYPT);
if(g_penvDbEnv == NULL)
g_pdbTest ->set_encrypt("1234", DB_ENCRYPT_AES);
g_pdbTest->set_bt_compare(compare_int);
g_iResult = g_pdbTest->open(NULL, DB_FULL_NAME, NULL, DB_BTREE, DB_CREATE | DB_THREAD, 0);
// Get a cursor
g_pdbTest->cursor(NULL, &g_pdbcCursor, 0);
// Iterate over the database, retrieving each record in turn.
while((g_iResult = g_pdbcCursor->get(&g_dbtTestKey, &g_dbtTestData, DB_NEXT)) == 0)
// Get temp struct.
psttTest = (strTest*) g_dbtTestData.get_data();
g_iResult = g_pdbcCursor->del(0);
catch (DbException &dbe)
sprintf(g_caError,
"%s",
dbe.what());
g_pdbcCursor->close();
g_pdbTest->close(0);
delete g_pdbTest;
g_pdbTest = NULL;
int compare_int(Db dbp, const Dbt a, const Dbt *b)
int iReturn;
DWORD dwKey1;
DWORD dwKey2;
dwKey1 = 0;
dwKey2 = 0;
iReturn = 0;
dwKey1 = *((DWORD*) a->get_data());
dwKey2 = *((DWORD*) b->get_data());
if(dwKey1 > dwKey2)
iReturn = 1;
else
if(dwKey1 < dwKey2)
iReturn = -1;
return iReturn;
// THE CODE (END).
Thanks,
DelNetoHi all
I solved it. No documentation about it, but the solution is to use transaction.
Just use this DeleteAll function that all works fine.
void DeleteAll()
strTest *psttTest;
DbTxn *pTxn;
try
pTxn = NULL;
g_pdbTest = NULL;
if(g_penvDbEnv == NULL)
g_pdbTest = new Db(NULL, 0);
else
g_pdbTest = new Db(g_penvDbEnv, 0);
// Setting databases flags (Just use with environment).
g_pdbTest ->set_flags(DB_CHKSUM | DB_ENCRYPT);
if(g_penvDbEnv == NULL)
g_pdbTest ->set_encrypt("1234", DB_ENCRYPT_AES);
g_pdbTest->set_bt_compare(compare_int);
g_iResult = g_pdbTest->open(NULL, DB_FULL_NAME, NULL, DB_BTREE, DB_CREATE | DB_THREAD, 0);
if(g_penvDbEnv == NULL)
g_pdbTest->cursor(NULL, &g_pdbcCursor, 0);
else
// Get a cursor.
g_penvDbEnv->txn_begin(NULL, &pTxn, 0);
g_pdbTest->cursor(pTxn, &g_pdbcCursor, 0);
// Iterate over the database, retrieving each record in turn.
while((g_iResult = g_pdbcCursor->get(&g_dbtTestKey, &g_dbtTestData, DB_NEXT)) == 0)
// Get temp struct.
psttTest = (strTest*) g_dbtTestData.get_data();
g_iResult = g_pdbcCursor->del(0);
g_pdbcCursor->close();
if(g_penvDbEnv != NULL)
pTxn->commit(0);
catch (DbException &dbe)
sprintf(g_caError,
"%s",
dbe.what());
g_pdbcCursor->close();
if(g_penvDbEnv != NULL)
pTxn->abort();
g_pdbTest->close(0);
delete g_pdbTest;
g_pdbTest = NULL;
Thanks to all readers,
DelNeto -
How to Get the Unique Key results from OWB Tables after Profile
Hi,
We are using OWB 10gR2(Paris) Beta Version.
In this version the new feature is introduced is Data Profiling.
We are using this feature to analylize the data in terms of stanadards.
We have done profiling for our tables and we are able to see the results for each table in OWB Profile Results Canvas. In this window one Unique Key tab is there to see the Unique results.
Now my question is where these results will be stored in standard tables of OWB. I want to know those exact standard tables to extract thoes Unique results in to my reports.
After profiling we are generating HTML-DB reports to view all these profile results. But we are not able to find the Uique Key tables where these results are stored.
So pls can anybody provide help on this to get these tables...
Thanks in advance...,
Ramesh P.You can use DatabaseMetaData#getPrimaryKeys.
Maybe you are looking for
-
I would like to create one master account for all devices with seperate apple id's
I already have an account with itunes, but my kids got ipads and where set up with their own emails and apple id's. How can I merge all into one so I can manage and monitor the entire account ?
-
How do I to transfer my old phone list from iphone 3gs to my new iphone 4s
That's my question
-
Hi, Is it possible to just start the command prompt in a certain directory. ie. my java programs are in the file C:\Java\myprograms. Can I start the command prompt so that its already in that folder? Thanks, Cam
-
Is it possible to execute short cuts using JS? or event call the marquee zoom by click on the custom button created with JS (app.addToolButton({...})? It would be nice, that all buttons/functions which I need are collected on one place using JS. Tha
-
Mapping-source column(for the measure)disappears after pressing apply
I am using AWM 11.2.0.2.0B and Oracle 11.2. I have successfully mapped my dimensions. Then I defined a stored measure, say DISTANCE and I want to map it to a column in my database. When I click the "apply" button, the mapping disappears! And I can no