Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the status of Idoc

Former Member
0 Kudos

Hi All,

I need help regarding issue where i need to change the idoc status to ERROR(51),to reprocess it using program RBDMANI2(this program processes idocs only with status 51(Error)).

I am using function module EDI_DOCUMENT_CLOSE_EDIT to close the idoc after the changes are made to the "Idoc data". Inside this function module the status record table for Idoc "EDIDS" is filled.

So I need to change status record to "ERROR" to reprocess it using the program mentioned above.

Please help to solve this issue.

Thanks & Regards,

Lakshmi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Put the following code in your ABAP

Code:

Update edidc set status = '51'
where docnum = doc_to_update.

<b>Thanks for the reward!</b>

2 REPLIES 2

Former Member
0 Kudos

Put the following code in your ABAP

Code:

Update edidc set status = '51'
where docnum = doc_to_update.

<b>Thanks for the reward!</b>

0 Kudos

I thought the newer releases had a transaction to do this? In the past, I've used this program...

report zsu_idoc_status   no standard page heading
                         message-id fb
                         line-size 120
                         line-count 90(0).


*-----------------------------------------------------------------------
* Program Name  : ZSU_IDOC_STATUS
* Create Date   : 10/17/2001
* Application   : FI
* Logical DB    : None
* Description   : Utility to add a status record to an existing
*                 inbound IDoc.  Changes status to 68 (Error -
*                 no further processing).
*
* Inputs        : None
* Functions     : POPUP_TO_CONFIRM_STEP         - confirm step
*                 IDOC_STATUS_WRITE_TO_DATABASE - add status record
*
* Components    :
*
*
* Modifications:
*-----------------------------------------------------------------------


*----------------------------------------------------------------------*
* Tables                                                               *
*----------------------------------------------------------------------*
tables: edidc,                " Control record (IDoc)
        bhdgd.                " Common data area batch heading routine


*----------------------------------------------------------------------*
* Data Declarations                                                    *
*----------------------------------------------------------------------*
data: w_abort(1)          type c.      " abort flag


*----------------------------------------------------------------------*
* Internal Tables and Structures
*----------------------------------------------------------------------*
* status records to add
data: begin of i_status occurs 1.
        include structure bdidocstat.
data: end of i_status.


*----------------------------------------------------------------------*
* Selection Screen Parameters
*----------------------------------------------------------------------*
selection-screen skip 1.
selection-screen begin of block aa01 with frame title text-001.

parameters:
  p_docnum    like edidc-docnum obligatory.         " IDoc number

selection-screen skip 1.

parameters:
  p_text1     like bdidocstat-msgv1,                " status text
  p_text2     like bdidocstat-msgv2,
  p_text3     like bdidocstat-msgv3,
  p_text4     like bdidocstat-msgv4.

selection-screen skip 1.

parameters:
  p_status    like bdidocstat-status  default '68'. " status value

selection-screen end of block aa01.


*----------------------------------------------------------------------*
* Constants
*----------------------------------------------------------------------*
initialization.
  perform check_authorization.
  perform close_status_field.


*----------------------------------------------------------------------*
* Start of Selection
*----------------------------------------------------------------------*

start-of-selection.

  perform check_authorization.       " verify authorization
  perform get_idoc_info.             " get IDoc control record
  if not w_abort is initial.         " exit if not found or outbound
    message i000 with 'IDoc' p_docnum 'is invalid'.
    exit.
  endif.
  perform add_status.                " add status record

end-of-selection.


*&---------------------------------------------------------------------*
*&      Form  check_authorization
*&---------------------------------------------------------------------*
*       Check authorization
*----------------------------------------------------------------------*
form check_authorization.

* authorization check
*  authority-check object 'ZIDOCSTAT'
*            id 'ACTVT' field '01'.
*  if sy-subrc <> 0.
*    message e000(fb) with 'No authorization for IDoc *status update'.
*  endif.

endform.                    " check_authorization


*&---------------------------------------------------------------------*
*&      Form  add_status
*&---------------------------------------------------------------------*
*       Add status record to IDoc
*----------------------------------------------------------------------*
form add_status.

  data: l_answer(1)    type c,                 " reply from popup
        l_text1(50)    type c,                 " text for popup
        l_text2(50)    type c.                 " text for popup

  refresh i_status.
  clear:  i_status, l_text1, l_text2.

  i_status-status = p_status.
  i_status-msgty  = 'E'.
  i_status-msgid  = 'FB'.
  i_status-msgno  = '000'.
  i_status-msgv1  = p_text1.
  i_status-msgv2  = p_text2.
  i_status-msgv3  = p_text3.
  i_status-msgv4  = p_text4.

  append i_status.

  concatenate 'IDoc' p_docnum 'has a status of' edidc-status '.'
               into l_text1 separated by space.

  concatenate 'Update IDoc type' edidc-idoctp '?'
               into l_text2 separated by space.

  call function 'POPUP_TO_CONFIRM_STEP'
       exporting
            defaultoption  = 'N'
            textline1      = l_text1
            textline2      = l_text2
            titel          = sy-title
       importing
            answer         = l_answer
       exceptions
            others         = 1.

  if l_answer = 'J'.              " (J)a = YES

    call function 'IDOC_STATUS_WRITE_TO_DATABASE'
      exporting
        idoc_number                     = p_docnum
      tables
        idoc_status                     = i_status
      exceptions
        idoc_foreign_lock               = 1
        idoc_not_found                  = 2
        idoc_status_records_empty       = 3
        idoc_status_invalid             = 4
        db_error                        = 5
        others                          = 6.

    if sy-subrc <> 0.
      message i000 with '** ERROR UDPATING IDOC' p_docnum.
    else.
      message i000 with 'IDoc' p_docnum 'update to status' p_status.
    endif.

  endif.

endform.                    " add_status


*&---------------------------------------------------------------------*
*&      Form  close_status_field
*&---------------------------------------------------------------------*
*       Close the new status value field for input; display only
*----------------------------------------------------------------------*
form close_status_field.

  loop at screen.
    if screen-name = 'P_STATUS'.
      screen-input = '0'.            " output only
      modify screen.
    endif.
  endloop.

endform.                    " close_status_field


*&---------------------------------------------------------------------*
*&      Form  get_idoc_info
*&---------------------------------------------------------------------*
*       Get IDoc information from control record
*----------------------------------------------------------------------*
form get_idoc_info.

  clear edidc.

  select single * from edidc          " get control record
    where docnum = p_docnum.

  if sy-subrc <> 0         or         " not found
    edidc-direct <> '2'.              " not inbound
    w_abort = 'X'.
  endif.

endform.                    " get_idoc_info