SAP ABAP

Download some good Pdf for SAP Upgrading.
(i) SAP Upgrade Guide
Download pdf
( ii ) Complete Upgrade and Unicode Conversion Guide for R/3 4.6c.
Download pdf
(iii) Unicode In SAP system
Download pdf
( iv) Conversion fo SAP system to Unicode
Download pdf
Read Complete Posting on http://abapcode.info
Advertisements

Now You can read Complete Site on http://abapcode.info.

This Site Contains whole sap document about SAP ABAP Online Magazine
ABAP,ABAP report,Interactive Report,ALV grid,ALV list,IDOC,User Exit,RFC,Smartform,sapscript,ABAP Performance,Remote Function Module( RFC ),Function Module,Modularization techniques,ABAP tools,ALV report Generator,ABAP Interview Questions,BDC,BAPI,ALE,BADI, EDI,InternalTable,DataStructure,LSMW,Domain,DataElement,Basis and Administration ,ABAP HR development,ABAP Debugger,BW,ExceptionHandling,Download FI, CO, MM, PP, SD, PM, PS, QM, SM, HR, BW, APO,ABAP Tutorial

Read Complete Posting on http://abapcode.info

Definitions

Public attributes

Private attributes

Instance attributes

Static attributes

Public methods

Private methods

Constructor method

Static constructor

Protected components

Polymorphism

Public attributes

Public attributes are defined in the PUBLIC section and can be viewed and changed from outside the class. There is direct access to public attributes. As a general rule, as few public attributes should be defined as possible.

PUBLIC SECTION.

DATA: Counter type i.

Private attributes

Private attributes are defined in the PRIVATE section. The can only be viewes and changed from within the class. There is no direct access from outside the class.

PRIVATE SECTION.

DATA: name(25) TYPE c,

planetype LIKE saplane-planetyp,

Instance attributes

There exist one instance attribute for each instance of the class, thus they exist seperately for each object. Instance attributes are declared with the DATA keyword.

Static attributes

Static attributes exist only once for each class. The data are the same for all instances of the class, and can be used e.g. for instance counters. Static attributes are defined with the keyword CLASS-DATA.

PRIVATE SECTION.

CLASS-DATA: counter type i,

Public methods

Can called from outside the class

PUBLIC SECTION.

METHODS: set_attributes IMPORTING p_name(25) TYPE c,

p_planetype LIKE saplane-planetyp,

Private methods

Can only be called from inside the class. They are placed in the PRIVATE section of the class.

Constructor method

Implicitly, each class has an instance constructor method with the reserved name constructor and a static constructor method with the reserved name class_constructor.

The instance constructor is executed each time you create an object (instance) with the CREATE OBJECT statement, while the class constructor is executed exactly once before you first access a class.

The constructors are always present. However, to implement a constructor you must declare it explicitly with the METHODS or CLASS-METHODS statements. An instance constructor can have IMPORTING parameters and exceptions. You must pass all non-optional parameters when creating an object. Static constructors have no parameters.

Static constructor

The static constructor is always called CLASS_CONSTRUCTER, and is called autmatically before the clas is first accessed, that is before any of the following actions are executed:

Creating an instance using CREATE_OBJECT

Adressing a static attribute using ->

Calling a ststic attribute using CALL METHOD

Registering a static event handler

Registering an evetm handler method for a static event

The static constructor cannot be called explicitly.

Protected components

When we are talking subclassing and enheritance there is one more component than Public and Private, the Protected component. Protected components can be used by the superclass and all of the subclasses. Note that Subclasses cannot access Private components.

Polymorphism

Polymorphism: When the same method is implemented differently in different classes. This can be done using enheritance, by redefining a method from the superclass in subclasses and implement it differently.

Other Related Topics :

Object Oriented ABAP-Local and Global Classes

A easy Reference for ALV grid Control

Class vs. interface

Abstract Vs Interfaces

Object Oriented ALV-Using two Containers we can display data

Object Oriented ALV-Sample program to insert Logo in ALV

Learn Object Oriented ABAP online and Download Tutorial

Read Complete Posting on http://abapcode.info

Dynamic programing can save a lot of ‘superfluous’ coding.

To assign a variable a type at runtime, use the ABAP statement ASSIGN with the option TYPE. For instance:

DATA: D_TYPE,
D_FIELD(35).
DATA: D_TEST TYPE P.
FIELD-SYMBOLS: .
D_FIELD = ‘D_TEST’.
D_TYPE = ‘P’.
ASSIGN (D_FIELD) TO TYPE D_TYPE.

Additionally you can use the option DECIMALS of the ASSIGN statement if your type is ‘P’. You can even change the type at runtime of previously assigned field symbol like

ASSIGN TO TYPE ‘C’.

One more thing for dynamic programing. With the following coding you can access every DDIC table with the key you want:

SELECT SINGLE * FROM (DF_TNAME) INTO S_TMP WHERE (IF_KEY).
It is very powerful, isn’t it !!!
[ Ingo-Willy Raddatz, posted to SAP listserver]

Example 1: Print page “n of x pages” on reports

The following code is just a function to loop total pages. To use from the beginning of your report, you will have to loop through your report once before display. ABAP does not provide
an easy “read-ahead” method of doing this, so this is the “cludgy” way of making it work if needed.

FORM GET_TOTAL_PAGENO.

WRITE SY-PAGNO TO NUM_PAGES_C LEFT-JUSTIFIED.

DO SY-PAGNO TIMES.
READ LINE 2 OF PAGE SY-INDEX.
REPLACE ‘*****’ WITH NUM_PAGES_C INTO SY-LISEL.
MODIFY LINE 2 OF PAGE SY-INDEX.
ENDDO.

ENDFORM. ” GET_TOTAL_PAGENO

Read Complete Posting on http://abapcode.info

 

Normally, after returning from a function module, the system automatically sets the value of sy-subrc to zero. Use one of the following two statements to set sy-subrc to a non-zero value:

* raise
* message … raising

Using the raise Statement

Use the raise statement to exit the function module and set the value of sy-subrc on return.
Syntax for the raise Statement

The following is the syntax for the raise statement.

raise xname.

where:

* xname is the name of the exception to be raised.

The following points apply:

* xname can be any name that you make up. It does not have to be previously defined anywhere. It can be up to 30 characters in length. All characters are allowed except ” ‘ . , and :.
* Do not enclose xname within quotes.
* xname cannot be a variable.

When the raise statement is executed, control returns immediately to the call function statement and a value is assigned to sy-subrc based on the exceptions you have listed there. Values assigned to export parameters are not copied back to the calling program. Listings 1.7 and 1.8 and Figure 1.9 illustrate how this happens.

Listing 1.7 How to Set the Value of SY-SUBRC from Within a Function Module

1 report ztx2007.
2 parameters parm_in default ‘A’.
3 data vout(4) value ‘INIT’.
4 call function ‘Z_TX_2008’
5 exporting
6 exname = parm_in
7 importing
8 pout = vout
9 exceptions
10 error_a = 1
11 error_b = 4
12 error_c = 4
13 others = 99.
14 write: / ‘sy-subrc =’, sy-subrc,
15 / ‘vout =’, vout.

Listing 1.8 This Is the Function Module Called from Listing 1.7

1 function z_tx_2008.
2 *”————————————————————
3 *”*”Local interface:
4 *” IMPORTING
5 *” VALUE(EXNAME)
6 *” EXPORTING
7 *” VALUE(POUT)
8 *” EXCEPTIONS
9 *” ERROR_A
10 *” ERROR_B
11 *” ERROR_C
12 *” ERROR_X
13 *”————————————————————
14 pout = ‘XXX’.
15 case exname.
16 when ‘A’. raise error_a.
17 when ‘B’. raise error_b.
18 when ‘C’. raise error_c.
19 when ‘X’. raise error_x.
20 endcase.
21 endfunction.

The code in Listings 1.7 and 1.8 produce this output, if you specify a value of A for parm_in:

sy-subrc = 1
vout = INIT

* In Listing 1.7, line 4 takes the value from parm_in and passes it to the function module z_tx_2007. Control transfers to line 1 of Listing 1.8.
* In Listing 1.8, line 14 assigns a value to the pout parameter. This parameter is passed by value, so the change is only to the local definition of pout. The original has not yet been modified.
* In Listing 1.8, line 15 examines the value passed via parameter exname. The value is B, so line 17-raise error_b-is executed. Control transfers to line 9 of Listing 1.7. Because the raise statement has been executed, the value of pout is not copied back to the calling program, thus the value of vout will be unchanged.
* In Listing 1.7, the system scans lines 10 through 13 until it finds a match for the exception named by the just-executed raise statement. In this case, it’s looking for error_b. Line 11 matches.
* On line 11, the value on the right-hand side of the equals operator is assigned to sy-subrc. Control then transfers to line 20.

The special name others on line 13 of Listing 1.7 will match all exceptions not explicitly named on the exceptions addition. For example, if line 7 of Listing 20.8 were executed, exception error_x would be raised. This exception is not named in Listing 1.7, so others will match and the value of sy-subrc will be set to 99. You can code any numbers you want for exception return codes.

If an export parameter is passed by value, after a raise its value remains unchanged in the calling program even if a value was assigned within the function module before the raise statement was executed. If the parameter was passed by reference, it will be changed in the caller (it has the Reference flag turned on in the Export/Import Parameters screen). This effect is shown in Listing 20.7. The value of pout is changed in the function module and, if a raise statement is executed, the changed value is not copied back into the calling program.

Read Complete Posting on http://abapcode.info

Read_text Function Module has been Modified in new Version.Please Comment INLINE table in ECC6.0.It is no more use in it.

Older Version ( 4.6c)

CALL FUNCTION ‘READ_TEXT’
EXPORTING
client = sy-mandt
id = thead-tdid
language = thead-tdspras
name = thead-tdname
object = thead-tdobject
TABLES
lines = inline
inline = XXXX “comment this one in new version , it is no more have any use
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.

WS_UPLOAD – File transfer from presentation server file to internal table

WS_DOWNLOAD – File Transfer From Internal Table to Presentation Server File

WS_DOWNLOAD – Save Internal Table as File on the Presentation Server

WS_FILE_DELETE – Delete File at the Frontend

WS_FILENAME_GET – Call File Selector

FILENAME_GET – popup to get a filename from a user, returns blank filename if user selects cancel

LIST_DOWNLOAD – Download of ABAP list (Report) to local file

LIST_TO_ASCI – Converts the specified list (LIST_INDEX) or the provided list (LISTOBJECT) to ASCII.

RZL_READ_FILE – Read a file from the presentation server if no server name is given, or read file from remote server. Very useful to avoid authority checks that occur doing an OPEN DATASET. This function using a SAP C program to read the data.

RZL_WRITE_FILE_LOCAL – Saves table to the presentation server (not PC). Does not use OPEN DATASET, so it does not suffer from authority checks!

Read Whole Site there

http://abapcode.info

Topic Wise Content

blog content

October 2018
M T W T F S S
« Feb    
1234567
891011121314
15161718192021
22232425262728
293031  

Blog Stats

  • 505,469 hits
Advertisements