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: 

Alv + Pf_status

Former Member
0 Kudos
250

hi..

in my object..

i have to show material details in first page in alv. and

i have to show plant details in the second page for the corresponding material selected in the first page..

and also

i have to show pf status in the first page( i.e 2 bt plant button and exit button) in the application tool bar.

where can i write the logic for this 2 button.

how can i use this in the program..

kindly please its very important...

1 ACCEPTED SOLUTION

Former Member
0 Kudos
78

Hi,

You can create the secondary listing in alv using the slis_event_alv FM by capturing the doubleclick event in the alv listing and then in order to produce the secondary listing for the particular material number you can use a table which you will have to declare like slis_selfield which would have the entry for that particular number. For enabeling the buttons you can use a pfstatus and then use the case statement to program the logic for the same.

regards,

Himanshu

3 REPLIES 3

Former Member
0 Kudos
78

when ever your are keeping buttons in your program, you need to code them in PAI

Former Member
0 Kudos
79

Hi,

You can create the secondary listing in alv using the slis_event_alv FM by capturing the doubleclick event in the alv listing and then in order to produce the secondary listing for the particular material number you can use a table which you will have to declare like slis_selfield which would have the entry for that particular number. For enabeling the buttons you can use a pfstatus and then use the case statement to program the logic for the same.

regards,

Himanshu

uwe_schieferstein
Active Contributor
0 Kudos
78

Hello Selva

Perhaps the following sample report <b>ZUS_SDN_TWO_ALV_GRIDS_6</b> may be useful for you.

*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_TWO_ALV_GRIDS_6
*&
*&---------------------------------------------------------------------*
*& Screen '0100' contains no elements.
*& ok_code -> assigned to GD_OKCODE
*&
*& Flow logic:
*  PROCESS BEFORE OUTPUT.
*    MODULE STATUS_0100.
**
*  PROCESS AFTER INPUT.
*    MODULE USER_COMMAND_0100.
*&
*&---------------------------------------------------------------------*

REPORT  zus_sdn_two_alv_grids_6.




DATA:
  gd_okcode        TYPE ui_func,
*
  go_docking       TYPE REF TO cl_gui_docking_container,
  go_splitter      TYPE REF TO cl_gui_splitter_container,
  go_cell_top      TYPE REF TO cl_gui_container,
  go_cell_bottom   TYPE REF TO cl_gui_container,
  go_grid1         TYPE REF TO cl_gui_alv_grid,
  go_grid2         TYPE REF TO cl_gui_alv_grid,
  gs_layout        TYPE lvc_s_layo.


DATA:
  gt_outtab        TYPE STANDARD TABLE OF mara,
  gt_detail        TYPE STANDARD TABLE OF marc.





*---------------------------------------------------------------------*
*       CLASS lcl_eventhandler DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_eventhandler DEFINITION.

  PUBLIC SECTION.
    CLASS-METHODS:
      handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
        IMPORTING
          e_row
          e_column
          es_row_no
          sender.


ENDCLASS.                    "lcl_eventhandler DEFINITION



*---------------------------------------------------------------------*
*       CLASS lcl_eventhandler IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_eventhandler IMPLEMENTATION.

  METHOD handle_double_click.
*   define local data
    DATA:
      ls_outtab    LIKE LINE OF gt_outtab.

    CHECK ( sender = go_grid1 ).

    READ TABLE gt_outtab INTO ls_outtab INDEX e_row-index.
    CHECK ( ls_outtab-matnr IS NOT INITIAL ).

    CALL METHOD go_grid1->set_current_cell_via_id
      EXPORTING
*        IS_ROW_ID    =
*        IS_COLUMN_ID =
        is_row_no    = es_row_no.


*   Triggers PAI of the dynpro with the specified ok-code
    CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).



  ENDMETHOD.                    "handle_double_click

ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION






START-OF-SELECTION.

  SELECT * FROM  mara INTO TABLE gt_outtab UP TO 100 ROWS.


  PERFORM init_controls.




* NOTE: dynpro does not contain any elements
  CALL SCREEN '0100'.
* Flow logic of dynpro (does not contain any dynpro elements):
*
*PROCESS BEFORE OUTPUT.
*  MODULE STATUS_0100.
**
*PROCESS AFTER INPUT.
*  MODULE USER_COMMAND_0100.



END-OF-SELECTION.


*&---------------------------------------------------------------------*
*&      Form  INIT_CONTROLS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM init_controls .

* Create docking container
  CREATE OBJECT go_docking
    EXPORTING
      parent                      = cl_gui_container=>screen0
      ratio                       = 90
    EXCEPTIONS
      OTHERS                      = 6.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


* Create splitter container
  CREATE OBJECT go_splitter
    EXPORTING
      parent            = go_docking
      rows              = 2
      columns           = 1
*      NO_AUTODEF_PROGID_DYNNR =
*      NAME              =
    EXCEPTIONS
      cntl_error        = 1
      cntl_system_error = 2
      OTHERS            = 3.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

* Get cell container
  CALL METHOD go_splitter->get_container
    EXPORTING
      row       = 1
      column    = 1
    RECEIVING
      container = go_cell_top.
  CALL METHOD go_splitter->get_container
    EXPORTING
      row       = 2
      column    = 1
    RECEIVING
      container = go_cell_bottom.

* Create ALV grids
  CREATE OBJECT go_grid1
    EXPORTING
      i_parent          = go_cell_top
    EXCEPTIONS
      OTHERS            = 5.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


* Set event handler
  SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.


  CREATE OBJECT go_grid2
    EXPORTING
      i_parent          = go_cell_bottom
    EXCEPTIONS
      OTHERS            = 5.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


* Display data
  gs_layout-grid_title = 'Materials'.
  CALL METHOD go_grid1->set_table_for_first_display
    EXPORTING
      i_structure_name = 'MARA'
      is_layout        = gs_layout
    CHANGING
      it_outtab        = gt_outtab
    EXCEPTIONS
      OTHERS           = 4.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  gs_layout-grid_title = 'Plants (for Material)'.
  CALL METHOD go_grid2->set_table_for_first_display
    EXPORTING
      i_structure_name = 'MARC'
      is_layout        = gs_layout
    CHANGING
      it_outtab        = gt_detail  " empty !!!
    EXCEPTIONS
      OTHERS           = 4.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


* Link the docking container to the target dynpro
  CALL METHOD go_docking->link
    EXPORTING
      repid                       = syst-repid
      dynnr                       = '0100'
*      CONTAINER                   =
    EXCEPTIONS
      OTHERS                      = 4.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

ENDFORM.                    " INIT_CONTROLS


*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS_0100'.  " contains push button "DETAIL"
*  SET TITLEBAR 'xxx'.


* Refresh display of detail ALV list
  CALL METHOD go_grid2->refresh_table_display
*    EXPORTING
*      IS_STABLE      =
*      I_SOFT_REFRESH =
    EXCEPTIONS
      OTHERS         = 2.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


ENDMODULE.                 " STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

  CASE gd_okcode.
    WHEN 'BACK' OR
         'END'  OR
         'CANC'.
      SET SCREEN 0. LEAVE SCREEN.

*   User has pushed button "Display Details"
    WHEN 'DETAIL'.
      PERFORM entry_show_details.

    WHEN OTHERS.
  ENDCASE.

  CLEAR: gd_okcode.

ENDMODULE.                 " USER_COMMAND_0100  INPUT

*&---------------------------------------------------------------------*
*&      Form  ENTRY_SHOW_DETAILS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM entry_show_details .
* define local data
  DATA:
    ld_title    TYPE lvc_title,
    ld_row      TYPE i,
    ls_outtab   LIKE LINE OF gt_outtab.

  CALL METHOD go_grid1->get_current_cell
    IMPORTING
      e_row = ld_row.

  READ TABLE gt_outtab INTO ls_outtab INDEX ld_row.
  CHECK ( syst-subrc = 0 ).

  SELECT * FROM  marc INTO TABLE gt_detail
         WHERE  matnr = ls_outtab-matnr.

  CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
    EXPORTING
      input  = ls_outtab-matnr
    IMPORTING
      output = ld_title.


  CONCATENATE 'Plants (Material =' ld_title ')' INTO ld_title
    SEPARATED BY space.

  go_grid2->set_gridtitle( ld_title ).

ENDFORM.                    " ENTRY_SHOW_DETAILS

Regards

Uwe