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

pushbuttons in interactive report

Former Member
0 Likes
1,030

hi,

i have created an interactive report program.I have a pushbutton 'DISPLAY' on selection screen.After clicking the button i get basic list.I have set GUI status for basic lists' screen.But after double clicking the particular record i am not able to proceed to detailed list.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
927

Hi Vishal,

When you double click on the records of the basic list you won't be able to proceed to detail list unless you specify AT LINE SELECTION event . If you want to use a PUSHBUTTON you can use AT USER COMMAND event. For using the function keys you can use AT PF# event

For Example :

AT LINE SELECTION.

SELECT * from ...

6 REPLIES 6
Read only

Former Member
0 Likes
928

Hi Vishal,

When you double click on the records of the basic list you won't be able to proceed to detail list unless you specify AT LINE SELECTION event . If you want to use a PUSHBUTTON you can use AT USER COMMAND event. For using the function keys you can use AT PF# event

For Example :

AT LINE SELECTION.

SELECT * from ...

Read only

Former Member
0 Likes
927

Hi vishal

If u want to go next level, you should use <b>At Line-selection</b> command.

For example:

Use like this,

AT LINE-SELECTION.

IF SY-LSIND = 1.

SELECT * FROM EKKO INTO TABLE IT_EKKO WHERE LIFNR = WA_LFA1-LIFNR.

LOOP AT IT_EKKO INTO WA_EKKO.

WRITE : / WA_EKKO-EBELN,WA_EKKO-BUKRS,WA_EKKO-EKORG.

ENDLOOP.

ENDIF.

IF SY-LSIND = 2.

SELECT * FROM EKPO INTO TABLE IT_EKPO WHERE EBELN = WA_EKKO-EBELN.

LOOP AT IT_EKPO INTO WA_EKPO.

WRITE : / WA_EKPO-EBELN, WA_EKPO-EBELP,WA_EKPO-MATNR,WA_EKPO-BUKRS.

ENDLOOP.

ENDIF.

IF SY-LSIND = 3.

CALL TRANSACTION 'MM03'.

ENDIF.

If u r using "Push Button", you have to use AT user-command or you can specify in PBO PF-stauts.

If it is useful reward points.

Thanks

Senthil

Read only

Former Member
0 Likes
927

Here is the drilldown report with GUI STATUS and PF status ..

REPORT  zmm_rept_purchorderkkb01 LINE-SIZE 80
                                 LINE-COUNT 65(3)
                                 MESSAGE-ID z_msg_class
                                 NO STANDARD PAGE HEADING.

*------------------DECLARING THE STANDARD TABLES---------------------*
TABLES : ekko, "PURCHASE ORDER : HEADER
         ekpo. "PURCHASE ORDER : ITEM

*------------------DECLARING THE INTERNAL TABLE----------------------*
DATA  : BEGIN OF it_ekko OCCURS 2,
          ebeln LIKE ekko-ebeln, "PURCHASE ORDER NUMBER
          bukrs LIKE ekko-bukrs, "COMPANY CODE
          bsart LIKE ekko-bsart, "PURCHASING DOCUMENT TYPE
          lifnr LIKE ekko-lifnr, "VENDOR
          spras LIKE ekko-spras, "LANGUAGE KEY
          zterm LIKE ekko-zterm, "PAYMENT TERMS KEY
        end of it_ekko.

DATA  : BEGIN OF it_ekpo OCCURS 2,
          ebeln LIKE ekpo-ebeln, "PURCHASE ORDER NUMBER
          ebelp LIKE ekpo-ebelp, "PURCHASE ORDER NUMBER
          werks LIKE ekpo-werks, "PLANT
          matnr LIKE ekpo-matnr, "MATERIAL NUMBER
          matkl LIKE ekpo-matkl, "MATERIAL GROUP
        END OF it_ekpo.

DATA: it_ebeln LIKE ekko-ebeln OCCURS 0 WITH HEADER LINE.

*DATA: it_ebeln_high LIKE ekko-ebeln OCCURS 0 WITH HEADER LINE.

DATA: p_ebeln       TYPE i.

*------------------Declaring the selection screen--------------------*

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.

SELECT-OPTIONS : s_ebeln FOR ekko-ebeln.

PARAMETER      : p_limit TYPE i.

SELECTION-SCREEN END OF BLOCK blk1.


*INCLUDE z_incl_purorderkkb01_sub_f01.


*--------------------------------------------------------------------*
*  Validation for  number of records to be printed                   *
*--------------------------------------------------------------------*

*AT SELECTION-SCREEN ON p_limit.
*  IF p_limit IS INITIAL.
*    MESSAGE e011.
*  ENDIF.


*  IF p_limit GT sy-linct.
*    MESSAGE e010.
*  ENDIF.


*----------------------------------------------------------------------*
*        Search help for purchase document number (s_ebeln-low)        *
*----------------------------------------------------------------------*

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_ebeln-low.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = s_ebeln-low
    IMPORTING
      output = s_ebeln-low.

  perform form_search_help.

  IF sy-subrc <> 0.
    CASE sy-subrc.
      WHEN 2.
        LEAVE TO SCREEN 1000.
    ENDCASE.
  ELSE.
    LOOP AT it_ebeln.
      IF sy-tabix = p_ebeln.
        s_ebeln-low = it_ebeln.
        EXIT.
      ENDIF.
    ENDLOOP.
  ENDIF.

*----------------------------------------------------------------------*
*        Search help for purchase document number (s_ebeln-high)       *
*----------------------------------------------------------------------*

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_ebeln-high.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = s_ebeln-high
    IMPORTING
      output = s_ebeln-high.

  perform form_search_help.

  IF sy-subrc <> 0.
    CASE sy-subrc.
      WHEN 2.
        LEAVE TO SCREEN 1000.
    ENDCASE.
  ELSE.
    LOOP AT it_ebeln.
      IF sy-tabix = p_ebeln.
        s_ebeln-high = it_ebeln.
        EXIT.
      ENDIF.
    ENDLOOP.
  ENDIF.

*----------------------------------------------------------------------*
*                   Start-of-selection event                           *
*----------------------------------------------------------------------*

START-OF-SELECTION.

*----------------------To attach a user interface----------------------*
SET PF-STATUS '0010'.

*---------To fetch the data for the basic list-------------------------*
    SELECT ebeln                   "PURCHASE ORDER NUMBER
           bukrs                   "COMPANY CODE
           bsart                   "PURCHASING DOCUMENT TYPE
           lifnr                   "VENDOR
           spras                   "LANGUAGE KEY
           zterm                   "PAYMENT TERMS KEY
     up to p_limit rows
     into table it_ekko from ekko
     where ebeln in s_ebeln.

     REFRESH it_ekpo.

*---------To fetch the data for the secondary list-----------------------*

if it_ekpo is initial.

    SELECT ebeln "PURCHASE ORDER NUMBER
           ebelp "PURCHASING DOCUMENT TYPE
           werks "PLANT
           matnr "MATERIAL NUMBER
           matkl "MATERIAL GROUP
    FROM ekpo  INTO TABLE it_ekpo for all entries in it_ekko
    WHERE ebeln EQ it_ekko-ebeln.

endif.

*----------------------------------------------------------------------*
*                   End-of-selection event                             *
*----------------------------------------------------------------------*

END-OF-SELECTION.


*---------To display the data for the basic list-----------------------*
   format color 4 intensified off.
  LOOP AT it_ekko.
    WRITE :/ sy-vline, it_ekko-ebeln UNDER text-002, 18 sy-vline,
                                                    "PURCHASE ORDER NUMBER
                       it_ekko-bukrs UNDER text-003, 27 sy-vline,
                                                    "COMPANY CODE
                       it_ekko-bsart UNDER text-004, 38 sy-vline,
                                                    "PURCHASING DOCUMENT TYPE
                       it_ekko-lifnr UNDER text-005, 50 sy-vline,
                                                    "VENDOR
                       it_ekko-spras UNDER text-006, 62 sy-vline,
                                                    "LANGUAGE KEY
                       it_ekko-zterm UNDER text-007, 80 sy-vline.
                                                    "PAYMENT TERMS KEY

  hide : it_ekko-ebeln.
  ENDLOOP.
  WRITE :/ sy-uline(80).

*----------------------------------------------------------------------*
*                To generate the detailed lists                        *
*----------------------------------------------------------------------*

AT LINE-SELECTION.
  CASE sy-lsind.
    WHEN 1.
      SET PF-STATUS '0011'.

*---------To display the data for the secondary list-----------------------*
WINDOW STARTING AT 10 10
       ENDING   AT 90 30.
    format color 5 intensified off.
  LOOP AT it_ekpo where ebeln = it_ekko-ebeln .
    WRITE :/ sy-vline, it_ekpo-ebeln UNDER text-002, 15 sy-vline,
                                                     "PURCHASE ORDER NUMBER
                       it_ekpo-ebelp UNDER text-008, 30 sy-vline,
                                                     "PO ITEM NUMBER
                       it_ekpo-werks UNDER text-009, 45 sy-vline,
                                                     "PLANT
                       it_ekpo-matnr UNDER text-010, 60 sy-vline,
                                                     "MATERIAL NUMBER
                       it_ekpo-matkl UNDER text-011, 80 sy-vline.
                                                     "MATERIAL GROUP
  ENDLOOP.

  WRITE :/ sy-uline(80).

  ENDCASE.

  CASE sy-ucomm.
    WHEN 'EXIT' OR 'CANC' OR 'BACK'.
       LEAVE TO SCREEN 0.
  ENDCASE.

*----------------------------------------------------------------------*
*                    At user-command event                             *
*----------------------------------------------------------------------*

AT USER-COMMAND.
  CASE sy-ucomm.
    WHEN 'SELE' OR 'LIST1'.
      IF sy-lsind = 1.
      SET PF-STATUS '0011'.

*---------To display the data for the secondary list-----------------------*

WINDOW STARTING AT 10 10
       ENDING   AT 90 30.
       format color 5 intensified off.

  LOOP AT it_ekpo where ebeln = it_ekko-ebeln .
    WRITE :/ sy-vline, it_ekpo-ebeln UNDER text-002, 15 sy-vline, "PURCHASE ORDER NUMBER
                       it_ekpo-ebelp UNDER text-008, 30 sy-vline, "PO ITEM NUMBER
                       it_ekpo-werks UNDER text-009, 45 sy-vline, "PLANT
                       it_ekpo-matnr UNDER text-010, 60 sy-vline, "MATERIAL NUMBER
                       it_ekpo-matkl UNDER text-011, 80 sy-vline. "MATERIAL GROUP

  ENDLOOP.

  WRITE :/ sy-uline(80).
  endif.

  ENDCASE.

  CASE sy-ucomm.
    WHEN 'EXIT' OR 'CANC' OR 'BACK'.
       LEAVE TO SCREEN 0.

  ENDCASE.

*----------------------------------------------------------------------*
*                    Top-of-page for basic list                        *
*----------------------------------------------------------------------*

TOP-OF-PAGE.

 format color 3 intensified off.

  WRITE :/ sy-uline(80).
  WRITE :/    sy-vline,
           03 sy-repid,
           60 text-015,
              sy-uname,
           80 sy-vline.
  WRITE :/ sy-vline, 03 sy-datum,
           35 text-012,
           60 text-014,
              sy-pagno,
           80 sy-vline.
  WRITE :/ sy-uline(80).
  WRITE :/ sy-vline, text-002, 18 sy-vline, "PURCHASE ORDER NUMBER
                     text-003, 27 sy-vline, "COMPANY CODE
                     text-004, 38 sy-vline, "PURCHASING DOCUMENT TYPE
                     text-005, 50 sy-vline, "VENDOR
                     text-006, 62 sy-vline, "LANGUAGE KEY
                     text-007, 80 sy-vline. "PAYMENT TERMS KEY
  WRITE :/ sy-uline(80).

*----------------------------------------------------------------------*
*              Top-of-page for secondary list                          *
*----------------------------------------------------------------------*

TOP-OF-PAGE DURING LINE-SELECTION.
format color 2 intensified off.
WINDOW STARTING AT 10 10
       ENDING   AT 90 30.
  WRITE :/ sy-uline(80).
  WRITE :/   sy-vline,
          03 sy-repid,
          60 text-015,
             sy-uname,
          80 sy-vline.

  WRITE :/   sy-vline,
          03 sy-datum,
          35 text-013,
          60 text-014,
             sy-pagno,
          80 sy-vline.

  WRITE :/ sy-uline(80).

  WRITE :/ sy-vline, text-014, 15 sy-vline, "PURCHASE ORDER NUMBER
                     text-008, 30 sy-vline, "PO ITEM NUMBER
                     text-009, 45 sy-vline, "PLANT
                     text-010, 60 sy-vline, "MATERIAL NUMBER
                     text-011, 80 sy-vline. "MATERIAL GROUP

  WRITE :/ sy-uline(80).

*----------------------------------------------------------------------*
*                    End-of-page event                                 *
*----------------------------------------------------------------------*

END-OF-PAGE.
  WRITE :/    sy-vline,
           03 text-016,
              p_limit,
           60 text-014,
              sy-pagno,
           80 sy-vline.
  write:/ sy-uline(80).

INCLUDE Z_INCLUDE_PURCHORDERKKB01.
form form_search_help .

REFRESH it_ebeln.
  CLEAR it_ebeln.
  CLEAR P_ebeln.

  SELECT ebeln FROM ekko INTO TABLE it_ebeln.

  CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
    EXPORTING
      endpos_col   = 21
      endpos_row   = 35
      startpos_col = 12
      startpos_row = 1
      titletext    = text-012

    IMPORTING
      choise       = P_ebeln

    TABLES
      valuetab     = it_ebeln

    EXCEPTIONS
      break_off    = 1
      OTHERS       = 2.

reward points if it is usefull ....

Girish

Read only

Former Member
0 Likes
927

Vishal,

Check this real time example with output

In the purchasing (MM module) you can process the purchase requisitions. The purchase requisitions define primarily the need for a material/service. List the first 100 purchase requisitions at the plant 'PL01' (table EBAN). Then make it possible to change the purchase requisition itself from the list by clicking twice on the row or by using a push-button.

ADDITIONAL REQUIREMENTS TO THE LIST:

1. CONTENT: PURCHASE REQUISITION NUMBER, ITEM NUMBER, DOCUMENT TYPE, MATERIAL, QUANTITY, UNIT OF MEASURE

2. LAYOUT: MAIN HEADER SHOULD INCLUDE

PROGRAM NAME, COMPANY NAME, PLANT, PURCHASE GROUP, CREATION DATE, PAGE NUMBER

3. ONE PAGE SHOULD HAVE 50 LINE ITEM

-


report zmjud001 no standard page heading line-size 85 line-count 50.

  • DATA /TABLES DECLARATION*

tables: eban.

data: prog_nam(8).

data: begin of pur_req occurs 100,

ekgrp like eban-ekgrp,

werks like eban-werks,

banfn like eban-banfn,

bnfpo like eban-bnfpo,

bsart like eban-bsart,

estkz like eban-estkz,

matnr like eban-matnr,

menge like eban-menge,

meins like eban-meins,

numb(3) type n.

data: end of pur_req.

  • THE REPORT HEADER

prog_nam = sy-repid.

top-of-page.

perform header_write.

  • SELECTION

start-of-selection.

pur_req-numb = 1.

  • SELECT ONLY THOSE FIELDS THAT WILL BE USED FROM THE TABLE EBAN, AND ONLY

*THE FIRST100 RECORDS OF THE THE PLANT 'PL01'

select banfn bnfpo bsart ekgrp matnr werks menge meins frgdt estkz

into corresponding fields of eban from eban up to 100 rows

where bsart = 'NB' "document type 'NB' = purchase requisition

and werks = 'PL01'

and statu = 'N' "processing status

and loekz = ' '. "deletion indicator

  • THE SELECTED RECORDS SHOULD BE APPENDED TO INTERNAL TABLE 'PUR_REQ'

pur_req-banfn = eban-banfn.

pur_req-matnr = eban-matnr.

pur_req-werks = eban-werks.

pur_req-ekgrp = eban-ekgrp.

pur_req-bnfpo = eban-bnfpo.

pur_req-bsart = eban-bsart.

pur_req-menge = eban-menge.

pur_req-meins = eban-meins.

pur_req-estkz = eban-estkz.

append pur_req.

pur_req-numb = pur_req-numb + 1.

endselect.

  • CHECK WHETHER THE TABLE EBAN CONTAINS ANY PURCHASE REQUISITIONS

if sy-subrc ne 0.

write: / 'No Purchase Requisition found.'.

endif.

  • PROCESS THE INTERNAL TABLE; WRITE OUT THE REQUIRED FIELDS AND HIDE THE

*FIELDS YOU ARE GOING TO USE LATER

loop at pur_req.

write: /1 pur_req-numb, 9 pur_req-banfn, 21 pur_req-bnfpo, 31 pur_req-bsart, 41 pur_req-matnr,

61 pur_req-menge unit pur_req-meins, 82 pur_req-meins.

hide: pur_req-matnr, pur_req-werks, pur_req-banfn.

endloop.

clear pur_req-banfn. clear pur_req-matnr. clear pur_req-werks.

  • IN THE MENU PAINTER (SE41) CREATE A STATUS TO YOUR PROGRAM. HERE YOU CAN

*DEFINE THE PUSH-BUTTON

set pf-status 'basic'.

  • CHOOSE A REQUISITION (WITH DOUBLE CLICKING OR PUSH-BUTTON) IN THE LIST! THE

*PURCHASE REQUISITION IS GOING TO COME UP

at line-selection.

if pur_req-banfn <> space.

set parameter id 'BAN' field pur_req-banfn. " parameter id for pruchase req. number

call transaction 'ME52' and skip first screen. "trans. code 'ME52': Change Purchase Requis.

clear pur_req-banfn. clear pur_req-matnr.

clear pur_req-werks.

endif.

  • FORM THE HEADER

form header_write.

write: / prog_nam, 32 'FUN-FACTORY',

/ 'Purch.Gr.:', pur_req-ekgrp, 26 'Purchase Requisition List',

61 'As Of Date:', 75 sy-datum,

/ 'Plant:', pur_req-werks, 61 'Page:', 75 sy-pagno.

uline.

write: / text-001,

/ text-002.

uline.

endform.

-


NOTES:

1. PUSH-BUTTON DEFINITION (SE11)

In the Menu Painter a status must be created where you can maintain the function keys

2. MAINTAIN THE TEXT ELEMENT TO THE HEADER OF THE LIST

(SE38 choose the object component 'TEXT ELEMENTS' at the first screen, then the'TEXT SYMBOLS'. Here you can add a number (I.E. 001) to 'TEXT SYMBOL' and write the header title into the text field like this:

001 Numb.__Requisition__Item___Document_____Material_________________Quantity_Unit_of

002 _________Number_____Num______Type__________________________________Measure

THE FIRST 15 LINE ITEMS OF THE RESULT AND THE HEADERS:

ZMJUD001 FUN-FACTORY

Purch. Gr.: 001 Purchase Requisition List As Of Date: 05/09/1997

Plant: D031 Page: 1

-


Numb. Requisition Item Document Material Quantity Unit of

Number Num Type Measure

-


1 10049227 00010 NB 11141-030 23.000 CS

2 10049223 00010 NB 11141-030 23.000 CS

3 10049225 00010 NB 11141-030 13.000 CS

4 10049226 00010 NB 11141-030 9.000 CS

5 10049224 00010 NB 11141-030 23.000 CS

6 10049222 00010 NB 11141-030 23.000 CS

7 10049221 00010 NB 11141-030 38.000 CS

8 10049228 00010 NB 11141-030 23.000 CS

9 10049229 00010 NB 11141-030 23.000 CS

10 10049230 00010 NB 11141-030 22.000 CS

11 10049231 00010 NB 11141-030 24.000 CS

12 10049232 00010 NB 11141-030 24.000 CS

13 10049233 00010 NB 11141-030 24.000 CS

14 10049234 00010 NB 11141-030 23.000 CS

15 10049235 00010 NB 11141-030 5.000 CS

-


Refer this link

https://forums.sdn.sap.com/click.jspa?searchID=495487&messageID=2815531

https://forums.sdn.sap.com/click.jspa?searchID=495487&messageID=2773037

http://www.sapgenie.com/abap/ireports.htm

Don't forget to reward if useful....

Read only

Former Member
0 Likes
927

thanks

Read only

Former Member
0 Likes
927

Just check out whether u have written the hide command properly