Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Exceptions

Former Member
0 Likes
858

Hi all,

What is the Exact Difference between Error & Exception?

Diff B/w Select-options & Ranges?

6 REPLIES 6
Read only

Former Member
0 Likes
803

Hi

Select-options:

1.select options internally takes the table structure of sign option low and high.

2.it appears on the selection screen.

Range:

1.we need to explicitly define its structure manually.

2.it does not appear on the selection screen

Difference Between Select-Options & Ranges

Here both SELECT-OPTIONS & RANGES works for the same purpose. They both are used for the range selection from selection screen. The main diff. between them is, while we use SELECT-OPTIONS system implicitly creates the select options internal table which contains the fields of SIGN,OPTION,LOW & HIGH. But in case of RANGES, this internal table should be defined explicitly.

Eg. to SELECT-OPTIONS :

-


REPORT YARSELECT.

TABLES YTXLFA1.

SELECT-OPTIONS : VENDOR FOR YTXLFA1-LIFNR.

INITIALIZATION.

VENDOR-LOW = 1000. " It specifies the range starting value.

VENDOR-HIGH = 2000. " It specifies the range ending value.

VENDOR-OPTION = 'BT'. " specifies ranges value is in between.

VENDOR-SIGN = 'I'. "specifies both inclussive.

APPEND VENDOR.

- -

- -

SELECT LIFNR LAND1 NAME1 FROM LFA1 INTO TABLE ITAB

WHERE LIFNR IN VENDOR.

Eg. to RANGES:

-


REPORT YARRANGE.

TABLES YTXLFA1.

RANGES: VENDOR FOR YTXFLA1-LIFNR.

- -

- --

- -

SELECT LIFNR LAND1 NAME1 FROM LFA1 INTO TABLE ITAB

WHERE LIFNR IN VENDOR.

Here with RANGES user has to design an internal table with fields -

SIGN,OPTION,LOW and HIGH EXPLICITLY.

or check this link-

http://www.sap-img.com/abap/difference-between-select-options-ranges.htm

Reward If useful

regards

Ravikanth

Read only

Former Member
0 Likes
803

Hi,

Difference between error and exception:

The exception class defines mild error conditions that your program encounters. Exceptions can occur when trying to open the file, which does not exist, the network connection is disrupted, operands being manipulated are out of prescribed ranges, the class file you are interested in loading is missing. The error class defines serious error conditions that you should not attempt to recover from. In most cases it is advisable to let the program terminate when such an error is encountered.

Difference between select-options and range: Refer

http://www.sap-img.com/abap/difference-between-select-options-ranges.htm

http://www.geekinterview.com/question_details/39357

Reward if helpful.

Regards,

Ramya

Read only

Former Member
0 Likes
803

Hi.

The functional diiference, in terms of the compiler, is that you don't have to declare errors in throws clauses on methods, or catch them.

Conceptually, an Error means something has gone wrong with your program, which should usually give up and crash, whereas an exception is for an unusual situation that you, as a programmer, anticipated as a possibilty. So, for example, a divide-by-zero is an Error, but attempting to read a file and finding it doesn't exist is an Exception.

check the links.

http://www.techinterviews.com/?p=214

http://www.abapcode.sapbrainsonline.com/2008/03/ranges-abap-keyword.html

http://abapcode.blogspot.com/2007/12/submitting-another-report-using-select.html

http://www.sap-basis-abap.com/abap/difference-between-select-options-and-parameters.htm

regards.

sowjanya.b

Read only

Former Member
0 Likes
803

Hi,

SELECT-OPTIONS -> INPUT AS SELECT RANGE OF VALUES

PARAMETERS -> INPUT AS SINGLE VALUE

Regards,

V.Balaji

Reward if Usefull...

Read only

Former Member
0 Likes
803

Hi,

The occurrence of an exception is normally used to display an error situation. The handler of an exception must try to correct the error that has occurred, find an alternative solution, or (if this is not possible) at least bring the affected context into a consistent state and then forward the error. If a call hierarchy does not contain a handler for an exception, the program is ended with a runtime error. Since exceptions cannot be handled by means of program calls, all possible exceptions within the program itself must be handled to prevent a runtime error. This rule does not apply to the coding within procedures whose exceptions can easily be propagated to (external) callers.

If error situations occur while ABAP statements are being executed in the ABAP runtime environment, exceptions that can be handled or cannot be handled are raised, depending on the error. The exceptions that can be handled are class-based and can be handled between TRY and ENDTRY.

With error situations in the ABAP program, exceptions can be raised in a program-driven manner using the RAISE EXCEPTION statement. Exceptions based on both self-defined exception classes and on exception classes predefined in the system are possible here.

Reward if helpful.

Iyswarya

Read only

Former Member
0 Likes
803

Hi

What are the difference between SELECT-OPTIONS & RANGES?

Here both SELECT-OPTIONS & RANGES works for the same purpose. They both are used for the range selection from selection screen. The main diff. between them is, while we use SELECT-OPTIONS system implicitly creates the select options internal table which contains the fields of SIGN,OPTION,LOW & HIGH. But in case of RANGES, this internal table should be defined explicitly.

Eg. to SELECT-OPTIONS :

-


REPORT YARSELECT.

TABLES YTXLFA1.

SELECT-OPTIONS : VENDOR FOR YTXLFA1-LIFNR.

INITIALIZATION.

VENDOR-LOW = 1000. " It specifies the range starting value.

VENDOR-HIGH = 2000. " It specifies the range ending value.

VENDOR-OPTION = 'BT'. " specifies ranges value is in between.

VENDOR-SIGN = 'I'. "specifies both inclussive.

APPEND VENDOR.

- - - -

- - - -

SELECT LIFNR LAND1 NAME1 FROM LFA1 INTO TABLE ITAB

WHERE LIFNR IN VENDOR.

Eg. to RANGES:

-


REPORT YARRANGE.

TABLES YTXLFA1.

RANGES: VENDOR FOR YTXFLA1-LIFNR.

- - - -

- - - --

- - - -

SELECT LIFNR LAND1 NAME1 FROM LFA1 INTO TABLE ITAB

WHERE LIFNR IN VENDOR.

Here with RANGES user has to design an internal table with fields -

SIGN,OPTION,LOW and HIGH EXPLICITLY.

-


>

Example:

select-options: bukrs for zstock-bukrs.

Should the user fill in 'ABFI' in BUKRS on the selection screen, BUKRS will look like this:

IEQABFI

This is because BUKRS is set as a table as follows:

begin of bukrs occurs 0,

SIGN(1) type c,

OPTION(2) type c,

LOW like bukrs,

HIGH like bukrs,

end of bukrs.

Now, when you create the following range, it will have the exact same fields set inside its table:

Ranges: bukrs for zstock-bukrs.

The difference is, because ranges doesn't show on the selection screen, you will have to fill it yourself, meaning you will have to fill bukrs-sign, bukrs-option, bukrs-low & bukrs-high all manually.

Some tips:

Sign is always I (for Include) or E (for Exclude)

Option can be a whole range, which includes:

EQ (Equal)

BT (Between))

CP (Contain Pattern)

So let's say you want to have the range check for all company codes not starting with AB, you will set your code as follow:

ranges: bukrs for zstock-bukrs.

bukrs-sign = 'E'. "Exclude

bukrs-option = 'CP'. "Pattern

bukrs-low = 'AB*'. "Low Value

bukrs-high = ''. "High Value

append bukrs.

Always remember to APPEND your range when you fill it, as the WHERE clause checks against the lines of the range table, not against the header line.