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: 

PF-STATUS

Former Member
0 Kudos

Hello All,

I am Using PF-STATUS in Normal Program ,

using sorting , filtering , Export -


functionalities

Wold u please help How to write the functionality for these things in

AT USER COMMAND EVENT

4 REPLIES 4

Former Member
0 Kudos

Hi ,

After using set pf-satus, hope u assigned a FCODE( function code ) to each push button u placed on application tool bar, Menu, function key.

when the user selects a particular record on the basic list and clicks a particular Push button then ur User-command must be triggerd under the particular Function code.

suppose say on ur basic list u r displaying all the materails, wen the enduser selects a particular material and clicks on "PLNT" push button , the all athe plants for that material must be displayed.

function code = PLNT (say)

At user-command.

case sy-ucomm.

when 'PLNT'.

select matnr werks from marc into table itab1.

loop at itab1.

write: / itab1-matnr, itab1-werks.

endloop.

endcase

Revert back if any issues,

Reward with points if helpful.

Regards,

Naveen

0 Kudos

Thanks,

But i want the Function Code and Code ( for How to write in At user command )for Sorting ,Filtering, Export to local File

If Suppose,

F code 'ST' For Sorting.

if sy-ucomm = 'ST'.

-


-


endif.

0 Kudos

Hi,

give ur Function codes as follows:

Sorting = 'SORT'.

Export = 'EXPT'.

Filetering = 'FILT'

at user-command.

case sy-ucomm.

when 'SORT'.

( after selecting SORT, if u wanna sort the same list which is in BASIC LIST, say Sort by date. Already all the records in the interanal table itab)

Sort itab by ERSDA.

loop at itab.

write:/ itab-matnr, itab-ersda.

endloop.

when 'EXPT'.

open dataset './temp/nav' for output in text mode encoding default.

loop at itab.

transfer itab to './temp/nav' .

endlloop.

close dataset './temp/nav' .

when 'FILT'.

( here ut depends on the scenario, like which records to be dsiplayed.)

endcase.

Revert back if any issues.

Rewards with points if helpful.

Regards,

Naveen

Former Member
0 Kudos

Dialog Status for Lists

To allow the user to communicate with the system when a list is displayed, the lists must be able to direct user actions to the ABAP program. As described in User Actions on Screens, function codes are used to do this. Function codes are maintained in the GUI status of the list screen. You define a GUI status using the Menu Painter tool in the ABAP Workbench. The system assigns function codes to list-specific user actions.

The most important of these functions is for selecting list lines by double-clicking. As described in Using a GUI Status, the double-click function is always linked to the F2 key. If a function code is assigned to the F2 key in the GUI status, it will be triggered when you double-click.

The Standard List Status

As with normal screens, you can define your own GUI status for lists and attach it to a list level using the SET PF-STATUS statement. If you do not set a particular GUI status, the system sets a default list status for the list screen in an executable program. In other programs, for example, when you call a list from screen processing, you must set this status explicitly using the statement

SET PF-STATUS space.

This default interface always contains at least the functions described in the Standard List section.

Unlike normal dialog statuses, the default list status is affected by the ABAP program.

If you define event blocks in your program using the event keywords AT LINE-SELECTION or AT PF]

.

This statement sets the status parameters. To display an ampersand character ‘&’, repeat it in the title ‘&&’.

Examples

Example for dialog status in a list.

REPORT demo_list_menu_painter.

START-OF-SELECTION.

SET PF-STATUS 'TEST'.

WRITE: 'Basic list, SY-LSIND =', sy-lsind.

AT LINE-SELECTION.

WRITE: 'LINE-SELECTION, SY-LSIND =', sy-lsind.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'TEST'.

WRITE: 'TEST, SY-LSIND =', sy-lsind.

ENDCASE.

This program uses a status TEST, defined in the Menu Painter.

Function key F5 has the function code TEST and the text Test for demo.

Function code TEST is entered in the List menu.

The function codes PICK and TEST are assigned to pushbuttons.

The user can trigger the AT USER-COMMAND event either by pressing F5 , or by choosing List ® Test for demo, or by choosing the pushbutton Test for demo.The user can trigger the AT LINE-SELECTION event by selecting a line.

Example of setting a dialog status for the current list

REPORT demo_list_set_pf_status_1.

DATA: fcode TYPE TABLE OF sy-ucomm,

wa_fcode TYPE sy-ucomm.

START-OF-SELECTION.

wa_fcode = 'FC1 '. APPEND wa_fcode TO fcode.

wa_fcode = 'FC2 '. APPEND wa_fcode TO fcode.

wa_fcode = 'FC3 '. APPEND wa_fcode TO fcode.

wa_fcode = 'FC4 '. APPEND wa_fcode TO fcode.

wa_fcode = 'FC5 '. APPEND wa_fcode TO fcode.

wa_fcode = 'PICK'. APPEND wa_fcode TO fcode.

SET PF-STATUS 'TEST'.

WRITE: 'PF-Status:', sy-pfkey.

AT LINE-SELECTION.

IF sy-lsind = 20.

SET PF-STATUS 'TEST' EXCLUDING fcode.

ENDIF.

WRITE: 'Line-Selection, SY-LSIND:', sy-lsind,

/ ' SY-PFKEY:', sy-pfkey.

AT USER-COMMAND.

IF sy-lsind = 20.

SET PF-STATUS 'TEST' EXCLUDING fcode.

ENDIF.

WRITE: 'User-Command, SY-LSIND:', sy-lsind,

/ ' SY-UCOMM:', sy-ucomm,

/ ' SY-PFKEY:', sy-pfkey.

Suppose that the function codes FC1 to FC5 are defined in the status TEST and assigned to pushbuttons: The function code PICK is assigned to function key F2 .

When the program starts, the user can create detail lists by selecting a line or choosing one of the function codes FC1 to FC5. For all secondary lists up to level 20, the user interface TEST is the same as for the basic list:

On list level 20, EXCLUDING ITAB deactivates all function codes that create detail lists. This prevents the user from causing a program termination by trying to create detail list number 21.

Example of setting a dialog status for the current list

REPORT demo_list_set_pf_status_2.

START-OF-SELECTION.

WRITE: 'SY-LSIND:', sy-lsind.

AT LINE-SELECTION.

SET PF-STATUS 'TEST' IMMEDIATELY.

After executing the program, the output screen shows the basic list and the user interface predefined for line selection (with function code PICK).

When you choose Choose, the user interface changes. However, since the AT LINE-SELECTION processing block does not contain an output statement, the system does not create a detail list: The status TEST is defined as in the previous example.

Example: Titles of detail lists.

REPORT demo_list_title .

START-OF-SELECTION.

WRITE 'Click me!' HOTSPOT COLOR 5 INVERSE ON.

AT LINE-SELECTION.

SET TITLEBAR 'TIT' WITH sy-lsind.

WRITE 'Click again!' HOTSPOT COLOR 5 INVERSE ON.

In this program, a new title is set for each detail list. The title is defined as follows: "Title for Detail List &1".