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: 

AT PF-Status

Former Member
0 Kudos

Hi,

please let me know how to use the PF-STATUS and AT-PFn

5 REPLIES 5

Former Member

Former Member
0 Kudos

Hi,

We set pf-status to a program by using the statement

Set PF-status 'ABC'.

Double click on ABC, it gives popup, give description of pf-status, press ok. it navigates to different screen. Add required function codes and activate the screen. Press F3 to return back to the program. Again Activate the program again.

The below link might help

http://help.sap.com//saphelp_47x200/helpdata/EN/9f/dba99935c111d1829f0000e829fbfe/frameset.htm

Regards,

Priyanka.

Former Member
0 Kudos

This is the usage :

AT PFn.

Effect Event in interactive reporting

Here, n stands for a numeric value between 0 and 99.

This event is executed whenever the user presses a function key

that contains the function code PFn in the interface

definition. The default status for lists contains some of these

functions.

Otherwise, the effect is as for the variant AT LINE-SELECTION.

The cursor can be on any line.

Notes 1. To ensure that the chosen function is executed only for

valid lines, you can check the current HIDE information.

2. This variant should be used only for test or prototyping

purposes, since the default status is not normally used.

Instead, you should set a program-specific status with SET

PF-STATUS. This should not contain any function codes

beginning with "PF".

Example

DATA NUMBER LIKE SY-INDEX.

START-OF-SELECTION.

DO 9 TIMES.

WRITE: / 'Row', (2) SY-INDEX.

NUMBER = SY-INDEX.

HIDE NUMBER.

ENDDO.

AT PF8.

CHECK NOT NUMBER IS INITIAL.

WRITE: / 'Cursor was in row', (2) NUMBER.

CLEAR NUMBER.

Reward is appreciated !

Thanks

Former Member
0 Kudos

Hi Suman,

You can clearly distinguish between PF-STATUS and AT PF##.

If you want to enhance your GUI, ie, add buttons, menu etc you can define your GUI using SET PF-STATUS 'XXX'. Double-clicking on 'XXX' will lead you to a graphical editor on confirmation, where you can define your buttons, menus etc.

AT PF## is related to events. If you want to display a result, ie a list, on the hit of a button (PF## is generally used with function keys), you can define this in this event. The main advantage of this is, you don't have to define an extra button for using AT PF01 to AT PF24. SAP has preset these function codes with the function keys F1-F12 and Shift + F1-F12, ie, AT PF01 will be automatically executed if the user hits the F1 key and so on. There are certain function keys that are reserved. Check the documentation for details.

Hope this is of some help.

Regards

Anil Madhavan

Former Member
0 Kudos

to add your own buttons or menus on the application bar and on std. menu, you use the SET PF-STATUS.

eg. SET PF-STATUS 'ABCD'.

double click on ABCD and declare the options you want.

keep in mind that you have to declare fucntion key of each.

List Events in an ABAP Program

After a user interaction on a list, the ABAP runtime environment checks whether it should process the function code itself (for example, %EX or %PC), or whether it should trigger the relevant event. Unlike normal screens, in which the PAI event is triggered, the runtime environment triggers three special events when list events occur. You can use the corresponding event blocks in your ABAP program to react to the user action. From within the program, you can use the SY-UCOMM system field to access the function code. There is no OK_CODE field that is filled.

Event Blocks for Function Codes PF<nn> (Obsolete)

When the user chooses a function code PF<nn> (<nn> can be between 01 and 24), the system always triggers the AT PF<nn> event. In the standard list status, the function keys F<nn> that are not reserved for predefined system functions all have the function code PF<nn> as long as a corresponding event block is defined in the program.

AT PF<nn>.

<statements>.

These event blocks are executed when the user chooses the corresponding function key. The position of the cursor in the list is irrelevant.

If you use these event blocks at all, it should only be for temporary test versions. In production programs, you should only use AT USER-COMMAND with a dialog status of your own to assign function codes to function keys. When you use your own interfaces, the system displays a function text explaining what the function does. This does not happen when you use AT PF<nn> event blocks.

Event Block for Function Code PICK

When the user triggers the function code PICK, AT LINE-SELECTION is always triggered if the cursor is positioned on a list line. The function code PICK is, by default, always linked with function key F2 and hence with the mouse double-click. Consequently, if you have a simple program that does not react to any further user actions, you only need to write this event block.

AT LINE-SELECTION.

<statements>.

As described in the section Dialog Status for Lists, the function code PICK is always added to the standard list status when you have an AT LINE-SELECTION event in your program.

If you assign PICK to other function keys or menu entries, AT LINE-SELECTION is also triggered when the user chooses then. You should avoid this for the sake of the semantics.

Conversely, if you have a more extensive program that does not react to line selection, you should not use the function code PICK. Instead you should assign a different function code to F2 , to ensure that as many events as possible trigger the AT USER-COMMAND event.

Event Block for User-Defined Function Codes

If the user chooses a function code during list processing that is neither processed by the system, or PICK or PF<nn>, the system triggers the event AT USER-COMMAND. For this event, you must define your own GUI status for a list. To react to your own function codes in a program, you must define the following event block:

AT USER-COMMAND.

<statements>.

In this event block, you can use an IF or CASE structure to tell the function codes apart. They are available in the system field SY-UCOMM. There are further system fields that are filled in list events, such as SY-LSIND and SY-PFKEY, that allow you to make further case distinction

Reward me if useful

Regards

Ravi