cancel
Showing results for 
Search instead for 
Did you mean: 

RE: Opening a standard application

uppu_narayan
Active Participant
0 Kudos

Hi All,

I have a requirement where i have to open a standard application for PO(component name: WDC_WSPO_PO on click of the link in my webdynpro application. Now i want to pass the PO number so that it automatically displays the PO details.

This component actually gets called from the POWL component POWL_UI_COMP and it passes data to this component, so i want to use it my application. Has any one came across to it or any suggestion on how to do it?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Can you paste your code here which you have written for calling appl,

so that we can analyze it.

uppu_narayan
Active Participant
0 Kudos

  CONSTANTS lc_config TYPE string VALUE 'SAP-WD-CONFIGID'.

  DATA ls_httpnvp TYPE LINE OF tihttpnvp.

  DATA  lt_httpnvp TYPE tihttpnvp.

  DATA   w_url   TYPE string.

  ls_httpnvp-name = lc_config.

  ls_httpnvp-value = 'WDAC_WSPO_QAF_PO'.

  INSERT ls_httpnvp INTO TABLE lt_httpnvp.

  ls_httpnvp-name = 'PO_NUMBER'.

  ls_httpnvp-value = '4500000564'.

  INSERT ls_httpnvp INTO TABLE lt_httpnvp.

  ls_httpnvp-name = 'IV_PLANT'.

  ls_httpnvp-value = '0200'.

  INSERT ls_httpnvp INTO TABLE lt_httpnvp.

  CALL METHOD cl_wd_utilities=>construct_wd_url

    EXPORTING

      application_name = 'WDA_WSPO_PO'

      in_parameters    = lt_httpnvp

    IMPORTING

      out_absolute_url = w_url.

  DATA lo_window_manager TYPE REF TO if_wd_window_manager.

  DATA lo_api_component  TYPE REF TO if_wd_component.

  DATA lo_window         TYPE REF TO if_wd_window.

  lo_api_component  = wd_comp_controller->wd_get_api( ).

  lo_window_manager = lo_api_component->get_window_manager( ).

  lo_window         = lo_window_manager->create_external_window(

                   url = w_url ).

  lo_window->open( ).

Former Member
0 Kudos

  ls_httpnvp-name = 'IV_PO_NUMBER'.

  ls_httpnvp-value = '4500000564'.

  INSERT ls_httpnvp INTO TABLE lt_httpnvp.

Try chaning PO_NUMBER to IV_PO_NUMBER

ramakrishnappa
Active Contributor
0 Kudos

can you please share the code inside std application window?

uppu_narayan
Active Participant
0 Kudos

hi ramakrishnappa,

Following is the code in the feeder class of the POWL component which launches the PO application:

METHOD if_powl_feeder~handle_action.

  DATA:  lo_struc        TYPE REF TO cl_abap_structdescr,

         lo_table        TYPE REF TO cl_abap_tabledescr,

         lo_area         TYPE REF TO cl_powl_easy_area,

         lo_data         TYPE REF TO cl_powl_easy_sharedobj,

         lo_ex_root      TYPE REF TO cx_root,

         lr_s_keys_1     TYPE REF TO data,

         lr_s_keys_2     TYPE REF TO data,

         lr_selected     TYPE REF TO data,

         lr_keycolumn    TYPE REF TO data,

         lr_popupdata    TYPE REF TO if_powl_easy_feeder=>typ_s_popupdata,

         lt_comp         TYPE cl_abap_structdescr=>included_view,

         lt_comp_new     TYPE cl_abap_structdescr=>component_table,

         lt_messages     TYPE powl_msg_tty,

         lt_param        LIKE e_portal_actions-parameters,

         lt_keyfields    TYPE typ_t_komp,

         lt_sel_idx      TYPE rstabixtab,

         ls_comp         LIKE LINE OF lt_comp,

         ls_comp_new     LIKE LINE OF lt_comp_new,

         ls_sel_idx      TYPE rstabix,

         ls_actdef       LIKE LINE OF gt_actdef,

         ls_messages     LIKE LINE OF e_messages,

         ls_param        LIKE LINE OF lt_param,

         ls_keyfields    LIKE LINE OF lt_keyfields,

         ls_popup        TYPE if_powl_easy_feeder=>typ_s_popup,

         ls_button_txt   LIKE LINE OF ls_popup-button_texts,

         ls_meta         TYPE powl_easy_meta_sty,

         l_field         TYPE string,

         l_actionid      TYPE powl_actionid_ty,

         l_action_sav    TYPE powl_actionid_ty,

         l_exit_flag     TYPE boole_d,

         l_lines         TYPE i,

         l_idx_result    TYPE sytabix,

         l_idx_selected  TYPE sytabix,

         l_instance_name TYPE shm_inst_name,

         l_uuid32        TYPE guid_32,

         l_data          TYPE xstring.

  FIELD-SYMBOLS: <l_field>         TYPE any,

                 <ls_keys_1>       TYPE any,

                 <ls_keys_2>       TYPE any,

                 <ls_result>       TYPE any,

                 <ls_selected>     TYPE any,

                 <ls_popupdata>    TYPE if_powl_easy_feeder=>typ_s_popupdata,

                 <lt_selected>     TYPE STANDARD TABLE,

                 <lt_keycolumn>    TYPE STANDARD TABLE.

  l_actionid = i_actionid.

* Check that action is really wanted

  CHECK i_action_conf = 'Y'.

* Load definitions

  _create_powldef( i_type ).

* Get indices of selected entries

  IF i_action_index IS NOT INITIAL.

*   Line or cell was selected

    ls_sel_idx-tabix = i_action_index.

    APPEND ls_sel_idx TO lt_sel_idx.

  ELSE.

*   Button was pressed

    lt_sel_idx = c_selected.

  ENDIF.

* Process chain of actions

  WHILE l_action_sav <> l_actionid.

    l_action_sav = l_actionid.

    l_exit_flag = abap_true.

*   Determine action settings

    READ TABLE gt_actdef INTO ls_actdef WITH KEY action_id = l_actionid "#EC CI_STDSEQ

                                                 powl_type = i_type.

    IF sy-subrc <> 0.

*     Try generic definition if specific does not exist

      READ TABLE gt_actdef INTO ls_actdef WITH KEY action_id = l_actionid "#EC CI_STDSEQ

                                                   powl_type = space.

*     Exit if the action was not defined

      CHECK sy-subrc = 0.

    ENDIF.

*   Create table to store the selected entries

    lo_table ?= cl_abap_typedescr=>describe_by_data( c_result_tab ).

    CREATE DATA lr_selected TYPE HANDLE lo_table.

    ASSIGN lr_selected->* TO <lt_selected>.

*   Get entries

    IF ls_actdef-select_rows = 'A'.

*     Action shall process the whole table

      <lt_selected> = c_result_tab.

    ELSE.

*     Action shall process only the selected entries

      CLEAR <lt_selected>.

      LOOP AT lt_sel_idx INTO ls_sel_idx.                "#EC CI_NESTED

        READ TABLE c_result_tab INDEX ls_sel_idx-tabix ASSIGNING <ls_selected>.

        CHECK sy-subrc = 0.

        APPEND <ls_selected> TO <lt_selected>.

      ENDLOOP.

    ENDIF.

*   Check if the correct amount of lines were selected

    l_lines = lines( <lt_selected> ).

    IF ls_actdef-select_rows = '1' AND l_lines <> 1.

      ls_messages-msgtype = 'E'.

      ls_messages-message = text-1ln.

      APPEND ls_messages TO e_messages.

      EXIT.

    ENDIF.

*   Call method in assistance class

    IF ls_actdef-call_method IS NOT INITIAL.

      IF go_assist IS NOT BOUND.

        _create_assist( EXPORTING i_username   = i_username

                                  i_powl_type  = i_type

                        IMPORTING et_powl_mess = e_messages ).

        CHECK e_messages IS INITIAL.

      ENDIF.

      CLEAR lt_messages.

      CALL METHOD go_assist->powl_action

        EXPORTING

          i_powl_type   = i_type

          i_username    = i_username

        IMPORTING

          et_messages   = lt_messages

          es_popup      = ls_popup

        CHANGING

          cv_action     = l_actionid

          cv_do_refresh = e_do_refresh

          ct_data       = lr_selected.

      APPEND LINES OF lt_messages TO e_messages.

*     Create structures containing only the key fields

      cl_powl_easy_helper=>get_keytable( EXPORTING i_key_fields  = gs_powlhdr-key_field

                                         IMPORTING et_key_fields = lt_keyfields ).

      lo_struc ?= lo_table->get_table_line_type( ).

      lt_comp = lo_struc->get_included_view( ).

      SORT lt_comp BY name.

      LOOP AT lt_keyfields INTO ls_keyfields.

        READ TABLE lt_comp INTO ls_comp

                           WITH KEY name = ls_keyfields-name

                           BINARY SEARCH.

        CHECK sy-subrc = 0.

        ls_comp_new-name = ls_comp-name.

        ls_comp_new-type = ls_comp-type.

        APPEND ls_comp_new TO lt_comp_new.

      ENDLOOP.

      lo_struc = cl_abap_structdescr=>create( lt_comp_new ).

      CREATE DATA lr_s_keys_1 TYPE HANDLE lo_struc.

      ASSIGN lr_s_keys_1->* TO <ls_keys_1>.

      CREATE DATA lr_s_keys_2 TYPE HANDLE lo_struc.

      ASSIGN lr_s_keys_2->* TO <ls_keys_2>.

*     Update POWL data

      LOOP AT lt_sel_idx INTO ls_sel_idx.                "#EC CI_NESTED

*       Get each originally selected line

        l_idx_result = ls_sel_idx-tabix.

        READ TABLE c_result_tab INDEX l_idx_result ASSIGNING <ls_result>.

        CHECK sy-subrc = 0.

        MOVE-CORRESPONDING <ls_result> TO <ls_keys_1>.

*       Get corresponding updated line

        LOOP AT <lt_selected> ASSIGNING <ls_selected>.

          MOVE-CORRESPONDING <ls_selected> TO <ls_keys_2>.

          IF <ls_keys_1> = <ls_keys_2>.

            l_idx_selected = sy-tabix.

            EXIT.

          ENDIF.

        ENDLOOP.

*       Update result and index table

        IF ls_actdef-select_rows = 'A'.

*         Check / rebuild selection index

          IF sy-subrc = 0.

            IF sy-tabix <> l_idx_result.

              ls_sel_idx-tabix = sy-tabix.

              MODIFY lt_sel_idx FROM ls_sel_idx.

              e_selected_changed = co_x.

            ENDIF.

          ELSE.

            DELETE lt_sel_idx .

            e_selected_changed = co_x.

          ENDIF.

        ELSE.

          IF sy-subrc = 0.

            IF <ls_result> <> <ls_selected>.

*             Update POWL table if original and updated line are different

              MODIFY c_result_tab FROM <ls_selected> INDEX l_idx_result.

              e_result_lines_changed = co_x.

              e_changes_processed = co_x.

            ENDIF.

            DELETE <lt_selected> INDEX l_idx_selected.

          ELSE.

*           Line was deleted

            DELETE c_result_tab INDEX l_idx_result.

            DELETE lt_sel_idx .

*           Adjust indices of all following selected lines

            LOOP AT lt_sel_idx INTO ls_sel_idx WHERE tabix > l_idx_result. "#EC *

              ls_sel_idx-tabix = ls_sel_idx-tabix - 1.

              MODIFY lt_sel_idx FROM ls_sel_idx.

            ENDLOOP.

            e_result_lines_changed = co_x.

            e_changes_processed    = co_x.

            e_selected_changed     = co_x.

          ENDIF.

        ENDIF.

      ENDLOOP.

      IF ls_actdef-select_rows = 'A'.

*       Action processed the whole table

        IF c_result_tab <> <lt_selected>.

          c_result_tab = <lt_selected>.

          e_result_lines_changed = co_x.

          e_changes_processed    = co_x.

        ENDIF.

      ELSE.

*       Append all remaining (newly created) lines

        IF <lt_selected> IS NOT INITIAL.

          APPEND LINES OF <lt_selected> TO c_result_tab.

          e_result_lines_changed = co_x.

          e_changes_processed    = co_x.

        ENDIF.

      ENDIF.

      IF e_selected_changed = co_x.

*       Return new selection

        c_selected = lt_sel_idx.

      ENDIF.

    ENDIF.

    l_exit_flag = abap_false.

  ENDWHILE.

* Exit if WHILE was aborted due to an error

  IF l_exit_flag = abap_true.

    EXIT.

  ENDIF.

* Trigger followup Popup if requested

  IF ls_popup IS NOT INITIAL.

*   Correct Button text table (in case KEY was supplied with a numerical value)

    LOOP AT ls_popup-button_texts INTO ls_button_txt.

      CONDENSE ls_button_txt-key.

      MODIFY ls_popup-button_texts FROM ls_button_txt.

    ENDLOOP.

*   Store needed informations in the interface class

    CREATE DATA lr_popupdata.

    ASSIGN lr_popupdata->* TO <ls_popupdata>.

    <ls_popupdata>-powl_type     = i_type.

    <ls_popupdata>-helper_class  = gs_powlhdr-helper_class.

    <ls_popupdata>-username      = i_username.

    <ls_popupdata>-action_id     = l_actionid.

    <ls_popupdata>-popup         = ls_popup.

    <ls_popupdata>-powl_messages = e_messages.

*   Don't display messages in POWL, they are displayed on the popup

    CLEAR e_messages.

*   Tell main WD-component to display popup

    e_portal_actions-fire_wdevent = co_x.

    ls_param-key   = co_param_popup.

    ls_param-value = co_x.

    APPEND ls_param TO e_portal_actions-parameters.

*   Supply popup information

    e_portal_actions-add_wdevent_data = lr_popupdata.

*   In case of followup popup don't start WD-application

    EXIT.

  ENDIF.

  TRY.

*     Call WebDynpro application as follow up event

      IF ls_actdef-wd_appl  IS NOT INITIAL.

*       Rebuild table of selected entries

        IF ls_actdef-select_rows = 'A'.

*         Action shall process the whole table

          <lt_selected> = c_result_tab.

        ELSE.

*         Action shall process only the selected entries

          CLEAR <lt_selected>.

          LOOP AT lt_sel_idx INTO ls_sel_idx.

            READ TABLE c_result_tab INDEX ls_sel_idx-tabix ASSIGNING <ls_selected>.

            CHECK sy-subrc = 0.

            APPEND <ls_selected> TO <lt_selected>.

          ENDLOOP.

        ENDIF.

*       Get lead selection

        IF <lt_selected> IS NOT INITIAL.

          READ TABLE <lt_selected> INDEX 1 ASSIGNING <ls_selected>.

        ENDIF.

        e_portal_actions-fire_wdevent = co_x.

*       Supply the selected data

        e_portal_actions-add_wdevent_data = lr_selected.

*       Supply name of WebDynpro application

        ls_param-key   = co_wdappl_name.

        ls_param-value = ls_actdef-wd_appl.

        APPEND ls_param TO e_portal_actions-parameters.

*       Get Key field(s)

        IF ls_actdef-key_column IS NOT INITIAL.

          cl_powl_easy_helper=>get_keytable( EXPORTING i_key_fields  = ls_actdef-key_column

                                             IMPORTING et_key_fields = lt_keyfields ).

        ELSEIF lt_keyfields IS INITIAL.

          cl_powl_easy_helper=>get_keytable( EXPORTING i_key_fields  = gs_powlhdr-key_field

                                             IMPORTING et_key_fields = lt_keyfields ).

        ENDIF.

        CLEAR l_field.

        READ TABLE lt_sel_idx INTO ls_sel_idx INDEX 1.

        IF <lt_selected> IS NOT INITIAL.

          LOOP AT lt_keyfields INTO ls_keyfields.

            ASSIGN COMPONENT ls_keyfields-name OF STRUCTURE <ls_selected> TO <l_field>.

            CHECK sy-subrc = 0.

            CONCATENATE l_field <l_field> INTO l_field RESPECTING BLANKS.

          ENDLOOP.

          IF lines( lt_keyfields ) <> 1.

            ASSIGN l_field TO <l_field>.

          ENDIF.

        ENDIF.

        IF ls_actdef-use_shared_obj IS NOT INITIAL.

*         Shared object (created with SHMA) is used to transport the data to WD application

*         Create own ID

*          CALL FUNCTION 'GUID_CREATE'

*            IMPORTING                "Class not used because it is not available in 7.00

*              ev_guid_32 = l_uuid32.

          TRY.

              CALL METHOD CL_SYSTEM_UUID=>IF_SYSTEM_UUID_STATIC~CREATE_UUID_C32

                RECEIVING

                  UUID = L_UUID32.

            CATCH CX_UUID_ERROR .

          ENDTRY.

          ls_param-key = co_wdparam_name.

          CONCATENATE ls_actdef-wd_param '=' l_uuid32 INTO ls_param-value.

          APPEND ls_param TO e_portal_actions-parameters.

*         Create shared object

          l_instance_name = l_uuid32.

          lo_area = cl_powl_easy_area=>attach_for_write( inst_name = l_instance_name ).

          CREATE OBJECT lo_data AREA HANDLE lo_area.

          lo_area->set_root( lo_data ).

*         Fill helper class

          CLEAR l_data.

          ls_meta-powl_applid  = i_applid.

          ls_meta-powl_type    = i_type.

          ls_meta-feeder_class = cl_abap_classdescr=>get_class_name( me ).

          ls_meta-helper_class = gs_powlhdr-helper_class.

          ls_meta-action_id    = l_actionid.

          ls_meta-username     = i_username.

          IF ls_actdef-key_column IS INITIAL.

*           No key column given -> export the full table width

            IF <lt_selected> IS NOT INITIAL.

              EXPORT table = <lt_selected> TO DATA BUFFER l_data COMPRESSION ON.

            ENDIF.

            ls_meta-data_table_type = gs_powlhdr-table_type.

            ls_meta-data_table_key  = gs_powlhdr-key_field.

          ELSE.

*           Export only the named column(s)

            IF <lt_selected> IS NOT INITIAL.

*             Create table containing only the given column

              CREATE DATA lr_keycolumn LIKE STANDARD TABLE OF <l_field>.

              ASSIGN lr_keycolumn->* TO <lt_keycolumn>.

*             Copy key-column(s) to new table

              LOOP AT <lt_selected> ASSIGNING <ls_selected>.

                LOOP AT lt_keyfields INTO ls_keyfields.

                  ASSIGN COMPONENT ls_keyfields-name OF STRUCTURE <ls_selected> TO <l_field>.

                  CHECK sy-subrc = 0.

                  CONCATENATE l_field <l_field> INTO l_field RESPECTING BLANKS.

                ENDLOOP.

                IF lines( lt_keyfields ) <> 1.

                  ASSIGN l_field TO <l_field>.

                ENDIF.

                APPEND <l_field> TO <lt_keycolumn>.

              ENDLOOP.

              EXPORT table = <lt_keycolumn> TO DATA BUFFER l_data COMPRESSION ON.

            ENDIF.

            ls_meta-data_struc_type = g_powl_structure.

            ls_meta-data_field_name = ls_actdef-key_column.

          ENDIF.

          lo_data->gs_meta = ls_meta.

          lo_data->gt_data = l_data.

*         Release write lock

          lo_area->detach_commit( ).

        ELSEIF ls_actdef-wd_param IS NOT INITIAL.

*         Supply parameter for WD-application using lead selection / line of selected cell

*         only if something was selected

          ls_param-key = co_wdparam_name.

          CONCATENATE ls_actdef-wd_param '=' <l_field> INTO ls_param-value.

          APPEND ls_param TO e_portal_actions-parameters.

        ENDIF.

      ENDIF.

    CATCH cx_root INTO lo_ex_root.                       "#EC CATCH_ALL

      _conv_ex_to_mess( EXPORTING io_exception = lo_ex_root

                        CHANGING  ct_message   = e_messages ).

      CLEAR e_portal_actions.

  ENDTRY.

ENDMETHOD.

ramakrishnappa
Active Contributor
0 Kudos

Hi Narayan,

I appreciate, if you could clarify me that.. if you press enter key in launched application, is data getting fetched for the PO number ?

If so, we are required to pass OK_CODE to the application parameters.

Regards,

Rama

uppu_narayan
Active Participant
0 Kudos

yes the PO number and its line item in the table is getting passed..

ramakrishnappa
Active Contributor
0 Kudos

Hi Narayan,

We need to pass okcode as url  parameter.

Please append below entry to the parameter table.

ls_parameters-name = '~OKCODE'

ls_parameters-value = 'SHOW'.

append ls_parameters to lt_parameters.

Hope this resolves your issue.

Regards,

Rama

ramakrishnappa
Active Contributor
0 Kudos

Hi Narayan,

Is your issue resolved?

Regards,

Rama

uppu_narayan
Active Participant
0 Kudos

Thanks Ram..

for your support, ya this is resolved, i was missing one parameter IV_ACTIVITY param and we can see the the param list in the se80>>FPM_OIF_COMPONENT>>insde WD application >>your applicaiton>> finally parameter tab.

ramakrishnappa
Active Contributor
0 Kudos

Thats good.

Former Member
0 Kudos

Are you trying to open a wd appl from powl application?

This link will help you.

uppu_narayan
Active Participant
0 Kudos

in the standard it is getting called from the powl component.. but in my case i have to call it from my custom application

ramakrishnappa
Active Contributor
0 Kudos

Hi,

You can do the same as below

********** on click( ) **************

  "------------------------------------------------

  "Data declarations

  "------------------------------------------------

  DATA: lo_window_manager      TYPE REF TO if_wd_window_manager,

        lo_api_component       TYPE REF TO if_wd_component,
        lo_window              TYPE REF TO if_wd_window,
        lt_parameters          TYPE tihttpnvp,
        ls_parameters          LIKE LINE OF lt_parameters,
        lv_url                 TYPE string.

  "----------------------------------------------------

  "get view contoller, window manager

  lo_api_component           = wd_this->wd_get_api( ).

  lo_window_manager          = lo_api_component->get_window_manager( ).



  " Return if window manager is not bound

  "----------------------------------------------------

  IF lo_window_manager IS NOT BOUND.

    RETURN.

  ENDIF.

  "----------------------------------------------------

  " Prepare parameter table

  "----------------------------------------------------

  CLEAR: lt_parameters,

         ls_parameters.

  ls_parameters-name = ?   " find the parameter name of PO of std. application WDC_WSPO_PO
  ls_parameters-value =  ? " Give the value of PO which is selected from your application

  APPEND ls_parameters TO lt_parameters.



  "----------------------------------------------------

  " Construct url for STANDAR APPLICATION
  "----------------------------------------------------

  cl_wd_utilities=>construct_wd_url(

    EXPORTING

      application_name              =  ? " STANDARD APPLICATION NAME
      in_parameters                 lt_parameters

    IMPORTING

      out_absolute_url              =   lv_url

  ).



  lo_window_manager->create_external_window(

    EXPORTING

      url            = lv_url

      use_post       = abap_true

    RECEIVING

      window         = lo_window

  ).

  IF lo_window IS BOUND.

    lo_window->open( ).

  ENDIF.

"-----------------------------

This opens the standard application with PO number passed.

Hope this helps you.

Regards,

Rama

uppu_narayan
Active Participant
0 Kudos

hi ramkrishna,

i have tried in this way and passed the PO number, it launches the application but doesn't displays the PO details...

ramakrishnappa
Active Contributor
0 Kudos

hi Narayan,

is po number appearing in the  std application??

Regards,

Rama

uppu_narayan
Active Participant
0 Kudos

yes..

uppu_narayan
Active Participant
0 Kudos

This component has a V_PO_INIT view which automatically gets filled with PO number. when clicked on link in standard POWL component