Application Development and Automation 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: 
Read only

interactive report pf-status

Former Member
0 Likes
1,837

Hi All,

I created one interactive report with setting back and exit buttons on pf-status in interactive report.

In the function codes of both I wrote the same code ie 'LEAVE SCREEN'. when I press back button in primary secondary list,it will goes to the basic list. But when I press exit button it will goes to the initial selection screen. shall anybody clarify this?

suma.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,082

Hi suma,

1. Things won't work if we do normal things.

02. The important things are :

a) New PF-STATUS is required , say 'ABCD'.

b) Handle user_commmand

3. First of all, from Function group SALV,

copy the STANDARD gui status to your program,

from SE80, by right clicking.

4. come to your program.

start-of-selection.

SET PF-STATUS 'ABCD'.

5. Double click ABCD and activate the gui status.

6. In gui status,

in those green buttons and yellow buton,

write BACK1 in both.

ie. buttons with fcode BACK1.

Save and activate.

6. AT USER-COMMAND.

IF sy-ucomm = 'BACK1'.

DATA : answer TYPE c.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = 'Do You Want To Exit ?'

text_question = 'Do You Want To Exit ?'

IMPORTING

answer = answer

EXCEPTIONS

text_not_found = 1

OTHERS = 2.

IF answer = '1'.

SET USER-COMMAND 'BACK'.

ENDIF.

ENDIF.

This will solve your problem.

I tried at my end, it works fantastic.

regards,

amit m.

6 REPLIES 6
Read only

amit_khare
Active Contributor
0 Likes
1,082

Hi,

Welcome to SDN Forum.

You must check the function type applied to the buttons.

I think you have taken type E for exit button which actually forces the default exit code for exiting.

Regards

Amit

Read only

Former Member
0 Likes
1,082

Hi

check the button type.

regards

Read only

Former Member
0 Likes
1,083

Hi suma,

1. Things won't work if we do normal things.

02. The important things are :

a) New PF-STATUS is required , say 'ABCD'.

b) Handle user_commmand

3. First of all, from Function group SALV,

copy the STANDARD gui status to your program,

from SE80, by right clicking.

4. come to your program.

start-of-selection.

SET PF-STATUS 'ABCD'.

5. Double click ABCD and activate the gui status.

6. In gui status,

in those green buttons and yellow buton,

write BACK1 in both.

ie. buttons with fcode BACK1.

Save and activate.

6. AT USER-COMMAND.

IF sy-ucomm = 'BACK1'.

DATA : answer TYPE c.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = 'Do You Want To Exit ?'

text_question = 'Do You Want To Exit ?'

IMPORTING

answer = answer

EXCEPTIONS

text_not_found = 1

OTHERS = 2.

IF answer = '1'.

SET USER-COMMAND 'BACK'.

ENDIF.

ENDIF.

This will solve your problem.

I tried at my end, it works fantastic.

regards,

amit m.

Read only

0 Likes
1,082

Hi Suma,

check this following code...

(copy paste it)

you need to do set the pf-status STAT,add BACK,CANCEL,EXIT .

set their codes as BACK1, CANC1,EXIT1 respectively..

REPORT  ZTEST MESSAGE-ID ZZ NO STANDARD PAGE HEADING.

TABLES:VBAK.

DATA: BEGIN OF IT_VBAK OCCURS 0,
       VBELN LIKE VBAK-VBELN,
       ERDAT LIKE VBAK-ERDAT,
      END OF IT_VBAK.


DATA: BEGIN OF IT_VBAP OCCURS 0,
        VBELN LIKE VBAP-VBELN,
        POSNR LIKE VBAP-POSNR,
        MATNR LIKE VBAP-MATNR,
      END OF IT_VBAP.

DATA: FIELDNAME(20),
      VALUE(10).
SELECT-OPTIONS:S_VBELN FOR VBAK-VBELN.


START-OF-SELECTION.

  SELECT VBELN
         ERDAT
         FROM VBAK
         INTO TABLE IT_VBAK
         WHERE VBELN IN S_VBELN.
  IF SY-SUBRC = 0.
    SORT IT_VBAK BY VBELN.
  ENDIF.
  IF NOT IT_VBAK[] IS INITIAL.
    SELECT VBELN
           POSNR
           FROM VBAP
           INTO TABLE IT_VBAP
           FOR ALL ENTRIES IN IT_VBAK
           WHERE VBELN = IT_VBAK-VBELN.
  ENDIF.
TOP-OF-PAGE.
WRITE: 'SALES ORDER',
       'CREATION DATE'.
END-OF-SELECTION.

  PERFORM WRITE_LIST.


AT LINE-SELECTION.
  SET PF-STATUS 'STAT'.


  GET CURSOR FIELD FIELDNAME VALUE VALUE.
  IF FIELDNAME = 'IT_VBAK-VBELN' .
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT  = VALUE
      IMPORTING
        OUTPUT = VALUE(10).
*  SET PARAMETER ID 'AUN' FIELD VALUE.
*  CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

    LOOP AT IT_VBAP WHERE VBELN = VALUE.
      WRITE:/ IT_VBAP-VBELN,
              IT_VBAP-POSNR.

    ENDLOOP.
  ENDIF.

AT USER-COMMAND.

  CASE SY-UCOMM.

    WHEN 'BACK1' OR 'CANC1' OR 'EXIT1'.

     sy-lsind = 0.
     PERFORM WRITE_LIST.


    WHEN 'REFR'.
      SY-LSIND = 0.
      PERFORM WRITE_LIST.
  ENDCASE.
*&---------------------------------------------------------------------*
*&      Form  WRITE_LIST
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM WRITE_LIST .
  IF NOT IT_VBAK[] IS INITIAL.
    LOOP AT IT_VBAK.

      WRITE:/ IT_VBAK-VBELN,
              IT_VBAK-ERDAT.

    ENDLOOP.
  ELSE.
    MESSAGE I000 WITH 'NO DATA FOUND'.
  ENDIF.
ENDFORM.                    " WRITE_LIST

Read only

Former Member
0 Likes
1,082

Hi suma,

1. Things won't work if we do normal things.

02. The important things are :

a) New PF-STATUS is required , say 'ABCD'.

b) Handle user_commmand

3. First of all, from Function group SALV,

copy the STANDARD gui status to your program,

from SE80, by right clicking.

4. come to your program.

start-of-selection.

SET PF-STATUS '123'.

5. Double click 123 and activate the gui status.

6. In gui status,

in those green buttons and yellow buton,

write BACK1 in both.

ie. buttons with fcode BACK1.

Save and activate.

6. AT USER-COMMAND.

IF sy-ucomm = 'BACK1'.

DATA : answer TYPE c.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = 'Do You Want To Exit ?'

text_question = 'Do You Want To Exit ?'

IMPORTING

answer = answer

EXCEPTIONS

text_not_found = 1

OTHERS = 2.

IF answer = '1'.

SET USER-COMMAND 'BACK'.

ENDIF.

ENDIF.

Thanks & regards,

Sureshkumar

Read only

Former Member
0 Likes
1,082

Hi,

Nice qns from you their is small differance in BACK and EXIT. back will take you one step back but when you come exist it is mobule exist commond . it will take you initial point. if go into pf-status and see the function type it is "E" means exist .

i think it will help to find differance.

regards

saleem.shaik