IF_WD_MESSAGE_MANAGER

Hi everyone,
I've got a component which declares, in its view, a ViewUIElementContainer in which I embed another WebDynpro application.
So far so good.
The thing is that when I raise a message in the embedded application, the message is shown in the parent component and not in the embedded component.
How can I fix this?
Thanks

Hi,
     This is because you are using the component in viewcontainer of  a view , so when you raise a message
     it should get displayed in parent component only as  the current view which you are able to see is under
     the parent component, so that when you raise any message it would get displayed in the message area region
    of parent component which is at the top by default.

Similar Messages

  • REPORT_SUCCESS in IF_WD_MESSAGE_MANAGER is not working after Ehp5 Upgarde

    Hi All,
          Before EhP5 upgarde we are using the   REPORT_SUCCESS  method of interface IF_WD_MESSAGE_MANAGER  as below.
    data lo_api_controller     type ref to if_wd_controller.
        data lo_message_manager    type ref to if_wd_message_manager.
        lo_api_controller ?= wd_this->wd_get_api( ).
        call method lo_api_controller->get_message_manager
          receiving
            message_manager = lo_message_manager.     
        lv_text =
          wd_assist->if_wd_component_assistance~get_text( 'AIU' ).
        call method lo_message_manager->report_success
          exporting
            message_text = lv_text.
    But after upgrade the message is not displaying .Can anyone help what could be the issue.When i check the inteface it is updated by SAP ,but how to check the particular issue.
    Thanks in advance.
    Regards
    CB

    Hi CB,
    In the method, pass the 'VIEW' parameter with the view name where you want the display the message.
      call method lo_message_manager->report_success
          exporting
            message_text = lv_text.
    code should be like below.
      call method lo_message_manager->report_success
          exporting
            message_text = lv_text
           view                 = 'Main_view'.  "This the view name where I want to display the message.
    Thanks,
    Nag.

  • Setting the value of a single attribute for multiple line items

    Hi all,
    I am working on a Web Dynpro application, I have created this applicaion for an accounting document so it has header data and multiple line item data. As per the requirement I have to put the following logic:
    1. When a user enters a value in the field KBLNR on the line item, all the other fields like cost centerm fund, functional area should populate from a database table based on the value of the KBLNR. to get this I have put the following code:
    TYPES: BEGIN OF t_kblp,
              fipos     TYPE kblp-fipos,
              kostl     TYPE kostl,
                      END OF t_kblp.
      DATA lv_kblnr TYPE wd_this->element_t_bseg-kblnr.
      DATA: lt_kblp TYPE STANDARD TABLE OF t_kblp,
            wa_kblp LIKE LINE OF lt_kblp,
            lt_bseg              TYPE STANDARD TABLE OF bseg,
            wa_bseg              TYPE bseg.
      DATA lo_nd_t_bseg TYPE REF TO if_wd_context_node.
      DATA lo_el_t_bseg TYPE REF TO if_wd_context_element.
      DATA: ls_t_bseg TYPE wd_this->element_t_bseg,
            lo_api_controller    TYPE REF TO if_wd_controller,
            lo_message_manager   TYPE REF TO if_wd_message_manager,
            lo_nd_tbseg          TYPE REF TO if_wd_context_node,
             lo_el_tbseg          TYPE REF TO if_wd_context_element,
             lt_el_tbseg          TYPE wdr_context_element_set,
             lv_bseg              TYPE bseg.
      lo_nd_t_bseg = wd_context->path_get_node( path = `ZDATA.CHANGING.T_BSEG` ).
      lo_api_controller ?= wd_this->wd_get_api( ).
      CALL METHOD lo_api_controller->get_message_manager
        RECEIVING
          message_manager = lo_message_manager.
      lo_nd_tbseg = wd_context->path_get_node( path = `ZDATA.CHANGING.T_BSEG` ).
      lt_el_tbseg = lo_nd_tbseg->get_elements( ).
      LOOP AT lt_el_tbseg INTO lo_el_tbseg.
        lo_el_tbseg->get_static_attributes(
                               IMPORTING static_attributes = lv_bseg ).
      IF lv_bseg-kblnr NE ' '.
          SELECT belnr
                 fipos
                 kostl
                 PSPNR
                 geber
                 saknr
                 fkber
                 grant_nbr
                 gsber
                 FROM kblp
                 inTO corresponding fields of wa_kblp
                 WHERE belnr = lv_bseg-kblnr and
                      saknr = lv_bseg-saknr.
            ENDSELECT.
    lo_nd_t_bseg = wd_context->path_get_node( path = `ZPRELIMINARY_POSTING.CHANGING.T_BSEG` ).
    * get element via lead selection
            lo_el_t_bseg = lo_nd_t_bseg->get_element( ).
    lo_el_tbseg->set_static_attributes(
                               EXPORTING static_attributes = wa_kblp ).
       CLEAR: lv_bseg, wa_kblp.
      ENDLOOP.
    everything is working fine but now the problem is couple of fields that I have in wa_kblp are with different names in bseg table and hence they are not updating... I tried putting the following logic within the loop :
    lo_el_t_bseg->set_attribute(
        name =  `PROJK`
    value = wa_kblp-pspnr ).
    but it's only setting the value of the first line item and not working for the multiple line items, can you please tell me how can do this?
    Thanks,
    Rajat Garg
    Edited by: rajatg on Jun 24, 2011 5:09 PM

    Hi Chris,
    I tried your code and it worked fine but after I put this code I am getting another issue. within the loop I had a code to make the fields non modifiable on the screen and was working fine but now what's happening is it's making the all the lines uneditable except the one with data on it (which is completely opposite), this is what I have coded:
    LOOP AT lt_el_tbseg INTO lo_el_tbseg.
        lo_el_tbseg->get_static_attributes(
                               IMPORTING static_attributes = lv_bseg ).
    IF lv_bseg-kblnr NE ' '.
      SELECT belnr
                 fipos
                 kostl
                 PSPNR
                 geber
                 saknr
                 fkber
                 grant_nbr
                 gsber
                 FROM kblp
                 inTO corresponding fields of wa_kblp
                 WHERE belnr = lv_bseg-kblnr and
                      saknr = lv_bseg-saknr.
            ENDSELECT.
    move: wa_kblp-belnr to wa_bseg-kblnr,
    wa_kblp-fipos to wa_bseg-fipos,
    wa_kblp-kostl to wa_bseg-kostl,
    wa_kblp-pspnr to wa_bseg-projk,
    wa_kblp-geber to wa_bseg-geber,
    wa_kblp-saknr to wa_bseg-saknr,
    wa_kblp-fkber to wa_bseg-fkber,
    wa_kblp-grant_nbr to wa_bseg-grant_nbr,
    wa_kblp-gsber to wa_bseg-gsber,
    lv_bseg-dmbtr to wa_bseg-dmbtr.
    append wa_bseg to lt_bseg.
    lo_nd_edit_property = wd_context->path_get_node( path = `ZPRELIMINARY_POSTING.CHANGING.T_BSEG.EDIT_PROPERTY` ).
          get element via lead selection
          lo_el_edit_property = lo_nd_edit_property->get_element( ).
          lo_el_edit_property->set_attribute(
            name =  `EDIT_FIELD`
            value = 'ABAP_TRUE' ).
          lo_el_edit_property->set_attribute(
            name =  `EDIT_WBS`
            value = 'ABAP_TRUE' ).
    endif.
    endloop.
    o_nd_t_bseg = wd_context->path_get_node( path = `ZPRELIMINARY_POSTING.CHANGING.T_BSEG` ).
    get element via lead selection
            lo_el_t_bseg = lo_nd_t_bseg->get_element( ).
      CALL METHOD lo_nd_t_bseg->bind_table
        EXPORTING
          new_items            = lt_bseg.
    Can you please see what I am doing it wrong here....

  • Error message not displayed in a pop up

    Hi ,
    I have a pop up screen in my web dynpro  with a input field and two buttons.
    i have a error message written in the WDDOBEFOREACTION method of my pop up window. But the message is not displayed on the window. But If the same is written in the event handler of the button click it is triggered.
    Please help me to display the message with the code in WDDOBEFOREACTION method  .
    The code is as below
    lo_nd_bp_data = wd_context->get_child_node( name = wd_this->wdctx_bp_data ).
    * get element via lead selection
      lo_el_bp_data = lo_nd_bp_data->get_element( ).
    * get single attribute
      lo_el_bp_data->get_attribute(
        EXPORTING
          name =  `BP_NUMBER`
        IMPORTING
          value = lv_bp_number ).
      CHECK lv_bp_number IS NOT INITIAL.
      IF zcl_rms_webdynpro_texts=>check_for_victim_bp( i_bp_number = lv_bp_number ) = abap_true.
    * get message manager
        DATA lo_api_controller     TYPE REF TO if_wd_controller.
        DATA lo_message_manager    TYPE REF TO if_wd_message_manager.
        DATA: lv_p1 LIKE syst-msgv1.
        lo_api_controller ?= wd_this->wd_get_api( ).
        CALL METHOD lo_api_controller->get_message_manager
          RECEIVING
            message_manager = lo_message_manager.
        lv_p1 = lv_bp_number.
    * report message
        CALL METHOD lo_message_manager->report_t100_message
          EXPORTING
            msgid                     = ZMSG_CLS
            msgno                     = '222'
            msgty                     = 'E'
            p1                        = lv_p1
            cancel_navigation         = abap_true
            enable_message_navigation = abap_true.
      ENDIF.
    Edited by: SAP LEARNER on Jan 5, 2012 1:37 PM

    have a error message written in the WDDOBEFOREACTION method of my pop up window. But the message is not displayed on the window. But If the same is written in the event handler of the button click it is triggered.
    strange..
    wddobeforeaction will trigger then event handler wil trigger then wddoafteraction will trigger.
    Did you put a break point in wddobeforeaction?
    Regards
    Srinivas

  • I am trying to save a DMS File through File upload UI element to CV01n Transactions....It works fine for .TXT file but other files it is not downloading coorectly and file is getting damaged

    Hi, I am downloading DMS file using following code and the file contents are getting damaged and cannot be retieved back. I am also getting hard time to open a DMS file in seperate browser.
    Can anybody please help me.
      TYPES : BEGIN OF ty_ts_raw_line,
    *                 line TYPE sdokcntbin ,
                line(2550) TYPE x,
               END OF ty_ts_raw_line.
      DATA: ls_documentdata TYPE bapi_doc_draw2,
            lv_doctype TYPE   bapi_doc_aux-doctype,
            lv_docnumber TYPE bapi_doc_aux-docnumber,
            lv_documentpart TYPE bapi_doc_aux-docpart,
            lv_documentversion TYPE bapi_doc_aux-docversion,
            ls_return TYPE bapiret2,
            gt_bapi_doc_files2 TYPE TABLE OF bapi_doc_files2,
            gs_bapi_doc_files2 LIKE LINE OF gt_bapi_doc_files2,
            lo_nd_nd_cost_rate TYPE REF TO if_wd_context_node,
            lt_nd_cost_rate TYPE wd_this->elements_nd_cost_rate,
            ls_nd_cost_rate TYPE wd_this->element_nd_cost_rate,
            lv_string TYPE string,
            lv_temp TYPE string,
            lv_input_file_name TYPE string,
            lv_size TYPE i ,
            lt_bindata TYPE STANDARD TABLE OF ty_ts_raw_line,"  STANDARD TABLE  OF zst_ts_raw_line,
            ls_bindata TYPE  sdokcntbin,
            ls_drao TYPE drao,
            lt_drao TYPE TABLE OF drao,
            lt_files TYPE cvapi_tbl_doc_files,
            ls_files TYPE cvapi_doc_file,
            ls_api_ctrl TYPE cvapi_api_control,
            ls_message TYPE messages,
            lv_dappl TYPE draw-dappl,
            lv_filename TYPE char200,
            lv_filename_draw_filep TYPE draw-filep,
            lv_doc_succ TYPE c,
            lv_tabix TYPE sy-tabix,
            lv_char_tabix(5) TYPE c,
    * get message manager
            lo_api_controller     TYPE REF TO if_wd_controller,
            lo_message_manager    TYPE REF TO if_wd_message_manager,
            lv_text TYPE string,
            lt_tabix TYPE STANDARD TABLE OF sytabix,
            lv_api_ctrl TYPE cvapi_api_control VALUE 'CV01N',
            lv_documentnumber TYPE draw-doknr,
            lt_drat TYPE TABLE OF dms_db_drat,
            ls_drat TYPE dms_db_drat.
      CONSTANTS: lc_cst(3) TYPE c VALUE 'CST',
                 lc_000(3) TYPE c VALUE '000',
                 lc_00(2) TYPE c VALUE '00',
                 lc_zng_test(8) TYPE c VALUE  'ZNG-TEST',
                 lc_desc(11)  TYPE c VALUE 'Cost Rate',
                 lc_test(4)  TYPE c VALUE 'Test',
    *             lc_file_path(31) TYPE c VALUE 'C:\FAKEPATH\COST_RATE_TABLE.TXT',
                 lc_x TYPE c VALUE 'X',
                 lc_blank TYPE c VALUE '',
                 lc_nd(2) TYPE c VALUE '&1'.
      FIELD-SYMBOLS <ls_wd_assist_mt_input> LIKE LINE OF wd_assist->mt_input.
      lo_api_controller ?= wd_this->wd_get_api( ).
      CALL METHOD lo_api_controller->get_message_manager
        RECEIVING
          message_manager = lo_message_manager.
    * navigate from <CONTEXT> to <ND_COST_RATE> via lead selection
      lo_nd_nd_cost_rate = wd_context->get_child_node( name = wd_this->wdctx_nd_cost_rate ).
    * @TODO handle non existant child
      IF lo_nd_nd_cost_rate IS NOT INITIAL.
        lo_nd_nd_cost_rate->get_static_attributes_table( IMPORTING table = lt_nd_cost_rate ).
      ENDIF.
      ls_documentdata-documenttype = lc_cst.
      ls_documentdata-documentnumber = lc_cst.
      ls_documentdata-documentversion = lc_00.
      ls_documentdata-documentpart  = lc_000.
      ls_documentdata-description  = lc_desc.
    *  ls_documentdata-
    *  ls_drat-dktxt = lc_desc.
    *  append ls_drat to lt_drat.
    *  clear ls_drat.
    *  lv_api_ctrl = 'CV01N'.
      LOOP AT lt_nd_cost_rate INTO ls_nd_cost_rate WHERE row_index IS NOT INITIAL.
        lv_tabix = sy-tabix.
    *           CALL FUNCTION 'CVAPI_DOC_CREATE'
    *         EXPORTING
    *           ps_draw              = ls_documentdata " wa_documentfiles
    *           ps_api_control       = lv_api_ctrl
    *         IMPORTING
    *           psx_message          = ls_message
    *           pfx_doknr            = lv_documentnumber.
    **         TABLES
    **           pt_drat_x            = it_drat.
        CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
          EXPORTING
            documentdata    = ls_documentdata
            defaultclass    = 'X'
          IMPORTING
            documenttype    = lv_doctype
            documentnumber  = lv_docnumber
            documentpart    = lv_documentpart
            documentversion = lv_documentversion
            return          = ls_return.
        IF ls_return-type CA 'EA'.
          ROLLBACK WORK.
        ELSE.
          COMMIT WORK.
        ENDIF.
        LOOP AT wd_assist->mt_input ASSIGNING <ls_wd_assist_mt_input> WHERE row_index = ls_nd_cost_rate-row_index.
          CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
            EXPORTING
              buffer        = <ls_wd_assist_mt_input>-file_data
            IMPORTING
              output_length = lv_size
            TABLES
              binary_tab    = lt_bindata.
          lv_filename_draw_filep = <ls_wd_assist_mt_input>-filename.
          WHILE lv_filename_draw_filep CA '\'.
            SPLIT lv_filename_draw_filep AT '\'
            INTO lv_temp lv_filename_draw_filep.
          ENDWHILE.
          LOOP AT lt_bindata INTO ls_bindata.
            CLEAR ls_drao.
            ls_drao-orblk = ls_bindata-line.
            ls_drao-orln = lv_size.
            ls_drao-dokar = lv_doctype.
            ls_drao-doknr = lv_docnumber.
            ls_drao-dokvr = lv_documentversion.
            ls_drao-doktl = lv_documentpart.
            ls_drao-appnr = '1'.
            APPEND ls_drao TO lt_drao.
            CLEAR ls_drao.
          ENDLOOP.
          CONDENSE lv_input_file_name.
    *      lv_input_file_name = 'Test.txt'.
          CALL FUNCTION 'CV120_DOC_GET_APPL'
            EXPORTING
              pf_file   = lv_filename_draw_filep
            IMPORTING
              pfx_dappl = lv_dappl.
          ls_files-appnr = '1'.
          ls_files-dappl = lv_dappl.
          ls_files-filename = lv_filename_draw_filep.
          ls_files-updateflag = 'I'.
          ls_files-langu = sy-langu.
          ls_files-storage_cat = 'SAP-SYSTEM'.
          ls_files-description = lv_filename_draw_filep..
          APPEND ls_files TO lt_files.
          CLEAR ls_files.
          ls_api_ctrl-tcode = 'CV01N'.
          CALL FUNCTION 'CVAPI_DOC_CHECKIN'
            EXPORTING
              pf_dokar           = lv_doctype
              pf_doknr           = lv_docnumber
              pf_dokvr           = lv_documentversion
              pf_doktl           = lv_documentpart
              ps_api_control     = ls_api_ctrl
              pf_content_provide = 'TBL'
              pf_http_dest       = 'SAPHTTPA'
              pf_ftp_dest        = 'SAPFTPA'
            IMPORTING
              psx_message        = ls_message
            TABLES
              pt_files_x         = lt_files
              pt_content         = lt_drao.
          IF ls_message-msg_type CA 'EA'.
            lv_doc_succ = lc_blank.
          ELSE.
            COMMIT WORK.
            lv_doc_succ = lc_x.
            CLEAR lv_text .
            lv_text = <ls_wd_assist_mt_input>-comments.
          ENDIF.
          CLEAR: ls_api_ctrl,ls_message,lt_files[],lt_drao[].
        ENDLOOP.
        IF lv_doc_succ = lc_x.
          ls_nd_cost_rate-dokar = lv_doctype.
          ls_nd_cost_rate-doknr = lv_docnumber.
          ls_nd_cost_rate-doktl = lv_documentpart.
          ls_nd_cost_rate-dokvr = lv_documentversion.
          ls_nd_cost_rate-comments = lv_text.
          MODIFY lt_nd_cost_rate FROM ls_nd_cost_rate INDEX lv_tabix TRANSPORTING dokar doknr doktl dokvr comments.
        ELSE.
          APPEND lv_tabix TO lt_tabix.
        ENDIF.
        CLEAR ls_nd_cost_rate.
      ENDLOOP.
    I am also having hardtime to show DMS file on browser.

    Hi I've done DMS Creation like below code. Just check it .
          LS_DOC-DOCUMENTTYPE    = LW_DMS_APP-DOCUMENTTYPE.
          LS_DOC-DOCUMENTVERSION = LW_DMS_APP-DOCUMENTVERSION.
          LS_DOC-DOCUMENTPART    = LW_DMS_APP-DOCUMENTPART.
          LS_DOC-STATUSEXTERN    = LW_DMS_APP-STATUSEXTERN.
          LS_DOC-LABORATORY      = '  '.
    CONCATENATE WD_THIS->LW_REQ-BUKRS LS_DMS-REQ_NO LS_DMS-CR_YR INTO LW_OBJKEY SEPARATED BY '\'.
          LW_DRAD-OBJECTKEY = LW_OBJKEY.
          LW_DRAD-OBJECTTYPE = 'ZAPR_REQ'.
          APPEND LW_DRAD TO LT_DRAD.
          LW_DRAT-LANGUAGE = SY-LANGU.
          LW_DRAT-DESCRIPTION = LS_STRIPPEDNAME.
          APPEND LW_DRAT TO LT_DRAT.
          CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
            EXPORTING
              DOCUMENTDATA         = LS_DOC
            IMPORTING
              DOCUMENTTYPE         = LF_DOCTYPE
              DOCUMENTNUMBER       = LF_DOCNUMBER
              DOCUMENTPART         = LF_DOCPART
              DOCUMENTVERSION      = LF_DOCVERSION
              RETURN               = LS_RETURN
            TABLES
              DOCUMENTDESCRIPTIONS = LT_DRAT
              OBJECTLINKS          = LT_DRAD.
    *--------Creating DMS Document Using BAPI-----------------*
          IF LS_RETURN-TYPE NA 'EA'.
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                WAIT = 'X'.
          LS_DRAW-DOKAR = LW_DMS_APP-DOCUMENTTYPE.
          LS_DRAW-DOKVR = LW_DMS_APP-DOCUMENTVERSION.
          LS_DRAW-DOKTL = LW_DMS_APP-DOCUMENTPART.
          LS_DRAW-DWNAM = SY-UNAME.
          LS_DRAW-DOKST = LW_DMS_APP-STATUSEXTERN.
          LV_STORAGE_CAT = LW_DMS_APP-STORAGECATEGORY.
          LS_API_CONTROL-TCODE = 'CV01N'.
          IF LF_DOCNUMBER IS NOT INITIAL.
            CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
              EXPORTING
                BUFFER        = LS_DMS_FILE-FILE_CTGRY
              IMPORTING
                OUTPUT_LENGTH = LV_SIZE
              TABLES
                BINARY_TAB    = LT_BINDATA.
            LOOP AT LT_BINDATA INTO LS_BINDATA.
              CLEAR LS_DRAO.
              LS_DRAO-ORBLK = LS_BINDATA-LINE.
              LS_DRAO-ORLN  = LV_SIZE.
              LS_DRAO-DOKAR = LS_DRAW-DOKAR.
              LS_DRAO-DOKNR = LF_DOCNUMBER.
              LS_DRAO-DOKVR = LS_DRAW-DOKVR.
              LS_DRAO-DOKTL = LS_DRAW-DOKTL.
              LS_DRAO-APPNR = '1'.
              APPEND LS_DRAO TO LT_DRAO.
            ENDLOOP.
            CALL FUNCTION 'CV120_DOC_GET_APPL'
              EXPORTING
                PF_FILE   = LS_STRIPPEDNAME
              IMPORTING
                PFX_DAPPL = LS_FILES-DAPPL.
            LS_DRAW-FILEP = LS_STRIPPEDNAME.
            LS_DRAW-DAPPL = LS_FILES-DAPPL.
            LS_FILES-APPNR = '1'.
            LS_FILES-FILENAME = LS_STRIPPEDNAME.
            LS_FILES-UPDATEFLAG = 'I'.
            LS_FILES-LANGU = SY-LANGU.
            LS_FILES-STORAGE_CAT = LW_DMS_APP-STORAGECATEGORY. "'ZDMS_DI'.
            LS_FILES-DESCRIPTION = LS_STRIPPEDNAME.
            APPEND LS_FILES TO LT_FILES.
            CALL FUNCTION 'CVAPI_DOC_CHECKIN'
              EXPORTING
                PF_DOKAR           = LS_DRAW-DOKAR
                PF_DOKNR           = LF_DOCNUMBER
                PF_DOKVR           = LS_DRAW-DOKVR
                PF_DOKTL           = LS_DRAW-DOKTL
                PS_API_CONTROL     = LS_API_CONTROL
                PF_CONTENT_PROVIDE = 'TBL'
              IMPORTING
                PSX_MESSAGE        = LS_MESSAGE
              TABLES
                PT_FILES_X         = LT_FILES
                PT_CONTENT         = LT_DRAO.
            IF NOT LS_MESSAGE-MSG_TYPE CA 'EA' AND
                   LF_DOCNUMBER IS NOT INITIAL.
              CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
           ENDIF.
    Regards,
    Jack.  

  • Closing pop-up box error

    Hello,
    Im getting  a frustrating problem'  Access via 'NULL' object reference not possible ' when I try to close the popup box , I am assuming its something to do with either setting up my nodes or attributes, unfortunately i tried everything I could but nothing worked.
    this is the part of the code action to generate a popup box, subscribe and assign the OK button an action
    method ONACTIONADD_NAME .
      Data: context_node         type ref to if_wd_context_node.
      data lv_action_view          TYPE REF TO if_wd_view_controller.
      DATA lv_title                    TYPE string.
      DATA lo_nd_add_name    TYPE REF TO if_wd_context_node.
      DATA lo_el_add_name     TYPE REF TO if_wd_context_element.
      DATA ls_add_name         TYPE wd_this->element_add_name.
      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.
    generate a popup box
       lo_api_component  = wd_comp_controller->wd_get_api( ).
       lo_window_manager = lo_api_component->get_window_manager( ).
       lo_window         = lo_window_manager->create_window(
                       window_name            = 'W_ADD_NAME'
                       title                  = 'Add a Tester'
                       close_in_any_case      = abap_false
                       message_display_mode   = if_wd_window=>co_msg_display_mode_selected
                       close_button           = abap_true
                       button_kind            = if_wd_window=>co_buttons_okcancel
                       message_type           = if_wd_window=>co_msg_type_none
                       default_button         = if_wd_window=>co_button_ok
    Subscribe the action handler methods to the popup ok and cancel buttons
      lv_action_view = wd_this->wd_get_api( ).
          lo_window->subscribe_to_button_event(
                 button            = if_wd_window=>co_button_ok
                 action_name       = 'ON_OK_ADD_NAME'
                 action_view       = lv_action_view
    lo_window->open( ).
    endmethod.
    and this is the action where I have the issue of closing the popup box
    DATA lo_nd_ui_manipulation TYPE REF TO if_wd_context_node.
      DATA lo_nd_add_name        TYPE REF TO if_wd_context_node.
      DATA lo_el_add_name        TYPE REF TO if_wd_context_element.
      DATA lo_nd_sname           TYPE REF TO if_wd_context_node.
      DATA ls_add_name           TYPE wd_this->element_add_name.
      DATA lo_nd_sname_copy      TYPE REF TO if_wd_context_node.
      DATA lt_sname_copy         TYPE wd_this->elements_sname_copy.
      DATA lv_msg_text           TYPE string.
      DATA lv_param1             TYPE symsgv.
      DATA lv_param2             TYPE symsgv.
      DATA lv_param3             TYPE symsgv.
      DATA lv_elements_count     TYPE i.
      data lo_window             type ref to if_wd_window.
    get message manager
      data lo_api_controller     type ref to if_wd_controller.
      data lo_message_manager    type ref to if_wd_message_manager.
    Read the values user entered in add name popup
      lo_nd_add_name = wd_context->get_child_node( name = wd_this->wdctx_add_name ).
      lo_el_add_name = lo_nd_add_name->get_element(  ).
      lo_el_add_name->get_static_attributes(
        IMPORTING
          static_attributes = ls_add_name ).
      IF ls_add_name IS INITIAL OR ls_add_name-first_name IS INITIAL.
    display messages fill in the required field in the pop-up windows
       lo_api_controller ?= wd_This->Wd_Get_Api( ).
       CALL METHOD lo_api_controller->GET_MESSAGE_MANAGER
         RECEIVING
        MESSAGE_MANAGER = lo_message_manager.
       CALL METHOD lo_message_manager->REPORT_T100_MESSAGE
         EXPORTING
         MSGID         = '00'
         MSGNO         = 055
         MSGTY         = 'E' .
      ELSE.
      Check if the name  is already present
        lo_nd_sname_copy = wd_context->get_child_node( name = wd_this->wdctx_sname_copy ).
        CHECK NOT lo_nd_sname_copy IS INITIAL.
        CALL METHOD lo_nd_sname_copy->get_static_attributes_table
          IMPORTING
            table = lt_sname_copy.
        READ TABLE lt_sname_copy WITH KEY first_name = ls_add_name-first_name TRANSPORTING NO FIELDS.
        IF sy-subrc EQ 0.
        If a same name  exist, raise error message
          lv_msg_text = 'name exist, please enter a different name'.
          lo_api_controller ?= wd_This->Wd_Get_Api( ).
          CALL METHOD lo_api_controller->GET_MESSAGE_MANAGER
           RECEIVING
             MESSAGE_MANAGER = lo_message_manager.
         CALL METHOD lo_message_manager->REPORT_ERROR_MESSAGE
           EXPORTING
             MESSAGE_TEXT             = lv_msg_text.
        ELSE.
    if the name doesnt exist
       lo_nd_sname_copy = wd_context->get_child_node( name = wd_this->wdctx_sname_copy ).
        CHECK NOT lo_nd_sname_copy IS INITIAL.
        CALL METHOD lo_nd_sname_copy->get_static_attributes_table
          IMPORTING
            table = lt_sname_copy.
        READ TABLE lt_sname_copy WITH KEY first_name = ls_add_name-first_name TRANSPORTING NO FIELDS.
      IF the name doesnt exist , add name
        lo_nd_sname = wd_context->get_child_node( name = wd_this->wdctx_sname ).
          CHECK NOT lo_nd_sname IS INITIAL.
          lo_nd_sname->bind_structure( new_item = ls_add_name set_initial_elements = abap_false ).
          CLEAR lt_sname_copy.
          CALL METHOD lo_nd_sname->get_static_attributes_table
            IMPORTING
              table = lt_sname_copy.
    add the name to the local context
          lo_nd_sname_copy->bind_table( lt_sname_copy ).
    add the name to the shared data name context
          lo_nd_sname->bind_table( lt_sname_copy ).
    set the table's visible row property in order to show the added record
          lv_elements_count = lo_nd_sname_copy->get_element_count( ).
          lo_nd_ui_manipulation = wd_context->get_child_node( name = wd_this->wdctx_ui_manipulation ).
          lo_nd_ui_manipulation->set_attribute( name =  `VISIBLEROW` value = lv_elements_count ).
          lv_param1 = ls_add_name-first_name.
          lv_param2 = ls_add_name-last_name.
          lv_param3 = ls_add_name-c_num.
    display a successfull message
    lo_api_controller ?= wd_This->Wd_Get_Api( ).
    CALL METHOD lo_api_controller->GET_MESSAGE_MANAGER
      RECEIVING
        MESSAGE_MANAGER = lo_message_manager
    report message
    CALL METHOD lo_message_manager->REPORT_SUCCESS
      EXPORTING
        MESSAGE_TEXT             = 'succesfully added'.
    Enable/disable delete button based on lead selection
          CALL METHOD wd_comp_controller->manage_delete_button .
    Save the last action in the context, this data will be shown in the idr
          CLEAR lv_msg_text.
          lv_msg_text = wd_assist->if_wd_component_assistance~get_text( key = '014' ).
          CONCATENATE lv_msg_text ls_add_name-first_name INTO lv_msg_text SEPARATED BY space.
          lo_nd_ui_manipulation = wd_context->get_child_node( name = wd_this->wdctx_ui_manipulation ).
          lo_nd_ui_manipulation->set_attribute( name =  `IDR_LAST_ACTION` value = lv_msg_text ).
    lo_window->close( ).
    every time I add the lo_window->close( ). I get the Null error.
    Thanks in advance

    Hi Abdul,
    I guess that you want the user to be able to modify the data in the table & then have the changes made saved to database. Right? SAP recommends using a BAPI for doing the same. (Using a [Service Call|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9cb5d345-0801-0010-6a8e-fc57c23fd600] you can call a BAPI from within your component & get the desired functionality.) If you however intend to just try out a sample example in your IDES then you can directly try using the normal ABAP MODIFY statement on the database table. Try check the sample code snippet below.
    Regards,
    Uday
    data:
          node_sflight           type ref to if_wd_context_node,
          elem_sflight           type ref to if_wd_context_element,
          lt_elements            type WDR_CONTEXT_ELEMENT_SET,
          stru_sflight           type if_main=>element_sflight_node,
          it_flights             type if_main=>elements_sflight_node.
    "   navigate from <CONTEXT> to <SFLIGHT_NODE> via lead selection
        node_sflight_node = wd_context->get_child_node( name = if_main=>wdctx_sflight_node ).
    "   get element via lead selection
    "    elem_sflight_node = node_sflight_node->get_element(  ).
         lt_elements = node_sflight->get_elements( ).
    "   get all declared attributes
        loop at lt_elements into elem_sflight.
        elem_sflight->get_static_attributes(
          importing
            static_attributes = stru_sflight ).
        append stru_sflight to it_flights.
        endloop.
        modify ZSFLIGHT99 from table it_flights.
        if sy-subrc eq 0.
        endif.

  • Short Dump while creating Configuration (Application or Component)

    Hi All,
    I m facing a short dump, while creating a Component or Applcation Configuration
    in the standard FPM_GAF_COMPONENT.
    Short dump states the Runtine error as MESSAGE_TYPE_UNKNOWN
    Short text
        Message type " " is unknown.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "CL_WDR_MESSAGE_MANAGER========CP" had to be
         terminated because it has
        come across a statement that unfortunately cannot be executed.
    Information on where terminated
        Termination occurred in the ABAP program "CL_WDR_MESSAGE_MANAGER========CP" -
         in "IF_WD_MESSAGE_MANAGER~REPORT_T100_MESSAGE".
        The main program was "SAPMHTTP ".
        In the source code you have the termination point in line 16
        of the (Include) program "CL_WDR_MESSAGE_MANAGER========CM00R".
      12        exporting
      13           textid = cx_wdr_rt_exception=>invalid_
      14   endif.
      15
    >>>>   message id msgid type msgty number msgno
      17           with p1 p2 p3 p4
      18           into msg.
      19
      20   if p1 is not initial.

    Hello Srikanth,
    I have no issues in trying to help someone as polite as you! It is very nice to have questions answered in an intelligible manner - not unfortunately always the case.
    Without being able to debug on your system it is quite difficult to say what might be causing this error - especially as you say this was working in a different system.
    I'm sure you've already tried eliminating differences in your authorisations between the two systems? Are you registered as a developer in the new system?
    Sorry I'm now just guessing as I've not come across the error myself - hopefully now that we have clearly documented the issue, someone else might be able to shed some light on what might cause it!
    Chris

  • Need help to change user email id in table ADR6

    Hi,
    i want to update user email id in table adr6. i hv written following code but not working to change email in table adr6.
          DATA lo_nd_email TYPE REF TO if_wd_context_node.
          DATA lo_el_email TYPE REF TO if_wd_context_element.
          DATA ls_email TYPE wd_this->element_email.
          DATA lv_mail_id LIKE ls_email-mail_id.
        navigate from <CONTEXT> to <EMAIL> via lead selection
          lo_nd_email = wd_context->get_child_node( name = wd_this->wdctx_email ).
        get element via lead selection
          lo_el_email = lo_nd_email->get_element(  ).
        get single attribute
          lo_el_email->get_attribute(
            EXPORTING
              name =  `MAIL_ID`
            IMPORTING
              value = lv_mail_id ).
          DATA:lv_bname TYPE BAPIBNAME-BAPIBNAME.
          DATA:lt_return TYPE TABLE OF bapiret2.
          DATA:PER_NO TYPE AD_PERSNUM,
               ADDR_NO TYPE ADRC-ADDRNUMBER."AD_ADDRNUM.
          DATA:SEARCH TYPE REF TO IF_WD_CONTEXT_NODE.
          SEARCH = WD_CONTEXT->GET_CHILD_NODE( 'USER' ).
          SEARCH->GET_ATTRIBUTE( EXPORTING NAME = 'BNAME'
               IMPORTING VALUE =  lv_bname ).
          DATA:wa_address TYPE bapiaddr3.
          DATA : CONS_NO TYPE AD_CONSNUM.
        IF lv_mail_id IS INITIAL.
              get message manager
              DATA lo_api_controller TYPE REF TO if_wd_controller.
              DATA lo_message_manager TYPE REF TO if_wd_message_manager.
              lo_api_controller ?= wd_this->wd_get_api( ).
              CALL METHOD lo_api_controller->get_message_manager
                RECEIVING
                  message_manager = lo_message_manager.
              report message
              CALL METHOD lo_message_manager->report_error_message
                EXPORTING
                  message_text  = 'Please Enter Email Id'.
        ENDIF.
       DATA:l_addr type addr_keynr.
       DATA:C_YES(1).
            CLEAR:C_YES.
            C_YES = 'X'.
       TYPES: ty_comm_smtp TYPE  adsmtp ,             
            ty_returncode TYPE SZAD_FIELD-RETURNCODE,
            ty_error TYPE ADDR_ERROR,
            adsuse TYPE ADSUSE.
        DATA:EMAIL_ID TYPE AD_SMTPADR,
             lt_comm_smtp TYPE STANDARD TABLE OF ty_comm_smtp,    """"Data Object
             lv_returncode TYPE STANDARD TABLE OF ty_returncode,
             error_table TYPE STANDARD TABLE OF ty_error,
             lt_adsuse  TYPE STANDARD TABLE OF adsuse.
        data:ls_comm_smtp like LINE OF lt_comm_smtp,
             ls_returncode like LINE OF lv_returncode .
        CALL FUNCTION  'SUSR_USER_ADDRESSKEY_GET'
          EXPORTING  BNAME    = lv_bname
          IMPORTING  PERSNUMBER    = l_addr-persnumber
                     ADDRNUMBER    = l_addr-addrnumber
               EXCEPTIONS ADDRESS_NOT_FOUND = 1
                          OTHERS            = 2.
      IF SY-SUBRC = 0.
        REFRESH: lt_comm_smtp.
          CALL FUNCTION 'ADDR_PERS_COMP_COMM_GET'
               EXPORTING
                    address_handle    = ''
                    address_number    = l_addr-addrnumber
                    person_handle     = ''
                    person_number     = l_addr-persnumber
                    DATE_FROM         = '00010101'
                  LANGUAGE          = SY-LANGU
                    table_type        = 'ADSMTP'
                    iv_current_state  = space                       "*981i
               IMPORTING
                    returncode        = ls_returncode
               TABLES
                    comm_table        = lt_comm_smtp
                    error_table       = error_table
                    et_usage          = lt_adsuse                   "*981i
               EXCEPTIONS
                    parameter_error   = 1
                    address_not_exist = 2
                    person_not_exist  = 3
                    internal_error    = 4
                    OTHERS            = 99.
          IF sy-subrc <> 0.
            IF sy-subrc = 1 OR sy-subrc = 2 OR sy-subrc = 3.
             raise_message 'AM' 'A' 885 'ADDR_PERS_COMP_COMM_GET' space
             space space internal_error.
            ELSE.
             same_message_dia_a internal_error.
            ENDIF.
          ENDIF.
      ENDIF.
        CLEAR:ls_comm_smtp, email_id.
        READ TABLE lt_comm_smtp INTO ls_comm_smtp INDEX 1.
        EMAIL_ID = ls_comm_smtp-smtp_addr.    """""""OLD EMAIL ID which we get from ADDR_PERS_COMP_COMM_GET
        CONS_NO = ls_comm_smtp-CONSNUMBER.
        CLEAR:ls_comm_smtp.
        ls_comm_smtp-CONSNUMBER = CONS_NO.
        ls_comm_smtp-FLGDEFAULT = 'X'.
        ls_comm_smtp-HOME_FLAG = 'X'.
        ls_comm_smtp-UPDATEFLAG = 'U'.
        ls_comm_smtp-smtp_addr = lv_mail_id.
        TRANSLATE email_id TO UPPER CASE.
        ls_comm_smtp-smtp_srch = email_id.
        REFRESH :lt_comm_smtp.
         append ls_comm_smtp to lt_comm_smtp.
      IF SY-SUBRC = 0.
        CALL FUNCTION 'ADDR_PERS_COMP_COMM_MAINTAIN'
             EXPORTING
                  address_handle    = ' '
                  address_number    = l_addr-addrnumber
                  person_handle     = ' '
                  person_number     = l_addr-persnumber
                  table_type        = 'ADSMTP'
                  iv_time_dependence = C_YES                   "*981i
            IMPORTING
                 returncode        =  ls_returncode
            TABLES
                 comm_table        =  lt_comm_smtp
                 error_table       =  error_table
            EXCEPTIONS
                 parameter_error   = 1
                 address_not_exist = 2
                 person_not_exist  = 3
                 internal_error    = 4
                 OTHERS            = 99.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
      ENDIF.
      IF sy-subrc = 0.
          COMMIT WORK.
      ENDIF.
    i hv also tried second approch available on sdn CALL FUNCTION 'ADDR_COMM_MAINTAIN'. but in this fm person number we can't pass.
    please help me

    Hi Abhilesh,
    You can use the following FM's to update the Email ID. There are many posts ADDR* FM using for updating Email ID.  Please have a look if you have a doubt.
    DATA: iadsmtp TYPE adsmtp    OCCURS 0 WITH HEADER LINE.
    "Retrieving Address Details
    CALL FUNCTION 'ADDR_COMM_GET'
          EXPORTING
            address_number =  addrnr
            table_type     = 'ADSMTP'
          TABLES
            comm_table     = iadsmtp
          EXCEPTIONS
            OTHERS         = 0.
    READ TABLE iadsmtp index 1.
    if sy-subrc is initial.
    iadsmtp-SMTP_ADDR = 'new mail ID'.  " Here pass your New Email ID
    Modify iadsmtp.
    Endif.
      CALL FUNCTION 'ADDR_COMM_MAINTAIN'
          EXPORTING
            address_number           = addrnr
            table_type               = 'ADSMTP'
            substitute_all_comm_data = 'X'
          TABLES
            comm_table               = iadsmtp
          EXCEPTIONS
            OTHERS                   = 0.
    Then call FM 'ADDR_SINGLE_SAVE'  to do the Commit.

  • Sales order creation with bapi in webdynpro using table control

    When i use table control to update the line items only first row is getting updated in the sale order creation and the loop is not updating the other row to header only the first row is getting saved, for the same set of data sale order is getting created in va01 for multiple line items. Pls give me some idea to resolve this issue, here is the code i am using for creating sale order using bapi 'BAPI_SALESORDER_CREATEFROMDAT2' method CREATE_SALES_ORDER .
    Declaration for Order Header Node DATA: node_order_header TYPE REF TO if_wd_context_node, elem_order_header TYPE REF TO if_wd_context_element, stru_order_header TYPE if_componentcontroller=>element_order_header . * Declaration for Order Items Node DATA: node_order_items TYPE REF TO if_wd_context_node, elem_order_items TYPE REF TO if_wd_context_element, stru_order_items TYPE if_componentcontroller=>element_order_items . * Declaration for Order Partners Node DATA: node_order_partners TYPE REF TO if_wd_context_node, elem_order_partners TYPE REF TO if_wd_context_element, stru_order_partners TYPE if_componentcontroller=>element_order_partners . node_order_header = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_header ). elem_order_header = node_order_header->get_element( ). elem_order_header->get_static_attributes( IMPORTING static_attributes = stru_order_header ). * via lead selection node_order_items = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_items ). elem_order_items = node_order_items->get_element( ). elem_order_items->get_static_attributes( IMPORTING static_attributes = stru_order_items ). * via lead selection node_order_partners = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_partners ). elem_order_partners = node_order_partners->get_element( ). elem_order_partners->get_static_attributes( IMPORTING static_attributes = stru_order_partners ). DATA: v_sales_doc TYPE bapivbeln-vbeln. DATA: w_order_header_in TYPE bapisdhd1, i_order_header_in TYPE table of bapisdhd1," i_order_partners TYPE TABLE OF bapiparnr, w_order_partners TYPE bapiparnr, i_return TYPE TABLE OF bapiret2, w_return TYPE bapiret2, i_order_items_in TYPE TABLE OF bapisditm, w_order_items_in TYPE bapisditm, i_order_conditions_in TYPE TABLE OF bapicond, w_order_conditions_in TYPE bapicond, w_order_SCHDL type BAPISCHDL, i_order_SCHDL type table of BAPISCHDL. * Order Header Details CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in, i_order_conditions_in, w_order_SCHDL, i_order_SCHDL. refresh : i_order_partners, i_return, i_order_items_in, i_order_conditions_in, i_order_SCHDL. w_order_header_in-doc_type = stru_order_header-doc_type. w_order_header_in-sales_org = stru_order_header-sales_org. w_order_header_in-distr_chan = stru_order_header-distr_chan. w_order_header_in-division = stru_order_header-division. w_order_header_in-req_date_h = stru_order_header-req_date_h. w_order_header_in-sales_dist = stru_order_header-sales_dist. w_order_header_in-purch_no_c = stru_order_header-purch_no_c. * Order Item Details CLEAR: i_order_items_in,w_order_items_in. * w_order_items_in-itm_num = stru_order_items-itm_num. w_order_items_in-ITM_NUMBER = stru_order_items-ITM_NUMBER. w_order_items_in-material = stru_order_items-material. w_order_items_in-target_qty = stru_order_items-target_qty."'5'. w_order_items_in-target_qu = stru_order_items-target_qu."'5'. w_order_items_in-plant = stru_order_items-plant. w_order_items_in-target_val = stru_order_items-target_val. w_order_items_in-currency = stru_order_items-currency. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_items_in-material IMPORTING output = w_order_items_in-material. APPEND w_order_items_in TO i_order_items_in. * Order Partner Details CLEAR: i_order_partners,w_order_partners. w_order_partners-partn_role = stru_order_partners-partn_role. w_order_partners-partn_numb = stru_order_partners-partn_numb. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_partners-partn_numb IMPORTING output = w_order_partners-partn_numb. APPEND w_order_partners TO i_order_partners. * Order Condition Details w_order_SCHDL-ITM_NUMBER = stru_order_items-itm_number." '000010'. w_order_SCHDL-req_qty = stru_order_items-target_qty." '5'. APPEND w_order_SCHDL to i_order_SCHDL. * Create Sales Order BAPI Call *loop at i_order_header_in into w_order_header_in. CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2' EXPORTING order_header_in = w_order_header_in IMPORTING salesdocument = v_sales_doc TABLES return = i_return order_items_in = i_order_items_in order_partners = i_order_partners order_schedules_in = i_order_SCHDL order_conditions_in = i_order_conditions_in. * Get message manager DATA: l_current_controller TYPE REF TO if_wd_controller, l_message_manager TYPE REF TO if_wd_message_manager. l_current_controller ?= wd_this->wd_get_api( ). CALL METHOD l_current_controller->get_message_manager RECEIVING message_manager = l_message_manager. DATA: v_message_text TYPE string. * When Sales Order is created commit the data IF NOT v_sales_doc IS INITIAL. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = 'X'. CONCATENATE 'Sales Document' v_sales_doc 'has been created.' INTO v_message_text SEPARATED BY space. * Report Success message CALL METHOD l_message_manager->report_success EXPORTING message_text = v_message_text. ELSE. v_message_text = 'Error Creating Sales Order'. * Report Error message CALL METHOD l_message_manager->report_error_message EXPORTING message_text = v_message_text. ENDIF. *endloop. endmethod. and code for table control i am using is method WDDOINIT . Types : Begin of item_tab, itm_number type bapisditm-itm_number, material type bapisditm-material, plant type bapisditm-plant , target_qty type bapisditm-target_qty, target_qu type bapisditm-target_qu, target_val type bapisditm-target_val, currency type bapisditm-currency, end of item_tab. *Creating internal table and Work Area of the same structure *as that of the Node created. Data : it_item type standard table of item_tab, wa_item type item_tab. *Appending Blank Work Area to Internal table. ***********************************************888 *LOOP AT it_item INTO wa_item. **wa_item-itm_number to bapisditm-itm_number. **wa_item-material to bapisditm-material. **wa_item-plant to bapisditm-plant. **wa_item-target_qty to bapisditm-target_qty. **wa_item-target_qu to bapisditm-target_qu. **wa_item-target_val to bapisditm-target_val. **wa_item-currency to bapisditm-currency. ** * APPEND wa_item TO it_item. *ENDLOOP. **********************************************88 ******** Do 10 times. Append wa_item to it_item. enddo. ********* "Binding the table DATA lo_nd_order_items TYPE REF TO if_wd_context_node. * DATA lt_material TYPE wd_this->Elements_material. * navigate from to via lead selection lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ). * @TODO handle non existant child * IF lo_nd_material IS INITIAL. * ENDIF. ** @TODO compute values ** e.g. call a model function * lo_nd_order_items->bind_table( new_items = it_item set_initial_elements = abap_true ). endmethod.

    DATA: node_order_header TYPE REF TO if_wd_context_node, elem_order_header TYPE REF TO if_wd_context_element, stru_order_header TYPE if_componentcontroller=>element_order_header . * Declaration for Order Items Node DATA: node_order_items TYPE REF TO if_wd_context_node, elem_order_items TYPE REF TO if_wd_context_element, stru_order_items TYPE if_componentcontroller=>element_order_items . * Declaration for Order Partners Node DATA: node_order_partners TYPE REF TO if_wd_context_node, elem_order_partners TYPE REF TO if_wd_context_element, stru_order_partners TYPE if_componentcontroller=>element_order_partners . node_order_header = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_header ). elem_order_header = node_order_header->get_element( ). elem_order_header->get_static_attributes( IMPORTING static_attributes = stru_order_header ). * via lead selection node_order_items = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_items ). elem_order_items = node_order_items->get_element( ). elem_order_items->get_static_attributes( IMPORTING static_attributes = stru_order_items ). * via lead selection node_order_partners = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_partners ). elem_order_partners = node_order_partners->get_element( ). elem_order_partners->get_static_attributes( IMPORTING static_attributes = stru_order_partners ). DATA: v_sales_doc TYPE bapivbeln-vbeln. DATA: w_order_header_in TYPE bapisdhd1, i_order_header_in TYPE table of bapisdhd1," i_order_partners TYPE TABLE OF bapiparnr, w_order_partners TYPE bapiparnr, i_return TYPE TABLE OF bapiret2, w_return TYPE bapiret2, i_order_items_in TYPE TABLE OF bapisditm, w_order_items_in TYPE bapisditm, i_order_conditions_in TYPE TABLE OF bapicond, w_order_conditions_in TYPE bapicond, w_order_SCHDL type BAPISCHDL, i_order_SCHDL type table of BAPISCHDL. * Order Header Details CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in, i_order_conditions_in, w_order_SCHDL, i_order_SCHDL. refresh : i_order_partners, i_return, i_order_items_in, i_order_conditions_in, i_order_SCHDL. w_order_header_in-doc_type = stru_order_header-doc_type. w_order_header_in-sales_org = stru_order_header-sales_org. w_order_header_in-distr_chan = stru_order_header-distr_chan. w_order_header_in-division = stru_order_header-division. w_order_header_in-req_date_h = stru_order_header-req_date_h. w_order_header_in-sales_dist = stru_order_header-sales_dist. w_order_header_in-purch_no_c = stru_order_header-purch_no_c. * Order Item Details CLEAR: i_order_items_in,w_order_items_in. * w_order_items_in-itm_num = stru_order_items-itm_num. w_order_items_in-ITM_NUMBER = stru_order_items-ITM_NUMBER. w_order_items_in-material = stru_order_items-material. w_order_items_in-target_qty = stru_order_items-target_qty."'5'. w_order_items_in-target_qu = stru_order_items-target_qu."'5'. w_order_items_in-plant = stru_order_items-plant. w_order_items_in-target_val = stru_order_items-target_val. w_order_items_in-currency = stru_order_items-currency. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_items_in-material IMPORTING output = w_order_items_in-material. APPEND w_order_items_in TO i_order_items_in. * Order Partner Details CLEAR: i_order_partners,w_order_partners. w_order_partners-partn_role = stru_order_partners-partn_role. w_order_partners-partn_numb = stru_order_partners-partn_numb. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_partners-partn_numb IMPORTING output = w_order_partners-partn_numb. APPEND w_order_partners TO i_order_partners. * Order Condition Details w_order_SCHDL-ITM_NUMBER = stru_order_items-itm_number." '000010'. w_order_SCHDL-req_qty = stru_order_items-target_qty." '5'. APPEND w_order_SCHDL to i_order_SCHDL. * Create Sales Order BAPI Call *loop at i_order_header_in into w_order_header_in. CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2' EXPORTING order_header_in = w_order_header_in IMPORTING salesdocument = v_sales_doc TABLES return = i_return order_items_in = i_order_items_in order_partners = i_order_partners order_schedules_in = i_order_SCHDL order_conditions_in = i_order_conditions_in. * Get message manager DATA: l_current_controller TYPE REF TO if_wd_controller, l_message_manager TYPE REF TO if_wd_message_manager. l_current_controller ?= wd_this->wd_get_api( ). CALL METHOD l_current_controller->get_message_manager RECEIVING message_manager = l_message_manager. DATA: v_message_text TYPE string. * When Sales Order is created commit the data IF NOT v_sales_doc IS INITIAL. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = 'X'. CONCATENATE 'Sales Document' v_sales_doc 'has been created.' INTO v_message_text SEPARATED BY space. * Report Success message CALL METHOD l_message_manager->report_success EXPORTING message_text = v_message_text. ELSE. v_message_text = 'Error Creating Sales Order'. * Report Error message CALL METHOD l_message_manager->report_error_message EXPORTING message_text = v_message_text. ENDIF. *endloop. endmethod. and code for table control i am using is method WDDOINIT . Types : Begin of item_tab, itm_number type bapisditm-itm_number, material type bapisditm-material, plant type bapisditm-plant , target_qty type bapisditm-target_qty, target_qu type bapisditm-target_qu, target_val type bapisditm-target_val, currency type bapisditm-currency, end of item_tab. *Creating internal table and Work Area of the same structure *as that of the Node created. Data : it_item type standard table of item_tab, wa_item type item_tab. *Appending Blank Work Area to Internal table. ***********************************************888 *LOOP AT it_item INTO wa_item. **wa_item-itm_number to bapisditm-itm_number. **wa_item-material to bapisditm-material. **wa_item-plant to bapisditm-plant. **wa_item-target_qty to bapisditm-target_qty. **wa_item-target_qu to bapisditm-target_qu. **wa_item-target_val to bapisditm-target_val. **wa_item-currency to bapisditm-currency. ** * APPEND wa_item TO it_item. *ENDLOOP. **********************************************88 ******** Do 10 times. Append wa_item to it_item. enddo. ********* "Binding the table DATA lo_nd_order_items TYPE REF TO if_wd_context_node. * DATA lt_material TYPE wd_this->Elements_material. * navigate from to via lead selection lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ). * @TODO handle non existant child * IF lo_nd_material IS INITIAL. * ENDIF. ** @TODO compute values ** e.g. call a model function * lo_nd_order_items->bind_table( new_items = it_item set_initial_elements = abap_true ). endmethod.

  • Sales order creation with bapi in webdynpro

    When i use table control to update the line items only first row is getting updated in the sale order creation and the loop is not updating the other row to header only the first row is getting saved, for the same set of  data sale order is getting created in  va01 for multiple line items.
    Pls give me some idea to resolve this issue,
    here is the code i am using for creating sale order using bapi 'BAPI_SALESORDER_CREATEFROMDAT2'
    method CREATE_SALES_ORDER .
    Declaration for Order Header Node
    DATA: node_order_header TYPE REF TO if_wd_context_node,
           elem_order_header TYPE REF TO if_wd_context_element,
           stru_order_header TYPE if_componentcontroller=>element_order_header .
    Declaration for Order Items Node
    DATA: node_order_items TYPE REF TO if_wd_context_node,
           elem_order_items TYPE REF TO if_wd_context_element,
           stru_order_items TYPE if_componentcontroller=>element_order_items .
    Declaration for Order Partners Node
    DATA: node_order_partners TYPE REF TO if_wd_context_node,
    elem_order_partners TYPE REF TO if_wd_context_element,
    stru_order_partners TYPE if_componentcontroller=>element_order_partners .
    node_order_header = wd_context->get_child_node(
    name = if_componentcontroller=>wdctx_order_header
    elem_order_header = node_order_header->get_element( ).
    elem_order_header->get_static_attributes(
    IMPORTING static_attributes = stru_order_header
    <ORDER_ITEMS> via lead selection
    node_order_items = wd_context->get_child_node(
    name = if_componentcontroller=>wdctx_order_items ).
    elem_order_items = node_order_items->get_element( ).
    elem_order_items->get_static_attributes(
    IMPORTING static_attributes = stru_order_items ).
    <ORDER_PARTNERS> via lead selection
    node_order_partners = wd_context->get_child_node(
    name = if_componentcontroller=>wdctx_order_partners ).
    elem_order_partners = node_order_partners->get_element( ).
    elem_order_partners->get_static_attributes(
    IMPORTING static_attributes = stru_order_partners ).
    DATA: v_sales_doc TYPE bapivbeln-vbeln.
    DATA: w_order_header_in TYPE bapisdhd1,
          i_order_header_in TYPE table of bapisdhd1,"
          i_order_partners TYPE TABLE OF bapiparnr,
          w_order_partners TYPE bapiparnr,
          i_return TYPE TABLE OF bapiret2,
          w_return TYPE bapiret2,
          i_order_items_in TYPE TABLE OF bapisditm,
          w_order_items_in TYPE bapisditm,
          i_order_conditions_in TYPE TABLE OF bapicond,
          w_order_conditions_in TYPE bapicond,
          w_order_SCHDL type  BAPISCHDL,
          i_order_SCHDL type table of BAPISCHDL.
    Order Header Details
    CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in,
              i_order_conditions_in, w_order_SCHDL, i_order_SCHDL.
    refresh : i_order_partners, i_return, i_order_items_in,
              i_order_conditions_in, i_order_SCHDL.
    w_order_header_in-doc_type = stru_order_header-doc_type.
    w_order_header_in-sales_org = stru_order_header-sales_org.
    w_order_header_in-distr_chan = stru_order_header-distr_chan.
    w_order_header_in-division = stru_order_header-division.
    w_order_header_in-req_date_h = stru_order_header-req_date_h.
    w_order_header_in-sales_dist = stru_order_header-sales_dist.
    w_order_header_in-purch_no_c = stru_order_header-purch_no_c.
    Order Item Details
      CLEAR: i_order_items_in,w_order_items_in.
    w_order_items_in-itm_num = stru_order_items-itm_num.
    w_order_items_in-ITM_NUMBER =  stru_order_items-ITM_NUMBER.
    w_order_items_in-material = stru_order_items-material.
    w_order_items_in-target_qty = stru_order_items-target_qty."'5'.
    w_order_items_in-target_qu = stru_order_items-target_qu."'5'.
    w_order_items_in-plant = stru_order_items-plant.
    w_order_items_in-target_val = stru_order_items-target_val.
    w_order_items_in-currency = stru_order_items-currency.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
       input = w_order_items_in-material
       IMPORTING output = w_order_items_in-material.
    APPEND w_order_items_in TO i_order_items_in.
    Order Partner Details
    CLEAR: i_order_partners,w_order_partners.
    w_order_partners-partn_role = stru_order_partners-partn_role.
    w_order_partners-partn_numb = stru_order_partners-partn_numb.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING input = w_order_partners-partn_numb
       IMPORTING output = w_order_partners-partn_numb.
    APPEND w_order_partners TO i_order_partners.
    Order Condition Details
    w_order_SCHDL-ITM_NUMBER  = stru_order_items-itm_number." '000010'.
             w_order_SCHDL-req_qty     = stru_order_items-target_qty." '5'.
              APPEND w_order_SCHDL to i_order_SCHDL.
    Create Sales Order BAPI Call
    *loop at i_order_header_in into  w_order_header_in.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
    EXPORTING
       order_header_in = w_order_header_in
       IMPORTING
         salesdocument = v_sales_doc
         TABLES
           return = i_return
           order_items_in = i_order_items_in
           order_partners = i_order_partners
            order_schedules_in  = i_order_SCHDL
           order_conditions_in = i_order_conditions_in.
    Get message manager
      DATA: l_current_controller TYPE REF TO if_wd_controller,
            l_message_manager    TYPE REF TO if_wd_message_manager.
      l_current_controller ?= wd_this->wd_get_api( ).
      CALL METHOD l_current_controller->get_message_manager
        RECEIVING
          message_manager = l_message_manager.
      DATA: v_message_text TYPE string.
    When Sales Order is created commit the data
    IF NOT v_sales_doc IS INITIAL.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
          wait = 'X'.
        CONCATENATE 'Sales Document' v_sales_doc 'has been created.'
        INTO v_message_text SEPARATED BY space.
    Report Success message
        CALL METHOD l_message_manager->report_success
        EXPORTING message_text = v_message_text.
        ELSE.
          v_message_text = 'Error Creating Sales Order'.
    Report Error message
          CALL METHOD l_message_manager->report_error_message
          EXPORTING message_text = v_message_text.
          ENDIF.
    *endloop.
    endmethod.
    and code for table control i am using is
    method WDDOINIT .
      Types : Begin of item_tab,
            itm_number  type bapisditm-itm_number,
            material type bapisditm-material,
            plant type bapisditm-plant ,
            target_qty type bapisditm-target_qty,
            target_qu type bapisditm-target_qu,
            target_val type bapisditm-target_val,
        currency type bapisditm-currency,
            end of item_tab.
    *Creating internal table and Work Area of the same structure
    *as that of the Node created.
    Data : it_item type standard table of item_tab,
            wa_item type item_tab.
    *Appending Blank Work Area to Internal table.
    ***********************************************888
    *LOOP AT it_item INTO wa_item.
    **wa_item-itm_number to  bapisditm-itm_number.
    **wa_item-material to bapisditm-material.
    **wa_item-plant to bapisditm-plant.
    **wa_item-target_qty to bapisditm-target_qty.
    **wa_item-target_qu to bapisditm-target_qu.
    **wa_item-target_val to bapisditm-target_val.
    **wa_item-currency to bapisditm-currency.
       APPEND wa_item TO it_item.
    *ENDLOOP.
    **********************************************88
    Do 10 times.
    Append wa_item to it_item.
    enddo.
    "Binding the table
    DATA lo_nd_order_items TYPE REF TO if_wd_context_node.
    DATA lt_material TYPE wd_this->Elements_material.
    navigate from <CONTEXT> to <MATERIAL> via lead selection
      lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ).
    @TODO handle non existant child
    IF lo_nd_material IS INITIAL.
    ENDIF.
    @TODO compute values
    e.g. call a model function
      lo_nd_order_items->bind_table( new_items =
      it_item set_initial_elements = abap_true ).
    endmethod.

    When i use table control to update the line items only first row is getting updated in the sale order creation and the loop is not updating the other row to header only the first row is getting saved, for the same set of  data sale order is getting created in  va01 for multiple line items.
    Pls give me some idea to resolve this issue,
    here is the code i am using for creating sale order using bapi 'BAPI_SALESORDER_CREATEFROMDAT2'
    method CREATE_SALES_ORDER .
    Declaration for Order Header Node
    DATA: node_order_header TYPE REF TO if_wd_context_node,
           elem_order_header TYPE REF TO if_wd_context_element,
           stru_order_header TYPE if_componentcontroller=>element_order_header .
    Declaration for Order Items Node
    DATA: node_order_items TYPE REF TO if_wd_context_node,
           elem_order_items TYPE REF TO if_wd_context_element,
           stru_order_items TYPE if_componentcontroller=>element_order_items .
    Declaration for Order Partners Node
    DATA: node_order_partners TYPE REF TO if_wd_context_node,
    elem_order_partners TYPE REF TO if_wd_context_element,
    stru_order_partners TYPE if_componentcontroller=>element_order_partners .
    node_order_header = wd_context->get_child_node(
    name = if_componentcontroller=>wdctx_order_header
    elem_order_header = node_order_header->get_element( ).
    elem_order_header->get_static_attributes(
    IMPORTING static_attributes = stru_order_header
    <ORDER_ITEMS> via lead selection
    node_order_items = wd_context->get_child_node(
    name = if_componentcontroller=>wdctx_order_items ).
    elem_order_items = node_order_items->get_element( ).
    elem_order_items->get_static_attributes(
    IMPORTING static_attributes = stru_order_items ).
    <ORDER_PARTNERS> via lead selection
    node_order_partners = wd_context->get_child_node(
    name = if_componentcontroller=>wdctx_order_partners ).
    elem_order_partners = node_order_partners->get_element( ).
    elem_order_partners->get_static_attributes(
    IMPORTING static_attributes = stru_order_partners ).
    DATA: v_sales_doc TYPE bapivbeln-vbeln.
    DATA: w_order_header_in TYPE bapisdhd1,
          i_order_header_in TYPE table of bapisdhd1,"
          i_order_partners TYPE TABLE OF bapiparnr,
          w_order_partners TYPE bapiparnr,
          i_return TYPE TABLE OF bapiret2,
          w_return TYPE bapiret2,
          i_order_items_in TYPE TABLE OF bapisditm,
          w_order_items_in TYPE bapisditm,
          i_order_conditions_in TYPE TABLE OF bapicond,
          w_order_conditions_in TYPE bapicond,
          w_order_SCHDL type  BAPISCHDL,
          i_order_SCHDL type table of BAPISCHDL.
    Order Header Details
    CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in,
              i_order_conditions_in, w_order_SCHDL, i_order_SCHDL.
    refresh : i_order_partners, i_return, i_order_items_in,
              i_order_conditions_in, i_order_SCHDL.
    w_order_header_in-doc_type = stru_order_header-doc_type.
    w_order_header_in-sales_org = stru_order_header-sales_org.
    w_order_header_in-distr_chan = stru_order_header-distr_chan.
    w_order_header_in-division = stru_order_header-division.
    w_order_header_in-req_date_h = stru_order_header-req_date_h.
    w_order_header_in-sales_dist = stru_order_header-sales_dist.
    w_order_header_in-purch_no_c = stru_order_header-purch_no_c.
    Order Item Details
      CLEAR: i_order_items_in,w_order_items_in.
    w_order_items_in-itm_num = stru_order_items-itm_num.
    w_order_items_in-ITM_NUMBER =  stru_order_items-ITM_NUMBER.
    w_order_items_in-material = stru_order_items-material.
    w_order_items_in-target_qty = stru_order_items-target_qty."'5'.
    w_order_items_in-target_qu = stru_order_items-target_qu."'5'.
    w_order_items_in-plant = stru_order_items-plant.
    w_order_items_in-target_val = stru_order_items-target_val.
    w_order_items_in-currency = stru_order_items-currency.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
       input = w_order_items_in-material
       IMPORTING output = w_order_items_in-material.
    APPEND w_order_items_in TO i_order_items_in.
    Order Partner Details
    CLEAR: i_order_partners,w_order_partners.
    w_order_partners-partn_role = stru_order_partners-partn_role.
    w_order_partners-partn_numb = stru_order_partners-partn_numb.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING input = w_order_partners-partn_numb
       IMPORTING output = w_order_partners-partn_numb.
    APPEND w_order_partners TO i_order_partners.
    Order Condition Details
    w_order_SCHDL-ITM_NUMBER  = stru_order_items-itm_number." '000010'.
             w_order_SCHDL-req_qty     = stru_order_items-target_qty." '5'.
              APPEND w_order_SCHDL to i_order_SCHDL.
    Create Sales Order BAPI Call
    *loop at i_order_header_in into  w_order_header_in.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
    EXPORTING
       order_header_in = w_order_header_in
       IMPORTING
         salesdocument = v_sales_doc
         TABLES
           return = i_return
           order_items_in = i_order_items_in
           order_partners = i_order_partners
            order_schedules_in  = i_order_SCHDL
           order_conditions_in = i_order_conditions_in.
    Get message manager
      DATA: l_current_controller TYPE REF TO if_wd_controller,
            l_message_manager    TYPE REF TO if_wd_message_manager.
      l_current_controller ?= wd_this->wd_get_api( ).
      CALL METHOD l_current_controller->get_message_manager
        RECEIVING
          message_manager = l_message_manager.
      DATA: v_message_text TYPE string.
    When Sales Order is created commit the data
    IF NOT v_sales_doc IS INITIAL.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
          wait = 'X'.
        CONCATENATE 'Sales Document' v_sales_doc 'has been created.'
        INTO v_message_text SEPARATED BY space.
    Report Success message
        CALL METHOD l_message_manager->report_success
        EXPORTING message_text = v_message_text.
        ELSE.
          v_message_text = 'Error Creating Sales Order'.
    Report Error message
          CALL METHOD l_message_manager->report_error_message
          EXPORTING message_text = v_message_text.
          ENDIF.
    *endloop.
    endmethod.
    and code for table control i am using is
    method WDDOINIT .
      Types : Begin of item_tab,
            itm_number  type bapisditm-itm_number,
            material type bapisditm-material,
            plant type bapisditm-plant ,
            target_qty type bapisditm-target_qty,
            target_qu type bapisditm-target_qu,
            target_val type bapisditm-target_val,
        currency type bapisditm-currency,
            end of item_tab.
    *Creating internal table and Work Area of the same structure
    *as that of the Node created.
    Data : it_item type standard table of item_tab,
            wa_item type item_tab.
    *Appending Blank Work Area to Internal table.
    ***********************************************888
    *LOOP AT it_item INTO wa_item.
    **wa_item-itm_number to  bapisditm-itm_number.
    **wa_item-material to bapisditm-material.
    **wa_item-plant to bapisditm-plant.
    **wa_item-target_qty to bapisditm-target_qty.
    **wa_item-target_qu to bapisditm-target_qu.
    **wa_item-target_val to bapisditm-target_val.
    **wa_item-currency to bapisditm-currency.
       APPEND wa_item TO it_item.
    *ENDLOOP.
    **********************************************88
    Do 10 times.
    Append wa_item to it_item.
    enddo.
    "Binding the table
    DATA lo_nd_order_items TYPE REF TO if_wd_context_node.
    DATA lt_material TYPE wd_this->Elements_material.
    navigate from <CONTEXT> to <MATERIAL> via lead selection
      lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ).
    @TODO handle non existant child
    IF lo_nd_material IS INITIAL.
    ENDIF.
    @TODO compute values
    e.g. call a model function
      lo_nd_order_items->bind_table( new_items =
      it_item set_initial_elements = abap_true ).
    endmethod.

  • Displaying multiple messages in a single view

    Hi,
    I am trying to display two diffrent messages in same view. for this i am using two different message area UI elements. When I use the code wizard to generate the message,same message is being displayed in two message areas. But i do not want that functionality.
    If error1 happens, I want the message1 to be displayed in Message area1.
    if error2 happens, I want the message2 to be displayed in Message area2.
    anyhelp would be appreciated.
    thanks,

    Hi,
    In the method you need to write the code for both the errors,
    get message manager from code wizard and call the method report_error_message.
    For both errors write the code below:
    *get message manager
          DATA lo_api_controller     TYPE REF TO if_wd_controller.
          DATA lo_message_manager    TYPE REF TO if_wd_message_manager.
          lo_api_controller ?= wd_this->wd_get_api( ).
          CALL METHOD lo_api_controller->get_message_manager
            RECEIVING
              message_manager = lo_message_manager.
    *  report message
          CALL METHOD lo_message_manager->report_error_message
            EXPORTING
              message_text = 'Message1 '. ("Write the first message")
    Hope this solves the issue, Let me know if any queries.
    Regards,
    Rajani

  • ABAP webDynpro MS Office component usage throws -  Access via 'NULL' object

    I am trying to include MS office word in my custom ABAP webDynro application based on the sample SAP Package SIOS for all the MS office component usage. <br>
    In WDMODIFY method  , when the courser is reaching the point to call office component  it throws a Null pointer exception. Not sure , if i am missing some thing here or skip a step. Please advice. <br>
    get the IOS interface <br>
      wd_this->factory ?= office->_method_handler. <br>
    Below is the code for WDMODIFY <br>
    method WDDOMODIFYVIEW . <br>
    DATA: <br>
        office TYPE REF TO cl_wd_view_element, <br>
        office_res TYPE REF TO cl_wd_view_element,<br>
        mime_repository TYPE REF TO if_mr_api,<br>
        content TYPE xstring, <br>
        url TYPE string VALUE <br>
    '/SAP/BC/WebDynpro/SAP/PUblic/BC/ssr/uuielibs/office_integration' & <br>
    '/iostest_fields.doc'. <br>
      DATA refexp TYPE REF TO cx_ios_exception.
      DATA: msgid TYPE syst-msgid,
         msgnr TYPE syst-msgno,
         msgty TYPE syst-msgty.
      get message manager
      DATA: l_current_controller TYPE REF TO if_wd_controller,
            l_message_manager    TYPE REF TO if_wd_message_manager.
      DATA envproxy TYPE REF TO if_ios_environment.
    just do it once
      CHECK first_time = abap_true.
      mime_repository = cl_mime_repository_api=>get_api( ).
      CALL METHOD mime_repository->get
        EXPORTING
          i_url     = url
        IMPORTING
          e_content = content.
      wd_context->set_attribute( name = 'DATAS' value = content ).
    get the office control
      office ?= view->get_element( 'GENERIC_OFFICE' ).
      ASSERT ID sios_demo CONDITION  office IS BOUND.
    not possible : Missing bugfix component bc-wd-aba
    office_res ?= view->get_element( 'RESULT_DOCUMENT' ).
    ASSERT ID sios_demo CONDITION  office IS BOUND.
    get the IOS interface
      wd_this->factory ?= office->_method_handler.
      ASSERT ID sios_demo CONDITION wd_this->factory IS BOUND.
    wd_this->factory_res ?= office_res->_method_handler.
    ASSERT ID sios_demo CONDITION wd_this->factory_res IS BOUND.
      TRY.
          wd_this->factory->get_wordprocessing_proxy(
             IMPORTING proxy = wd_this->document  ).
          ASSERT ID sios_demo CONDITION wd_this->document IS BOUND.
         wd_this->factory_res->get_wordprocessing_proxy(
            IMPORTING proxy = wd_this->document_res  ).
         ASSERT ID sios_demo CONDITION wd_this->document IS BOUND.
    *calling    setfields
          DATA co_error_info_getfields TYPE REF TO if_wd_context_element.
          DATA co_error_info_getfields_stru TYPE wdr_ext_attribute_pointer.
          co_error_info_getfields = wd_context->get_lead_selection( ).
          co_error_info_getfields_stru-attribute_name =
    'error_info_getfields'.
          co_error_info_getfields_stru-element = co_error_info_getfields.
          DATA fields TYPE if_ios_wordprocessing=>fields_type.
          DATA fieldstable TYPE if_ios_wordprocessing=>fields_type_table.
          DATA co_fieldcontent TYPE REF TO if_wd_context_element.
          DATA co_fieldcontent_stru TYPE wdr_ext_attribute_pointer.
          DATA inputfield1 TYPE xstring.
          DATA tabulator TYPE xstring.
          DATA endofline TYPE xstring.
          DATA: conv TYPE REF TO cl_abap_conv_out_ce.
          DATA: testfielddata TYPE string.
          testfielddata = 'SAPTEST'.
          conv = cl_abap_conv_out_ce=>create( encoding = '4110'
    ignore_cerr = abap_true ).
          CALL METHOD conv->convert( EXPORTING data = 'field1'
                                           IMPORTING buffer =
    fields-fieldidentifier  ).
          CALL METHOD conv->convert( EXPORTING data = testfielddata
                                           IMPORTING buffer = fields-value
          CALL METHOD conv->convert( EXPORTING data =
    cl_abap_char_utilities=>horizontal_tab
                                           IMPORTING buffer = tabulator  ).
          CALL METHOD conv->convert( EXPORTING data =
    cl_abap_char_utilities=>cr_lf
                                           IMPORTING buffer = endofline  ).
          wd_context->set_attribute( name = 'inputfield1'
                                     value = testfielddata ).
          APPEND fields TO fieldstable.
          wd_context->set_attribute( name = 'fieldcontent' value =
    fieldstable ).
          co_fieldcontent = wd_context->get_lead_selection( ).
          co_fieldcontent_stru-attribute_name = 'fieldcontent'.
          co_fieldcontent_stru-element = co_fieldcontent.
    document is set through datasource!
          wd_this->document->setfields( EXPORTING fieldsptr =
    co_fieldcontent_stru
                                                  tabulator = tabulator
                                                  endofline = endofline
                                                  errorinformation =
    co_error_info_getfields_stru ).
    *calling    opening result document
          DATA co_error_getcontent TYPE REF TO if_wd_context_element.
          DATA co_error_getcontent_stru TYPE wdr_ext_attribute_pointer.
          co_error_getcontent = wd_context->get_lead_selection( ).
          co_error_getcontent_stru-attribute_name = 'error_getcontent'.
          co_error_getcontent_stru-element = co_error_getcontent.
          DATA co_createdcontent TYPE REF TO if_wd_context_element.
          DATA co_createdcontent_stru TYPE wdr_ext_attribute_pointer.
          co_createdcontent = wd_context->get_lead_selection( ).
          co_createdcontent_stru-attribute_name = 'createdcontent'.
          co_createdcontent_stru-element = co_createdcontent.
    waiting of ACF Patch!
         wd_this->document->getcontent( errorinformation =
    *co_error_getcontent_stru
         contentpointer_result =  co_createdcontent_stru ).
    *calling    reopening template
          DATA error_opendocument TYPE REF TO if_wd_context_element.
          DATA error_opendocument_stru TYPE wdr_ext_attribute_pointer.
          error_opendocument = wd_context->get_lead_selection( ).
          error_opendocument_stru-attribute_name = 'error_opendocument'.
          error_opendocument_stru-element = error_opendocument.
         wd_this->document_res->if_ios_document~opendocument( EXPORTING errorinformation = error_opendocument_stru ).
        CATCH cx_ios_document INTO refexp.
        CATCH cx_ios_communicationwrapper INTO refexp.
        CATCH cx_ios_factory INTO refexp.
        CATCH cx_ios_environment INTO refexp.
        CATCH cx_ios_exception INTO refexp.
      ENDTRY.
      IF refexp IS NOT INITIAL.
        refexp->get_message( IMPORTING
                  mtype = msgty
                  number = msgnr
                  mid = msgid ).
        l_current_controller ?= wd_this->wd_get_api( ).
        CALL METHOD l_current_controller->get_message_manager
          RECEIVING
            message_manager = l_message_manager.
      report message
        CALL METHOD l_message_manager->report_t100_message
          EXPORTING
            msgid = msgid
            msgno = msgnr
            msgty = msgty.
      ENDIF.
    endmethod.
    Edited by: suryajoshi on Jan 13, 2011 5:04 PM

    Thanks for your reply.
    I have defined DATAS attribute  as XSTRING.  You are right i am using SIOS code from WDMODIFY.
    I am getting exception at this line:  Please advice. Its seems that factory is not been recognize. I double check , factory is present in attributes Tabs of the View.
    get the IOS interface
      wd_this->factory ?= office->_method_handler.
      ASSERT ID sios_demo CONDITION wd_this->factory IS BOUND.

  • How to display a variable in the message

    Hi all,
    I am developing an application where I am parking a document, can anyone please tell me how can I display the document number on the web dynpro screen with the message once the document has been parked. So far I have written the following code but this is just for displaying a message only and not the number:
    DATA lo_api_controller     TYPE REF TO if_wd_controller.
        DATA lo_message_manager    TYPE REF TO if_wd_message_manager.
    lo_api_controller ?= wd_this->wd_get_api( ).
        CALL METHOD lo_api_controller->get_message_manager
          RECEIVING
            message_manager = lo_message_manager.
        CALL METHOD lo_message_manager->report_success
          EXPORTING
            message_text = 'Document has been parked.'

    DATA lo_api_controller     TYPE REF TO if_wd_controller.
    DATA lo_message_manager    TYPE REF TO if_wd_message_manager.
    data lv_document_number    type        string.
    data lv_message_string        type        string.
    lo_api_controller ?= wd_this->wd_get_api( ).
        CALL METHOD lo_api_controller->get_message_manager
          RECEIVING
            message_manager = lo_message_manager.
    *** get document number in lv_document_number
    lv_document_number = .....
    *** form message string
    concatenate 'Document has been parked : Document No :' lv_document_number into lv_message_string.
        CALL METHOD lo_message_manager->report_success
          EXPORTING
            message_text = lv_message_string.

  • How to catch a dump occured on backend(a remote system) from frontend

    Hi All,
        I have a specific requirement wherein, i should be able to catch the dump/any system error occured on a backend system and i need to display a message in a proper format instead of showing the actual dump. I communicate with backend( R/3 4.7) from webdynpro for abap using RFC call. If anyone has any clue regarding this please reply..
    Thanks in advance
    Ashok

    Hi Ashok,
    This is very simple. Return error messages from RFC if any now in web dynpro handle those error messages using the message manager call method REPORT_ERROR_MESSAGE.
    Check the sample code below.
    call function BAPI_XXXXXXX
      importing
         et_error  = lt_error.
      get message manager
      DATA lo_api_controller     TYPE REF TO if_wd_controller.
      DATA lo_message_manager    TYPE REF TO if_wd_message_manager.
      lo_api_controller ?= wd_this->wd_get_api( ).
      CALL METHOD lo_api_controller->get_message_manager
        RECEIVING
          message_manager = lo_message_manager
    Loop at lt_error into ls_error.
      report message
      CALL METHOD lo_message_manager->report_error_message
        EXPORTING
          message_text              = ls_error-message
         params                    =
         msg_user_data             =
         is_permanent              = ABAP_FALSE
         scope_permanent_msg       = CO_MSG_SCOPE_CONTROLLER
         view                      =
         show_as_popup             =
         controller_permanent_msg  =
         msg_index                 =
         cancel_navigation         =
         enable_message_navigation =
      receiving
       message_id                =
    endloop.

  • Enhancement of Employee Self-Service Shop by an own Catalogue (ABAP)

    Hello SRM-Development-Experts
    I enhanced the /SAPSRM/WDC_DODC_SC_GAF_C-WD-Component of Employee Self-Service Shop with an own ActionLink to an own WD-Component.
    Details
    The own WD-Component uses the interfaces /SAPSRM/WDI_L_FPC_GENERAL, /SAPSRM/WDI_L_FPC_POPUP and /IF_FPM_UI_BUILDING_BLOCK.
    So the call from the V_DODC_SC_GAF_FSCA view is like this:
    method ONACTIONZ_ENH_MATCAT .
    DATA: lv_ref_cmp_usage  TYPE REF TO if_wd_component_usage,
          lr_general_controller TYPE REF TO /sapsrm/iwci_wdi_l_fpc_general,
          lv_task_container  TYPE REF TO /sapsrm/if_cll_task_container,
          lr_node  TYPE REF TO if_wd_context_node,
          lr_mo_bom_sc  TYPE REF TO /sapsrm/cl_ch_wd_bom_sc,
          lr_pdo  TYPE REF TO /sapsrm/cl_pdo_bo_sc_adv,
          lt_usages TYPE /sapsrm/t_ch_wd_usages,
          lr_api  TYPE REF TO if_wd_controller,
          lr_comp  TYPE REF TO if_wd_component,
          lr_win_manager  TYPE REF TO if_wd_window_manager,
          lr_win  TYPE REF TO if_wd_window.
    " component usage for our component.
         lv_ref_cmp_usage = wd_this->wd_cpuse_z_myself( ).
    " Initialization step starts.
        IF lv_ref_cmp_usage->has_active_component( ) IS INITIAL.
    " Component creation.
         lv_ref_cmp_usage->create_component( ).
         lr_mo_bom_sc ?= wd_this->mo_bom_sc.
         lr_pdo  ?= lr_mo_bom_sc->/sapsrm/if_cll_xo_mapper~get_pdo( ).
         APPEND lv_ref_cmp_usage TO lt_usages.
         wd_this->mo_component_manager->init_component_usages( it_usages = lt_usages ).
         " Second step: SRM-specific Initialisation of wd-component
         lr_general_controller ?= wd_this->wd_cpifc_z_myself( ).
         lr_general_controller->l_fpc_general__init( io_task_container = wd_this->mo_task_container
                                                   io_bo_mapper       = wd_this->mo_bom_sc ).
      endif.
      lr_api = wd_comp_controller->wd_get_api( ).
      lr_comp = lr_api->get_component( ).
      lr_win_manager = lr_comp->get_window_manager( ).
      lr_win = lr_win_manager->create_window_for_cmp_usage(
          interface_view_name  = 'Z_W_MYSELF'
          component_usage_name = 'Z_MYSELF'
          title = 'Material-Katalaog'
          close_in_any_case = abap_false ).
      lr_win->open( ).
    endmethod.
    To add products I (mis)used the /SAPSRM/IF_CLL_DODM_SC_I_IGOSV-Interface and copy pasted the content of /SAPSRM/WDC_DODC_SC_I_IGS into my WD-Comp:
    METHOD onactionadd_to_basket .
      DATA: lo_api_component  TYPE REF TO if_wd_view_controller,
            lo_w_component  TYPE REF TO if_wd_component,
            lo_window  TYPE REF TO if_wd_window,
            lo_window_ctrl  TYPE REF TO if_wd_window_controller,
            lr_current_controller TYPE REF TO if_wd_controller,
            lr_message_manager   TYPE REF TO if_wd_message_manager,
            lr_internal_goods TYPE REF TO if_wd_context_node,
            lv_close_window TYPE abap_bool,
            lo_idr  TYPE REF TO if_fpm_idr,
            lo_fpm  TYPE REF TO if_fpm,
            lo_cnr_gaf  TYPE REF TO if_fpm_cnr_gaf,
            lo_pdo_node TYPE REF TO if_wd_context_node,
            lo_pdo TYPE REF TO /sapsrm/cl_pdo_bo_sc_adv,
            ls_item TYPE bbp_pds_sc_item_icu,
    TRY.
          lr_internal_goods = wd_context->get_child_node( name = wd_this->wdctx_internal_goods ).
          lr_internal_goods->bind_structure( new_item = ls_item ).
         " mo_bom_sc is initialized in method L_FPC_GENERAL__INIT
          wd_comp_controller->mo_bom_sc->/sapsrm/if_cll_mapper~is_ui_changed_by_client( ).
          wd_this->mo_dodm_sc_i_igosv->add_internal_goods( IMPORTING ev_close_window = lv_close_window ).
          wd_comp_controller->mo_bom_sc->/sapsrm/if_cll_mapper~is_ui_changed_by_client( ).
          IF lv_close_window EQ abap_true.
    " Close window
            lo_api_component = wd_this->wd_get_api( ).
            lo_window_ctrl = lo_api_component->get_embedding_window_ctlr( ).
            IF wd_comp_controller->mv_popup_active EQ abap_true.
              FIELD-SYMBOLS: <ls_mapper> TYPE /sapsrm/s_cll_mapper.
              wd_comp_controller->mo_message_handler->deactivate_popup( EXPORTING iv_view_name_of_popup = 'V_ADD_TO_BASKET' ).
              LOOP AT wd_comp_controller->mt_mapper ASSIGNING <ls_mapper> .
                wd_comp_controller->mo_bom_sc->/sapsrm/if_cll_bo_mapper~deregister_mapper( io_mapper = <ls_mapper>-mapper ).
              ENDLOOP.
              CLEAR: wd_comp_controller->mt_mapper.
            ENDIF.
    " special message stack handling
            wd_comp_controller->mv_popup_active = abap_false.
            lo_window = lo_window_ctrl->get_window( ).
            lo_window->close( ).
          ENDIF.
        CATCH cx_root INTO lr_root.
      ENDTRY.
    ENDMETHOD.
    So, the after closing my own WD-Component the products have been added to the basket & the basket can be properly saved.
    But pushing the Next-Step-Button or Previous-Step-Button provided by the GAF framework makes the shopping basket "empty" and the Previous/Next navigation doesn't react anymore.
    What is the correct approach? Documentation?
    Thanks in advance.

    Dear Poster,
    As no response has been provided to the thread in some time I must assume the issue is resolved, if the question is still valid please create a new thread rephrasing the query and providing as much data as possible to promote response from the community.
    Best Regards,
    SDN SRM Moderation Team

Maybe you are looking for

  • Dead bettery

    my battery icon has an 'x' in it and appears to have no life. i have the laptop attached to a monitor and an external hard drive. can someone advise me on what to do? thank you jessica

  • Skype number and address

    my account is charged $67'00 without no explanations,every which way i am trying to chat or call,you are trying to sell me something instead of answering . please give a phone number and your office address in u.s in general and north california in s

  • Push Not Working After Update to 2.1

    Using Mobile Me. Not sure if its a server problem. Additionally, I have fetch set for hourly and that does not appear to be working either.

  • Office jet pro 8500 A

    My iPad no longer will connect to print from my hp office jet pro 8500A printer This question was solved. View Solution.

  • My iPhone wont do anything but say "Activation Required"! Help!

    I've had it for over 2 years. It's a 3GS. Today around 6 o'clock it just all of a sudden said "No Service". So I turned it off and then back on. Now it wont do anything but come up "Activation required" and then a black screen with the Apple logo. I