Heap implementation in ABAP
I try to implement in ABAP a heap. I created an class which simulate this heap but I'm interesting that in ABAP is an ready implementation of heap class?
My definition of class have methods:
- GET_LAST_TOKEN
- ADD_TOKEN
- RELEASE_TOKEN
- CHECK_IS_EMPTY
- FLIP_HEAP
Attibutes:
- HEAP //table
- TOTAL //counter
- C_FALSE //boolean false
- C_TRUE //bolean true
Implementation (only overall view)
method ADD_TOKEN .
APPEND i_token to heap.
IF sy-subrc = 0.
total = total + 1.
ENDIF.
endmethod.
METHOD release_token .
IF total > 0.
DELETE heap INDEX total.
IF sy-subrc = 0.
total = total - 1.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD get_last_token .
DATA: l_token LIKE LINE OF heap.
IF total is not INITIAL.
READ TABLE heap
INDEX total
INTO e_token.
ENDIF.
ENDMETHOD.
Is this good idea?
hi
good
go through this link about heap , i hope this ll help you to solve your problem
http://www.redbooks.ibm.com/redbooks/pdfs/sg246291.pdf
thanks
mrutyun^
Similar Messages
-
How to implement an abap program in a process chain
Hi,
I have an ABAP Program which uploads data into a table.
Now I want to implement this abap program in a process chain.
Please could anyone tell me how this can be done.
Thanks & Regards,
Sushanth H.S.Hi,
A process chain is a background task for processing data into a BW instance .
I want to know how to integrate an abap program into the process chain.
Regards,
Sushanth H.S. -
Where we should implement inbound abap proxy?
I have to implement Inbound abap proxy, there i need to call two BAPI s to create reservation and purchase requisition based on material number coming from input.
my doubt is all this code where should i implement and also please give me some sample codes.
Thank you
NeelimaHi,
U can find the code in the following link,
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/06adbf03-0a01-0010-f386-d8e45561a3c4
ABAP Inbound Proxy Error !
Problem with Inbound Abap Proxy
How to call BAPI from ABAP Inbound Proxy
issue with inbound abap proxy
Reward If Helpful,
Jagadish. -
Are user exits in Pricing for CRM 7.0 implementable in ABAP?
Hi all,
I'm new in CRM. I'm interested in creating some user exits for pricing in CRM 7.0. I know it can be done in Java but I was wandering, since now the web AS is implemented in ABAP, if I could drop Java and use solely ABAP for user exits in pricing.
ThanksHi all, I am new to CRM....Can I not create a user-exit condition type in CRM using VOFM ? The reason is that we are comfortable in ABAP but not in Java. Kindly reply with your experience. Thanks
-
Hai,
I want some information in ABAP Implementation.
Please give me some idea and share with me.
bye
visuESS/MSS implementation steps
http://searchsap.techtarget.com/generic/0,295582,sid21_gci1205058,00.html -
Hi,
In an abap program I want to pick up files from an other server (not the SAP server) and process the data.
I try do to this by using the CPI-C calls
COMMUNICATION INIT
COMMUNICATION ALLOCATE
COMMUNICATION ACCEPT
COMMUNICATION SEND
COMMUNICATION RECEIVE
COMMUNICATION DEALLOCATE
In the table TXCOM I define an destination. The transaction program is C-program.
This work when I put the files on the SAP-server.
Have someone more information about this or is there another way to do this.
Kind regards,
Ritai have no knowledge on cpi-c implementation.
but if the server where the file resides can support FTP you can use FTP FMs delivered to do the job
or
if the external system is accessible over HTTP protocol and if you are on WAS you can get the file using cl_http_client
Regards
Raja -
Hi, I'm trying to implement a min and a max heap. So far i am inserting nodes into an array, and setting them so they will know who their parent node, and left and right children are.
My problem is, when it it tries to set the parent, I get a null pointer. It has to be something simple that im just missing.
here is my code:
public class Node {
Node leftChild;
Node rightChild;
Node parent;
int nData;
boolean Root;
boolean Last;
public Node(int nData)
this.nData = nData;
public void root()
Root = true;
public void last()
Last = true;
public void removeLast()
Last = false;
public void checkRoot(Node node)
}The last line of the Test class is where the null pointer is coming in, nodes[k].parent = nodes[k/2];
public class Test {
Node[] nodes;
int i = 1;
public Test()
nodes = new Node[25];
addNode(new Node(10));
addNode(new Node(15));
addNode(new Node(12));
addNode(new Node(9));
//Prints Node Info
for(int j = 1; j<5; j++)
System.out.println(nodes[j].nData);
if(nodes[j].leftChild != null)
System.out.println("leftchild" + nodes[j].leftChild.nData);
if(nodes[j].rightChild != null)
System.out.println("right child" + nodes[j].rightChild.nData);
if(nodes[j].parent != null)
System.out.println("parent" + nodes[j].parent.nData);
System.out.println("root" + nodes[j].Root);
System.out.println("last" + nodes[j].Last);
public void addNode(Node node)
// Sets Root and Last Nodes
nodes[i] = node;
if(i==1)
node.root();
if(nodes[i+1] == null)
nodes.last();
if(nodes[i-1] != null)
nodes[i-1].removeLast();
update();
i++;
// Sets Left Child, Right Child and Parent nodes
public void update()
for(int k = 1; k<5;k++)
if(nodes[2*k] != null)
nodes[k].leftChild = nodes[2*k];
if(nodes[2*k + 1] != null)
nodes[k].rightChild = nodes[2*k + k];
if(nodes[k/2] != null)
nodes[k].parent = nodes[k/2];
Thank you for any replies, and apologize for being inadequate to solve something so simple, hah.The last line of the Test class is where the null pointer is coming in, nodes[k].parent = nodes[k/2];If that's where you're getting the NPE, then nodes[k] must be null.
Either nodes[k] never had a non-null value, or it had one and you overwrote it with null. Examine your code to see if you ever assign a value to nodes[k]. -
Could anyone give me some idea about heap imlementation with linked structure?(As far as i know, i had no problem with the "HeapNode" class, but i have a lot of difficulties with implementing the heap class. Also, i got the following code segment from a programming book, but i really cant keep everything in my mind.
public void insertItem(Object k, Object e)
throws InvalidKeyException {
if (!comparator.isComparable(k))
throw new InvalidKeyException("Invalid Key")
Position z; // Position to insert
if (isEmpty())
z = root();
else {
z = last;
while (!isRoot(z) && !isLeftChild(z))
z = parent(z);
if (!isRoot(z))
z = rightChild(parent(z));
while (!isExternal(z))
z = leftChild(z);
expandExternal(z);
replace(z, new KeyElementPair(k, e));
last = z;
// Up-heap bubbling comes next
Position u;
while (!isRoot(z)) { //Up-heap bubble
u = parent(z);
if (comparator.isLessThanOrEqualTo(
keyOfPosition(u),
keyOfPosition(z))) break;
swap(u, z);
z = u;
private Object keyOfPosition(Position p)
throws InvalidPositionException {
return ((KeyElementPair) p.element()).key();
// cast on line above should not fail
any help would be greatly appreciated.I'm just using the -xml option. But I don't know what is the "datapath" element.
This is my command line:
java -Xmx1024M -classpath ".\UploadTest\classes;E:\software\apache\java\xalan-j_2_7_1-bin\xalan.jar;E:\software\apa che\java\xalan-j_2_7_1-bin\serializer.jar" -Djavax.xml.transform.TransformerFactory=org.apache.xalan.xsltc.trax.TransformerFactoryIm pl com.adobe.adept.upload.UploadTest http://************:8080/packaging/Package "E:\Documenti\eBook personali\****\*****.pdf" -pass ******** -xml -jpg
The xalan implementation for xml serialization is more efficient. The -xml that you suggested is already on the command line.
The xml content is:
<package xmlns="http://ns.adobe.com/adept">
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title>*******</dc:title>
<dc:creator>**************</dc:creator>
<dc:publisher>**********</dc:publisher>
<dc:format>application/pdf</dc:format>
</metadata>
<permissions>
<display>
<device/>
<until>2013-01-13T13:10:49-07:00</until>
</display>
<excerpt>
<until>2013-01-13T13:10:49-07:00</until>
</excerpt>
<print>
<count initial="10" max="20" incrementInterval="3600"/>
<maxResolution>300</maxResolution>
</print>
</permissions>
</package>
What's "the path of the using the dataPath element"?
Thank you.
Gianpiero -
Service implementation in ABAP
This is regarding,
From proxy generation to service implementation. I have successfully created service interface at my PI 7.1 EHP1 system and I went to my ECC box and from sproxy I developed my server proxy and the code is ready to give the result.
Now I am trying to enable the service from my ECC box. So from my ECC I did the soamanager->Application and Scenario communication -> single service Administration. Here for my created service I am trying to create the service enablement and end point creation.
But here it is showing an error as, Error: Preconfiguration is invalid
Also when I check the classification tab, there the classification value is not released, I hope it should be Released.
For this please kindly suggest any preconfiguration is required for my SAP ECC box to service registry. If need please inform the configuration details.
Where as my PI 7.1 ehp 1 service registry configuration is working fine.
BTW my user having the authorizations, UDDI_Admin, SERVICE_REGISTRY_READ_WRITE.Hi,
Please check below thread.
Logical ports - SRT Framework exception: Preconfiguration is invalid
Hope this helps.
Regards,
Deepak. -
Implementing WebDynpro ABAP in JAVA Portal
Hello
We have a JAVA enterprise Portal and we would like to create an iView of WebDynpro ABAP application.
We have done it in our QA portal by creating a system and in the property editor configuring the "Web AS Host Name" & "Web AS Path".
It works great becuase there is only one ABAP application server.
However, in Productoin we have several ABAP application server and one central instance.
If i create a system using template and choose "SAP system with load balancing" , still In the property editor i see only "Web AS Host Name" .
How can i set in the system's property editor a group of servers that hold WebDynpro ABAP application ?
Does anybody have a clue ?
Adi J.Hi Adi,
For load balancing purposes you should use the SAP Web Dispatcher. The Web Dispatcher will know all you web application servers and will redirect the requests to the app server with more resources available.
Thus you can set the Web As hostname and port to the Web Dispatcher.
You should avoid using the message server for load balancing purposes. I can suggest you the following SAP notes for further information:
1225587 - WebDynpro ABAP with Loadbalancing in the Enterprise Portal
1040325 - HTTP load balancing: Message Server or Web Dispatcher?
945516 - Web Dynpro ABAP in a portal environment
I hope this helps.
Best regards,
Cristiano -
A Binary Tree Implementation in ABAP
Hi,
Can any one explaine me how to create a binary tree of random numbers with dynamic objects.
Thanks,
Manjula.Hi manjula,
This sample code uses dynamic objects to create a binary tree of random numbers as per your requirement ...pls go through It.
It stores numbers on the left node or right node depending on the value comparison with the current value. There are two recursive subrotines used for the building of the tree and printing through the tree.
For comparison purpose, the same random numbers are stored and sorted in an internal table and printed.
*& Report YBINTREE - Build/Print Binary Tree of numbers *
report ybintree .
types: begin of stree,
value type i,
left type ref to data,
right type ref to data,
end of stree.
data: tree type stree.
data: int type i.
data: begin of rnd occurs 0,
num type i,
end of rnd.
start-of-selection.
do 100 times.
generate random number between 0 and 100
call function 'RANDOM_I4'
exporting
rnd_min = 0
rnd_max = 100
importing
rnd_value = int.
store numbers
rnd-num = int.
append rnd.
build binary tree of random numbers
perform add_value using tree int.
enddo.
stored numbers are sorted for comparison
sort rnd by num.
print sorted random numbers
write: / 'Sorted Numbers'.
write: / '=============='.
skip.
loop at rnd.
write: rnd-num.
endloop.
skip.
print binary tree. This should give the same result
as the one listed from the internal table
write: / 'Binary Tree List'.
write: / '================'.
skip.
perform print_value using tree.
skip.
*& Form add_value
text - Build tree with value provided
-->TREE text
-->VAL text
form add_value using tree type stree val type i.
field-symbols: <ltree> type any.
data: work type stree.
if tree is initial. "When node has no values
tree-value = val. " assign value
clear: tree-left, tree-right.
create data tree-left type stree. "Create an empty node for left
create data tree-right type stree. "create an empty node for right
else.
if val le tree-value. "if number is less than or equal
assign tree-left->* to <ltree>. "assign the left node to fs
call add_value recursively with left node
perform add_value using <ltree> val.
else. "if number is greater
assign tree-right->* to <ltree>. "assign the right node to fs
call add_value recursively with right node
perform add_value using <ltree> val.
endif.
endif.
endform. "add_value
*& Form print_value
text - traverse tree from left-mid-right order
automatically this will be sorted list
-->TREE text
form print_value using tree type stree.
field-symbols: <ltree> type any.
if tree is initial. "node is empty
else. "non-empty node
assign tree-left->* to <ltree>. "left node
perform print_value using <ltree>. "print left
write: tree-value. "print the current value
assign tree-right->* to <ltree>. "right node
perform print_value using <ltree>. "print right
endif.
endform. "print_value
pls reward if helps,
regards. -
Method implementation using ABAP objects
hi folks,
I am impelementing a method using one of the parameters, which is a internal table taken as an import parameter.
I am using the field symbols to <b>modify</b> the table data but it is not working.
method IF_EX_PT_ABS_ATT_COUNTRY~CALCULATE_COUNTRY.
The method CALCULATE_COUNTRY has a parameter
TIMES_PER_DAY Importing TYPE PTM_TIMES_PER_DAY.
This is the table tha t retrieves the data for the Absence infotype 2001 for an employee and has the field
ABRST value populated.
I need to clear the value for this field and update the table 'TIMES_PER_DAY' before it populates the infotype record.
Hence I am writing the code in its method by calling the parameter.
here is the piece of code....
FIELD-SYMBOLS: <F1> TYPE PTM_TIMES_PER_DAY.
loop at times_per_day into <F1> where datum eq begda.
clear <F1>-abrst.
ASSIGN <F1> to times_per_day. ****ERROR
endloop.
endmethod.
I know the error is because trying to assign the <F1> field symbol to internal table.
But how can I do that ultimately I need to update the internal table 'times_per_day '
ALSO TRIED THIS....
data: w_tab type PTM_TIMES_PER_DAY.
loop at times_per_day into w_tab where datum eq begda.
CLEAR w_tab-abrst.
modify times_per_day from w_tab transporting abrst.
endloop.
It gave an error saying the table 'times_per_day' cannot be changed.
I hope you got what I am trying to achieve here... any leads or guidelines will be really helpful,
Thanks
VinuIs this table part of the IMPORT PARAMETERS list. If that is the case you cannot change the table.
It should be in the EXPORTING parametes to change.
Regards,
Ravi
Note : Please mark all the helpful answers -
ABAP OO: How to implement a Destructor
Hello.
I implemented a ABAP-OO-Class, which supports (above others) the following methods:
NEW -> Create new Object in DB
DELETE -> Delete Object from DB
In case the method DELETE is called i want to 'destroy' the object instance of this class. Currently i worked around this problem by CLEARing all instance attributes.
Is there a way to implement a DESTRUCTOR, which really destroys the object?
MIKEHI Mike,
Check these Links out
<b>METHOD DESTRUCTOR
Re: Any possibility to implement a destructor in abap-objects
Regards,
Santosh -
Poll: Development in ABAP Objects / Webdynpro vs. classical Dynpro
Hey there ABAP developers,
I just want to ask if you can give me one or two minutes of your attention for two poll questions.
At the moment I´m writing my master thesis about the development of a monitoring tool in ABAP. One of my bigger chapters is about the decision, which programming paradigm should be used for new development projects in SAP. And another important one is about WebDynpro vs. classical Dynpros.
Because of the fact, that I can´t create any polls in here, I just started this discussion and hope for many replies .
It would be very nice if some of you could give me an answer to the following questions (only 2 ), so that I can maybe use the result of this poll in my master thesis, if there are enough responses.
1. What percentage of new development projects are you developing in ABAP Objects? (Not to be considered small reports that just runs for only one time)
A. 0 %
B. less than 25%
C. 25% - 49%
D. 50% - 75%
E. more than 75%
2. Which GUI technology do you prefer?
A. Classical Dynpro
B. WebDynpro
C. Business Server Pages (BSP)
D. others (please mention)
I want to thank you in advance for answering the questions,
Best regards,
ChristophHi,
Present SAP Implementation projects are very rare, maximum projects are support and up gradations only .
If they want Implement the SAP newly , defiantly they should creating ABAP Objects.
Why Because ABAP Objects are Object Oriented Concepts, so, for future reference and re usability..etc .
Now Come to the First Quetion.
if it is implementation project ABAP Objects are 25% - 49%.
if it is Support project ABAP Objects are 25%
Now Come to the Second Quetion.
Depend upon Reqmnt, but Most of the Applications are Webdynpro . i.e 70%.
Remaining 30% All ( BSP and GUI ....Etc..)
This is my opinion.
Sambaiah.Paidipelli. -
How to delete cube old request by using abap code?
Dear experts,
Here is one thing need your help:
We have one cube need to delete the old request. This cube is loaded daily and only need to delete the request of that month.
I know there is one "Delete Overlap Requet" type in the process chain, but my concern is: in our DTP filter, different day the selection will have different values, let's say A and B, and A and B are not even overlap at all.
So my question is:
1. Can I still use "Delete Overlap Request" to delete the old request?
2. If so, I see it can be implemented by abap routine, can anyone give me some sample code? Like how to delete request only in this month. And how to delete request whose selection is equal to a specific value.
Note: one of the source cube is real time cube so can not delete the request from infopackage.
Any post will be appreciated and thank you all for your time in advance!
Regards.
TimHere is the intial code when I choose "Request Selection through Routine", please help me on how to choose the specific request and delete them in this routine.
program conversion_routine.
Type pools used by conversion program
Global code used by conversion rules
$$ begin of global - insert your declaration only below this line -
TABLES: ...
DATA: ...
$$ end of global - insert your declaration only before this line -
InfoCube = ZPC_DEL_REQ_ZBPS_C01
form compute_ZPC_DEL_REQ_ZBPS_C01
tables l_t_request_to_delete structure rsreqdelstruc
using l_request like rsreqdone-rnr
changing p_subrc like sy-subrc.
*Insert Source Code to decide if requests should be deleted.
*All Requests in table l_t_request_to_delete will be deleted
*from Infocube ZPC_DEL_REQ_ZBPS_C01.
*Add new requests if you want to delete more (from this cube).
*Remove requests you did not want to be deleted.
$$ begin of routine - insert your code only below this line -
loop at l_t_request_to_delete.
endloop.
clear p_subrc.
$$ end of routine - insert your code only before this line -
endform.
Maybe you are looking for
-
Is there a way to play my iTunes library from home, at work?
Wondering if this is possible...
-
How do I get rid of the subscriptions window on my iPad
my version is 8.1.2 (12B440) how can I get rid of the history, shared links, reading list that is always showing
-
hi,im from malaysia, how can i purchase apple tv.
-
Cound I change IPMP probing rate under solaris 10 u2 ?
Hey, gurus! I have one question about IPMP. Because there are so many SPARC servers in the same LAN, So many ICMP packages were produced. But I want to reduce ICMP probe rate less than 2 seconds. In other word, I want to reduce ICMP network traffic o
-
Setting Message Class via Content-Type for Faxes
Hello, I am trying to set the message class for inbound email messages (with a fax attachment) from the internet. The class that I am trying to set is IPM.Note.Microsoft.Fax.CA. Exchange 2013 SP1 is being used. I have a transport rule set up which