ABAP Objects issue
when calling to method in abap objects we can write
CALL METHOD method_name
EXPORTING
param =: value1 , value2 , .... ,valuen .
but how can i call method if it get 2 parameters ?
means like
CALL METHOD method_name
EXPORTING
param1 =: ???????
param2 =: ??????? .
Example
CALL METHOD object=>method
EXPORTING
param1 = 'PARAM1'
param2 = 'PARAM2'.
Another example:
CALL METHOD cl_gui_frontend_services=>file_open_dialog
CHANGING
file_table = filetable
rc = rc
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Please give points if it helps.
Message was edited by: Fuat Ulugay
Similar Messages
-
ABAP Objects Design/Organization Issues
Hi,
I'm trying to design and implement reusable components using ABAP Objects. I'm familliar with OO concepts and have developed a few applications using C++ and Java.
I'm trying to organize my classes into separate source files (include program in ABAP).
ie.
<b>include program a</b>
CLASS a DEFINITION.
ENDCLASS.
<b>include program b</b>
INCLUDE a.
CLASS b DEFINITION.
data x TYPE REF TO a.
ENDCLASS.
Lets say I want to write a report that uses both objects a and b. That means I have to include both programs. but since program b includes program a. including both programs a and b in my report would produce redeclarations of class a.
<b>executable program c</b>
REPORT c.
INCLUDE a.
INCLUDE b. " error: redeclaration of class a
DATA: x TYPE REF TO a.
y TYPE REF TO b.
This bothers me. Although it would be possible to <b>just include program b</b>, it would be a bit awkward since, i dont care if class a was used in the implementation of class b. Implementation should be abstracted from the user. Besides, everything should be explicit.
Is there a way to organize things as such? Would importing these classes globally would solve the problem.
Thanks.Emir,
The way we do OO Programming in ABAP and other languages differ.
In your case, it might be a better option to create these classes as global classes, so that you will not have this issue. You can SE24 to do the same.
Regards,
Ravi -
Logical Database in Abap Objects
Hi to All
I want do it a program report using a Logical Database.
Is this possible ??? But when I make a GET <node>, occurs the following error:
"" Statement "ENDMETHOD" missing. ""
I'm doing the following:
CLASS MONFIN IMPLEMENTATION.
METHOD TRAER_DATOS.
GET VBRK.
ENDMETHOD.
ENDCLASS.
Please, somebody tell me how I use the logical database in Abap Objects.
Thank you very much
Regards
Dario R.Hi there
Logical databases whilst of "some use" are not really part of OO.
If you want to use a logical database in an abap OO program I would create a special class which just does the get data from your DB and pass this either at record or table level.
Techniques such as GET XXXX LATE aren't really part of any OO type of application since at Object Instantiation time you should be able to access ALL the attributes of that object.
As far as OO is concerned Logical databases are a throwback to "Dinosaur Technology".
Since however modules such as SD and FI are still heavily reliant on relational structures (i.e linked tables etc) then there is still some limited life in this stuff but for OO try and solve it by another method.
If you really must use this stuff in OO then do it via a FMOD call and save the data in a table which your method will pass back to your application program.
You can't issue a GET command directly in a method.
Cheers
Jimbo -
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 -
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. -
[b]MiniSap and the ABAP OBJECTS book [/b]
Hello,
I have purchased the book "ABAP Objects" by Keller and Kruger. I attempted to install Minisap and ran into a lot of problems. I suspect that I need the most recent version of this product that runs on Windows XP. Can anyone direct me to place where I may download Minisap without having to pay for it again! I really have to say that it shouldn't be this difficult to install a product that is used for training and education. So far I've spent more time trying to install than learning ABAP.Most of the issues with trying to install this are either answered by the html documents on the kernel disc or by the FAQ doc at www.IT-minds.com search on ABAP and look for the resources.
One issue these documents will not solve is, if you have / had a version of SQLserver installed. As the disc only uses the MSinstaller_01 and can only use the default instance of MS SQLserver2000 desktop engine (MSDE2000). -
Using new namespace for existing abap objects
Hi,
We have just reserved a namespace and want to move existing code (tabels, data-elements, ...) to this namespace. The issue we notice is that the namespace is added to the name of the abap-object, so that every code-reference to that object must be changed. This leads to a lot of work. Can this somehow be avoided?
Regards,
JurgenHi Jurgen!
This can't be avoided, that's the very core of the names. Different question is: can this be automated. Not completely.
Fastest way (and it's really not so terrible as it seems):
- copy the objects to new names
- make where-used list to all objects (e.g. table name)
- search and replace in each object (e.g. include)
- generate new version
- delete old object
- check all objects for missed references
Still will take several days for one person. For very large developments you can think about a program to do the mentioned list - but this will take a lot of time to program, too.
Regards,
Christian -
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 -
Significance of Interfaces in ABAP Objects
Hi Guys, here I have a query -
Why do we use Interfaces in ABAP Objects?, and what is the significance of Interfaces in ABAP Objects?
Please clarify the above with a suitable example.Moderator message - Welcome to SCN.
But
Moderator message - But this isn't a training forum. Please ask a specific question - post locked -
Exception 'error_message' in ABAP Objects
I've got a heterogeneous scenario with new program parts in ABAP objects and older parts in classical ABAP.
In the older parts some R/3 standard functions are called which dump dialog messages which are not allowed at that state of the program flow ('on commit').
The simple solution in classical ABAP was to use standard exception 'error_message' in the top level 'call function' statement thus catch all dialog messages in lower levels.
I am looking for an analog solution in object oriented ABAP. But exception 'error_message' is not allowed with 'call method'. It cannot be defined statically in the methods declaration. And the system exception caused by the dialog error message is not included in the set of catchable system errors.
I would be grateful for any hints concerning this problem.Hi
Excuse me! But I didn't want to sent you my answer.
Anyway:
CLASS lcl_my_class DEFINITION.
PUBLIC SECTION.
METHODS my_method
EXPORTING
EXCEPTION TYPE CHAR1
EXCEPTIONS error_messages.
ENDCLASS. "LCL_MY_CLASS DEFINITION
CLASS lcl_my_class IMPLEMENTATION.
METHOD my_method.
IF EXCEPTION = 'X'.
MESSAGE e208(00) WITH 'Message error'
RAISING error_messages.
ELSE.
MESSAGE I208(00) WITH 'OK!'.
ENDIF.
ENDMETHOD. "MY_METHOD
ENDCLASS. "LCL_MY_CLASS IMPLEMENTATION
So you did want to do a call like this:
CALL METHOD lcl_my_class=>my_method
EXCEPTIONS
error_messages = 1
error_message = 2
OTHERS = 3.
No! you can't do it, but you try to insert your call in fm where you use ERROR_MESSAGE addition. I think you can do it if your methods are std.
Max
Message was edited by: max bianchi -
Re : select-options in abap-objects program
Dear friends,
I want to give select-options in abap-objects program. How to give that.
Thanking You
with regards,
ManiIn the transaction SE24, enter your class name, click modify.
in the tab named "Types" you have to declare two types. By example, if you want to receive one select-options that in your program that uses this class is declared like:
" P_SAKNR FOR SKAT-SAKNR".
you've got to declare two types in the class:
a- TYPES: begin of E_S_SAKNR,
sign(1),
option(2),
low(10),
high(10),
end of E_S_SAKNR.
b - TYPES E_T_SAKNR type standard table of E_S_SAKNR.
so, in the class method that you want to receive P_SAKNR as importing parameter. You got to do this:
method TEST importing ET_SAKNR type E_T_SAKNR.
now, in the implementation of this method you should be able to use ET_SAKNR as the same way as you usually use a parameter or a select-option. You could use it in a select with the operator IN by example.. -
Re : select-options in abap objects
Dear friends,
I want to give select-options in abap-objects program. How to give that.
Thanking You
with regards,
ManiHI Mani,
It's common mix ABAP Procedural with ABAP Objects in the same program.
You should use the same way used in ABAP procedural program as Marco Cerdelli sad.
But inside ABAP OBJECTS classes you can't use is these statement type.
Don't forget to close this thread and all yours previous when your question be answered ! In case of doubt read the [rules of engagement|https://forums.sdn.sap.com/].
Best Regards.
Marcelo Ramos -
Java package concept in ABAP Objects
Hi, just a question on grouping of classes in ABAP Objects.
In Java, you can group classes by "package" to avoid
namespace collision, my question, in ABAP Objects, how
do you group classes to avoid namespace collision?
I know that there is package concept in SAP/ABAP but it
is different concept in Java.
Thanks in advanced for your reply.Hello One and Lonley,
the package concept in ABAP and Java is quite different. In java the package name is part of the development object in ABAP not. So any class pool name is global unique. In combination with the restriction on 30 chars this leads often to somehow cryptic names.
The only way to escape this somehow is the excessive use of local classes. That mean classes defined within main programs. If you are on 7.00 you may check FuGr SAPLSAUNIT_TREE_CTRL_LISTENER for this technique.
Best Regards
klaus -
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. -
Dynamic documents in ABAP Objects (weblog)
Hi SDNers,
Do you want to implement the following features in ABAP Screens?
1. Large font sizes and more colour options than traditional ABAP/4 (There are some limitations also)
2. ICONS and pictures in different sizes
3. Texts
4. Links
5. Pushbuttons
6. Input fields
7. Dropdown list boxes
8. Tables with row span and with column span
9. Tables with frames and without frames
10. Tables with buttons, icons, pictures, input elements and texts in it.
Then please read the below weblog to incorporate these features...
<a href="/people/venkata.ramisetti/blog/2005/12/20/dynamic-documents-in-abap-objects">Dynamic Documents in ABAP Objects</a>
Thanks,
Ramakrishnaone limitation which comes to my mind immediately is that you cannot create spool output of the dynamic document.
Regards
Raja
Maybe you are looking for
-
2 questions: 1. I have an extensive list of Catelogs in the left panel in Library and they used to tell me how many pics I had in each one but now in LR 3 it only gives me "...". Do I need to bring in the old 2.5 version a different way for 3 to re
-
i can't reset my apple id. How do I erase my itouch
-
Video in 16:9 Motion menu preview being cropped
I can't find any discussion on this but am maybe asking the wrong question. How do I get the 16:9 preview buttons on a 16:9 motion menu to play without cropping the top and bottom of the source clip? I don't understand why a 16:9 clip doesn't fill a
-
OAS Create File for Download with PL/SQL Pkg
On OAS 4.0.8.1, I am trying to create a PL/SQL DB Pkg to allow a WWW user to extract data from the DB and download it to their local workstation, for example, a class list of student names and ids in "tab-separated-values" format. I think I have conf
-
Org.osmf.media::MediaPlayer could not be found
Hi all, I'm using Win 7, Flash Builder 4 with Flex 4.5 SDK (manually upgraded). I'm creating a video viewer, which streams from a Flash Media Server. Sometimes, when you reload the app, the video is not showed: audio is fine, duration, seek, everythi