Last 10 records of a table with out using count
How can i get last 10 records of a table with out using count() method? if there is some page size(eg 10) , and if we want last page. is it posible without ount()? if posible how?
Message was edited by:
user480375
"is there any other way without nesting?"
Not correctly, no. What is your problem with nesting? Nested queries are not inherently slower than unnested queries. In some cases, such as this, they are the only correct way to do the query. Even an analytic version of the Top N needs to be nested because:
SQL> SELECT object_name
2 FROM t
3 WHERE ROW_NUMBER() OVER (ORDER BY object_name DESC) < 11
4 /
WHERE ROW_NUMBER() OVER (ORDER BY object_name DESC) < 11
ERROR at line 3:
ORA-30483: window functions are not allowed hereTTFN
John
Similar Messages
-
Selecting records from DB table with out using internal tables
hi,
i need to retrieve values from a database table based on few fields and date as well. however, i need to check whether the date is less or equal to the current date and along with that i should get the appropriate record. how can i do that with out using internal table.
field1-----date---
11111----
20070219
11111--20070214 <---
11111----
20070205
in the above scenario i should get the second record
Regards,
Kranthi.Try:
REPORT ztest MESSAGE-ID 00.
TABLES bkpf.
SELECT * FROM bkpf
UP TO 1 ROWS
WHERE budat <= sy-datum
ORDER BY budat DESCENDING.
ENDSELECT.
Rob -
Deletion of duplicates in the table with out using rowid
How can I delete duplicates in the table with out using ROWID .
hi
sleect count(coulmnname),columnname from table
group by columnname
having count(columnname) > 1;
find the primary key of the table
apply the below query
delete from table
where (primary key,repeated column name )
not in
( select min(primary key), repeated column
from employee group by repeated column );
use this in the primary key column use empid ,,,the repated column is ename
empid ename
1 sankar
2 sankar
try this one -
How to fetch the data to the internal table with out using mandt
Hi all,
Iam giving my code please observer... and give me the reasonable solution.
t_mar LIKE STANDARD TABLE OF z_mar.
SELECT mandt
werks " Plant
lifnr " Vendor
FROM z_mar
INTO TABLE t_mar
where sal = 2000.
By removing MANDT from select query, it is going to dump.
ex:
SELECT
werks " Plant
lifnr " Vendor
FROM z_mar
INTO TABLE t_mar
where sal = 2000.
> Now it is going to dump ( here i removed the mandt field ).
Please give me a solution to fetch the data by removing mandt in select statement, with out chaning the internal table structure.
Thanks,
Ravihi Ravi,
i also had to avoid move-corresponding and the following is what i did...its extra work and goes around but it will
do the needed work..............
t_mar LIKE STANDARD TABLE OF z_mar.
SELECT *
FROM z_mar
INTO TABLE t_mar
where sal = 2000.
the above gets you all the fields ...but if you still want to narrow it down to just two fields
*****Declaring structure with 2 fields
data:begin of fs_data.
data:werks type z_mar-werks,
lifnr type z_mar-lifnr ,
data:end of fs_data.
*******internal table of above
data:int_data like fs_data occurs 0 with headerline.
*****moving the only 2 required fields
loop at t_mar.
t_mar-werks = int_data-werks.
t_mar-lifnr = int_data-lifnr.
append int_data.
endloop.
Hope you found it useful...
Regards
Bx -
Internal table with out header line
Hi friends,
Can u send me code for internal table with out header line : how to declare ,how to populate data and how to access the data
Regards,
vijayHi Vijay
There are several ways to declare an internal table without header line:
A) You can define a type table
TYPES: BEGIN OF TY_ITAB OCCURS 0,
INCLUDE STRUCTURE ZTABLE.
TYPES: END OF TY_ITAB.
and then your intrnal table:
DATA: ITAB TYPE TY_ITAB.
B) DATA: ITAB TYPE/LIKE STANDARD TABLE OF ZTABLE.
C) DATA: ITAB TYPE/LIKE ZTABLE OCCURS 0.
All these ways create a STANDARD TABLE
You can create other types of internal table, for example SORTED TABLE or HASHED TABLE.
These kinds of table can allow to improve the performance because they use different rules to read the data.
When it wants to manage a table without header line, it need a work area, it has to have the same structure of table.
DATA: WA LIKE ZTABLE.
DATA: T_ZTABLE LIKE STANDARD TABLE OF ZTABLE.
A) To insert the record:
If you use INTO TABLE option you don't need workarea
SELECT * FROM ZTABLE INTO TABLE T_ZTABLE
WHERE FIELD1 = 'Z001'
AND FIELD2 = '2006'.
but if you want to append a single record:
SELECT * FROM ZTABLE INTO wa WHERE FIELD1 = 'Z001'
AND FIELD2 = '2006'.
APPEND WA TO T_ZTABLE.
ENDSELECT.
Now you need workarea.
B) To read data: you need always a workarea:
LOOP AT T_ZTABLE INTO WA WHERE ....
WRITE: / WA-FIELD1, WA-FIELD2, WA-FIELD3.
ENDLOOP.
or
READ T_ZTABLE INTO WA WITH KEY FIELD3 = '0000000001'.
IF SY-SUBRC = 0.
WRITE: / WA-FIELD1, WA-FIELD2, WA-FIELD3.
ENDIF.
Anyway if you want to know only if a record exists, you can use the TRANSPORTING NO FIELDS option, in this case it doesn't need a workarea.
READ T_ZTABLE WITH KEY FIELD3 = '0000000001'
TRANSPORTING NO FIELDS.
IF SY-SUBRC = 0.
WRITE 'OK'.
ENDIF.
C) To update the data: it always needs a workarea
LOOP AT T_ZTABLE INTO WA WHERE FIELD3 = '0000000001'.
WA-FIELD3 = '0000000002'.
MODIF T_ZTABLE FROM WA.
ENDLOOP.
or
READ T_ZTABLE INTO WA WITH KEY FIELD3 = '0000000001'.
IF SY-SUBRC = 0.
WA-FIELD3 = '0000000002'.
MODIF T_ZTABLE FROM WA INDEX SY-TABIX
ENDIF.
AT the end you can use the internal table to update database:
MODIFY/UPDATE/INSERT ZTABLE FROM T_ZTABLE.
See Help online for key words DATA, you can find out more details.
Max
Message was edited by: max bianchi -
BDC PROGRAM WITH OUT USING A FM?
Hi Experts,
I need wirte a BDC program for tcode PA30.
i did the screen recording part using tcode-shdb.
i need to use field i recorded as input fields.
Now the main part is how to write code? with out using a class/method?
class/method which i earlier used is class : CL_GUI_FRONTEND_SERVICES.
method: gui_upload.
am not using ny flat file/xml file to upload?
are there any function modules which i can use?
and how to write code with out using FM?
if any can solve my issue would be very helpful...plz provide code...which would be more helpful.
Thanks in Adv.
Krrish.Hi,
If you are migrating employee data, I would suggest you to do it through PA40 transaction rather PA30. systematic screen validations it will go through. If you dont want to use any FM and wanted to do using recording pls find the below code which will update the employee data through PA40 with call transaction method.
SELECTION SCREEN
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_plan TYPE ibipparms-path OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK b1.
TYPES: BEGIN OF ty_error,
pernr TYPE persno, " Personnel number
rel_obj_id(12), " Related Object ID
msg(200) TYPE c, " To store Message
END OF ty_error.
DATA: i_tplan TYPE STANDARD TABLE OF alsmex_tabline WITH HEADER LINE,
i_intern TYPE STANDARD TABLE OF alsmex_tabline WITH HEADER LINE,
i_error TYPE ty_error OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF w_pa000,
pernr TYPE persno,
begda TYPE begda,
END OF w_pa000.
DATA: wa_plan LIKE i_plan,
wa_messtab TYPE bdcmsgcoll, " Messages
wa_error TYPE ty_error. " Errors
DATA: it_pa000 LIKE STANDARD TABLE OF w_pa000 WITH HEADER LINE,
it_pa002 LIKE STANDARD TABLE OF w_pa000 WITH HEADER LINE,
it_pa001 LIKE STANDARD TABLE OF w_pa000 WITH HEADER LINE.
DATA: g_mode LIKE ctu_params-dismode VALUE 'N',
g_file TYPE ibipparms-path.
ALV field catalog
DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
Batchinputdata of single transaction
DATA: i_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
messages of call transaction
DATA: i_messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
error session opened (' ' or 'X')
Table to hold the return messages
DATA: BEGIN OF i_errmsg OCCURS 10.
INCLUDE STRUCTURE bapiret2.
DATA: END OF i_errmsg.
ALV List header table
DATA : i_header1 TYPE slis_t_listheader.
ALV List header table
DATA : i_header TYPE slis_listheader.
***ALV Events
DATA: is_layout TYPE slis_layout_alv.
DATA : it_event TYPE slis_alv_event.
DATA : it_event1 TYPE slis_t_event.
To get the F4 help for file
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_plan.
PERFORM get_filename.
START OF SELECTION
START-OF-SELECTION.
Initialise data
PERFORM initialise_events.
Retrieve data from Excel file
PERFORM retreive_data.
Populate final data into an internal table
PERFORM populate_data.
Process the excel file data to create a record for IT0007
PERFORM process_data.
END OF SELECTION
END-OF-SELECTION.
PERFORM final_output.
*& Form GET_FILENAME
FORM get_filename .
*Function module used for F4 help
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_plan.
ENDFORM. " GET_FILENAME
*& Form INITIALISE_EVENTS
FORM initialise_events .
i_header-typ = 'H'.
i_header-key = 'R'.
i_header-info = 'BDC Interface for PA Infotypes 0000,0001,0002'.
APPEND i_header TO i_header1.
CLEAR i_header.
i_header-typ = 'S'.
i_header-info = 'Hiring, Org.Assignment, Personnel Data'.
APPEND i_header TO i_header1.
CLEAR i_header.
***Events and form name
it_event-name = 'TOP_OF_PAGE'.
it_event-form = 'TOP_OF_PAGE'.
APPEND it_event TO it_event1.
ENDFORM. " INITIALISE_EVENTS
*& Form RETREIVE_DATA
FORM retreive_data .
PERFORM upload_data.
ENDFORM. " RETREIVE_DATA
*& Form UPLOAD_DATA
FORM upload_data .
FM to upload data from excel sheet to internal table
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_plan
i_begin_col = g_colbeg
i_begin_row = g_rowbeg
i_end_col = g_colend
i_end_row = g_rowend
TABLES
intern = i_tplan
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " UPLOAD_DATA
*& Form POPULATE_DATA
FORM populate_data .
processing the internal table generated from the function module
Passing data from Excel file to internal table
CLEAR: g_cnt_processed,
g_cnt_err_processed,
i_intern,
i_plan.
LOOP AT i_tplan.
AT NEW row.
CLEAR i_plan.
ENDAT.
CASE i_tplan-col.
Begin Date
WHEN '0001'.
i_plan-pernr = i_tplan-value.
End Date
WHEN '0002'.
i_plan-begda = i_tplan-value.
WHEN '0003'.
i_plan-massg = i_tplan-value.
Sign
WHEN '0004'.
i_plan-plans = i_tplan-value.
WHEN '0005'.
i_plan-werks = i_tplan-value.
WHEN '0006'.
i_plan-persg = i_tplan-value.
WHEN '0007'.
i_plan-persk = i_tplan-value.
WHEN '0008'.
i_plan-anrex = i_tplan-value.
WHEN '0009'.
i_plan-nachn = i_tplan-value.
WHEN '0010'.
i_plan-vorna = i_tplan-value.
WHEN '0011'.
i_plan-gesch = i_tplan-value.
WHEN '0012'.
i_plan-gbdat = i_tplan-value.
WHEN '0013'.
i_plan-fatxt = i_tplan-value.
WHEN '0014'.
i_plan-famdt = i_tplan-value.
WHEN '0015'.
i_plan-gblnd = i_tplan-value.
WHEN '0016'.
i_plan-anzkd = i_tplan-value.
WHEN '0017'.
i_plan-natio = i_tplan-value.
WHEN '0018'.
i_plan-btrtl = i_tplan-value.
WHEN '0019'.
i_plan-gsber = i_tplan-value.
WHEN '0020'.
i_plan-abkrs = i_tplan-value.
ENDCASE.
Appending the internal table tb_data, tb_chng
AT END OF row.
APPEND i_plan.
IF i_plan IS INITIAL.
g_cnt_err_processed = g_cnt_err_processed + 1.
ENDIF.
ENDAT.
ENDLOOP.
To get the total number of records processed
DESCRIBE TABLE i_plan LINES g_lines.
g_cnt_processed = g_cnt_err_processed + g_lines.
CLEAR g_lines.
ENDFORM. " POPULATE_DATA
*& Form PROCESS_DATA
FORM process_data .
CLEAR wa_error.
REFRESH i_bdcdata.
Check if the employee numbers from the template has already been hired
SELECT pernr
begda
FROM pa0000
INTO TABLE it_pa000
FOR ALL ENTRIES IN i_plan
WHERE pernr = i_plan-pernr
AND massn = 'ZA'.
IF sy-subrc = 0.
SORT it_pa000 BY pernr.
Check if employee has a corresponding infotype 0001 record
SELECT pernr
begda
FROM pa0001
INTO TABLE it_pa001
FOR ALL ENTRIES IN it_pa000
WHERE pernr = it_pa000-pernr AND
begda = it_pa000-begda.
IF sy-subrc = 0.
SORT it_pa001 BY pernr.
Check if employee has a corresponding infotype 0002 record
SELECT pernr
begda
FROM pa0001
INTO TABLE it_pa002
FOR ALL ENTRIES IN it_pa001
WHERE pernr = it_pa001-pernr AND
begda = it_pa001-begda.
IF sy-subrc = 0.
SORT it_pa002 BY pernr.
ENDIF.
ENDIF.
ENDIF.
LOOP AT i_plan.
REFRESH i_bdcdata.
***your recording to be pasted here***
PERFORM bdc_field USING 'BDC_CURSOR'
'P0006-BEGDA'.
PERFORM call_transaction.
APPEND wa_error TO i_error.
REFRESH: i_bdcdata, i_messtab.
CLEAR: wa_error, i_error.
ENDLOOP.
ENDFORM. " PROCESS_DATA
*& Form BDC_DYNPRO
FORM bdc_dynpro USING program dynpro.
CLEAR i_bdcdata.
i_bdcdata-program = program.
i_bdcdata-dynpro = dynpro.
i_bdcdata-dynbegin = 'X'.
APPEND i_bdcdata.
ENDFORM. "BDC_DYNPRO
*& Form BDC_FIELD
FORM bdc_field USING fnam fval.
IF fval <> nodata.
CLEAR i_bdcdata.
i_bdcdata-fnam = fnam.
i_bdcdata-fval = fval.
APPEND i_bdcdata.
ENDIF.
ENDFORM. "bdc_field
*& Form ERROR_RECORD_DATA
FORM error_record_data .
CLEAR: g_lines,
wa_messtab,
g_msg.
DESCRIBE TABLE i_messtab LINES g_lines.
READ TABLE i_messtab INTO wa_messtab INDEX g_lines.
IF sy-subrc = 0.
CLEAR g_msg.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_messtab-msgid
lang = sy-langu
no = wa_messtab-msgnr
v1 = wa_messtab-msgv1
v2 = wa_messtab-msgv2
v3 = wa_messtab-msgv3
v4 = wa_messtab-msgv4
IMPORTING
msg = g_msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF wa_messtab-msgtyp = 'E'.
IF wa_messtab-msgtyp = 'S' AND wa_messtab-msgnr = '102' AND wa_messtab-msgid = 'PG'.
wa_error-pernr = i_plan-pernr.
wa_error-rel_obj_id = 'S'.
wa_error-msg = 'Personnel Number Created Successfully'.
ELSE.
wa_error-pernr = i_plan-pernr.
wa_error-rel_obj_id = 'E'.
wa_error-msg = g_msg.
ENDIF.
APPEND wa_error TO i_error.
CLEAR i_error.
ENDIF.
ENDFORM. " ERROR_RECORD_DATA
*& Form FINAL_OUTPUT
FORM final_output .
CLEAR g_lines.
SORT i_error.
*************added*********************************************
loop at i_error into wa_error.
if wa_error-MSG eq 'No batch input data for screen MP000600 2000'.
wa_error-rel_obj_id = 'S'.
wa_error-MSG = 'Record Created Successfully'.
modify i_error from wa_error.
endif.
endloop.
loop at i_error into wa_error.
if wa_error-rel_obj_id = 'S'.
g_cnt_success = g_cnt_success + 1. " Append success count
elseif wa_error-rel_obj_id = 'E'.
g_cnt_failure = g_cnt_failure + 1. " Append error count
endif.
endloop.
***Field catalog
PERFORM field_cat.
***Assigning Program name
g_repid = sy-repid.
SORT i_error.
***Display Output
IF NOT it_final[] IS INITIAL.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'PF_STATUS_SET'
i_save = 'A'
it_events = it_event1
is_layout = is_layout
it_fieldcat = i_fieldcat[]
TABLES
t_outtab = i_error[].
ELSE.
MESSAGE i015(zv_msg) WITH 'No Data Found for this selection'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " FINAL_OUTPUT
*& Form top_of_page
text
FORM top_of_page.
***FM for Displaying Heading
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_header1[]
i_logo = 'ENJOYSAP_LOGO'.
ENDFORM. "top_of_page
*& Form FIELD_CAT
FORM field_cat .
ENDFORM. " FIELD_CAT
*& Form CALL_TRANSACTION
FORM call_transaction .
CALL TRANSACTION 'PA40' USING i_bdcdata
MODE g_mode
UPDATE 'S'
MESSAGES INTO i_messtab.
If call transaction successful
IF sy-subrc = 0.
g_cnt_success = g_cnt_success + 1. " Append success count "changed
PERFORM error_record_data. " Populate all data
If call transaction not successful
ELSE.
PERFORM error_record_data. " Populate all table
g_cnt_failure = g_cnt_failure + 1. " Append error count "changed
ENDIF.
ENDFORM. " CALL_TRANSACTION -
How to find the last records of the table in adventure work db
hi all,
i want to find out " how to receive a last records of the table (eg: person.emailaddress ) in sql 2008 and 2005"
ThanksIf you are looking for the latest record( the one which got inserted/modified last) then use this query
select top 1 * from person.emailaddress
Order by ModifiedDate desc
Satheesh
My Blog |
How to ask questions in technical forum -
Difference Ref cursor with/with out using clause
Hi everyone,
When I am using dynamic sql with USING clause ,the results are not sorted in Ascending order.
DECLARE
TYPE emp_refcursor IS REF CURSOR;
emp_rc emp_refcursor;
TYPE v_emp_id IS TABLE OF number INDEX BY PLS_INTEGER;
TYPE v_last_name IS TABLE OF varchar2(50) INDEX BY binary_integer;
V_empno v_emp_id;
v_ename v_last_name;
p_deptno number := &U_DEPTNO;
v_limit number := 10;
v_ordcolumn varchar2(20) := 'employee_id';
v_stmt varchar2(1000);
BEGIN
v_stmt :=
'select employee_id,last_name from employees
where department_id = :x order by :y ';
dbms_output.put_line(v_stmt);
OPEN emp_rc FOR v_stmt USING p_deptno,v_ordcolumn;
LOOP
FETCH emp_rc BULK COLLECT INTO v_empno,v_ename LIMIT v_limit;
EXIT WHEN v_empno.count = 0;
FOR I IN v_empno.first .. v_empno.last
LOOP
dbms_output.put_line(v_empno(i)||' '||v_ename(i));
END LOOP;
END LOOP;
END;
When I use dynamic sql with out USING cluase,results are sorted in Ascending order.
DECLARE
TYPE emp_refcursor IS REF CURSOR;
emp_rc emp_refcursor;
TYPE v_emp_id IS TABLE OF number INDEX BY PLS_INTEGER;
TYPE v_last_name IS TABLE OF varchar2(50) INDEX BY binary_integer;
V_empno v_emp_id;
v_ename v_last_name;
p_deptno number := &U_DEPTNO;
v_limit number := 10;
v_ordcolumn varchar2(20) := 'employee_id';
v_stmt varchar2(1000);
BEGIN
v_stmt :=
'select employee_id,last_name from employees
where department_id = '||p_deptno ||
' order by '||v_ordcolumn;
dbms_output.put_line(v_stmt);
OPEN emp_rc FOR v_stmt;
LOOP
FETCH emp_rc BULK COLLECT INTO v_empno,v_ename LIMIT v_limit;
EXIT WHEN v_empno.count = 0;
FOR I IN v_empno.first .. v_empno.last
LOOP
dbms_output.put_line(v_empno(i)||' '||v_ename(i));
END LOOP;
END LOOP;
END;
P.S :---- department_id (used) = 50;
Please can some one explain why this is happening like this.
Thanks
Raghu
--------------------------------------------------------------------------------Hi sundar,
I am new to oracle and learning/trying to get the same output by using differnt methods,rather than using FOR LOOP ,I tried to use ref cursor with dynamic sql.I am in a belief that ref cursor's with dynamic sql are faster than FOR LOOP,irrespective of the size of data.Can you correct me if I am wrong.
Coming back to ur reply,how should my statement look like,when using ref cursor
with USING claus to sort data by asc/desc order.
Thanks in advance
Raghu -
Adding data file with out using brtools /sapdba
Hi all,
How to add data file to table spaces with out using brtools /sapdba.Please let meknow.
Satya.why would you do that? whats your requirement?
You can use sql commands (I prefer doing it via brtools),
example
alter tablespace <name of the tablespace> add datafile '<path of the datafile>' size <size in Mb>M autoextend <on/off> next <size> maxsize <size>;
regards
Juan -
With out using pivot function need a Query
Hi
I am having table which has 7 columns
data in table:
ID,Region,area, year-month, sales_target, actual_sales,
1, abc, xyz, 200907, 1000, 500
2, abc, pqr, 200908, 2000, 1500
3, mnr, xyz, 200907, 3000, 2000
I need the data in year and month with out using pivot funtion
intial
region, area, jul, aug, sep, oct .......jun
abc, xyz, 1000,0, 0, 0... 0
actual
region, area, jul, aug, sep, oct .......jun
abc, xyz, 500, 0, 0, 0... 0ThanksHere it is
with d as ( select 1 ID, 'abc' Region, 'xyz' area, 200907 yearmonth, 1000 sales_target, 500 actual_sales from dual
union all select 2, 'abc', 'pqr', 200908, 2000, 1500 from dual
union all select 3, 'mnr', 'xyz', 200907, 3000, 2000 from dual
select region, area,
max(case extract(month from to_date(yearmonth,'yyyymm')) when 7 then sales_target
else 0 end ) TGT_JUL
max(case extract(month from to_date(yearmonth,'yyyymm')) WHEN 8 then sales_target
else 0 end ) TGT_AUG
max(case extract(month from to_date(yearmonth,'yyyymm')) WHEN 9 then sales_target
else 0 end ) TGT_SEP
from d
group by region, area
REG ARE TGT_JUL TGT_AUG TGT_SEP
abc pqr 0 2000 0
mnr xyz 3000 0 0
abc xyz 1000 0 0You can copy and replicate the results for another one - actual_sales. -
Hi All How to TypeCast in vector<>... typedef struct ... to class...
//how to cast the vector to vector cast with out using loop
// is there any way?
//================ This is Type Definition for the class of ClsMytype=====================
typedef struct tagClsMytype
CString m_Name;
int m_Index;
double m_Value;
} xClsMytype;
//================ End of Type Definition for the class of ClsMytype=====================
class ClsMytype : public CObject
public:
ClsMytype(); // Constructor
virtual ~ClsMytype(); // Distructor
ClsMytype(const ClsMytype &e);//Copy Constructor
// =========================================
DECLARE_SERIAL(ClsMytype)
virtual void Serialize(CArchive& ar); /// Serialize
ClsMytype& operator=( const ClsMytype &e); //= operator for class
xClsMytype GetType(); // return the typedef struct of an object
ClsMytype& operator=( const xClsMytype &e);// = operator to use typedef struct
ClsMytype* operator->() { return this;};
operator ClsMytype*() { return this; };
//public veriable decleare
public:
CString m_Name;
int m_Index;
double m_Value;
typedef struct tagClsMyTypeCollection
vector <xClsMytype> m_t_Col;
} xClsMyTypeCollection;
class ClsMyTypeCollection : public CObject
public:
ClsMyTypeCollection(); // Constructor
virtual ~ClsMyTypeCollection(); // Distructor
ClsMyTypeCollection(const ClsMyTypeCollection &e);//Copy Constructor
DECLARE_SERIAL(ClsMyTypeCollection)
virtual void Serialize(CArchive& ar);
xClsMyTypeCollection GetType();
ClsMyTypeCollection& operator=( const xClsMyTypeCollection &e);
ClsMyTypeCollection& operator=( const ClsMyTypeCollection &e); //= operator for class
void Init(); // init all object
CString ToString(); // to convert value to string for the display or message proposed
ClsMyTypeCollection* operator->() { return this;}; // operator pointer to ->
operator ClsMyTypeCollection*() {return this;};
public:
vector <ClsMytype> m_t_Col;
//private veriable decleare
private:
//===================================================
ClsMytype& ClsMytype::operator=( const xClsMytype &e )
this->m_Name= e.m_Name;
this->m_Index= e.m_Index;
this->m_Value= e.m_Value;
return (*this);
//==========================Problem for the vector to vector cast
ClsMyTypeCollection& ClsMyTypeCollection::operator=( const xClsMyTypeCollection &e )
this->m_t_Col= (vector<ClsMytype>)e.m_t_Col; // how to cast
return (*this);
Thanks in AdvanceHi Smirt
You could do:
ClsMyTypeCollection* operator->() {
returnthis;};
// operator pointer to ->
operatorClsMyTypeCollection*()
{returnthis;};
public:
vector<ClsMytype>
m_t_Col;//??
The last line with "vector<xClsMytype>
m_t_Col;". It compiles but I doubt that is what you want.
Regards
Chong -
How to insert record in child table with foreign key
Hi,
I am using Jdeveloper 11.1.2.0. I have two master table one child table.
How to insert and update a record in child table with foreign key ?
I have created VO based on three EO(one eo is updatable other two eo are references) by using joined query.
Thanks in Advance
Edited by: 890233 on Dec 24, 2011 10:40 PM... And here is the example to insert using sequenceimpl by getting the primary key of the master record and insert master and detail together.
Re: Unable to insert a new row with a sequence generated column id
-Arun -
How to print a string with out using main method??
how to print a string with out using main method??
if we can tell me with example?
thanks in adavance
rajaHi,
actually there's none. The UITableView class needs to "know" the tableView's height so either it can calc <number of rows> times <row height> or it has to sum the height of each single row.
If the row which needs to be of different size always is the first or the last row you can user a tableHeader or tableFoot view.
Regards
Dirk -
Business user needs to view tables with out SE16 access
Hi ,
There is a requirement where business user ( Data team) need to view some master and transactional data tables in production . But , as per our process , end users will not be given SE16 access .
Is there any solution where we can allow the end user to view tables with out SE16 access ?
Thanks in advance .
Thanks .
Dharma.Hi,
Using Function Module C160_TRANSACTION_CALL you can call any tcode which dont have access..
Create a report and call function module and pass se16 to parameter .
CALL FUNCTION 'C160_TRANSACTION_CALL' "
EXPORTING
i_tcode = 'SE16' " sy-tcode
EXCEPTIONS
ILLEGAL_INPUT = 1 "
INTERNAL_ERROR = 2 "
. " C160_TRANSACTION_CALL
now create a tcode for this report as ZSE16.,
hope this helps u.,
You can also create Data browser ( SE16 ) in report and display as ALV., using Field Symbols and RTTS.
Thanks & Regards,
Kiran -
Please suggest a select query / sub query with out using any subprograms or
source table: Three columns ORIGIN, DESTINATION,MILES
Origin Destination Miles
Sydney Melbourne 1000
Perth Adelaide 3000
Canberra Melbounre 700
Melbourne Sydney 1000
Brisbane Sydney 1000
Perth Darwin 4000
Sydney Brisbane 1000
out put :Three columns ORIGIN, DESTINATION,MILES
Duplicate routes are to be ignored so the output is
Origin Destination Miles
Sydney Melbourne 1000
Perth Adelaide 3000
Canberra Melbounre 700
Brisbane Sydney 1000
Perth Darwin 4000
Please suggest a select query / sub query with out using any subprograms or functions/pkgs to get the out put table.Hi,
user9368047 wrote:
... Please suggest a select query / sub query with out using any subprograms or functions/pkgs to get the out put table.Why? If the most efficient way to get the results you want involves using a function, why wouldn't you use it?
Here's one way, without any functions:
SELECT a.*
FROM source_table a
LEFT OUTER JOIN source_table b ON a.origin = b.destination
AND a.destination = b.origin
AND a.miles = b.miles
WHERE b.origin > a.origin -- Not b.origin > b.origin
OR b.origin IS NULL
;If you'd care to post CREATE TABLE and INSERT statements for your sample data, then I could test this.
Edited by: Frank Kulash on Nov 6, 2012 7:39 PM
Corrected WHERE clause after MLVrown (below)
Maybe you are looking for
-
Hi Experts This refers to credit memo to vendors thru FB65.The vendor master has payment terms populated which gets carried forward in case of a credit memo. The solution of entering a "credit memo" payment terms in the vendor master has been explore
-
Exacting Audio from a .MOV file?
I have a concert in a .MOV format and want to exact the audio so I can listen to it on my iPod. How do I do this? So is there an easy way to set where songs start and stop?
-
Procedure for sending equipment in an Exibition
Dear Sir, We are manufacturer of machines . We have a scenario where we need to send out 1 Machine to some exibition for 15 days and subsequently this machine will come back to us . The machine can be sent out only against the Excise Invoice . Kind
-
Email Link Created in Muse won't work
This is odd. I can send an email to my client from any email program. But if I select the email link from his webpage (created in Muse), even though the email is correct when an email window opens, the client is not receiving emails. Some get bounceb
-
Spontaneous or unintentional creation of Groups, which cannot be deleted
In Address Book in the Group column there suddenly appeared about 20-25 icons of new Groups without (so far as I know) any action on my part. These Groups cannot be deleted, whether I assign a name to them, or not. When I go to "Edit/Delete Group" an