Application Development 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: 

some abap questions

Former Member
0 Kudos

1 What are the problems in processing batch input sessions? How is batch input process different from processing on line?

2 . What does an EXEC SQL stmt do in ABAP? What is the disadvantage of using it?

3 What are the exceptions in function module? what is the use of exceptions

4 . How are the date and time field values stored in SAP?

5 . What transactions do you use for data analysis?

1 ACCEPTED SOLUTION

vinod_gunaware2
Active Contributor
0 Kudos

<b>1.</b>

BATCH INPUT SESSION is an intermediate step between internal table and

Database table. Data along with the action is stored in session i.e. data for screen fields, to which screen it is passed, program name behind it, and how next screen is processed.

PROBLEMS: -

I) If the user forgets to opt for keep session then the session will be automatically removed from the session queue (log remains). However if session is processed we may delete it manually.

ii) If session processing fails data will not be transferred to SAP database table.

<b>2.</b>

<b>Basic form</b>

EXEC SQL.

<b>Addition:</b>

... PERFORMING form

<b>Effect</b>

Executes the Native SQL statements enclosed between EXEC SQL and ENDEXEC statements. Unlike Open SQL, the addressed database tables must not be declared in the ABAP Dictionary.

<b>Disadvantage:</b>

You cannot perform reliable authorization checks using EXEC SQL. You should implement them at program level instead.

<b>3.</b>

EXCEPTIONS lists the exceptions to be handled by the calling program itself. If one of the exceptions occurs, SY-SUBRC is set to the corresponding value and control returns back to the calling program.

This helps as a communication interface between the function module and the calling program. If you are building your own function module, and want to use exceptions then it can be done with the statements RAISE and MESSAGE ... RAISING. If exception is not to be handled by the calling program itself, then RAISE terminates the program with a runtime error; whereas MESSAGE ... RAISING outputs the message.

<b>4.</b>

<b>YYYYMMDD AND HHMMSS</b>

<b>5.</b>

<b>ST05</b>

regards

vinod

5 REPLIES 5

former_member181962
Active Contributor
0 Kudos

1 What are the problems in processing batch input sessions? How is batch input process different from processing on line?

There are no real problems in execution of batch input sessions.

Processing the records online is not always possible if the vlolume of data to be processed is huge.

For such cases you need to do it in background.

2 . What does an EXEC SQL stmt do in ABAP? What is the disadvantage of using it?

For executing native sql commands you need to use exec sql. end end exec.

3 What are the exceptions in function module? what is the use of exceptions

Exceptions are the situations in which the program flow cannot continue in the way it is supposed to.

It tells te program to branch the control to the calling program, wherein you can handle the exceptions.

4 . How are the date and time field values stored in SAP?

sy-datum for date

sy-uzeit for time

Date in 8 chars yyyymmdd

time in 6 chars hhmmss

5 . What transactions do you use for data analysis?

don't understand.

Regards,

Ravi

former_member583013
Active Contributor
0 Kudos

1.- I don't think there is any problems in using Batch Input in sessions...When you do Batch Input process, you can process more than just one line...I guess that's the main difference...

2.- Don't know -:)

3.- Exceptions are errors in your FM, for example...If your FM is looking for Sales Documents, but you cant find any, you can raise and exception saying that you couldn't found any Sales Documents at all...

4.- DATE is stores like this 18.04.2006 --> 20060416 and TIME is store like this 09:28:00 --> 092800.

5.- For data analysis...Actually it depends on what data you want to analyse...You can use SAP Querys, transaction SQ01.

Greetings,

Blag.

Former Member
0 Kudos

2) There are two disadvantages of native SQL. It tends to be slower that the open SQL we normally write in a SELECT statement. Native SQL is specific to a single database and is not necessarily portable from one to another. In other words, a native SQL statement written for Oracle, may not work in a DB2 environment.

The advantage is that you are able to do things in native SQL that you cannot do in open SQL, like translate from lower to upper case within the select.

Rob

vinod_gunaware2
Active Contributor
0 Kudos

<b>1.</b>

BATCH INPUT SESSION is an intermediate step between internal table and

Database table. Data along with the action is stored in session i.e. data for screen fields, to which screen it is passed, program name behind it, and how next screen is processed.

PROBLEMS: -

I) If the user forgets to opt for keep session then the session will be automatically removed from the session queue (log remains). However if session is processed we may delete it manually.

ii) If session processing fails data will not be transferred to SAP database table.

<b>2.</b>

<b>Basic form</b>

EXEC SQL.

<b>Addition:</b>

... PERFORMING form

<b>Effect</b>

Executes the Native SQL statements enclosed between EXEC SQL and ENDEXEC statements. Unlike Open SQL, the addressed database tables must not be declared in the ABAP Dictionary.

<b>Disadvantage:</b>

You cannot perform reliable authorization checks using EXEC SQL. You should implement them at program level instead.

<b>3.</b>

EXCEPTIONS lists the exceptions to be handled by the calling program itself. If one of the exceptions occurs, SY-SUBRC is set to the corresponding value and control returns back to the calling program.

This helps as a communication interface between the function module and the calling program. If you are building your own function module, and want to use exceptions then it can be done with the statements RAISE and MESSAGE ... RAISING. If exception is not to be handled by the calling program itself, then RAISE terminates the program with a runtime error; whereas MESSAGE ... RAISING outputs the message.

<b>4.</b>

<b>YYYYMMDD AND HHMMSS</b>

<b>5.</b>

<b>ST05</b>

regards

vinod

Former Member
0 Kudos

Hi,

Below are the answers to a few of your questions.

<b>2.</b> EXEC SQL is a Native SQL Statement used to retrieve data from the database.Open SQL allows you to access database tables declared in the ABAP Dictionary regardless of the database platform that you R/3 System is using. Native SQL allows you to use database-specific SQL statements in an ABAP program. This means that you can use database tables that are not administered by the ABAP Dictionary, and therefore integrate data that is not part of the R/3 System.

<b>Scope of Native SQL</b>

Native SQL allows you to execute (nearly) all statements available through the SQL programming interface (usually known as SQL Call Interface or similar) for executing SQL program code directly (using EXEC IMMEDIATE or a similar command). The following sections list the statements that are not supported.

<b>Native SQL and the Database Interface</b>

Native SQL statements bypass the R/3 database interface. There is no table logging, and no synchronization with the database buffer on the application server. For this reason, you should, wherever possible, use Open SQL to change database tables declared in the ABAP Dictionary. In particular, tables declared in the ABAP Dictionary that contain long columns with the types LCHR or LRAW should only be addressed using Open SQL, since the columns contain extra, database-specific length information for the column. Native SQL does not take this information into account, and may therefore produce incorrect results. Furthermore, Native SQL does not support automatic client handling. Instead, you must treat client fields like any other.

<b>3.</b> Exceptions in Function Modules.

Exceptions are information to the user stating the status of a certain process. Exception in Function Modules can be handled in two different ways..

a. Class Based Exceptions

for Class based Exceptions check the below link.

http://help.sap.com/saphelp_47x200/helpdata/en/55/bff20efe8c11d4b54a006094b9456f/content.htm

b. Traditional Exceptions.

<b> RAISE <Exception>.

MESSAGE..... RAISING <Exception>.</b>

The effect of these statements depends on whether you handle the exception in the calling program or let the system process it.

If you trigger the exception in the RAISE statement and the calling program is to handle it, the function module processing is terminated, and the numeric value assigned to the exception is placed in the system field SY-SUBRC. Further processing then takes place in the calling program.

If the calling program fails to handle the exception, the system triggers a runtime error.

If you use the MESSAGE... RAISING statement, the processing is similar if you want to handle the exception in the calling program. If you want the system to handle the exception, there is no runtime error generated in this case. Instead, processing continues, and the system displays a message with the defined type. To do this, you must specify the MESSAGE-ID in the first statement of the include program L<fgrp>TOP. The MESSAGE... RAISING statement also enters values in the following system fields:

SY-MSGID (message ID)

SY-MSGTY (message type)

SY-MSGNO (message number)

SY-MSGV1 to SY-MSGV4 (contents of the fields <f1> to <f4> that are included in the message).

For further information, see the keyword documentation for the MESSAGE statement.

Check the below link for Exceptions in Function Modules.

http://help.sap.com/saphelp_47x200/helpdata/en/9f/dbaa0635c111d1829f0000e829fbfe/content.htm

<b>4.</b> The date and time field are stored in the following way in SAP.

Data type - D

Initial Field Length - 8

Valid Field Length - 8

Initial Value - '00000000'

Format in Database - Date field(Format: YYYYMMDD)

Data type - T

Initial Field Length - 6

Valid Field Length - 6

Initial Value - '000000'

Format in Database - Time field(Format: HHMMSS)

<b>5.</b> Use LSMW for Data Analysis.

Regards,

Vara