cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Code for Delete Last Requests in Process Chain.

Former Member
0 Kudos

Hi Experts,

i searched a while but I cannot find the right solution I guess. I have the following Data flow: WO DSO to DSO (Full Load) and then DSO to Cube (delta).

WO-DSO to DSO - only last request should be loaded but before I load the last request, I have to delete the last request that was in the DSO. Then from DSO to Cube to also load this last request. The thing is that I have to do full load everyday for a specific time period and I don't want to delete the entire content of the DSO because it might have data before this specific time period. Thats why I want to delete only the last request from DSO. Could you please let me know the ABAP Code that I should include in the process chain to achieve this requirement.

I would appreciate any help on this. Thank you in advance.

Regards, Regys

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

any help on this please?

Thank you.

Regards,

Regys

RafkeMagic
Active Contributor
0 Kudos

you could start from this document: http://scn.sap.com/docs/DOC-32954 and change it to your requirements

(we did it on a previous project I worked on)

Former Member
0 Kudos

Hi Raf,

thank you very much for the response. I have seen this link but it doesn't really fit to our requirement as we need this ABAP code to be implemented in Process Chain, meaning the deletion to run as the process chain runs and not as a separate process. Do you have any other suggestion?

Thank you in advance.

Regards,

Regys

Former Member
0 Kudos

Try this one


Input -> DSO name

DTP-> WDSO to DSO


*****************************************************************************

tables: rsiccont.                      " Request posted to DSO

types: begin of s_l_t_request_to_delete,

        timestamp type rsstatmanpart-timestamp_anf,

        rnr type rsreqdone-rnr,

        end of s_l_t_request_to_delete.

data: l_t_request_to_delete type standard table of s_l_t_request_to_delete with header line,

       wa_l_t_request_to_delete type s_l_t_request_to_delete,

       wv_nb_req(4)         type c,

       wv_nb_req_del        type i,

       rnr_prev   type rsseldone-rnr,

       uzeit3     type sy-uzeit,

       deleted(1type c,

       uztmout   type sy-uzeit.

data i_date like  ccupeaka-timestamp.

data i_request_date like  ccupeaka-timestamp.

data i_diff_sec type i.

data i_diff_day type i.

data i_request_tm like rsreqdelstruc-timestamp.

parameters: i_cube type rsiccont-icube obligatory, i_dtp type rsstatmanpart-logdpid obligatory.

i_date+0(8) = sy-datum.

i_date+8(6) = '000000'.

i_request_tm = i_date.

select timestamp_anf rnr from

rsstatmanpart

into table l_t_request_to_delete

where logdpid    =    i_dtp        and

           dta     =    i_cube

*  and

*          timestamp_anf >= i_request_tm

order by timestamp_anf descending.

read table l_t_request_to_delete into wa_l_t_request_to_delete index 1.

if-sy-subrc eq 0.

    call function 'RSSM_DELETE_REQUEST'

     exporting

       request                    = wa_l_t_request_to_delete-rnr

       infocube                   = i_cube

     exceptions

       request_not_in_cube        = 1

       infocube_not_found         = 2

       request_already_aggregated = 3

       request_already_comdensed  = 4

       others                     = 5.

   if sy-subrc eq 0.

     add 1 to wv_nb_req_del.

   endif.

*Initialise the flag we'll use to track deletion of request from IC/ODS

*and also store request ID for tracking.

   rnr_prev = wa_l_t_request_to_delete-rnr.

   deleted = ''.

*Next check if we have a request to track and check every 30 secs until

*deleted.  Also lets set the timeout value in case something is locked

*and we can avoid endless loop by checking we haven't exceeded timeout.

   if rnr_prev ne ''.

     uzeit3 = sy-uzeit + uztmout.

     while deleted ne 'Y'.

       wait up to 30 seconds.

       select * from rsiccont

         where rnr eq rnr_prev and icube eq i_cube.

       endselect.

       if sy-subrc ne 0.

         deleted = 'Y'.

       elseif uzeit3 < sy-uzeit.

         write: / 'Timeout waiting for Deletion of:'.

         write : /5

           wa_l_t_request_to_delete-timestamp time zone 'CET   ',

           wa_l_t_request_to_delete-rnr.

         sy-subrc = 4.

         return.

       endif.

     endwhile.

endif.


*****************************************************************************


Regards,

Sandeep

Former Member
0 Kudos

Hi Sandeep,

thank you very much for the effort. One question, where do I add the name of the DSO that I want to delete the last request in the ABAP code you provided me. Sorry for the question, as I don't have lot of ABAP Skills.

Thank you.

Former Member
0 Kudos

first test create a program  in zdso_last_r ->>>se38.

Execute the program

give dso name

DTP ( dtp technical name ) ->>>loading from wso to dso.

It is coded to take the last request(by timestamp) from entered DTP.

I made it for cube, but it should work for DSO too,unless it is the last request.

In process chain, add an abap type and give this program name (zdso_last_r) and variant with values.

Regards,

Sandeep

Former Member
0 Kudos

Thank you very much. I will try it and let you know ASAP. I hope it will work for DSO because that is why I need it for.

Thank you.

RafkeMagic
Active Contributor
0 Kudos

you can call programs in process chains, so I don't understand why this wouldn't fit your requirements?

Former Member
0 Kudos

Hi Raf,

I tried to implement the code you suggested me, but there is the following error:

Line 159

Field "L_REQCNTL_REQCNT" is unknown. It is neither in one of the following specified tables nor defined by a "DATA" statement.

Can you suggest any fix on it? Thank you.

Regards,

Regys

Former Member
0 Kudos

Hi Sandeep,

for the deleting the last request of the cube, it worked find but for the DSO it gives me this error: 

If I run the program individually, sometimes for DSO works also but when I run in the Process Chain, it didnt delete the last request of the DSO.

Could you please give me some hint on this issue?

Thank you

Former Member
0 Kudos

I will test it and let you know in a day.

Former Member
0 Kudos

Thank you very much.

Former Member
0 Kudos

I have cleaned it up a bit. If you use it properly, it should work. ( You have delete the cube(s) request(s) also (datamart), without that you cannot delete last request from DSO).

***********************************************************

tables: rsiccont.                      " Request posted to InfoCube

types: begin of s_l_t_request_to_delete,

        timestamp type rsstatmanpart-timestamp_anf,

        rnr type rsreqdone-rnr,

        end of s_l_t_request_to_delete.

data: l_t_request_to_delete type standard table of s_l_t_request_to_delete with header line,

       wa_l_t_request_to_delete type s_l_t_request_to_delete,

       wv_nb_req(4)         type c,

       wv_nb_req_del        type i,

       rnr_prev   type rsseldone-rnr,

       uzeit3     type sy-uzeit,

       deleted(1type c,

       uztmout   type sy-uzeit.

data i_date like  ccupeaka-timestamp.

data i_request_date like  ccupeaka-timestamp.

data i_diff_sec type i.

data i_diff_day type i.

data i_request_tm like rsreqdelstruc-timestamp.

parameters: i_cube type rsiccont-icube obligatory, i_dtp type rsstatmanpart-logdpid obligatory.

i_date+0(8) = sy-datum.

i_date+8(6) = '000000'.

i_request_tm = i_date.

select timestamp_anf rnr from

rsstatmanpart

into table l_t_request_to_delete

where logdpid    =    i_dtp        and

           dta     =    i_cube

*  and

*          timestamp_anf >= i_request_tm

order by timestamp_anf descending.

read table l_t_request_to_delete into wa_l_t_request_to_delete index 1.

if sy-subrc eq 0.

   call function 'RSSM_DELETE_REQUEST'

     exporting

       request                    = wa_l_t_request_to_delete-rnr

       infocube                   = i_cube

     exceptions

       request_not_in_cube        = 1

       infocube_not_found         = 2

       request_already_aggregated = 3

       request_already_comdensed  = 4

       others                     = 5.

   if sy-subrc eq 0.

     WRITE:/ 'Request is deleted'.

   elseif sy-subrc eq 4.

     WRITE:/ 'Request is already updated to Datamart, Please delete it first'.

   elseif sy-subrc eq 1.

     WRITE:/ 'Request is not found'.

   elseif sy-subrc eq 2.

     WRITE:/ 'Infoprovider is not found'.

   elseif sy-subrc eq 5.

     WRITE:/ 'Some other problem occured'.

   endif.

endif.

**************************************************************

Regards,

Sandeep

Former Member
0 Kudos

Hi Regys,

The field is L_REQCNT (it is repeated).

Regards,

Gorka.

Former Member
0 Kudos

Thank you for the explanation, I will try it on Friday and hope that will work.

Best Regards,

Regys

Answers (4)

Answers (4)

Former Member
0 Kudos

Dear all,

thank you for your help and reply. The problem is solved and the points are assigned. I wished I could assign more than one correct answer.

Best Regards,

Regys

former_member223526
Participant
0 Kudos

Hi,

The delete overlapping request is the option readly avaible to delete the previos request from the target.

As this is full load u can do a delete overlap request. If it is a delta load use the delete entire content from target process step before loading the data to the DSO.

This will help.

Thanks,

Madhu.

Former Member
0 Kudos

Hi,

You can use delete overlapping request variant to achieve this.

Please gothrw the below link,

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e0431c48-5ba4-2c10-eab6-fc91a5fc2...

Hope this helps,

Regards,

Former Member
0 Kudos

Hi Regys,

Have you use this FM yet "RSSM_PORCESS_REQUDEL_ODSO"?

Regards,

Gorka.

Former Member
0 Kudos

Hi Gorka,

thank you for your response. I haven't this FM yet. Is there anyway to add this FM to my Process Chain right before DSO? Also, if I add this process, will this be automized, meaning that will delete all the DTP Requests to this DSO for the day before?

Thank you.

Regards,

Regys

Former Member
0 Kudos

Hi Regys,

You can insert FM in an ABAP program before the DSO load, this FM deletes the last load in DSO.

Regards,

Gorka.

Former Member
0 Kudos

Hi Gorka,

I will try this and see if it works and let you know. Thank you.