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: 

report

Former Member
0 Kudos

Difference Between ATPF and AT user command?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

ATPF when u execute keyboard key.

AT usercommand when u execute buttons on screens

Reward with points if helpful.

Message was edited by:

Vinutha YV

6 REPLIES 6

Former Member
0 Kudos

At PF: When you execute a keyboard key the line will execute.

At user command: when you execute a button in the screen, the line will execute.

0 Kudos

At PF example:

REPORT demo_list_at_pf .

START-OF-SELECTION.
  WRITE 'Basic List, Press PF5, PF6, PF7, or PF8'.

AT pf5.
  PERFORM out.

AT pf6.
  PERFORM out.

AT pf7.
  PERFORM out.

AT pf8.
  PERFORM out.

FORM out.
  WRITE: 'Secondary List by PF-Key Selection',
       / 'SY-LSIND =', sy-lsind,
       / 'SY-UCOMM =', sy-ucomm.
ENDFORM.

At user command example:

REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.

START-OF-SELECTION.
  WRITE: 'Basic List',
       / 'SY-LSIND:', sy-lsind.

TOP-OF-PAGE.
  WRITE 'Top-of-Page'.
  ULINE.

TOP-OF-PAGE DURING LINE-SELECTION.
  CASE sy-pfkey.
    WHEN 'TEST'.
      WRITE 'Self-defined GUI for Function Codes'.
      ULINE.
  ENDCASE.

AT LINE-SELECTION.
  SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
  PERFORM out.
  sy-lsind = sy-lsind - 1.

AT USER-COMMAND.
  CASE sy-ucomm.
    WHEN 'FC1'.
      PERFORM out.
      WRITE / 'Button FUN 1 was pressed'.
    WHEN 'FC2'.
      PERFORM out.
      WRITE / 'Button FUN 2 was pressed'.
    WHEN 'FC3'.
      PERFORM out.
      WRITE / 'Button FUN 3 was pressed'.
    WHEN 'FC4'.
      PERFORM out.
      WRITE / 'Button FUN 4 was pressed'.
    WHEN 'FC5'.
      PERFORM out.
      WRITE / 'Button FUN 5 was pressed'.
  ENDCASE.
  sy-lsind = sy-lsind - 1.

FORM out.
  WRITE: 'Secondary List',
       / 'SY-LSIND:', sy-lsind,
       / 'SY-PFKEY:', sy-pfkey.
ENDFORM.

p291102
Active Contributor
0 Kudos

Former Member
0 Kudos

Hi

AT PF is used in interactive reports For predefined function keys...

AT NEW is used within Internal table

this is mainly used to do Totals/sum for the Qty and Amount fields based on a key field in that internal table

DATA: sflight_tab TYPE SORTED TABLE OF sflight

WITH UNIQUE KEY carrid connid fldate,

sflight_wa LIKE LINE OF sflight_tab.

SELECT *

FROM sflight

INTO TABLE sflight_tab.

LOOP AT sflight_tab INTO sflight_wa.

AT NEW connid.

WRITE: / sflight_wa-carrid,

sflight_wa-connid.

ULINE.

ENDAT.

WRITE: / sflight_wa-fldate,

sflight_wa-seatsocc.

AT END OF connid.

SUM.

ULINE.

WRITE: / 'Sum',

sflight_wa-seatsocc UNDER sflight_wa-seatsocc.

SKIP.

ENDAT.

AT END OF carrid.

SUM.

ULINE.

WRITE: / 'Carrier Sum',

sflight_wa-seatsocc UNDER sflight_wa-seatsocc.

NEW-PAGE.

ENDAT.

AT LAST.

SUM.

WRITE: / 'Overall Sum',

sflight_wa-seatsocc UNDER sflight_wa-seatsocc.

ENDAT.

ENDLOOP.

Reward points if useful

Regards

Anji

Message was edited by:

Anji Reddy Vangala

srinivas_akiri
Active Participant
0 Kudos

Hi

both are used to handle the user actions in the module pool programming, differance is

AT user-command will raise when user performance and action and depends on the value of sy-ucomm we need to process.

AT PF is used to process the process codes attached to the pf-status of the program.

Thanks

Srini

Former Member
0 Kudos

hi,

ATPF when u execute keyboard key.

AT usercommand when u execute buttons on screens

Reward with points if helpful.

Message was edited by:

Vinutha YV