понедельник, 8 июня 2015 г.

SAP CRM ECC How to get to object id, from bDoc message id

How to get object id when queues names have a short 2 digits number?
 
Sometimes you can get 1000 of BDocs, which are failed due to some issues( server crash, wrong code implementation and etc.) now it is more difficult to get B.object ID.
 
  1. First method with code for big numbers of mistakes.
For this you can implement short program with code:
REPORT  ZZTESTKM.

tablessmw3_bdoc.

datagt_bdoc type table of smw3_bdoc,
      gs_bdoc 
type smw3_bdoc.

SELECT-OPTIONSs_id for smw3_bdoc-BDOC_ID.

START-OF-SELECTION.

select from smw3_bdoc into table gt_bdoc
                        
where bdoc_id in s_id.

loop at gt_bdoc into gs_bdoc.

  
perform write.

ENDLOOP.
*&---------------------------------------------------------------------*
*&      Form  WRITE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM WRITE .

data l_body_ext type COMT_PROD_MATERIAL_BDOC_TAB.
data l_mat type COMT_PROD_MATERIAL_BDOC.

  
CALL METHOD cl_smw_bdocstore=>get_bdoc
    
EXPORTING
      bdoc_id           
gs_bdoc-BDOC_ID
      GET_BDOC_HEADER   
space
      GET_BODY_EXT      
'X'
    
IMPORTING
       bdoc_body_ext    
l_body_ext.

  
loop at l_body_ext into l_mat.
    
write/ gs_bdoc-BDOC_IDl_mat-header-COM_PRODUCT-PRODUCT_ID.
  
endloop.

ENDFORM.                    " WRITE
 
 
You have to input only ID of BDoc messages and you will get result.
Advantage of this method, that you will get you  BObject ID even, if Object link was already deleted.
 
Second method:
  1. Without code.
    Go to T-code: SQVI
     
    Join tables:  SRRELROLES (field ROLETYPE) with SMWOREL(field ROLEA), and
    SMWOREL (field ROLE B) with SRRELROLES (field RoleID)
     
    In next way
     
    And fields for selection: Object Type, Object Key, and again Object key, object type
     
     
     
    Run request. Input ID of BDoc messages from T-code SMW02 into 1st field Object key
    you will get Object GUID
     
     
     
    This method has one disadvantage, if bDocs are too old and already lost their object link – this method doesn’t work.

Комментариев нет:

Отправить комментарий