Please give me a idea with sample code explainingBDC with TAB control
Hello,
Can anybody give me a idea of doing BDC with TAB control.
Regards
Mave
hi, you need to show the BDC script in TAB control?
then you can reference to the screen of SHDB, maybe
thanks
Similar Messages
-
Look for JDeveloper Tutorial with samples code
Hello All ,
my name is Ron ,
i'm new user of JDeveloper i'm looking for a place to start a tutorial "How to use
the JDeveloper ? " with samples code .
from very basic use ( Hello world program ) to addvanced programming ( Like GUI Forms and Database )
please show me links where to start learning from
thanks in advanceThe tutorials in the JDeveloper help system are a very good place to start. Choose Help | Help Topics from the JDeveloper menu then click the Tutorials book in the Help navigator. The tutorials are also available on OTN, see:
http://otn.oracle.com:8877/jdeveloper/help/
You may also find the 'how to' documents and samples on OTN helpful:
Oracle9i JDeveloper How To Documents
http://otn.oracle.com/products/jdev/howtos/content.html
Oracle9i JDeveloper Sample Code
http://otn.oracle.com/sample_code/products/jdev/content.html
Hope this helps.
- jon -
How to use TreeByKeyTableColumn (with sample code)
Hi Guys,
Can anyone tell me How to bind data with TreeByKeyTableColumn ? (with sample code). Is it possible to add checkbox with TreeByKeyTableColumn? Kindly aware me further in this regards....
Thanks,
RavinHi
Answering to following question
How to bind data with TreeByKeyTableColumn
Create the Context
Click on the Context tab of the view. Create a node name it as "AIR_LINES". Set the Cardinality as 0...N. Make it a Singleton Node. Give a method name in supply function column by name "GENERATE_TREE".
Then we will create attributes required for the tree column. We require 5 attributes
1. Attribute which contains the current level of the node. Create an attribute called "NODE_LEVEL" of type STRING.
2. Attribute which contains the parent level of the node. Create an attribute called "PARENT_LEVEL" of type STRING.
3. Attribute which contains the contents of the node. Create an attribute called "NODE_CONTENT" of type STRING.
4. Attribute which contains X or Space depending upon the node is expanded or not. Create an attribute called "EXPANDED" of type WDY_BOOLEAN.
5. Attribute which contains X or Space depending upon the type of the node, whether the node is a branch or a leaf. Create an attribute called "IS_LEAF" of type WDY_BOOLEAN.
Click on the layout tab of the view. Add UI element of type Table, give the name as 'Tree Table'. Bind the DATASOURCE property of the table to the AIR_LINES node of the view context.
Give heading to the table as "Booking Details".
Right click on table node crated and chose Insert Master Column.
Name it as "TREE_NODE" and chose TreeByKeyTableColumn from the dropdown
Bind the 4 properties with context attributes we have already created.
Expanded -> Expanded.
Is_leaf -> Is_leaf.
Parent_key -> Parent_level
Row_key -> Node_level
Give heading to the tree node in the text field.
Insert a cell editor in the tree column and chose the type as Text view.
Bind the text property of the text view to the NODE_CONTENT attribute of the context.
Similarly create a table column to display the second column i.e. Node type.
Right click -> Insert table column -> Give the heading in the text property of the header (Node Type).
Right click -> Insert Cell Editor -> Bind the text property to NODE_TYPE attribute of the context.
Click on the Methods tab of the view. You will find the method of type supply function which we created during the creation of node. Double click and write the following code.
METHOD generate_tree .
Ideally this code must go to a method of a class which will return four internal tables
start of Model code
TYPES : BEGIN OF ty_scarr, " Air line Table
carrid TYPE s_carr_id,
END OF ty_scarr.
TYPES : BEGIN OF ty_spfli, " Flight Connection Table
carrid TYPE s_carr_id,
connid TYPE s_conn_id,
END OF ty_spfli.
TYPES : BEGIN OF ty_sflight, " Flight Table
carrid TYPE s_carr_id,
connid TYPE s_conn_id,
fldate TYPE s_date,
END OF ty_sflight.
TYPES : BEGIN OF ty_sbook, " Flight Booking Table
carrid TYPE s_carr_id,
connid TYPE s_conn_id,
fldate TYPE s_date,
bookid TYPE s_book_id,
END OF ty_sbook.
DATA : lt_scarr TYPE TABLE OF ty_scarr.
DATA : lt_spfli TYPE TABLE OF ty_spfli.
DATA : lt_sflight TYPE TABLE OF ty_sflight.
DATA : lt_sbook TYPE TABLE OF ty_sbook.
DATA : ls_scarr TYPE ty_scarr.
DATA : ls_spfli TYPE ty_spfli.
DATA : ls_sflight TYPE ty_sflight.
DATA : ls_sbook TYPE ty_sbook.
SELECT carrid
FROM scarr
INTO TABLE lt_scarr
UP TO 2 ROWS.
IF lt_scarr[] IS NOT INITIAL.
SELECT carrid connid
FROM spfli
INTO TABLE lt_spfli
FOR ALL ENTRIES IN lt_scarr
WHERE carrid EQ lt_scarr-carrid.
IF lt_spfli[] IS NOT INITIAL.
SELECT carrid connid fldate
FROM sflight
INTO TABLE lt_sflight
FOR ALL ENTRIES IN lt_spfli
WHERE carrid EQ lt_spfli-carrid
AND connid EQ lt_spfli-connid.
For an additional level of branching
IF lt_spfli[] IS NOT INITIAL.
SELECT carrid connid fldate bookid
FROM sbook
INTO TABLE lt_sbook
FOR ALL ENTRIES IN lt_sflight
WHERE carrid EQ lt_sflight-carrid
AND connid EQ lt_sflight-connid
AND fldate EQ lt_sflight-fldate.
ENDIF.
ENDIF.
ENDIF.
End of Model code
Start of code for generation the tree
data declaration
DATA lt_table TYPE wd_this->elements_air_lines.
DATA ls_table LIKE LINE OF lt_table.
DATA lvl1_index TYPE string.
DATA lvl2_index TYPE string.
DATA lvl3_index TYPE string.
DATA lvl4_index TYPE string.
Level 1
LOOP AT lt_scarr INTO ls_scarr.
lvl1_index = sy-tabix.
condense lvl1_index.
create a row
ls_table-node_level = lvl1_index. " 1 st level
ls_table-parent_level = ''. " No parent
ls_table-node_content = ls_scarr-carrid.
ls_table-node_type = 'Air Line'.
ls_table-is_leaf = abap_false.
INSERT ls_table INTO TABLE lt_table.
clear ls_table.
Level 2
LOOP AT lt_spfli INTO ls_spfli.
lvl2_index = sy-tabix.
condense lvl2_index.
create a row
concatenate lvl1_index `.` lvl2_index into ls_table-node_level.
ls_table-parent_level = lvl1_index. " Parent 1 st level
ls_table-node_content = ls_spfli-connid.
ls_table-node_type = 'Flight Connection'.
ls_table-is_leaf = abap_false.
INSERT ls_table INTO TABLE lt_table.
clear ls_table.
Level 3
LOOP AT lt_sflight INTO ls_sflight.
lvl3_index = sy-tabix.
condense lvl3_index.
create a row
concatenate lvl1_index `.` lvl2_index `.` lvl3_index into ls_table-node_level.
concatenate lvl1_index `.` lvl2_index into ls_table-parent_level.
ls_table-node_content = ls_sflight-fldate.
ls_table-node_type = 'Flight'.
ls_table-is_leaf = abap_true.
INSERT ls_table INTO TABLE lt_table.
clear ls_table.
If you want an additional level it can be programmed like this
Level 4
*LOOP AT lt_sbook INTO ls_sbook.
lvl4_index = sy-tabix.
condense lvl4_index.
create a row
concatenate lvl1_index `.` lvl2_index `.` lvl3_index `.` lvl4_index into ls_table-node_level.
concatenate lvl1_index `.` lvl2_index `.` lvl3_index into ls_table-parent_level.
ls_table-node_content = ls_sbook-bookid.
ls_table-node_type = 'Booking'.
ls_table-is_leaf = abap_true. " as its the final level in our hier archy
INSERT ls_table INTO TABLE lt_table.
ENDLOOP.
ENDLOOP.
ENDLOOP.
ENDLOOP.
bind all the elements
node->bind_table(
new_items = lt_table
set_initial_elements = abap_true ).
ENDMETHOD. -
Can any body please give me an idea and the Import and Export process?
Can any body please give me an idea and the Import and Export process? Excise Duty and other duties and so on.
I will be highly obliged for the help.
Regards,
Subhasishfor importing material,every importer has to file bill of entry in customs.
first vendor send some documents like certificate of origine , bill of lading, packing list etc to importer.
on the basis of those documents,importer makes supporting documents like duty calculation sheet, GATE declaration form,CHA declaration form,insurance certificate.
CHA (custom house agent ) file the bill of entry on behalf of impoter in customs.
custom verify it.
after duty payment, CHA can clears the consignment from custom.
there are two typs of BOE.
1 Home consumption BOE
2 Warehousing BOE
in 1st type of BOE , payment of duty is done at the time of custom clearance
and in 2nd type of BOE, importer can put material in warehouse without payment of duty. at time of using those material from warehouse,importer has to file out bond warehouse BOE and pay the all duties. -
Sun ejb tutorial compilation problem with sample code
I have been trying to follow the ejb tutorial off of Sun's web site. However, I get the following problem when I try to compile the sample code.
prompt>javac Demo.java
works fine
Prompt>javac DemoBean.java
works fine
Prompt>javac DemoHome.java
DemoHome.java:23: cannot resolve symbol
symbol : class Demo
location: interface ejb.demo.DemoHome
public Demo create() throws CreateException, RemoteException;
^
1 error
Prompt>
Can anyone help me out as I have tried several books which conveniently skip the part about compiling errors.
I noticed I don't have a CLASSPATH variable and then i created one with just '.' in it and that didn't work. any help would be appreciated as this is driving me crazy. Thanks.try to change the order of the exception.
first RemoteException and then CreateException -
Please add Forms/Reports in the Sample Code section
Hi
When we click on the Breadcrumb menu->Sample code
http://www.oracle.com/technology/sample_code/index.html
In the Sample ApplicationsDevelopment Tools there is no link for
Forms and Reports product. Please add these links there:
http://www.oracle.com/technology/sample_code/products/forms/index.html
http://www.oracle.com/technology/sample_code/products/reports/index.htmlGood point; we have made these additions.
Cheers, OTN -
How to do rollback with sample code.
Hi all,
I have a requirement : we are updating the record by FM hr_maintain_masterdata in three table and if the record is get updated in two table but not in one table, it should do rollback . it should not allow to update the record in other tables also.
Kindly provide the sample code for the same.
Thanks in advance
Shweta
Edited by: shweta singh on Dec 20, 2008 1:39 PMHi,
Just type ROLLBACK WORK in the error handling code blocks. This works only, if the function module doesn't set an explicit COMMIT WORK in itself.
COMMIT WORK.
*Changes on your first table
CALL FUNCTION hr_maintain_masterdata
IF sy-subrc <> 0.
ROLLBACK WORK.
* EXIT or MESSAGE Statement
ENDIF.
*Changes on your second table
CALL FUNCTION hr_maintain_masterdata
IF sy-subrc <> 0.
ROLLBACK WORK.
* EXIT or MESSAGE Statement
ENDIF.
*Changes on your third table
CALL FUNCTION hr_maintain_masterdata
IF sy-subrc <> 0.
ROLLBACK WORK.
* EXIT or MESSAGE Statement
ENDIF.
Regards
Mark-André
Edited by: Mark-André Kluck on Dec 20, 2008 2:53 PM -
Creating Contract Account "With Sample" at migration with emigall?
Hi!
Is it possible to define a "With Sample" type of a creation of Contract Account (and Contract Object) as it is possible at manual creation/posting? I was looking for a standard field and haven't find it.
Thanks for your help!
Best regards,
PeterTheres a button "Create with Sample" in manual posting of ContractAccout: [screen-shoot|http://www.shrani.si/f/r/S7/4SYcJ9N4/cac.jpg]
...and also at ContractObject.
Thanks for help.
Best regards,
Peter -
Client machine is Windows 7 x64.
I am using AdobeApplicationManager tool to extract sources from original Set-up.exe.
Extracted sources contain Build and Exceptions folder. The Build directory contain Dreamweaver.msi and Exceptions contains AdobeHelp and WidgetBrowser sources.
After silent installation of Dreamweaver.msi, i'm tried to install WidgetBrowser but it return error code 7(The storage control blocks were destroyed).
I tried on different windows 7 x64 client but still its not working.
Please help.Hi,
I have the exact same problem, except I am using 32-bit Windows 7.
Thanks
Rosy_55 -
Final Year Project! Please give me some idea!
I'm doing an individual final year project using IBM Aglet, JRun and J2ME. The topic is "Mobile agent shopping system", better with some theories. I have no idea about what types of application should be done. Initially, I intended to build a system for the customers to search for the products in a shopping mall with data mining recommendation(e.g. association-Apriori), but my supervisor want me to give him a new idea because previous students has built similar application (but using classification in data mining).
My supervisor has another 3 students doing the same project, but one of them doing a restaurant reservation system, another one has many multimedia in his system. The last one - I don't know. It seems that my project has no "selling points". I don't want to think of a quite complicated one as my programming skill is not so good. But the big problem is the project is restricted to a shopping mall. There is not much can be done. The project will be handed in 2 months later. I'm afraid that I can't hand it in on time. Does anyone have any suggestion on the topic. I have thought of this many times, but my supervisor still does not satisfy with it.
Please help me!http://mindprod.com/projects/projects.html
-
Please help me to find the sample code and schema for GetDBDateTime.zip fil
Please help me to find the GetDBDateTime.zip and Guest_Book.zip files.
Tks!Does this Help?
http://www.oracle.com/technology/sample_code/products/ias/files/psp/GetDBDateTime/Readme.html
Did you install Oracle9iAS ? -
Report Listing for GL account with tax code assiociated with it by company
Hi expert,
Would like to seek for help does SAP have any standard report to list down all the tax code (with description) with the related GL accout by company code?
Please help.
Many thanks.
KHHi,
Thank you for your reply.
Do you have any ideas any report will be able to list all the define tax code for the related GL account not by posting document.
Please advice.
Many thanks.
KH -
Please give some idea friends.
I have a text file with 10 lines. Eas line is containing 3 words separated by colon. I have a bean to get those 3 words. What i want to do is to create 10 bean object, initialize them with the data available in the text file. and finally store those beans in a array list. I have written the following code to read a line and bread the line in tokens. After that how i should proceed. Please give me some idea.
for(String line = null; (line = br.readLine()) != null; lineCount++) {
StringTokenizer tokenizer = new StringTokenizer(line, ":");
while(tokenizer.hasMoreTokens()) {
String strTemp = tokenizer.nextToken();
System.out.println(strTemp);
}Thanks.you should have an array of strings to store the information and then call your object constructor, passing it the various elements in the array. I couldn't tell from looking at your code, but if you don't include a space in the tokenizer constructor, then it will return a word including a space. I'm not sure if that matters to you or not.
-
Hello Experts please give some suggestions in this code
Hello Experts . Please give suggestions in changing the below code to increase the performance . Thanks in advance for all your suggestions...
PARAMETERS : Pr_WERKS LIKE EKPO-WERKS OBLIGATORY,
Pr_EINDT LIKE EKET-EINDT OBLIGATORY.
SELECT-OPTIONS : S_LIFNR FOR EKKO-LIFNR MATCHCODE
OBJECT KRED OBLIGATORY.
DATA: BEGIN OF SELEC OCCURS 10,
SIGN(1),
OPTION(2),
LOW LIKE p_eindt,
HIGH LIKE p_eindt,
END OF SELEC.
SELEC-SIGN = 'I'.
SELEC-OPTION = 'BT'.
SELEC-LOW = pr_eindt.
SELEC-HIGH = pr_eindt + 31.
SELECT * FROM EKET WHERE EINDT IN SELEC.
CHECK EKET-MENGE NE 0.
SELECT * FROM EKPO WHERE EBELN = EKET-EBELN AND
EBELP = EKET-EBELP AND
WERKS = Pr_WERKS.
SELECT * FROM EKKO WHERE EBELN = EKET-EBELN AND
LIFNR IN S_LIFNR AND
BSTYP = 'L' AND
FRGKE = 'R'.
SELECT SINGLE * FROM MAKT WHERE MATNR = EKPO-MATNR AND
SPRAS = 'EN'.
SELECT SINGLE * FROM LFA1 WHERE LIFNR = EKKO-LIFNR.
EXTRACT DETAIL.
ENDSELECT.
ENDSELECT.
ENDSELECT.Ways of Performance Tuning
1. Selection Criteria
2. Select Statements
Select Queries
SQL Interface
Aggregate Functions
For all Entries
Select Over more than one internal table
Selection Criteria
1. Restrict the data to the selection criteria itself, rather than filtering it out using the ABAP code using CHECK statement.
2. Select with selection list.
SELECT * FROM SBOOK INTO SBOOK_WA.
CHECK: SBOOK_WA-CARRID = 'LH' AND
SBOOK_WA-CONNID = '0400'.
ENDSELECT.
The above code can be much more optimized by the code written below which avoids CHECK, selects with selection list
SELECT CARRID CONNID FLDATE BOOKID FROM SBOOK INTO TABLE T_SBOOK
WHERE SBOOK_WA-CARRID = 'LH' AND
SBOOK_WA-CONNID = '0400'.
Select Statements Select Queries
1. Avoid nested selects
SELECT * FROM EKKO INTO EKKO_WA.
SELECT * FROM EKAN INTO EKAN_WA
WHERE EBELN = EKKO_WA-EBELN.
ENDSELECT.
ENDSELECT.
The above code can be much more optimized by the code written below.
SELECT PF1 PF2 FF3 FF4 INTO TABLE ITAB
FROM EKKO AS P INNER JOIN EKAN AS F
ON PEBELN = FEBELN.
Note: A simple SELECT loop is a single database access whose result is passed to the ABAP program line by line. Nested SELECT loops mean that the number of accesses in the inner loop is multiplied by the number of accesses in the outer loop. One should therefore use nested SELECT loops only if the selection in the outer loop contains very few lines or the outer loop is a SELECT SINGLE statement.
2. Select all the records in a single shot using into table clause of select statement rather than to use Append statements.
SELECT * FROM SBOOK INTO SBOOK_WA.
CHECK: SBOOK_WA-CARRID = 'LH' AND
SBOOK_WA-CONNID = '0400'.
ENDSELECT.
The above code can be much more optimized by the code written below which avoids CHECK, selects with selection list and puts the data in one shot using into table
SELECT CARRID CONNID FLDATE BOOKID FROM SBOOK INTO TABLE T_SBOOK
WHERE SBOOK_WA-CARRID = 'LH' AND
SBOOK_WA-CONNID = '0400'.
3. When a base table has multiple indices, the where clause should be in the order of the index, either a primary or a secondary index.
To choose an index, the optimizer checks the field names specified in the where clause and then uses an index that has the same order of the fields. In certain scenarios, it is advisable to check whether a new index can speed up the performance of a program. This will come handy in programs that access data from the finance tables.
4. For testing existence, use Select.. Up to 1 rows statement instead of a Select-Endselect-loop with an Exit.
SELECT * FROM SBOOK INTO SBOOK_WA
UP TO 1 ROWS
WHERE CARRID = 'LH'.
ENDSELECT.
The above code is more optimized as compared to the code mentioned below for testing existence of a record.
SELECT * FROM SBOOK INTO SBOOK_WA
WHERE CARRID = 'LH'.
EXIT.
ENDSELECT.
5. Use Select Single if all primary key fields are supplied in the Where condition .
If all primary key fields are supplied in the Where conditions you can even use Select Single.
Select Single requires one communication with the database system, whereas Select-Endselect needs two.
Select Statements SQL Interface
1. Use column updates instead of single-row updates
to update your database tables.
SELECT * FROM SFLIGHT INTO SFLIGHT_WA.
SFLIGHT_WA-SEATSOCC =
SFLIGHT_WA-SEATSOCC - 1.
UPDATE SFLIGHT FROM SFLIGHT_WA.
ENDSELECT.
The above mentioned code can be more optimized by using the following code
UPDATE SFLIGHT
SET SEATSOCC = SEATSOCC - 1.
2. For all frequently used Select statements, try to use an index.
SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA
WHERE CARRID = 'LH'
AND CONNID = '0400'.
ENDSELECT.
The above mentioned code can be more optimized by using the following code
SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA
WHERE MANDT IN ( SELECT MANDT FROM T000 )
AND CARRID = 'LH'
AND CONNID = '0400'.
ENDSELECT.
3. Using buffered tables improves the performance considerably.
Bypassing the buffer increases the network considerably
SELECT SINGLE * FROM T100 INTO T100_WA
BYPASSING BUFFER
WHERE SPRSL = 'D'
AND ARBGB = '00'
AND MSGNR = '999'.
The above mentioned code can be more optimized by using the following code
SELECT SINGLE * FROM T100 INTO T100_WA
WHERE SPRSL = 'D'
AND ARBGB = '00'
AND MSGNR = '999'.
Select Statements Aggregate Functions
If you want to find the maximum, minimum, sum and average value or the count of a database column, use a select list with aggregate functions instead of computing the aggregates yourself.
Some of the Aggregate functions allowed in SAP are MAX, MIN, AVG, SUM, COUNT, COUNT( * )
Consider the following extract.
Maxno = 0.
Select * from zflight where airln = LF and cntry = IN.
Check zflight-fligh > maxno.
Maxno = zflight-fligh.
Endselect.
The above mentioned code can be much more optimized by using the following code.
Select max( fligh ) from zflight into maxno where airln = LF and cntry = IN.
Select Statements For All Entries
The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the length of the WHERE clause.
The plus
Large amount of data
Mixing processing and reading of data
Fast internal reprocessing of data
Fast
The Minus
Difficult to program/understand
Memory could be critical (use FREE or PACKAGE size)
Points to be must considered FOR ALL ENTRIES
Check that data is present in the driver table
Sorting the driver table
Removing duplicates from the driver table
Consider the following piece of extract
Loop at int_cntry.
Select single * from zfligh into int_fligh
where cntry = int_cntry-cntry.
Append int_fligh.
Endloop.
The above mentioned can be more optimized by using the following code.
Sort int_cntry by cntry.
Delete adjacent duplicates from int_cntry.
If NOT int_cntry[] is INITIAL.
Select * from zfligh appending table int_fligh
For all entries in int_cntry
Where cntry = int_cntry-cntry.
Endif.
Select Statements Select Over more than one Internal table
1. Its better to use a views instead of nested Select statements.
SELECT * FROM DD01L INTO DD01L_WA
WHERE DOMNAME LIKE 'CHAR%'
AND AS4LOCAL = 'A'.
SELECT SINGLE * FROM DD01T INTO DD01T_WA
WHERE DOMNAME = DD01L_WA-DOMNAME
AND AS4LOCAL = 'A'
AND AS4VERS = DD01L_WA-AS4VERS
AND DDLANGUAGE = SY-LANGU.
ENDSELECT.
The above code can be more optimized by extracting all the data from view DD01V_WA
SELECT * FROM DD01V INTO DD01V_WA
WHERE DOMNAME LIKE 'CHAR%'
AND DDLANGUAGE = SY-LANGU.
ENDSELECT
2. To read data from several logically connected tables use a join instead of nested Select statements. Joins are preferred only if all the primary key are available in WHERE clause for the tables that are joined. If the primary keys are not provided in join the Joining of tables itself takes time.
SELECT * FROM EKKO INTO EKKO_WA.
SELECT * FROM EKAN INTO EKAN_WA
WHERE EBELN = EKKO_WA-EBELN.
ENDSELECT.
ENDSELECT.
The above code can be much more optimized by the code written below.
SELECT PF1 PF2 FF3 FF4 INTO TABLE ITAB
FROM EKKO AS P INNER JOIN EKAN AS F
ON PEBELN = FEBELN.
3. Instead of using nested Select loops it is often better to use subqueries.
SELECT * FROM SPFLI
INTO TABLE T_SPFLI
WHERE CITYFROM = 'FRANKFURT'
AND CITYTO = 'NEW YORK'.
SELECT * FROM SFLIGHT AS F
INTO SFLIGHT_WA
FOR ALL ENTRIES IN T_SPFLI
WHERE SEATSOCC < F~SEATSMAX
AND CARRID = T_SPFLI-CARRID
AND CONNID = T_SPFLI-CONNID
AND FLDATE BETWEEN '19990101' AND '19990331'.
ENDSELECT.
The above mentioned code can be even more optimized by using subqueries instead of for all entries.
SELECT * FROM SFLIGHT AS F INTO SFLIGHT_WA
WHERE SEATSOCC < F~SEATSMAX
AND EXISTS ( SELECT * FROM SPFLI
WHERE CARRID = F~CARRID
AND CONNID = F~CONNID
AND CITYFROM = 'FRANKFURT'
AND CITYTO = 'NEW YORK' )
AND FLDATE BETWEEN '19990101' AND '19990331'.
ENDSELECT.
1. Table operations should be done using explicit work areas rather than via header lines.
READ TABLE ITAB INTO WA WITH KEY K = 'X BINARY SEARCH.
IS MUCH FASTER THAN USING
READ TABLE ITAB INTO WA WITH KEY K = 'X'.
If TAB has n entries, linear search runs in O( n ) time, whereas binary search takes only O( log2( n ) ).
2. Always try to use binary search instead of linear search. But dont forget to sort your internal table before that.
READ TABLE ITAB INTO WA WITH KEY K = 'X'. IS FASTER THAN USING
READ TABLE ITAB INTO WA WITH KEY (NAME) = 'X'.
3. A dynamic key access is slower than a static one, since the key specification must be evaluated at runtime.
4. A binary search using secondary index takes considerably less time.
5. LOOP ... WHERE is faster than LOOP/CHECK because LOOP ... WHERE evaluates the specified condition internally.
LOOP AT ITAB INTO WA WHERE K = 'X'.
ENDLOOP.
The above code is much faster than using
LOOP AT ITAB INTO WA.
CHECK WA-K = 'X'.
ENDLOOP.
6. Modifying selected components using MODIFY itab TRANSPORTING f1 f2.. accelerates the task of updating a line of an internal table.
WA-DATE = SY-DATUM.
MODIFY ITAB FROM WA INDEX 1 TRANSPORTING DATE.
The above code is more optimized as compared to
WA-DATE = SY-DATUM.
MODIFY ITAB FROM WA INDEX 1.
7. Accessing the table entries directly in a "LOOP ... ASSIGNING ..." accelerates the task of updating a set of lines of an internal table considerably
Modifying selected components only makes the program faster as compared to Modifying all lines completely.
e.g,
LOOP AT ITAB ASSIGNING <WA>.
I = SY-TABIX MOD 2.
IF I = 0.
<WA>-FLAG = 'X'.
ENDIF.
ENDLOOP.
The above code works faster as compared to
LOOP AT ITAB INTO WA.
I = SY-TABIX MOD 2.
IF I = 0.
WA-FLAG = 'X'.
MODIFY ITAB FROM WA.
ENDIF.
ENDLOOP.
8. If collect semantics is required, it is always better to use to COLLECT rather than READ BINARY and then ADD.
LOOP AT ITAB1 INTO WA1.
READ TABLE ITAB2 INTO WA2 WITH KEY K = WA1-K BINARY SEARCH.
IF SY-SUBRC = 0.
ADD: WA1-VAL1 TO WA2-VAL1,
WA1-VAL2 TO WA2-VAL2.
MODIFY ITAB2 FROM WA2 INDEX SY-TABIX TRANSPORTING VAL1 VAL2.
ELSE.
INSERT WA1 INTO ITAB2 INDEX SY-TABIX.
ENDIF.
ENDLOOP.
The above code uses BINARY SEARCH for collect semantics. READ BINARY runs in O( log2(n) ) time. The above piece of code can be more optimized by
LOOP AT ITAB1 INTO WA.
COLLECT WA INTO ITAB2.
ENDLOOP.
SORT ITAB2 BY K.
COLLECT, however, uses a hash algorithm and is therefore independent
of the number of entries (i.e. O(1)) .
9. "APPEND LINES OF itab1 TO itab2" accelerates the task of appending a table to another table considerably as compared to LOOP-APPEND-ENDLOOP.
APPEND LINES OF ITAB1 TO ITAB2.
This is more optimized as compared to
LOOP AT ITAB1 INTO WA.
APPEND WA TO ITAB2.
ENDLOOP.
10. DELETE ADJACENT DUPLICATES accelerates the task of deleting duplicate entries considerably as compared to READ-LOOP-DELETE-ENDLOOP.
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING K.
This is much more optimized as compared to
READ TABLE ITAB INDEX 1 INTO PREV_LINE.
LOOP AT ITAB FROM 2 INTO WA.
IF WA = PREV_LINE.
DELETE ITAB.
ELSE.
PREV_LINE = WA.
ENDIF.
ENDLOOP.
11. "DELETE itab FROM ... TO ..." accelerates the task of deleting a sequence of lines considerably as compared to DO -DELETE-ENDDO.
DELETE ITAB FROM 450 TO 550.
This is much more optimized as compared to
DO 101 TIMES.
DELETE ITAB INDEX 450.
ENDDO.
12. Copying internal tables by using ITAB2[ ] = ITAB1[ ] as compared to LOOP-APPEND-ENDLOOP.
ITAB2[] = ITAB1[].
This is much more optimized as compared to
REFRESH ITAB2.
LOOP AT ITAB1 INTO WA.
APPEND WA TO ITAB2.
ENDLOOP.
13. Specify the sort key as restrictively as possible to run the program faster.
SORT ITAB BY K. makes the program runs faster as compared to SORT ITAB.
Internal Tables contd
Hashed and Sorted tables
1. For single read access hashed tables are more optimized as compared to sorted tables.
2. For partial sequential access sorted tables are more optimized as compared to hashed tables
Hashed And Sorted Tables
Point # 1
Consider the following example where HTAB is a hashed table and STAB is a sorted table
DO 250 TIMES.
N = 4 * SY-INDEX.
READ TABLE HTAB INTO WA WITH TABLE KEY K = N.
IF SY-SUBRC = 0.
ENDIF.
ENDDO.
This runs faster for single read access as compared to the following same code for sorted table
DO 250 TIMES.
N = 4 * SY-INDEX.
READ TABLE STAB INTO WA WITH TABLE KEY K = N.
IF SY-SUBRC = 0.
ENDIF.
ENDDO.
Point # 2
Similarly for Partial Sequential access the STAB runs faster as compared to HTAB
LOOP AT STAB INTO WA WHERE K = SUBKEY.
ENDLOOP.
This runs faster as compared to
LOOP AT HTAB INTO WA WHERE K = SUBKEY.
ENDLOOP. -
Socket Programing in J2ME - Confused with Sun Sample Code
Hai Everybody,
I have confused with sample code provided by Sun Inc , for the demo of socket programming in J2ME. I found the code in the API specification of J2ME. The code look like :-
// Create the server listening socket for port 1234
ServerSocketConnection scn =(ServerSocketConnection) Connector.open("socket://:1234");
where Connector.open() method return an interface Connection which is the base interface of ServerSocketConnection. I have confused with this line , is it is possible to cast base class object to the derived class object?
Plese help me in this regards
Thanks in advance
SulfikkarThere is nothing to be confused about. The Connector factory creates an implementation of one of the extentions of the Connection interface and returns it.
For a serversocket "socket://<port>" it will return an implementation of the ServerSocketConnection interface. You don't need to know what the implementation looks like. You'll only need to cast the Connection to a ServerSocketConnection .
Maybe you are looking for
-
How can you change track length times in itunes?
I use itunes now for all music media, and have gone to the extraordinary pains of sorting and importing all of my music so that it is now all digitally stored... The curious thing is that in itunes, it reports some track lengths as being way longer t
-
Hi All, I have below two requirement , is there any report available in sap which fullfills my below requirement 1) Report for outstanding commitments Is there any repoert available which shows outstanding commitments related to the purchase orders 2
-
What is the best Compressor settings for burning a 2 hour DVD on single layer disc?
I have a 2 hour (120 minutes) project timeline which I want to encode in compressor to fit on a single layer DVD. Do I need to change the Bit Rate to make it fit on a single layer? Or can someone post the settings or link to where I can find the best
-
Can my AVG anti-virus check on websites be re-enabled?
My anti virus program, AVG, was checking each website as I accessed them. It also checked the sights as I posted them in the Google program. When I downloaded Firefox version 5, that feature was disabled. If it can be restored, I'll download 5 again.
-
How to use paint bucket.
I am trying to change the background color and I USED, to be able to just click on the paint bucket and then click the background with whichever color I wanted. For some reason when i click nothing happens... Im getting frustrated. blah Please help.