Oops programming in abap
hi,
i need oops programming in abap where in i need only programmin and coding tecnique strictly(dont want theory)means where oops programming needs in reporting,alv and bdc ,i need only programming related material,so if any body having the connecting links or material or objects regarding the above said things kindly reply me here or by sending mail to [email protected]
Hi ...
Here i am sending you one Link.....Follow this link and there you can find
theory as well as the sample code examples for every technology in ABAP.
Go for:- http://abapprogramming.blogspot.com/2007/10/oops-abap-2.html.
Regards,
Mandeep.
Note: Plz do not forget to award points if reply is useful.
Similar Messages
-
I need information about oops concept programming in abap
Hi ,
I need information about oops concept programming in abap
Thanks,
AshaOf course, the best place to start is help.sap.com.
http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
There are a couple good books out there as well. You can get them at www.amazon.com
Regards,
Rich Heilman -
Hi experts,
When executing a simple oops program ..i got the following error. Please correct the code.
"VAR" is not type-compatible with formal parameter "I_DATA".
CLASS main DEFINITION
CLASS main DEFINITION.
PUBLIC SECTION.
"// Instance Methods ( Note we use the statement 'METHODS'
"// to define an instance method )
METHODS set_data IMPORTING i_data TYPE string.
METHODS get_data RETURNING value(r_data) TYPE string.
METHODS print_attribute IMPORTING i_data TYPE string.
"// Instance Methods ( Note we use the statement 'CLASS-METHODS'
"// to define a static method )
CLASS-METHODS set_classdata IMPORTING i_data TYPE string.
CLASS-METHODS get_classdata RETURNING value(r_data) TYPE string.
CLASS-METHODS print_classattribute IMPORTING i_data TYPE string.
PROTECTED SECTION.
"// Instance Attribute ( Note we use the statement 'DATA'
"// to define an instance attribute )
DATA attribute TYPE string.
"// Static Attribute ( Note we use the statement 'CLASS-DATA'
"// to define a static attribute )
CLASS-DATA classattribute TYPE string.
PRIVATE SECTION.
"// Instace event ( Note we use the statement 'EVENTS'
"// to define aN instance event )
EVENTS event EXPORTING value(e_data) TYPE string.
"// Instace event ( Note we use the statement 'CLASS-EVENTS'
"// to define a static event )
CLASS-EVENTS classevent EXPORTING value(e_data) TYPE string.
"// For more informations about events see the following example:
"// ABAP Objects - Creating your First Local Class - Using Events
ENDCLASS. "main DEFINITION
CLASS main IMPLEMENTATION
CLASS main IMPLEMENTATION.
METHOD set_data.
CONCATENATE 'Instance Attribute value' i_data
INTO attribute SEPARATED BY space.
ENDMETHOD. "set_data
METHOD get_data.
MOVE attribute TO r_data.
ENDMETHOD. "get_data
METHOD set_classdata.
CONCATENATE 'Static Attribute value' i_data
INTO classattribute SEPARATED BY space.
ENDMETHOD. "set_classdata
METHOD get_classdata.
MOVE main=>classattribute TO r_data.
ENDMETHOD. "get_classdata
METHOD print_attribute.
WRITE: i_data, /.
ENDMETHOD. "print_attribute
METHOD print_classattribute.
WRITE: i_data, /.
ENDMETHOD. "print_classattribute
ENDCLASS. "main IMPLEMENTATION
DATA: var type char20.
START-OF-SELECTION.
"// Calling a Static method (note we don't have a object )
"// instead we use the <class name>=><method name>.
main=>set_classdata( 'SDN' ).
var = main=>get_classdata( ).
"// Print the var value
main=>print_classattribute( var ).
DATA: object_reference TYPE REF TO main.
CREATE OBJECT object_reference.
"// - Calling a Instance Method( Note we have to use a object to
"// access the insntace components of class main )
"// - Note we're using the statment "CALL METHOD", see looking for
"// functional & General methods for more informations
CALL METHOD object_reference->set_data( 'BPX' ).
var = object_reference->get_data( ).
object_reference->print_attribute( var ).
Thanks in Advance.
Regards
NaniHi Nani,
try changing your data definition for var from CHAR20 to STRING.
regards,
Peter -
Dear all,
Can anybody tell me please which events are being used in ABAP OOPS Programming ? Please , needful reply for same....check these links
http://erpgenie.com/abaptips/content/view/394/61/
http://erpgenie.com/abaptips/content/view/395/61/
Thanks
Bala Duvvuri -
Hi all problem in demo OOPS program
I have written small abap-oops program but it is giving error that
The line type of "OBJ" must be compatible with one of the types
"<b>OBJ_RECORD</b>".
Plz help me out.
REPORT zkclass1.
CLASS number1 DEFINITION
CLASS number1 DEFINITION.
PUBLIC SECTION.
METHODS : constructor IMPORTING x1 TYPE i
y1 TYPE i.
METHODS : findsum EXPORTING z TYPE i.
PRIVATE SECTION.
DATA : x TYPE i,
y TYPE i.
ENDCLASS.
CLASS number IMPLEMENTATION
CLASS number1 IMPLEMENTATION.
METHOD constructor.
x = x1.
y = y1.
ENDMETHOD.
METHOD findsum.
z = x + y.
WRITE : / z.
ENDMETHOD.
ENDCLASS.
DATA : obj TYPE REF TO number1.
DATA : z1 TYPE i.
PARAMETERS : s_x1 type i obligatory.
PARAMETERS : s_y1 type i obligatory.
START-OF-SELECTION.
CREATE OBJECT obj EXPORTING x1 = s_x1
y1 = s_y1.
CALL METHOD OF OBJ -> FINDSUM EXPORTING x1 = s_x1
y1 = s_y1.Hi,
Try this way.
* CLASS number1 DEFINITION
CLASS number1 DEFINITION.
PUBLIC SECTION.
METHODS : constructor IMPORTING x1 TYPE i
y1 TYPE i.
METHODS : findsum EXPORTING z TYPE i
y1 type i. "Changed
PRIVATE SECTION.
DATA : x TYPE i,
y TYPE i.
ENDCLASS.
* CLASS number IMPLEMENTATION
CLASS number1 IMPLEMENTATION.
METHOD constructor.
x = x1.
y = y1.
ENDMETHOD.
METHOD findsum.
z = x + y.
y1 = me->y. "Changed
WRITE : / z.
ENDMETHOD.
ENDCLASS.
DATA : obj TYPE REF TO number1.
DATA : z1 TYPE i.
PARAMETERS : s_x1 TYPE i OBLIGATORY.
PARAMETERS : s_y1 TYPE i OBLIGATORY.
START-OF-SELECTION.
CREATE OBJECT obj EXPORTING x1 = s_x1
y1 = s_y1.
"Use This way here.
CALL METHOD obj->findsum IMPORTING z = s_x1
y1 = s_y1.
" Don't use this here.
*CALL METHOD OF OBJ -> FINDSUM EXPORTING x1 = s_x1
*y1 = s_y1. " 'OF' is used for OLE Objects
Regards.
Marcelo Ramos -
hi,friends
does anybody working on ABAP OBJECTS?
so what r the diffrent programs ur writing using oops approach in ABAP? i mean reports......like that....
plz explain something ur working on ABAP OBJECTS..in real time....Hi Prashanth
You use OOPS for the following advantages.
Complex software systems become easier to understand, since object-oriented structuring provides a closer representation of reality than other programming techniques.
In a well-designed object-oriented system, it should be possible to implement changes at class level, without having to make alterations at other points in the system. This reduces the overall amount of maintenance required.
Through polymorphism and inheritance, object-oriented programming allows you to reuse individual components.
In an object-oriented system, the amount of work involved in revising and maintaining the system is reduced, since many problems can be detected and corrected in the design phase.
You will releaze OOPS advantage only if you involve in complex projects.
For reading in ABAP OOPS concepts, refer the below links.
BC404 is SAPs reference material on OO programming in ABAP.
Object Service
http://help.sap.com/saphelp_nw04s/helpdata/en/ab/9d0a3ad259cd58e10000000a11402f/frameset.htm
ABAP - Shared Objects
http://help.sap.com/saphelp_nw04s/helpdata/en/14/dafc3e9d3b6927e10000000a114084/frameset.htm
OO interfaces
http://help.sap.com/saphelp_nw04s/helpdata/en/c3/225b5354f411d194a60000e8353423/frameset.htm
ABAP Objects
http://help.sap.com/saphelp_nw04s/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
ABAP OO Books
ABAP Objects
by Horst Keller, Sascha Kruger
ABAP Objects - Reference book
by Horst Keller, Joachim Jacobitz
Dont forget to reward, if it helps ;>)
Regards,
Rakesh. -
Error while calling java program from ABAP
Hi Experts,
We are trying for RFC inbound scenario.
We followed the below blog
/people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection
We are working with SAP JCO 3.0.2
We are getting the error : 'STFC_CONNECTION' could not be found in the server repository.
After I run the Java server program if I execute the RFC destination directly from SM 59 it is showing successful messages.
If I stop the java program then this RFC is failing. Based on this we concluded that RFC to Java connection is working fine.
But as mentioned in blog if we call the RFC Destination from ABAP program it is giving the below error,
'STFC_CONNECTION' could not be found in the server repository.
If we test the RFC destination using RFC_TRUSTED_CHECK standard FM we are getting the below error.
'RFCPING' could not be found in the server repository.
We create the RFC destination of Type : TCP/IP as exactly mention in the blog.
Please help us in resolving this issue.
Thanks
PrincePabi,
Using the RFC connection,we can establish a link between Java and SAP.
Afterwards,hope we can call Java program from ABAP.
Below is the sample piece of code to establish RFC connection(link) between Java and SAP.
DATA: REQUTEXT LIKE SY-LISEL,
RESPTEXT LIKE SY-LISEL,
ECHOTEXT LIKE SY-LISEL.
DATA: RFCDEST like rfcdes-rfcdest VALUE 'NONE'.
DATA: RFC_MESS(128).
REQUTEXT = 'HELLO WORLD'.
RFCDEST = 'JCOSERVER01'. "corresponds to the destination name defined in the SM59
CALL FUNCTION 'STFC_CONNECTION'
DESTINATION RFCDEST
EXPORTING
REQUTEXT = REQUTEXT
IMPORTING
RESPTEXT = RESPTEXT
ECHOTEXT = ECHOTEXT
EXCEPTIONS
SYSTEM_FAILURE = 1 MESSAGE RFC_MESS
COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.
IF SY-SUBRC NE 0.
WRITE: / 'Call STFC_CONNECTION SY-SUBRC = ', SY-SUBRC.
WRITE: / RFC_MESS.
ENDIF.
Regards,
Sree -
How to call java program from ABAP
Hi Experts,
My requirement is to call java programs from ABAP. For that i have set up SAP JCO connection by using this link http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/739. [original link is broken] [original link is broken] [original link is broken] Connection gets sucessfully. After this how to call java program from ABAP as per our requirement. Please help me out.
Also i tried this way also.. but while executing the DOS Command line appear & disappear in few seconds. So couldnt see the JAVA output. Please help me out to call java programs in ABAP..
DATA:command TYPE string VALUE 'D:Javajdk1.6.0_20 injavac',
parameter TYPE string VALUE 'D:java MyFirstProgram'.
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
application = command
parameter = parameter
OPERATION = 'OPEN'
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
bad_parameter = 3
file_not_found = 4
path_not_found = 5
file_extension_unknown = 6
error_execute_failed = 7
OTHERS = 8.
Thanks.This depends on the version of your Netweaver Java AS. If you are running 7.0, you will have to use the Jco framework. The Jco framework is deprecated since 7.1 though. If you want to build a RFC server in 7.1 or higher, it is adviced that you set it up through JRA.
Implement an RFC server in 7.0:
http://help.sap.com/saphelp_nw04/helpdata/en/6a/82343ecc7f892ee10000000a114084/frameset.htm
Implement an RFC server in 7.1 or higher:
http://help.sap.com/saphelp_nwce72/helpdata/en/43/fd063b1f497063e10000000a1553f6/frameset.htm -
Unable to open any programs in ABAP editor
Hi folks i'm unable to open any programs in ABAP Editor.
When ever i try to open any program it goes to short dump.
Even when i try to open STO4 to view error log.
it shows following message
Short text
Runtime error, short dump could not be written.
What happened?
Error in the ABAP Application Program
The current ABAP program " " had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Unfortunately, the system cannot carry out a detailed analysis of the
error, as the table SNAP (which gathers information at the time of
termination) does not contain a suitable short dump.
Information About Termination Point in XSLT Prog.
Termination occurred in the XSLT program " ".
The call took place using CALL TRANSFORMATION from the ABAP
program specified below.
In the source code, the termination point is in line " "
of the (Include) program " ".
Internal notes
The termination was triggered in function " "
of the SAP kernel, in line " " of the module " ".
The internal operation just processed is " ".
Internal mode was started at " ".hi,
check whether any exit has been implemented for se38 and because of some statements in that it may goto dump.
also try to open ur program from SE80.if u have access to se80 then u can do it from there itself.
reward points if hlpful. -
Calling Java program from ABAP
Hi All,
my ABAP program downloads one file to one folder. Then one Java program is running to Encrypt the file.
Now , they want to call the JAVA program in ABAP, so that they can encrypt the file before downloading.
Is it possible to call a Java program from ABAP ? If Yes, please give me the detailed procedure.
Thanks
pabiPabi,
Using the RFC connection,we can establish a link between Java and SAP.
Afterwards,hope we can call Java program from ABAP.
Below is the sample piece of code to establish RFC connection(link) between Java and SAP.
DATA: REQUTEXT LIKE SY-LISEL,
RESPTEXT LIKE SY-LISEL,
ECHOTEXT LIKE SY-LISEL.
DATA: RFCDEST like rfcdes-rfcdest VALUE 'NONE'.
DATA: RFC_MESS(128).
REQUTEXT = 'HELLO WORLD'.
RFCDEST = 'JCOSERVER01'. "corresponds to the destination name defined in the SM59
CALL FUNCTION 'STFC_CONNECTION'
DESTINATION RFCDEST
EXPORTING
REQUTEXT = REQUTEXT
IMPORTING
RESPTEXT = RESPTEXT
ECHOTEXT = ECHOTEXT
EXCEPTIONS
SYSTEM_FAILURE = 1 MESSAGE RFC_MESS
COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.
IF SY-SUBRC NE 0.
WRITE: / 'Call STFC_CONNECTION SY-SUBRC = ', SY-SUBRC.
WRITE: / RFC_MESS.
ENDIF.
Regards,
Sree -
TCP/IP socket programming in ABAP
Hi,
Is there any method of TCP socket programming in ABAP? For example is there any function module for creating a socket for a IP address and port number. After that, is it possible to send binary/text data to a connected IP/port destination. I need such a solution because I need to send raw data (native commans) to barcode printer on our network which has a static IP address and listens incoming data through a fixed port number specified in its documentation. For a solution, I coded some .NET VB and built a small application that acts as a RFC server program which can be called by SAP according to definitions I made in SM59 (I defined a new TCP connection and it works well sometimes!). In this application, data coming from SAP are transferred to the barcode printer. This is achived by the .NET Socket class library. This solution works well but after a few subsequent call from SAP, connection hangs! SAP cannot call the application anymore, I test the connection in SM59 and it also hangs, so I need to restart the VB application, but this is unacceptable in our project.
As a result, I decided to code the program that will send data to the printer in ABAP as a function module or subroutine pool, so is there any way to create a socket in ABAP and connect to specific IP/port destination? I searched for possible function modules in SE37 and possible classes in SE24 but unfortunately I could not find one. For example, do know any kind of system function in ABAP (native commands executed by CALL statement), that can be used for this purpose?
I would appreciate any help,
Kind regards,
Tolga
Edited by: Tolga Togan Duz on Dec 17, 2007 11:49 PMHi,
I doubt that there is a low level API for sockets in ABAP. There is API for HTTP but probably that won't help you. As a workaround you can use external OS commands (transactions SM69 and SM49). For example on Unix you can use netcat to transfer file. Your FM needs to dump data into folder and then call netcat to transfer file.
Cheers -
Tool creation for checking program of ABAP in TXT format with the ABAP stds
Tool creation for checking program of ABAP in TXT format with the ABAP stds
Hello Jagrut
There is a simple reason why we cannot do off-line ABAP development:
- the <b>ABAP dictionary</b> (which contains all structures, tables, data elementes, etc.)
Because even the simplest ABAP report (except for the "Hello World" report) will reference some objects from the ABAP dictionary and, thus, requires to access these objects directly. Therefore, we are still bound to server-side ABAP development.
Regards
Uwe -
Using field symbols in OOPs programming...have ur points.
Hi all,
I want to use field symbols in OOPS programming like this...
But the system is giving me dump....help me.
START-OF-SELECTION.
CREATE OBJECT OBJ.
FIELD-SYMBOLS : <AB> TYPE ANY.
ASSIGN OBJ TO <AB>.
CALL METHOD <AB>->add
EXPORTING
a = 4
b = 6
changing
c = Z
WRITE : / Z.check the code below
TYPES: BEGIN OF t_struct,
col1 TYPE i,
col2 TYPE i,
END OF t_struct.
DATA: dref1 TYPE REF TO data,
dref2 TYPE REF TO data.
FIELD-SYMBOLS: <fs1> TYPE t_struct,
<fs2> TYPE i.
CREATE DATA dref1 TYPE t_struct.
ASSIGN dref1->* TO <fs1>.
<fs1>-col1 = 1.
<fs1>-col2 = 2.
dref2 = dref1.
ASSIGN dref2->* TO <fs2> CASTING.
WRITE / <fs2>.
GET REFERENCE OF <fs1>-col2 INTO dref2.
ASSIGN dref2->* TO <fs2>.
WRITE / <fs2>.
reward points if helpful......... -
Good book learn Abap Objects ( Object Orineted Programming in Abap )
Hi,
Could you please suggest a nice book to learn ABAP objects.
thanks.hi deepti
These are the recommended books for OO programming in ABAP.
1.ABAP Objects: The Official Reference
by Horst Keller, Joachim Jacobitz
This is systematic language reference book for ABAP Objects.
2. ABAP Objects: Introduction to Programming SAP(R) Applications
by Horst Keller, Sascha Kruger -
Links/Docs for Module Pool Programing using abap objects
Hi all,
Can anyone send me links/docs related to Module Pool programing using Abap Objects.
Thanks n Regards
Maruthi Rao. Ahi maruthi rao,
check the below link
http://abapcode.blogspot.com/2007/06/object-oriented-alv-sample-program-to.html
Maybe you are looking for
-
Looking for a particular HP motherboar​d
Hello I was wondering if someone good guide me or tell me where I could find a mother board for the following laptop HP Pavilion dv7-4065dx. For some reason can't find it anywhere , not even on ebay or Hp website. Any help would be appreciated This
-
PA30 - Personnel Number field greyed out - No input help available.
Hi Experts, In our System in DEV, & Quality in PA30, we are unable to select employees either by directly giving the number (greyed out) or by selecting through F4 (No input help is available). But in Production System we can directly give Pernr or
-
Unable to locate where code is at...
hi there, sorry ahead of time as its been a long time since i've had to perform much forms coding... i've some code that is operating in my form which i can see but don't know where the heck it might exist in the object navigator. its a 10g form that
-
Unable to customize the Searchresults.aspx in 2013 OOB
I am Unable to customize the Searchresults.aspx in 2013 OOB. Whenever I try and edit the page, I get the error "Code Blocks not allowed in this page". Let me know if I am doing something wrong. Thanks
-
What programs does OS9 and classic run?
Primarily I use OS 10.3.9 but have OS9 and classic on my iMac from initial installation/purchase. Specifically, what programs/applications might the OS9 and classic run? If they are not programs I use, then I'll delete them and save the space. Thanks