Thursday, February 10, 2011

SAP ABAP Scripts Question and Answers Part 6

What is the advantages using the SAP long form over the short form of database changes?

Ans :- May be Fast Effect.

Can ‘where’ clause be used when updating database entries?

Ans :- Yes.

Describe array operations and their advantages?

Ans :-

What is logical unit of work? How is it defined?

Ans :- Logical Unit of work is a block of memory area where database contents are stored and manipulated.
For every SAP application LUW is automatically created for database communication. Besides this we have SAP LUW s also there.

What function is performed by the commit work command?

Ans :- When you perform Commit , all the LUW s work will be reflected to the database.

Why is it so important for a programmer to check the lock entries?

Ans :- To find out if record is locked and also to maintain data integrity.

How can you find a lock entry for a database table?

Ans :- The function module ‘ENQUEUE ’ checks whether a lock was triggered for the same object. Otherwise an exception FOREIGN_LOCK is carried out. If the object is not locked the function module sets the lock.

What steps are necessary to set a lock on a record within a database table?

Ans :-
Execute CALL FUNCTION statement
CALL FUNCTION “ENQUEUE
EXPORTING…
EXCEPTIONS…
CASE SY-SUBRC.
.
.
ENDCASE.

How do you unlock the entry? Why is this necessary?

Ans :-
Execute the CALL FUNCTION statement
CALL FUNCTION ‘DEQUEUE
EXPORTING…
It is important to unlock the entry so others can update it.
What is the difference between ‘CALL SCREEN # # # ‘ and ‘SET SCREEN ### ’

… LEAVE SCREEN?

Ans :-
SET SCRREN statement sets or overwrites the follow-up screen.
LEAVE SCREEN executes the screen number currently in the follow-screen field
CALL SCREEN interrupts the processing of the current screen to call a new screen or a chain of screens, processing of the current screen is resumed directly after the call.

After a CALL SCREEN command where does the processing return after the screen has been executed?
Ans :- It returns the processing to the calling screen.

Which is the more similar to a call with return, the SET SCREEN or the CALL SCREEN?

Ans :- The CALL SCREEN command.

What function is performed by the SET SCREEN 0 command?

Ans :- Returns to the original screen.

What are the main differences between the repot status and screen status?

Ans :-

Where must you place the SET PF-STATUS command in your online program?

Ans :- Place it in the PBO module of the screen.

Why is it good idea to clear OK_CODE field after deciding which action to take?

Ans :- You need to clear the OK code to avoid sending a screen that already has a function code.

How do you specify that a function is an exit type command?

Ans :- By specifying function type E for the pushbuttons or menu options in the screen painter or menu painter.


What is the purpose of the ‘AT EXIT-COMMAND’?

Ans :- Usually there are many ways to leave a screen (back,exit,cancel) .This command will perform termination logic for all functions of type E.

What are screen groups?

Ans :- A group of screen fields such as radio buttons or checkboxes.

What is the correct syntax for dynamically modifying a large number of screen fields?

Ans :-
MODULE MODIFY _SCREEN_OUTPUT
.
.
.
LOOP AT SCREEN
IF SCREEN –GROUP = 3D ‘GR1’
SCREEN-INPUT=3D 1
ENDIF.
IF SCREEN-NAME = 3D ‘TAB-FIELD’
SCREEN-ACTIVE=3D 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.

What is the name of the internal table that stores the screen information?

Ans :- SCREEN.

What is the purpose of the MODIFY command when performing the dynamic screen modifications?

Ans :- after you activate or deactivate the field attributes by assigning them 1 or 0, you save the modifications via MODIFY SCREEN command.

Direction for the use of check box and radio buttons in screen painter?

Ans :-
Creating Radio Button and Check Boxes on the screen
Go to the full screen editor.
Place an underscore at the point where you want to place the field.
Define the name of the field using
Place the cursor on the field and press
Then press or depending on which graphic element you want
Then you group related check boxes and radio boxes.

What are user Exits and transactions?

Ans :- Generally, user exits are the forms defined within SAP standard code (usually starting with user exit). These predefined areas in the code allow programmers to insert custom defined code into the standard processing of a transaction (e.g. allow resorting of the batch sequence in VA01 batch processing). There are many specific examples if you are interested, but usually user exits are searched for when a specific use is being analyzed.

What happens if you enter 0 in NEXT Screen attribute?

Ans :- It does not go to any other screen and it moves back one level. However you can control this in run-time using SET SCREEN command.

How to modify the attributes of screen fields at run time ?.
We loop through the fields of the screen. When you find the name of a screen field you want to
modify, set attributes for the field and use MODIFY SCREEN to update the
attribtes.

You can find the attributes in the internal table SCREEN.
This loop makes some of the screen fields invisible ind a selection screen:
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'P_VERAB' OR
screen-name = 'P_STXT1' OR
screen-name = 'P_STXT2' OR
screen-name = '%_P_VERAB_%_APP_%-TEXT' OR
screen-name = '%_P_STXT1_%_APP_%-TEXT' OR
screen-name = '%_P_STXT2_%_APP_%-TEXT'.

screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.

How to leave dynpro allthough required entry not made ?

In the menu painter - Function attributes for the button, set Functional
type to E (Exit command)

PROCESS AFTER INPUT.
Call module that leaves screen before User_Command_xxxx is executed

MODULE ReturnExit AT EXIT-COMMAND.
MODULE user_command_1000.

MODULE returnexit.
CASE sy-ucomm.
WHEN 'CANC'. "Or whatever you want to call it
Clear w_screen.
LEAVE TO SCREEN 0.

ENDCASE.
ENDMODULE.

Calling a report from a dynpro

There are to ways to do this:
Use leave to list-processing if you want to do it in your module pool. You will not be able to use
selection-screens.
Use the submit statement to start a seperate report from your dynpro.
Anyone who have idea on how to know the selected value on run-time?
How can get the table control attribute selected value ? I try to read the value in debuger which is #
(table_control-cols-selected). There is no difference on the other row which is not selected.

The tc-cols-selected is for column selection only. For row selection you have two scenarios

turn on the SelColumn attribute in screen painter, give it a name and declare an abap variable with the same name type C length 1. In your PAI loop at itab, when the selected row is processed the abap variable will = 'X'. At this point you can save the record or key.

you can determine which row the cursor is on in your table control as follows:

DATA: LINE_SEL LIKE SY-STEPL,
TABIX LIKE SY-TABIX

GET CURSOR LINE LINE_SEL.
TABIX =

-TOP_LINE + LINE_SEL - 1.

TABIX is now the index of the selected row.

F4 Help - Calling it from a program and limiting values ?

To avoid the standard F4 help to be show, insert the event PROCESS ON-VALUE-REQUEST in the program and add a field statement for the field that should trigger the F4 help. In the mdoule called from

PROCESS ON-VALUE-REQUEST, call function module
F4IF_FIELD_VALUE_REQUEST.

Example 1 - Dynpro

process before output.
.....

process after input.
.....

PROCESS ON VALUE-REQUEST.
FIELD it_zsd00003-prctr MODULE f4_help_for_pctr.

MODULE f4_help_for_pctr INPUT.

NOTE:
Tabname/fieldname is the name of the table and field
for which F4 should be shown.
*
Dynprog/Dynpnr/Dynprofield are the names of the Progran/Dynpro/Field
in which the f4 value should be returned.
*
Value: The value of the Dynpro fuield when calling the F4 help.
You can limit the values shown, by inseting a value in this parameter
e.g '50*' to show only values beginning with 50

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

EXPORTING
tabname = 'ZSD00003'
fieldname = 'PRCTR'
* SEARCHHELP = ' '
* SHLPPARAM = ' '
dynpprog = 'ZSD00002_BRUGERKONV_LISTE'
dynpnr = '0100'
dynprofield = 'IT_ZSD00003-PRCTR'
* STEPL = 0
value = '50*'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '

* SUPPRESS_RECORDLIST = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
TABLES

No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)

Userexits/BADIs

Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

Blog Archive

goodsites