How to process batch in ABAP Objects content
Hi,
my name is Wadim and i am sorry for my bad english
I have a problem, maybe someone of you can help me.
I need a class to pracess batch(bdc) oder a Call transaction which i had recorded with SHDB. I search for it but without success.
The class should habe all function like the default BDC-Include "bdcrecx1".
Is there a default class in SAP?
Thanks for help.
regards mark
Edited by: Krapp Wadim on May 20, 2010 9:19 PM
There is a class CL_HRTNM_QUOTA_BATCH_MANAGER which has a lot of batch functionality.
I've never used it. My company has our own Z class for batch processing. A lot of similar code is in CL_HRTNM_QUOTA_BATCH_MANAGER in methods BDC_DYNPRO, BDC_FIELD, BDC_SESSION, CREATE_BATCH.
In my quick look at that class, I don't see where they call BDC_CLOSE_GROUP but you should have a method with this also.
Similar Messages
-
Why and how to use events in abap objects
Dear all,
Please explain me why and how to use events in abap objects with real time example
regards
pankaj giriHi Pankaj,
I will try to explain why to use events... How to use is a different topic.. which others have already answered...
This is same from your prev. post...
Events :
Technically speaking :
" Events are notifications an object receives from, or transmits to, other objects or applications. Events allow objects to perform actions whenever a specific occurrence takes place. Microsoft Windows is an event-driven operating system, events can come from other objects, applications, or user input such as mouse clicks or key presses. "
Lets say you have an ALV - An editable one ...
Lats say - Once you press some button you want some kind of validation to be done.
How to do this ?
Raise an Event - Which is handled by a method and write the validation code.
Now you might argue, that I can do it in this way : Capture the function code - and call the validate method.
Yes, in this case it can be done.. But lets say .. you change a field in the ALV and you want the validation to be done as soon as he is done with typing.
Where is the function code here ? No function code... But there is an event here - The data changed event.
So you can raise a data changed event that can be handled and will do the validation.
It is not user friendly that you ask the user to press a button (to get the function code) for validation each time he enters a data.
The events can be raised by a system, or by a program also. So in this case the data changed event is raised by a system that you can handle.
Also, Lets say on a particular action you want some code to trigger. (You can take the same example of validation code). In this case the code to trigger is in a separate class. The object of which is not available here at this moment. (This case happens very frequently).
Advantage with events : Event handlers can be in a separate class also.
e.g : In the middle of some business logic .. you encounter a error. You want to send this information to the UI (to user - in form of a pop up) and then continue with some processing.
In many cases - A direct method call to trigger the pop up is not done. Because (in ideal cases) the engine must not interact with UI directly - Because the UI could be some other application - like a windows UI but the error comes from some SAP program.
So - A event is raised from the engine that is handled in the UI and a pop up is triggered.
Here -- I would have different classes (lets say for different Operating Systems). And all these classes must register to the event ERROR raised in application.
And these different classes for different Operation systems will have different code to raise a pop-up.
Now you can imagine : If you coded a pop-up for Windows (in your application logic) .. it will not work for Mac or Linux. But of you raise a event.. that is handled separately by a different UI classes for Win, Linux or Mac they will catch this event and process accordingly.
May be I complicated this explanation .... but I couldn't think of a simpler and concrete example.
Cheers.
Varun. -
How can we create a ABAP object into .ptr file
HI,
How can we create a ABAP object into .ptr/.car/.sar format so that we can give it to a remote client and which can be imported into their R/3 system to get the functionality of this object.Hello Ramesh
All you need is SAPLINK. Have a look at the following links:
<a href="/people/ed.herrmann/blog/2005/11/14/the-enterprise-and-the-bazaar Enterprise and the Bazaar</a>
<a href="https://sourceforge.net/projects/saplink/">SAPLINK</a>
Regards
Uwe -
ABAP list processing statements in ABAP Objects
Hi,
Based on the Online help "The ABAP statements used for list processing are not yet fully available in ABAP Objects".
Is there any chnage planned about this for the next WAS release?
Thanks,
PeterHi Peter
I believe, most of the measures taken are for some compatibility and performance issues. So, there is no need to expect great changes about this.
*--Serdar -
How to process a JCO.Table object line by line
Hello all.
I am new to development using JCo. How to process a JCO.Table line by line?! I want to print each line of the table using System.out.println ...
Thx a lot
MikeHi Mike,
here is a sample code for you,
JCO.Table codes = function.getTableParameterList().getTable("INFO");
for (int i = 0; i < codes.getNumRows(); i++) {
codes.setRow(i);
int tmp = new Integer(codes.getString("POSNN")).intValue();
String tmpStr = new String(Integer.toString(tmp));
ret = result.put(tmpStr, codes.getString("VBELN"));
then using System.out.println(), you can print these values.
regards,
Abhijeet -
How to process XML into ABAP data?
Hi,
I have a string variable which content is a xml file. Then how to extract data from it into corresponding ABAP data objects like internal table or structure?
Thanks a lot!HI Long
check this code which converts xml to bap internal table using DOM
REPORT Z_XML_TO_TABLE.
TYPE-POOLS: ixml.
TYPES: BEGIN OF t_xml_line,
data(256) TYPE x,
END OF t_xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_parser TYPE REF TO if_ixml_parser,
l_istream TYPE REF TO if_ixml_istream,
l_document TYPE REF TO if_ixml_document,
l_node TYPE REF TO if_ixml_node,
l_xmldata TYPE string.
DATA: l_elem TYPE REF TO if_ixml_element,
l_root_node TYPE REF TO if_ixml_node,
l_next_node TYPE REF TO if_ixml_node,
l_name TYPE string,
l_iterator TYPE REF TO if_ixml_node_iterator.
DATA: l_xml_table TYPE TABLE OF t_xml_line,
l_xml_line TYPE t_xml_line,
l_xml_table_size TYPE i.
DATA: l_filename TYPE string.
PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:\temp\orders_dtd.xml'.
Validation of XML file: Only DTD included in xml document is supported
PARAMETERS: pa_val TYPE char1 AS CHECKBOX.
START-OF-SELECTION.
Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
wrap the table containing the file into a stream
l_istream = l_streamfactory->create_istream_itable( table =
l_xml_table
size =
l_xml_table_size ).
Creating a document
l_document = l_ixml->create_document( ).
Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
Validate a document
IF pa_val EQ 'X'.
l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
ENDIF.
Parse the stream
IF l_parser->parse( ) NE 0.
IF l_parser->num_errors( ) NE 0.
DATA: parseerror TYPE REF TO if_ixml_parse_error,
str TYPE string,
i TYPE i,
count TYPE i,
index TYPE i.
count = l_parser->num_errors( ).
WRITE: count, ' parse errors have occured:'.
index = 0.
WHILE index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
WRITE: 'line: ', i.
i = parseerror->get_column( ).
WRITE: 'column: ', i.
str = parseerror->get_reason( ).
WRITE: str.
index = index + 1.
ENDWHILE.
ENDIF.
ENDIF.
Process the document
IF l_parser->is_dom_generating( ) EQ 'X'.
PERFORM process_dom USING l_document.
ENDIF.
*& Form get_xml_table
FORM get_xml_table CHANGING l_xml_table_size TYPE i
l_xml_table TYPE STANDARD TABLE.
Local variable declaration
DATA: l_len TYPE i,
l_len2 TYPE i,
l_tab TYPE tsfixml,
l_content TYPE string,
l_str1 TYPE string,
c_conv TYPE REF TO cl_abap_conv_in_ce,
l_itab TYPE TABLE OF string.
l_filename = pa_file.
upload a file from the client's workstation
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = l_xml_table_size
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Writing the XML document to the screen
CLEAR l_str1.
LOOP AT l_xml_table INTO l_xml_line.
c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data
replacement = space ).
c_conv->read( IMPORTING data = l_content len = l_len ).
CONCATENATE l_str1 l_content INTO l_str1.
ENDLOOP.
l_str1 = l_str1+0(l_xml_table_size).
SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
WRITE: /.
WRITE: /' XML File'.
WRITE: /.
LOOP AT l_itab INTO l_str1.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab
IN
l_str1 WITH space.
WRITE: / l_str1.
ENDLOOP.
WRITE: /.
ENDFORM. "get_xml_table
*& Form process_dom
FORM process_dom USING document TYPE REF TO if_ixml_document.
DATA: node TYPE REF TO if_ixml_node,
iterator TYPE REF TO if_ixml_node_iterator,
nodemap TYPE REF TO if_ixml_named_node_map,
attr TYPE REF TO if_ixml_node,
name TYPE string,
prefix TYPE string,
value TYPE string,
indent TYPE i,
count TYPE i,
index TYPE i.
node ?= document.
CHECK NOT node IS INITIAL.
ULINE.
WRITE: /.
WRITE: /' DOM-TREE'.
WRITE: /.
IF node IS INITIAL. EXIT. ENDIF.
create a node iterator
iterator = node->create_iterator( ).
get current node
node = iterator->get_next( ).
loop over all nodes
WHILE NOT node IS INITIAL.
indent = node->get_height( ) * 2.
indent = indent + 20.
CASE node->get_type( ).
WHEN if_ixml_node=>co_node_element.
element node
name = node->get_name( ).
nodemap = node->get_attributes( ).
WRITE: / 'ELEMENT :'.
WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
IF NOT nodemap IS INITIAL.
attributes
count = nodemap->get_length( ).
DO count TIMES.
index = sy-index - 1.
attr = nodemap->get_item( index ).
name = attr->get_name( ).
prefix = attr->get_namespace_prefix( ).
value = attr->get_value( ).
WRITE: / 'ATTRIBUTE:'.
WRITE: AT indent name COLOR COL_HEADING INVERSE, '=',
value COLOR COL_TOTAL INVERSE.
ENDDO.
ENDIF.
WHEN if_ixml_node=>co_node_text OR
if_ixml_node=>co_node_cdata_section.
text node
value = node->get_value( ).
WRITE: / 'VALUE :'.
WRITE: AT indent value COLOR COL_GROUP INVERSE.
ENDCASE.
advance to next node
node = iterator->get_next( ).
ENDWHILE.
ENDFORM. "process_dom
regards
kishore
reward if helpful -
How to process batch input session through program
Hi Friends,
I am getting 5 batch input sessions in SM35,but I want to process these all sessions through program without going to SM35.
How it is possible through Program?
Please Guide me!
Thanks,
YogeshHi,
It's the report to run the batchinput sessions.
When you create to B.I. session, you can execute it by transaction SM35 (but it uses rsbdcsub) or rsbdcsub.
For example you can use it in the same program where you create B.I.:
Here the code to fill the structures of FI batch input
standard....
...here it creates session...
SUBMIT RFBIBL00 WITH DS_NAME = VA_FILE
WITH CALLMODE = CALLMODE AND RETURN.
....here it runs session....
SUBMIT RSBDCSUB WITH MAPPE = P_NAME
WITH VON = SY-DATUM
WITH BIS = SY-DATUM
WITH FEHLER = ' '
TO SAP-SPOOL
LIST NAME P_NAME
LIST DATASET P_NAME
COVER TEXT P_NAME
NEW LIST IDENTIFICATION ' '
EXPORTING LIST TO MEMORY
AND RETURN.
regards,
Shiva. -
How to process a collection of objects of a derived class?
I'm trying to clean up some duplicated code.
I have several classes that have a common parent class. I have in my application several searching and sorting functions that operate on these child classes. But I realized that this is code duplication, as these functions only need data members of the common parent class. So I figured I could make these functions operate on collections of the parent class.
But during refactoring, I ran into a compiler error that surprised me. This is the SSCCE:
import java.util.*;
public class Tinker {
static class ParentClass {}
static class ChildClass extends ParentClass {}
static void processClassCollection( Collection< ParentClass > c ) {}
public static void main( String[] args ) {
Collection< ParentClass > parentClassCollection = new Vector< ParentClass >();
Collection< ChildClass > childClassCollection = new Vector< ChildClass >();
processClassCollection( parentClassCollection );
processClassCollection( childClassCollection ); // Why won't this compile?
}Every object of type ChildClass is also of type ParentClass, right? Every function that requires a ParentClass object, can be passed a ChildClass, right?
Then, if a function requires a Collection< ParentClass >, why can't I pass it a Collection< ChildClass >?
Apparently there is a gap of my understanding, either of inheritance, or of Collections. I would very much appreciate clarification, and any suggestion how to deal with such a case.
-Ron.ejp wrote:
Why can't a Collection< ChildClass > be used where a Collection< ParentClass > is expected?Because Collection< ChildClass > doesn't extend Collection< ParentClass >. They are separate unrelated types.And I think part of the reason this is not allowed. i.e. you can pass ChildClass to a method which expects a ParentClass. is that java doesn't know if you are just looking at the Collection or modifying it. If you could add anything which extends ParentClass to the collection, the collection of ChildClass would not be valid any more.
The difference is that in the first case, you are passing the reference by value and changing it in the method has no impact on the caller. However, in the case of the Collection, you could corrupt it if you can add objects which the caller does not expect to be in it. -
How to use sort using abap objects
hello friends,
i am using the class cl_salv_table to display my ALV. now on my selection screen i have 3 radio buttons,according to the radiobutton selected my output should appear sorted.
which class can help me sort my internal fields according to the radio button on the selection screen and pls tell me how to do this.Hi,
Check this...
DATA: lr_sorts TYPE REF TO cl_salv_sorts.
DATA: lr_agg TYPE REF TO cl_salv_aggregations.
TRY.
lr_sorts = gr_table->get_sorts( ).
lr_sorts->add_sort( columnname = 'FIELD1' subtotal = gc_true ).
lr_sorts->add_sort( columnname = 'FIELD2' subtotal = gc_true ).
lr_sorts->add_sort( columnname = 'FIELD3' subtotal = gc_true ). "subtotal is optional for each field
etc
CATCH cx_salv_existing. "#EC NO_HANDLER
CATCH cx_salv_not_found. "#EC NO_HANDLER
CATCH cx_salv_data_error. "#EC NO_HANDLER
ENDTRY.
TRY.
lr_agg = gr_table->get_aggregations( ).
lr_agg->add_aggregation( 'FIELD4' ).
lr_agg->add_aggregation( 'FIELD5' ).
etc
CATCH cx_salv_existing. "#EC NO_HANDLER
CATCH cx_salv_not_found. "#EC NO_HANDLER
CATCH cx_salv_data_error. "#EC NO_HANDLER
ENDTRY.
Regards,
Omkar. -
Adding leading zeros in abap objects.
Can anyone explain me
1. How to add leading zeros to a field in abap objects.
For eg:
data: dmb(6) type c value '123456',
actually the output value of c should have leading zeros added to it for length 16.
i.e '0000000000123456' . If the length of dmb is less than 16 then leading zeros should be added to that value to make it 16 as length.
Please tell me how to do it in ABAP Objects.Hi Camila
Try to use the statement
DATA: ALPHABET(15) VALUE ' ABCDEFGHIJ',
M1(4) VALUE 'ABCD',
M2(6) VALUE 'BJJCA '.
SHIFT ALPHABET LEFT DELETING LEADING M1.
The field
ALPHABET
remains unchanged.
SHIFT ALPHABET LEFT DELETING LEADING SPACE.
The field ALPHABET now has the following contents:
'ABCDEFGHIJ '.
SHIFT ALPHABET RIGHT DELETING TRAILING M2.
<b>ALPHABET</b> now has the following contents:
' ABCDEFGHI'.
<u><b>IN CHARACTER MODE</b></u>
<b>Effect</b>
This is the default setting (see above), and the addition is therefore optional.
<b>Note
Performance:</b>
For performance reasons, you should avoid using SHIFT in WHILE loops.
The runtime required to shift a field with length 10 by one character to the right or left requires about 5 msn (standardized microseconds). A cyclical shift requires around 7 msn. The runtime for the ...
LEFT DELETING LEADING
... variant is around 3.5 msn, for ...
RIGHT DELETING TRAILING
... around 4.5 msn.
Reward all helpfull answers
Regards
Pavan -
hallow
i wont example in regular abap like select stetmet and how i do that in abap objects (the same code)and which benefit i have in using objects.
Regardshi,
check the below links lot of info and examples r there
http://www.sapgenie.com/abap/OO/index.htm
http://www.geocities.com/victorav15/sapr3/abap_ood.html
http://www.brabandt.de/html/abap_oo.html
Check this cool weblog:
/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
http://www.sapgenie.com/abap/OO/index.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
http://www.allsaplinks.com/
http://www.sap-img.com/
http://www.sapgenie.com/
http://help.sap.com
For funtion module to class
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
for classes
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
for methods
http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
for inheritance
http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
for interfaces
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8 -
Parallel processing using ABAP objects
Hello friends,
I had posted in the performance tuning forum , regarding a performance issue problem , I am reposting it as it involves OO concept .
the link for the previous posting
Link: [Independent processing of elements inside internal table;
Here is the scenario,
I have a internal table with 10 records(indepentent) , and i need to process them .The processing of one record doesnt have any influence on the another . When we go for loop , the performance issue is that , the 10 th record has to wait until the 9 records get processed even though there is no dependency on the output.
Could some one tell a way out to improve the performance..
If i am not clear with the question , i would explain it still clearer...
A internal table has 5 numbers , say( 1,3,4,6,7)
we are trying to find square of each number ,,,
If it is a loop the finding of suare of 7 has to wait until 6 is getting completed and it is waste of time ...
This is related to parallel processing , I have refered to parallel processing documents,But I want to do this conceptually ..
I am not using conventional procedural paradigm but Object orientedness...I am having a method which is performing this action .What am I supposed to do in that regard.
Comradely ,
K.SibiHi,
As examplified by Edward, there is no RFC/asynchronous support for Methods of ABAP Objects as such. You would indeed need to "wrap" your method or ABAP Object in a Function Module, that you can then call with the addition "STARTING NEW TASK". Optionally, you can define a Method that will process the results of the Function Module that is executed asynchronously, as demonstrated as well in Edward's program.
You do need some additional code to avoid the situation where your program takes all the available resources on the Application Server. Theoretically, you cannot bring the server or system down, as there is a system profile parameter that determines the maximum number of asynchronous tasks that the system will allow. However, in a productive environment, it would be a good idea to limit the number of asynchronous tasks started from your program so that other programs can use some as well.
Function Group SPBT contains a set of Function Modules to manage parallel processing. In particular, FM SPBT_INITIALIZE will "initialize" a Server Group and return the maximum number of Parallel Tasks, as well as the number of free ones at the time of the initialization. The other FM of interest is SPBT_GET_CURR_RESOURCE_INFO, that can be called after the Server Group has been initialized, whenever you want to "fork" a new asynchronous task. This FM will give you the number of free tasks available for Parallel Processing at the time of calling the Function Module.
Below is a code snippet showing how these Function Modules could be used, so that your program always leaves a minimum of 2 tasks for Parallel Processing, that will be available for other programs in the system.
IF md_parallel IS NOT INITIAL.
IF md_parallel_init IS INITIAL.
*----- Server Group not initialized yet => Initialize it, and get the number of tasks available
CALL FUNCTION 'SPBT_INITIALIZE'
EXPORTING
GROUP_NAME = ' '
IMPORTING
max_pbt_wps = ld_max_tasks
free_pbt_wps = ld_free_tasks
EXCEPTIONS
invalid_group_name = 1
internal_error = 2
pbt_env_already_initialized = 3
currently_no_resources_avail = 4
no_pbt_resources_found = 5
cant_init_different_pbt_groups = 6
OTHERS = 7.
md_parallel_init = 'X'.
ELSE.
*----- Server Group initialized => check how many free tasks are available in the Server Group
for parallel processing
CALL FUNCTION 'SPBT_GET_CURR_RESOURCE_INFO'
IMPORTING
max_pbt_wps = ld_max_tasks
free_pbt_wps = ld_free_tasks
EXCEPTIONS
internal_error = 1
pbt_env_not_initialized_yet = 2
OTHERS = 3.
ENDIF.
IF ld_free_tasks GE 2.
*----- We have at leasr 2 remaining available tasks => reserve one
ld_taskid = ld_taskid + 1.
ENDIF.
ENDIF.
You may also need to program a WAIT statement, to wait until all asynchronous tasks "forked" from your program have completed their processing. Otherwise, you might find yourself in the situation where your main program has finished its processing, but some of the asynchronous tasks that it started are still running. If you do not need to report on the results of these asynchronous tasks, then that is not an issue. But, if you need to report on the success/failure of the processing performed by the asynchronous tasks, you would most likely report incomplete results in your program.
In the example where you have 10 entries to process asynchronously in an internal table, if you do not WAIT until all asynchronous tasks have completed, your program might report success/failure for only 8 of the 10 entries, because your program has completed before the asynchronous tasks for entries 9 and 10 in your internal table.
Given the complexity of Parallel Processing, you would only consider it in a customer program for situations where you have many (ie, thousands, if not tens of thousands) records to process, that the processing for each record tends to take a long time (like creating a Sales Order or Material via BAPI calls), and that you have a limited time window to process all of these records.
Well, whatever your decision is, good luck. -
How to synchronize concurrent access to static data in ABAP Objects
Hi,
1) First of all I mwould like to know the scope of static (class-data) data of an ABAP Objects Class: If changing a static data variable is that change visible to all concurrent processes in the same Application Server?
2) If that is the case. How can concurrent access to such data (that can be shared between many processes) be controlled. In C one could use semaphores and in Java Synchronized methods and the monitor concept. But what controls are available in ABAP for controlling concurrent access to in-memory data?
Many thanks for your help!
Regards,
ChristianHello Christian
Here is an example that shows that the static attributes of a class are not shared between two reports that are linked via SUBMIT statement.
*& Report ZUS_SDN_OO_STATIC_ATTRIBUTES
REPORT zus_sdn_oo_static_attributes.
DATA:
gt_list TYPE STANDARD TABLE OF abaplist,
go_static TYPE REF TO zcl_sdn_static_attributes.
<i>* CONSTRUCTOR method of class ZCL_SDN_STATIC_ATTRIBUTES:
**METHOD constructor.
*** define local data
** DATA:
** ld_msg TYPE bapi_msg.
** ADD id_count TO md_count.
**ENDMETHOD.
* Static public attribute MD_COUNT (type i), initial value = 1</i>
PARAMETERS:
p_called(1) TYPE c DEFAULT ' ' NO-DISPLAY.
START-OF-SELECTION.
<b>* Initial state of static attribute:
* zcl_sdn_static_attributes=>md_count = 0</b>
syst-index = 0.
WRITE: / syst-index, '. object: static counter=',
zcl_sdn_static_attributes=>md_count.
DO 5 TIMES.
<b>* Every time sy-index is added to md_count</b>
CREATE OBJECT go_static
EXPORTING
id_count = syst-index.
WRITE: / syst-index, '. object: static counter=',
zcl_sdn_static_attributes=>md_count.
<b>* After the 3rd round we start the report again (via SUBMIT)
* and return the result via list memory.
* If the value of the static attribute is not reset we would
* start with initial value of md_count = 7 (1+1+2+3).</b>
IF ( p_called = ' ' AND
syst-index = 3 ).
SUBMIT zus_sdn_oo_static_attributes EXPORTING LIST TO MEMORY
WITH p_called = 'X'
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = gt_list
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'DISPLAY_LIST'
* EXPORTING
* FULLSCREEN =
* CALLER_HANDLES_EVENTS =
* STARTING_X = 10
* STARTING_Y = 10
* ENDING_X = 60
* ENDING_Y = 20
* IMPORTING
* USER_COMMAND =
TABLES
listobject = gt_list
EXCEPTIONS
empty_list = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDDO.
<b>* Result: in the 2nd run of the report (via SUBMIT) we get
* the same values for the static counter.</b>
END-OF-SELECTION.
Regards
Uwe -
How to identify active ABAP objects in the HR R/3 System?
Hi
We are in process of doing assessment on HR 4.6C to ECC 6. I need to identify the active abap objects ( Reports/FM's etc. ) in the sytem. Appreciate if some one can suggest me how to look into the system.
Rgds
PeddiTry the Transaction code se95.
Regards,
Ravi Kanth Talagana -
How to use LDB PNP with ABAP objects in a program
Hello,
I am wondering if anybody has used the HR logical database(LDB) PNP with user defined ABAP objects in a program? I am using the FM- <b>LDB_PROCESS</b> but its not working. Also assigning PNP in the attributes section of the program -- so that I can use predefined fields from the LDB and then invoking the FM doesn't work -- throwing 'Logical database already active' error.
I suppose even with the ABAP objects and the new FM -- I should still be able to utilize the pre-defined fields of the PNP database -- and also the built in authorizations. I cannot use GET PERNR and REJECT as they give errors. I understand that the use of HR-macros (RP-PROVIDE-FROM-LAST and et al.) are not allowed as they use the table work area -- which is not allowed in ABAP-OOPS.
I would really appreciate if anyone could show me some insight regarding this. Thank you.
Kshitij R. DevreHi Kshitij
It would be really good if we could use both together. But as I know, it is not possible. "GET pernr." is an event-like loop statement and so cannot be used in OO context. And I guess, the same restriction holds for the "LDB_PROCESS" since it uses LDB-specific processing.
What I suggest you is to use standard and BAPI functions.
Sorry for giving bad news...
*--Serdar
Maybe you are looking for
-
External hard drive for time machine back-ups
Can anyone please suggest the best external hard drive to use for time machine back-ups on my iMac? I also use a 1TB external hard drive for my iTunes library, but I've noticed that it can be slower to access the music than if I used the iMac hard dr
-
Page Information in which Table
hi, i need to know, when we create a Page in APEX, in which table information is stored and alos i need to know who created a page and last updated by ,all there information is stored in DB, in which table it is stored?
-
2013 iMac // 10.9.3 // Premiere Pro CC 2014 (latest update) I have been editing a project for a few days, and it just started giving me issues on my last run through it before exporting. I have dealt with many problems with PP before, but I honestly
-
Jvm crashes on startup of javaFX client on MAC OSX 10.8.3
Hello I have a java application which uses javaFX and swing and which is developed on windows and also runs fine on windows. When I try to run the same application on mac osx the jvm crashes. 2013-04-18 16:49:53.891 java[2119:2713] Cocoa AWT: Running
-
I am a photographer and have never used ID. A client of mine uses my photos in ID and we have the workflow listed below... 1. I shoot for my clients client. 2. I send low res proofs to both. 3. They arrange page layout. 4. They send list of photos th