Advertisement
Ahmed_Ait_Lahcen

Untitled

Aug 1st, 2023
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 10.51 KB | None | 0 0
  1.   METHOD if_swf_flex_ifs_condition_def~get_conditions.
  2. *&**********************************************************************
  3. *OBJECT ID             : ZCL_MM_SWF_WORKFLOW_COND                      *
  4. *TITLE                 : Purchase Order Pre-Condition check            *
  5. *AUTHOR                : Shiva Krishna                                 *
  6. *DATE                  : 17/02/2021                                    *
  7. *DEVELOPMENT ID        : W-PR-0001                                     *
  8. *Rev-Trac              : 326,129,198,2781                              *
  9. *REQUESTED BY          : Rachel McCutcheon                             *
  10. *TRANSPORT NO.         : SD1K904020,SD1K905223,SD1K905390,SD1K905462   *
  11. *                        SD1K905550                                    *
  12. *DESCRIPTION           : Purchase Order Pre-Condition check            *
  13. * To check the preconditions for the workflow to get trigger           *
  14. *&**********************************************************************
  15. *&                      CHANGE HISTORY LOG                             *
  16. *&---------------------------------------------------------------------*
  17. * DATE(MM/DD/YYYY)|    DEVELOPER     |   REQUESTOR    |   TRANSPORT #  *
  18. * 07/29/2021      |   Shiva Krishna  |     Eswar      | TR# SD1K906194 *
  19. * DESCRIPTION : Added new logic to determine the PR workflow agents    *
  20. * 11/17/2021       | Venkatesh        |    Eswar      | TR# SD1K907675 *
  21. *                                                           SD1K907863 *
  22. * DESCRIPTION : New logic for procurement manager and PG#903           *
  23. *&---------------------------------------------------------------------*
  24. * 01/10/2023      | Ahmed Ait Lahcen | Hamza Asrar | TR# SD1K911104    *
  25. * DESCRIPTION : Suppress WF approval for some contract change scenarios*
  26. *&---------------------------------------------------------------------&
  27. * 02/20/2023    | Ahmed Ait Lahcen    | Hamza Asrar   | TR# SD1K911356 *
  28. * DESCRIPTION : Suppress WF approval for PO / Contract                 *
  29. *&---------------------------------------------------------------------&
  30.  
  31. *&--- Local WorkArea Declarations
  32.     DATA : ls_condition LIKE LINE OF ct_condition.
  33.     DATA : ls_parameter LIKE LINE OF ct_parameter.
  34.  
  35. *&--- Contract Reference Conditions
  36. *&--- Update the Pre-Conditions
  37.     ls_condition-id = 1.
  38.     ls_condition-subject = 'Contract Reference'.
  39.     ls_condition-type    = if_swf_flex_ifs_condition_def=>cs_condtype-start_step.
  40.     APPEND ls_condition TO ct_condition.
  41.     CLEAR : ls_condition.
  42.  
  43. *&--- Update Parameters for Pre-Conditions
  44.     ls_parameter-id = 1.
  45.     ls_parameter-name = 'EKPO-KONNR'.
  46.     ls_parameter-xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string.
  47.     ls_parameter-mandatory = abap_false.
  48.     APPEND ls_parameter TO ct_parameter.
  49.     CLEAR : ls_parameter.
  50.  
  51. *&--- Target Value for Outline Agreement in Document Currency
  52. *&--- Update the Pre-Conditions
  53.     ls_condition-id = 3.
  54.     ls_condition-subject = 'Total net value of all line items in Quantity Contract greater than'.
  55.     ls_condition-type    = if_swf_flex_ifs_condition_def=>cs_condtype-start_step.
  56.     APPEND ls_condition TO ct_condition.
  57.     CLEAR : ls_condition.
  58.  
  59. *&--- Update Parameters for Pre-Conditions
  60.     ls_parameter-id = 3.
  61.     ls_parameter-name = 'EKPO-ZWERT'.
  62.     ls_parameter-xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string.
  63.     ls_parameter-mandatory = abap_false.
  64.     APPEND ls_parameter TO ct_parameter.
  65.     CLEAR : ls_parameter.
  66.  
  67.     ls_parameter-id = 3.
  68.     ls_parameter-name = 'Currency'.
  69.     ls_parameter-xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string.
  70.     ls_parameter-mandatory = abap_false.
  71.     ls_parameter-service_path = '/sap/opu/odata/sap/S_MMPURWorkflowVH_CDS'.
  72.     ls_parameter-entity       = 'S_MMPURWorkflowVH'.
  73.     ls_parameter-property     = 'Currency'.
  74.     APPEND ls_parameter TO ct_parameter.
  75.     CLEAR : ls_parameter.
  76.  
  77. *&--- Target Value for Outline Agreement in Document Currency
  78. *&--- Update the Pre-Conditions
  79.     ls_condition-id = 4.
  80.     ls_condition-subject = 'Total net value of all line items in Quantity Contract less than or equal to'.
  81.     ls_condition-type    = if_swf_flex_ifs_condition_def=>cs_condtype-start_step.
  82.     APPEND ls_condition TO ct_condition.
  83.     CLEAR : ls_condition.
  84.  
  85. *&--- Update Parameters for Pre-Conditions
  86.     ls_parameter-id = 4.
  87.     ls_parameter-name = 'EKPO-ZWERT1'.
  88.     ls_parameter-xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string.
  89.     ls_parameter-mandatory = abap_false.
  90.     APPEND ls_parameter TO ct_parameter.
  91.     CLEAR : ls_parameter.
  92.  
  93. *&--- Update Currency
  94.     ls_parameter-id = 4.
  95.     ls_parameter-name = 'Currency'.
  96.     ls_parameter-xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string.
  97.     ls_parameter-mandatory = abap_false.
  98.     ls_parameter-service_path = '/sap/opu/odata/sap/S_MMPURWorkflowVH_CDS'.
  99.     ls_parameter-entity       = 'S_MMPURWorkflowVH'.
  100.     ls_parameter-property     = 'Currency'.
  101.     APPEND ls_parameter TO ct_parameter.
  102.     CLEAR : ls_parameter.
  103.  
  104. *&--- Account Assignment Category
  105. *&--- Update the Pre-Conditions
  106.     ls_condition-id = 5.
  107.     ls_condition-subject = 'Account Assignment Category'.
  108.     ls_condition-type    = if_swf_flex_ifs_condition_def=>cs_condtype-start_step.
  109.     APPEND ls_condition TO ct_condition.
  110.     CLEAR : ls_condition.
  111.  
  112. *&--- Update Parameters for Pre-Conditions
  113.     ls_parameter-id = 5.
  114.     ls_parameter-name = 'EBAN-KNTTP'.
  115.     ls_parameter-xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string.
  116.     ls_parameter-mandatory = abap_false.
  117.     APPEND ls_parameter TO ct_parameter.
  118.     CLEAR : ls_parameter.
  119.  
  120. *&--- Account Assignment Category
  121. *&--- Update the Pre-Conditions
  122.     ls_condition-id = 6.
  123.     ls_condition-subject = 'Job Code'.
  124.     ls_condition-type    = if_swf_flex_ifs_condition_def=>cs_condtype-start_step.
  125.     APPEND ls_condition TO ct_condition.
  126.     CLEAR : ls_condition.
  127.  
  128. *&--- Update Parameters for Pre-Conditions
  129.     ls_parameter-id = 6.
  130.     ls_parameter-name = 'PA0001-ZZJOB_CODE'.
  131.     ls_parameter-xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string.
  132.     ls_parameter-mandatory = abap_false.
  133.     APPEND ls_parameter TO ct_parameter.
  134.     CLEAR : ls_parameter.
  135.  
  136. *&--- PR Initiator Manager/Cost center owner
  137. *&--- Update the Pre-Conditions
  138.     ls_condition-id = 7.
  139.     ls_condition-subject = 'Initiator Manager/Cost Center Owner'.
  140.     ls_condition-type    = if_swf_flex_ifs_condition_def=>cs_condtype-start_step.
  141.     APPEND ls_condition TO ct_condition.
  142.     CLEAR : ls_condition.
  143.  
  144. *&--- Update Parameters for Pre-Conditions
  145.     ls_parameter-id = 7.
  146.     ls_parameter-name = 'M/O'.
  147.     ls_parameter-xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string.
  148.     ls_parameter-mandatory = abap_false.
  149.     APPEND ls_parameter TO ct_parameter.
  150.     CLEAR : ls_parameter.
  151.  
  152. *&--- Job Code at Manager's Level
  153. *&--- Update the Pre-Conditions
  154.     ls_condition-id = 8.
  155.     ls_condition-subject = TEXT-t01.
  156.     ls_condition-type    = if_swf_flex_ifs_condition_def=>cs_condtype-start_step.
  157.     APPEND ls_condition TO ct_condition.
  158.     CLEAR : ls_condition.
  159.  
  160. *&--- Update Parameters for Pre-Conditions
  161.     ls_parameter-id = 8.
  162.     ls_parameter-name = 'PA0001-ZZJOB_CODE'.
  163.     ls_parameter-xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string.
  164.     ls_parameter-mandatory = abap_false.
  165.     APPEND ls_parameter TO ct_parameter.
  166.     CLEAR : ls_parameter.
  167.  
  168. *&--- Job Code at cost centre owner's Level
  169. *&--- Update the Pre-Conditions
  170.     ls_condition-id = 9.
  171.     ls_condition-subject = TEXT-t02.
  172.     ls_condition-type    = if_swf_flex_ifs_condition_def=>cs_condtype-start_step.
  173.     APPEND ls_condition TO ct_condition.
  174.     CLEAR : ls_condition.
  175.  
  176. *&--- Update Parameters for Pre-Conditions
  177.     ls_parameter-id = 9.
  178.     ls_parameter-name = 'PA0001-ZZJOB_CODE'.
  179.     ls_parameter-xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string.
  180.     ls_parameter-mandatory = abap_false.
  181.     APPEND ls_parameter TO ct_parameter.
  182.     CLEAR : ls_parameter.
  183.  
  184. *&--- Begin of changes for RT 1412 tr SD1K907675
  185. *&--- Procurement Manager
  186. **&--- Update the Pre-Conditions
  187.     ls_condition-id = 10.
  188.     ls_condition-subject = 'Procurement Manager'.
  189.     ls_condition-type    = if_swf_flex_ifs_condition_def=>cs_condtype-start_step.
  190.     INSERT ls_condition INTO TABLE ct_condition.
  191.     CLEAR : ls_condition.
  192.  
  193. *&--- Update Parameters for Pre-Conditions
  194.     ls_parameter-id = 10.
  195.     ls_parameter-name = 'P'.
  196.     ls_parameter-xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string.
  197.     ls_parameter-mandatory = abap_false.
  198.     APPEND ls_parameter TO ct_parameter.
  199.     CLEAR : ls_parameter.
  200.  
  201.  
  202. *&--- Purchasing group 903
  203. **&--- Update the Pre-Conditions
  204.     ls_condition-id = 11.
  205.     ls_condition-subject = 'Approval Level'.
  206.     ls_condition-type    = if_swf_flex_ifs_condition_def=>cs_condtype-start_step.
  207.     INSERT ls_condition INTO TABLE ct_condition.
  208.     CLEAR : ls_condition.
  209.  
  210. *&--- Update Parameters for Pre-Conditions
  211.     ls_parameter-id = 11.
  212.     ls_parameter-name = '1/2/3'.
  213.     ls_parameter-xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string.
  214.     ls_parameter-mandatory = abap_false.
  215.     APPEND ls_parameter TO ct_parameter.
  216.     CLEAR : ls_parameter.
  217.  
  218. *&--- End of changes for RT 1412 tr SD1K907675
  219.  
  220. *&--- Begin of code for RT# 2781 TR# SD1K911104
  221. *&--- Update the Pre-Conditions
  222.     ls_condition-id = 12.
  223.     ls_condition-subject = 'Contract change'.
  224.     ls_condition-type    = if_swf_flex_ifs_condition_def=>cs_condtype-start_step.
  225.     INSERT ls_condition INTO TABLE ct_condition.
  226.     CLEAR : ls_condition.
  227.  
  228. *&--- Update Parameters for Pre-Conditions
  229.     ls_parameter-id = 12.
  230.     ls_parameter-name = 'Contract change'.
  231.     ls_parameter-xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string.
  232.     ls_parameter-mandatory = abap_false.
  233.     APPEND ls_parameter TO ct_parameter.
  234.     CLEAR : ls_parameter.
  235. *&--- End of code for RT# 2781 TR# SD1K911104
  236.  
  237. *&--- Begin of code for RT# 2876 TR# SD1K911356
  238. *&--- Update the Pre-Conditions
  239.     ls_condition-id = 13.
  240.     ls_condition-subject = 'PO change'.
  241.     ls_condition-type    = if_swf_flex_ifs_condition_def=>cs_condtype-start_step.
  242.     INSERT ls_condition INTO TABLE ct_condition.
  243.     CLEAR : ls_condition.
  244.  
  245. *&--- Update Parameters for Pre-Conditions
  246.     ls_parameter-id = 13.
  247.     ls_parameter-name = 'PO change'.
  248.     ls_parameter-xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string.
  249.     ls_parameter-mandatory = abap_false.
  250.     APPEND ls_parameter TO ct_parameter.
  251.     CLEAR : ls_parameter.
  252. *&--- End of code for RT# 2876 TR# SD1K911356
  253.  
  254.   ENDMETHOD.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement