cancel
Showing results for 
Search instead for 
Did you mean: 

To update table BBP_PDHGP

Former Member
0 Kudos

Dear all,

I have a scenario to change the posting date in table BBP_PDHGP. I am using FM BBP_PD_CONF_UPDATE by passing the gui_id and i_save as 'X'.

This function module however does not return any error and executes but the posting date in this table remains same.

Please let me know whether I am using the right function module Or should I use some other function module??

Thanks in advance,

Regards,

Suman.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Please provide complete Business requirements in your next reply.

Anyways, Yo ucan use the standard SRM Function module - <u>BBP_PROCDOC_UPDATE</u> to get it working.

Regards

- Atul

Former Member
0 Kudos

Hi Atul,

The complete business requirement as follows:

I have customised a standard workflow WS1040002 for single approval of goods recieval. Now when the posting date is a past date i.e. it is not the current date then I have to change the posting date. For this I have implemented the code in BBP_CONF_CHANGE method of BADI BBP_DOC_CHANGE_BADI. The method used in the end of workflow 'setReleased' from BUS2203 which generates an IDOC of type MBGMCR ( message type ) to back end system with the changed posting date.This scenario is working fine.

The problem occurs when I use Latest End in deadline monitoring. Well once the deadline reaches I need to approve automatically and use the method setReleased from BUS2203 which generates an IDOC of type MBGMCR ( message type ) to back end system. Here in this scenario BADI is not being called and posting date is not getting changed. On observation I found that IDOC is being generated from table BBP_PDHGP and hence wanted to change the field POSTING_DATE_FI in this table.

So I am trying to create a new method which can be used by the workflow when deadline is reached to change the posting date in the table before the IDOC is sent to backend.

I have executed BBP_PROCDOC_UPDATE and BBP_PD_CONF_UPDATE in a test program and it does not change the posting date. Now how can I achieve this??

Please help me. I am out of options.

Thanks and Regards,

Suman.

Former Member
0 Kudos

Hi

<b>Please go through the links below -></b>

Related SAP OSS Notes ->

Note 1001079 Different posting date for confirmations

Note 486124 Entering posting date

Note 485977 Posting date not transferred correctly to the back end

Hope this will definitely help.

Regards

- Atul

Former Member
0 Kudos

Hi,

I have used BBP_PROCDOC_UPDATE and BBP_PROCDOC_SAVE concurrently and I can see the date getting changed. But there is another problem where in <b>short dump</b> occurs when I execute the workflow. The task I have given will ve executed in background.

Any idea why this Dump occurs??

Below is the ST22 Analysis:

<i>

Runtime Errors UNCAUGHT_EXCEPTION

Exception CX_BBP_PD_ABORT

Occurred on 04.07.2007 at 15:02:58

An exception that could not be caught occurred.

What happened?

The exception 'CX_BBP_PD_ABORT' was raised but was not caught at any stage in the call hierarchy.

Since exceptions represent error situations, and since the system could

not react adequately to this error, the current program, 'SAPLBBP_PDH', had to

be terminated.

Error analysis

An exception occurred. This exception is dealt with in more detail below. The exception, which is assinged to the class 'CX_BBP_PD_ABORT', was not caught,

which led to a runtime error.</i>

Regards,

Suman.

Former Member
0 Kudos

Hi

<u>Please check - There might be some problem in your code -></u>

<b>Sample code -></b>

*   Update the purchasing document with the new confirmation information
    PERFORM update_po_with_conf TABLES   lt_text
                                USING    lt_items[]
                                         lt_conf_new[]
                                         lt_header_cv[]
                                         lt_items_cv[]
                                         ls_header
                                CHANGING lt_return[].

*&---------------------------------------------------------------------*
*&      Form  update_po_with_conf
*&---------------------------------------------------------------------*
*       Update the purchase order with data from a confirmation
*----------------------------------------------------------------------*
*      -->IT_ITEMS     Purchase order it ems
*      -->IT_CONF      Confirmation
*      -->IS_HEADER    Purchase order header
*      <--CT_RETURN    Return information
*----------------------------------------------------------------------*
FORM update_po_with_conf TABLES   it_text STRUCTURE bbp_pds_longtext
                         USING    it_items TYPE bbpt_pd_item
                                  it_conf TYPE bbp_pdcon_tab
                                  it_header_cv TYPE bbpt_pd_header
                                  it_items_cv TYPE bbpt_pd_item
                                  is_header TYPE bbp_pds_header
                         CHANGING ct_return TYPE bapiret2_tab.
* ---------------------------------------------------------------------
* Local Variables
* ---------------------------------------------------------------------
  DATA lt_messages  TYPE bbpt_pd_messages.

  DATA ls_return  TYPE LINE OF bapiret2_tab.
  DATA ls_message TYPE LINE OF bbpt_pd_messages.

  DATA lv_error TYPE xfeld.
* versions data
  DATA: ls_header_cv TYPE bbp_pds_header,
        ls_items_cv TYPE bbp_pds_item,
        lt_items_cv TYPE STANDARD TABLE OF  bbp_pds_item,
        lt_text_cv TYPE STANDARD TABLE OF bbp_pds_longtext,
        ls_text_cv type bbp_pds_longtext,
        lt_conf_cv TYPE STANDARD TABLE OF bbp_pds_con,
        ls_conf_cv TYPE bbp_pds_con.
* ---------------------------------------------------------------------
* Program Code
* ---------------------------------------------------------------------
* Clear return information
  REFRESH ct_return.

* Call PO update API
  REFRESH lt_messages.
  CALL FUNCTION 'BBP_PD_PO_LOCK'
    EXPORTING
      i_header_guid = is_header-guid
    TABLES
      e_messages    = lt_messages.

* Fill return structure bad enqueue
  LOOP AT lt_messages INTO ls_message.
    PERFORM fill_bapireturn USING ls_message-msgty
                                  ls_message-msgid
                                  ls_message-msgno
                                  ls_message-msgv1
                                  ls_message-msgv2
                                  ls_message-msgv3
                                  ls_message-msgv4
                            CHANGING ls_return.
    APPEND ls_return TO ct_return.
    IF ls_message-msgty EQ c_msgty_e OR
       ls_message-msgty EQ c_msgty_a.
      MOVE c_on TO lv_error.
    ENDIF.
  ENDLOOP.
  IF NOT lv_error IS INITIAL.
    EXIT.
  ENDIF.

* update aktive document
  CALL FUNCTION 'BBP_PROCDOC_UPDATE'
    EXPORTING
      i_header                = is_header
      iv_with_change_approval = c_off  "do not create a change version
    TABLES
      i_item                  = it_items
      i_confirm               = it_conf
      i_longtext              = it_text
      e_messages              = lt_messages.

* Save aktive document without start off WF
  CALL FUNCTION 'BBP_PROCDOC_SAVE'
    EXPORTING
      iv_usertype    = c_wf_system
      iv_header_guid = is_header-guid.

* version update with order responce

* change version to PO
  LOOP AT it_items_cv INTO ls_items_cv.
    REFRESH: lt_conf_cv, lt_text_cv.

*   connect order responce to change version
    LOOP AT it_conf INTO ls_conf_cv
            WHERE p_guid EQ ls_items_cv-active_item.
      ls_conf_cv-p_guid = ls_items_cv-guid.
      APPEND ls_conf_cv TO lt_conf_cv.
    ENDLOOP.

*   connect order responce to change version
    LOOP AT it_text INTO ls_text_cv
            WHERE guid EQ ls_items_cv-active_item.
      ls_text_cv-guid = ls_items_cv-guid.
      APPEND ls_text_cv TO lt_text_cv.
    ENDLOOP.

    READ TABLE it_header_cv INTO ls_header_cv
                            WITH KEY guid = ls_items_cv-header.

    refresh lt_items_cv.
    append ls_items_cv to lt_items_cv.
*   update change version
    CALL FUNCTION 'BBP_PROCDOC_UPDATE'
      EXPORTING
        i_header                = ls_header_cv
        iv_with_change_approval = c_off "do not create a change version
      TABLES
        i_item                  = lt_items_cv
        i_confirm               = lt_conf_cv
        i_longtext              = lt_text_cv
        e_messages              = lt_messages.

*   Save change version without start off WF
    CALL FUNCTION 'BBP_PROCDOC_SAVE'
      EXPORTING
        iv_usertype    = c_wf_system
        iv_header_guid = ls_header_cv-guid.

  ENDLOOP.
* Fill return structure
  LOOP AT lt_messages INTO ls_message.
    PERFORM fill_bapireturn USING ls_message-msgty
                                  ls_message-msgid
                                  ls_message-msgno
                                  ls_message-msgv1
                                  ls_message-msgv2
                                  ls_message-msgv3
                                  ls_message-msgv4
                            CHANGING ls_return.
    APPEND ls_return TO ct_return.
    IF ls_message-msgty EQ c_msgty_e OR
       ls_message-msgty EQ c_msgty_a.
      MOVE c_on TO lv_error.
    ENDIF.
  ENDLOOP.
  IF NOT lv_error IS INITIAL.
    CALL FUNCTION 'BBP_PD_PO_UNLOCK'
      EXPORTING
        i_header_guid = is_header-guid.

    EXIT.
  ENDIF.



* Success message
  PERFORM fill_bapireturn USING 'I' 'BBP_PD' '143'
                                is_header-object_id space space space
                          CHANGING ls_return.
  APPEND ls_return TO ct_return.
ENDFORM.                    " update_po_with_conf

<b>Please try looking for other related Function modules as well -></b>

BAPI_POEC_ADD_CONFIRMATION

BBP_MAP_BAPICONF_TO_PDCONF

Do let me know.

Regards

- Atul

Former Member
0 Kudos

Hi,

Well when I copy paste the code in a test executable program and execute it,then, I do not get the dump. But when I put the same program in a method of the busniess object and call it from Workflow as background task, the workitem is in state 'In Process' and a short dump being issued.

Please find the Code I have used below:

CALL FUNCTION 'BBP_PROCDOC_GETDETAIL'
  EXPORTING
    i_guid   = guid
  IMPORTING
    e_header = e_header
  TABLES
    e_item   = i_item.

IF e_header-posting_date_fi LT sy-datum.
  e_header-posting_date_fi = sy-datum.
ELSE.
  EXIT.
ENDIF.


CALL FUNCTION 'BBP_PROCDOC_UPDATE'
  EXPORTING
*      i_save     = 'X'
    i_header   = e_header
    iv_with_change_version = ' '
  IMPORTING
    es_header  = es_header
  TABLES
    i_item     = i_item
    e_messages = e_message.

CALL FUNCTION 'BBP_PROCDOC_SAVE'
  EXPORTING
    iv_workitem_id = '000000000000'
    iv_header_guid = es_header-guid
    iv_object_type = es_header-object_type.

COMMIT WORK.  " AND WAIT.

If there is something wrong in the code then direct execution should not also work. Please let me know if anything extra has to be added in the code.

Regards,

Suman

Answers (0)