<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: DYNPRO: Triggering PAI manually in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynpro-triggering-pai-manually/m-p/551733#M20901</link>
    <description>&lt;P&gt;By default, all ALV Grid control events don't trigger the PAI (system events). This may be changed for all events, via the parameter I_APPL_EVENTS = 'X' of the constructor (application events).&lt;/P&gt;
  &lt;P&gt;You may also transport explicitly the screen fields you want, via the function module DYNP_VALUES_READ.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Sep 2017 17:55:36 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2017-09-28T17:55:36Z</dc:date>
    <item>
      <title>DYNPRO: Triggering PAI manually</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynpro-triggering-pai-manually/m-p/551729#M20897</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;my DYNPRO consits of 3 sections like shown below.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/75264-dynpro.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;The CUSTOM CONTROL section is displaying an CL_GUI_ALV_GRID-object with a customized toolbar (by handling the event TOOLBAR of CL_GUI_ALV_GRID).&lt;/P&gt;
  &lt;P&gt;When a button of the customized toolbar is pressed, the handler for this action has to use data from the upper right section of the DYNPRO (named: "WE: Allgemeine Buchungsdaten" in the image above).&lt;/P&gt;
  &lt;P&gt;As there is no PAI executed after pressing the button, no data-transfer from DYNPRO to programm happens. So my handler works with data transferred before last PAI, which may be old.&lt;/P&gt;
  &lt;P&gt;Is there a way to trigger PAI manually in my handler?&lt;/P&gt;
  &lt;P&gt;I tried&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;  CALL METHOD cl_gui_cfw=&amp;gt;set_new_ok_code
    EXPORTING
      new_code = 'DUMMY'.
   CALL METHOD cl_gui_cfw=&amp;gt;flush.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;like &lt;A href="https://wiki.scn.sap.com/wiki/display/Snippets/Triggering+PAI+manually"&gt;https://wiki.scn.sap.com/wiki/display/Snippets/Triggering+PAI+manually&lt;/A&gt; told me, but PAI is not triggered after this peace of code.&lt;/P&gt;
  &lt;P&gt;Please help,&lt;/P&gt;
  &lt;P&gt;Hubert&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 11:54:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynpro-triggering-pai-manually/m-p/551729#M20897</guid>
      <dc:creator>hubert_heitzer</dc:creator>
      <dc:date>2017-09-28T11:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: DYNPRO: Triggering PAI manually</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynpro-triggering-pai-manually/m-p/551730#M20898</link>
      <description>&lt;P&gt;CL_GUI_CFW=&amp;gt;SET_NEW_OK_CODE works well for me (no need of flush):&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;REPORT.
DATA int_fleet TYPE TABLE OF sflight.
DATA alv_1 TYPE REF TO cl_gui_alv_grid.
*----------------------------------------------------------------------*
CLASS lcl_event_receiver DEFINITION.
  PUBLIC SECTION.
    METHODS on_user_command FOR EVENT user_command OF cl_gui_alv_grid.
    METHODS handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
          IMPORTING e_object e_interactive.
ENDCLASS.                    "lcl_event_receiver DEFINITION
DATA event_receiver TYPE REF TO lcl_event_receiver.
*----------------------------------------------------------------------*
CLASS lcl_event_receiver IMPLEMENTATION.
  METHOD handle_toolbar.
    DATA ls_toolbar TYPE stb_button.
    DELETE e_object-&amp;gt;mt_toolbar WHERE function = '&amp;amp;DETAIL'.
    CLEAR ls_toolbar.
    ls_toolbar-butn_type = cntb_btype_sep.
    APPEND ls_toolbar TO e_object-&amp;gt;mt_toolbar.
    CLEAR ls_toolbar.
    ls_toolbar-function  = 'AIRCRAFT LIST'.
    ls_toolbar-icon      = icon_bw_ref_structure_sap.
    ls_toolbar-quickinfo = 'Show Tail No. and Equipment'(111).
    ls_toolbar-text      = 'Structure'(112).
    ls_toolbar-disabled  = ''.
    APPEND ls_toolbar TO e_object-&amp;gt;mt_toolbar.
  ENDMETHOD.                    "handle_toolbar
  METHOD on_user_command.
    MESSAGE 'on_user_command' TYPE 'I'.
    cl_gui_cfw=&amp;gt;set_new_ok_code( 'DUMMY' ).
  ENDMETHOD.                    "handle_toolbar
ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
PARAMETERS dummy.
AT SELECTION-SCREEN OUTPUT.
  IF alv_1 IS INITIAL.
    SELECT * FROM sflight INTO TABLE int_fleet.
    DATA: it_layout TYPE lvc_s_layo,
          it_fcat TYPE lvc_t_fcat,
          ls_exclude TYPE ui_func,
          gs_variant TYPE disvariant,
          lt_exclude TYPE ui_functions.
    ls_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_excl_all.
    APPEND ls_exclude TO lt_exclude.
    PERFORM get_fcat CHANGING int_fleet it_fcat.
    CREATE OBJECT alv_1
      EXPORTING
        i_parent = cl_gui_container=&amp;gt;screen0.
    CREATE OBJECT event_receiver.
* set the toolbar handler before SET_TABLE_FOR_FIRST_DISPLAY so that to
* make it raised automatically (thus no need to call SET_TOOLBAR_INTERACTIVE)
    SET HANDLER event_receiver-&amp;gt;handle_toolbar FOR alv_1.
    SET HANDLER event_receiver-&amp;gt;on_user_command FOR alv_1.
    CALL METHOD alv_1-&amp;gt;set_table_for_first_display
      EXPORTING
        is_layout                     = it_layout
        it_toolbar_excluding          = lt_exclude
        is_variant                    = gs_variant
      CHANGING
        it_outtab                     = int_fleet
        it_fieldcatalog               = it_fcat
      EXCEPTIONS
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        OTHERS                        = 4.
  ENDIF.
AT SELECTION-SCREEN.
  MESSAGE 'PAI' TYPE 'I'.
*---------------------------------------------------------------------------
FORM get_fcat CHANGING it_std TYPE STANDARD TABLE et_fcat TYPE lvc_t_fcat.
  DATA lo_table TYPE REF TO cl_salv_table.
  DATA lo_columns TYPE REF TO cl_salv_columns_list.
  DATA lo_agg TYPE REF TO cl_salv_aggregations.
  REFRESH et_fcat.
  CALL METHOD cl_salv_table=&amp;gt;factory
    IMPORTING
      r_salv_table = lo_table
    CHANGING
      t_table      = it_std[].
  lo_columns = lo_table-&amp;gt;get_columns( ).
  lo_agg = lo_table-&amp;gt;get_aggregations( ).
  et_fcat = cl_salv_controller_metadata=&amp;gt;get_lvc_fieldcatalog( r_columns = lo_columns r_aggregations = lo_agg ).
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Sep 2017 12:52:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynpro-triggering-pai-manually/m-p/551730#M20898</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2017-09-28T12:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: DYNPRO: Triggering PAI manually</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynpro-triggering-pai-manually/m-p/551731#M20899</link>
      <description>&lt;P&gt;Yep,&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;  CALL METHOD cl_gui_cfw=&amp;gt;set_new_ok_code
    EXPORTING
      new_code = 'DUMMY'.
   CALL METHOD cl_gui_cfw=&amp;gt;flush.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;works in a way that does not help me &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
  &lt;P&gt;My handler (short version):&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;  METHOD alv_user_command.
    CASE e_ucomm. " importing parameter
      WHEN 'BOOK'.
        CALL METHOD cl_gui_cfw=&amp;gt;set_new_ok_code
          EXPORTING
            new_code = 'DUMMY'.
        CALL METHOD cl_gui_cfw=&amp;gt;flush.

        PERFORM book_purchase_order.
        PERFORM display_purchase_order_info.
      WHEN OTHERS.
    ENDCASE.
  ENDMETHOD.                    "ALV_USER_COMMAND
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;PAI has to take place before calling of FORM book_puchase_order, but it happens after METHOD alv_user_command is finished.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 13:47:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynpro-triggering-pai-manually/m-p/551731#M20899</guid>
      <dc:creator>hubert_heitzer</dc:creator>
      <dc:date>2017-09-28T13:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: DYNPRO: Triggering PAI manually</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynpro-triggering-pai-manually/m-p/551732#M20900</link>
      <description>&lt;P&gt;Set a new ok_code with &lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;        CALL METHOD cl_gui_cfw=&amp;gt;set_new_ok_code
          EXPORTING
            new_code = 'BOOK_PAI'.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;and move your processing code&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;     WHEN 'BOOK_PAI'.
        PERFORM book_purchase_order.
        PERFORM display_purchase_order_info.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;to the 'normal' &lt;/P&gt;
  &lt;P&gt;PROCESS AFTER INPUT.&lt;BR /&gt; MODULE user_command.&lt;/P&gt;
  &lt;P&gt;&lt;EM&gt;cl_gui_cfw=&amp;gt;set_new_ok_code&lt;/EM&gt; is a 'simple' forward to leave the ALV events and go back to the standard flow logic.&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 15:08:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynpro-triggering-pai-manually/m-p/551732#M20900</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-09-28T15:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: DYNPRO: Triggering PAI manually</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynpro-triggering-pai-manually/m-p/551733#M20901</link>
      <description>&lt;P&gt;By default, all ALV Grid control events don't trigger the PAI (system events). This may be changed for all events, via the parameter I_APPL_EVENTS = 'X' of the constructor (application events).&lt;/P&gt;
  &lt;P&gt;You may also transport explicitly the screen fields you want, via the function module DYNP_VALUES_READ.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 17:55:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynpro-triggering-pai-manually/m-p/551733#M20901</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2017-09-28T17:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: DYNPRO: Triggering PAI manually</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynpro-triggering-pai-manually/m-p/551734#M20902</link>
      <description>&lt;P&gt;Thanks Tibor,&lt;/P&gt;
  &lt;P&gt;your suggestion is somthing like we call:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;from behind through the chest into the eye&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;in Germany, but it works fine.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2017 06:26:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynpro-triggering-pai-manually/m-p/551734#M20902</guid>
      <dc:creator>hubert_heitzer</dc:creator>
      <dc:date>2017-09-29T06:26:27Z</dc:date>
    </item>
  </channel>
</rss>

