Simple Program to Check Active Requests in ODSOs / ADSOs


In this document, we will create a program to check the whether an ODSO/ADSO is having an Active request or not.

Scenario: We have BW data flow which loads data from the Source System to DSO and from DSO to further multiple targets, and at the end of the Process Chain the request should get deleted from the source.

Here, we have a case if someone did an ad-hoc load from Source System to DSO and subsequently to targets, and forgot to delete the request from the DSO.

This leads to duplicate data into Targets in next Process Chain run.

Solution: To take care of the above case we can keep a checkpoint in the Process Chain which will monitor the request in DSO. 
If an existing request is found in DSO, then a notification can be displayed and we can go ahead and remove it manually. 

Case1: When we have Extraction Layer as ODSO.
As we all know SAP has given a Standard Function Module RSSM_ICUBE_REQUESTS_GET which can be used to get the DTP requests which are present in ODSO by providing the input to this FM.

So, we will be writing a program which will call this Function Module and by passing the InfoProvider, to get the existing request(s) in DSO. 



  CALL FUNCTION 'RSSM_ICUBE_REQUESTS_GET'
    EXPORTING
      i_infocube     = p_odso
    IMPORTING
      e_t_request    = odso_requests
    EXCEPTIONS
      wrong_infocube = 1
      internal_error = 2
      OTHERS         = 3.
 DESCRIBE TABLE gt_part LINES g_lines.
  IF g_lines GE 1.
    MESSAGE e002 WITH 'More than 1 request in target!' p_ods.
  ENDIF.


Case 2: When we have Extraction Layer as ADSO.

Here, we don't have any Function Module which gives the requests details present in the ADSO so in this case, we need to write custom logic to get the request details.

We have a Table RSPMREQUEST from where we can get the request of the ADSOs by writing the program and can be used in Process Chain Step with Variant.


PARAMETERS:
  p_adso TYPE rsdodsobject OBLIGATORY.

DATA: gt_rspmrequest TYPE STANDARD TABLE OF rspmrequest.

START-OF-SELECTION.

  DATA:
      adso_requests      TYPE rssm_t_part,
      gt_lines                 TYPE sy-tabix.

SELECT * FROM rspmrequest INTO TABLE gt_rspmrequest
  WHERE LAST_OPERATION_TYPE = 'C' AND
        TLOGO = 'ADSO' AND
        DATATARGET = p_adso.


  IF sy-subrc <> 0.
    MESSAGE s003 WITH 'RSSM_ICUBE_REQUESTS_GET: No request found for target' p_adso sy-subrc.
    EXIT.
  ENDIF.


  DESCRIBE TABLE gt_rspmrequest LINES gt_lines.
  IF gt_lines GE 1.
    MESSAGE e002 WITH 'More than 1 request in target' p_adso.
  ENDIF.

So, to conclude, we can use the above to resolutions to avoid duplicates and to reduce manual efforts. 

Thanks !  



Comments

Popular posts from this blog

Simplification List for SAP BW/4HANA (SAP Release 18th June’ 2018)

Unforeseen Issue during SAP BW Data Flow Migration