Supply Chain Management Blogs by Members
Learn about SAP SCM software from firsthand experiences of community members. Share your own post and join the conversation about supply chain management.
cancel
Showing results for 
Search instead for 
Did you mean: 
thanga_prakash
Active Contributor

This document will help you to find the where used list of the planning area in process chain steps in DP.

List of process types considered:

  1. SCM_DP003    Initialize (Create Time Series Objects)
  2. SCM_DP004    Deintitialize (Delete Time Series objects)
  3. SCM_DP005    DP Background Processing
  4. SCM_DP007    Load Data from InfoCube
  5. SCM_DP008    Copy Planning Version
  6. SCM_DP010    Time Series consistency Check

Selection:

Enter planning area in selection screen and execute, you will get the where used list of the planning area in process chains.


*&---------------------------------------------------------------------*


*& Report  ZBTP_PA_WHERE_USED_LIST


*&


*&---------------------------------------------------------------------*


*& This report is used to find the where used list of the planning area


*& in the process chains


*&---------------------------------------------------------------------*



REPORT  zbtp_pa_where_used_list.



*Types-pool


TYPE-POOLS: slis.



*Selection screen


PARAMETERS: Pl_area TYPE /sapapo/ts_pareaid.



*Types


TYPES: BEGIN OF ty_tsplb,


        jobnr TYPE /sapapo/jobnr,


       END OF ty_tsplb.


TYPES: BEGIN OF ty_dp005,


        chain_id TYPE rspc_chain,


       END OF ty_dp005.


TYPES: BEGIN OF ty_so_tsplb,


        sign   TYPE c LENGTH 1,


        option TYPE c LENGTH 2,


        low    TYPE rspc_variant,


        high   TYPE rspc_variant,


      END OF  ty_so_tsplb.


TYPES: BEGIN OF ty_final,


        type TYPE rspc_type,


        description TYPE rstxtlg,


        chain_id TYPE rspc_chain,


       END OF ty_final.


TYPES: BEGIN OF ty_report,


        sign   TYPE c LENGTH 1,


        option TYPE c LENGTH 2,


        low    TYPE vari_reprt,


        high   TYPE vari_reprt,


       END OF  ty_report.


TYPES: BEGIN OF ty_rspctype,


        sign   TYPE c LENGTH 1,


        option TYPE c LENGTH 2,


        low    TYPE rspc_type,


        high   TYPE rspc_type,


       END OF  ty_rspctype.


TYPES: BEGIN OF ty_varid,


        report TYPE vari_reprt,


        variant TYPE variant,


       END OF ty_varid.



*Internal table declaration


DATA: itab_so_report TYPE TABLE OF ty_report,


      itab_lt_tsplb TYPE TABLE OF ty_tsplb,


      itab_lt_dp005 TYPE TABLE OF ty_dp005,


      itab_lt_varid TYPE TABLE OF ty_varid,


      itab_lt_so_dp005 TYPE TABLE OF ty_so_tsplb,


      itab_lt_final TYPE TABLE OF ty_final,


      itab_lt_values TYPE TABLE OF rsparams,


      itab_so_type TYPE TABLE OF ty_rspctype,


      itab_lt_rspcvariant TYPE TABLE OF rspcvariant.



*Work area declaration


DATA: str_ls_varid TYPE ty_varid,


      str_ls_dp005 TYPE ty_dp005,


      str_ls_report TYPE ty_report,


      itab_lt_fcat TYPE slis_t_fieldcat_alv,


      str_ls_fcat TYPE slis_fieldcat_alv,


      str_lt_tsplb TYPE ty_tsplb,


      str_ls_so_dp005 TYPE ty_so_tsplb,


      str_ls_final TYPE ty_final,


      str_ls_values TYPE rsparams,


      str_ls_rspcvariant TYPE  rspcvariant,


      str_ls_type TYPE ty_rspctype,


      str_ls_rspcchain TYPE rspcchain,


      c_lv_variant TYPE raldb_vari.



*Process Type SCM_DP005 (DP Background Processing)


*Selection of job number


SELECT jobnr


  FROM /sapapo/tsplb


  INTO TABLE itab_lt_tsplb


  WHERE parea = Pl_area.


LOOP AT itab_lt_tsplb INTO str_lt_tsplb.


  str_ls_so_dp005-sign = 'I'.


  str_ls_so_dp005-option = 'EQ'.


  str_ls_so_dp005-low = str_lt_tsplb-jobnr.


  APPEND str_ls_so_dp005 TO itab_lt_so_dp005.


ENDLOOP.


IF itab_lt_so_dp005 IS NOT INITIAL.


*Selection of process chain


  SELECT chain_id


    FROM rspcchain


    INTO TABLE itab_lt_dp005


    WHERE variante IN itab_lt_so_dp005.


ENDIF.


DELETE ADJACENT DUPLICATES FROM itab_lt_dp005.


LOOP AT itab_lt_dp005 INTO str_ls_dp005.


  str_ls_final-type = 'SCM_DP005'.


  str_ls_final-description = 'DP Background Processing'.


  str_ls_final-chain_id = str_ls_dp005-chain_id.


  APPEND str_ls_final TO itab_lt_final.


ENDLOOP.



str_ls_report-sign = 'I'.


str_ls_report-option = 'EQ'.


str_ls_report-low = '/SAPAPO/TS_PAREA_INITIALIZE'.


APPEND str_ls_report TO itab_so_report.



str_ls_report-sign = 'I'.


str_ls_report-option = 'EQ'.


str_ls_report-low = '/SAPAPO/TS_PAREA_DE_INITIALIZE'.


APPEND str_ls_report TO itab_so_report.



str_ls_report-sign = 'I'.


str_ls_report-option = 'EQ'.


str_ls_report-low = '/SAPAPO/RTSINPUT_CUBE'.


APPEND str_ls_report TO itab_so_report.



str_ls_report-sign = 'I'.


str_ls_report-option = 'EQ'.


str_ls_report-low = '/SAPAPO/RTSCOPY'.


APPEND str_ls_report TO itab_so_report.



str_ls_report-sign = 'I'.


str_ls_report-option = 'EQ'.


str_ls_report-low = '/SAPAPO/TS_LCM_CONS_CHECK'.


APPEND str_ls_report TO itab_so_report.



*Selection of variants from variants directory


SELECT report


       variant


  FROM varid


  INTO TABLE itab_lt_varid


  WHERE report IN itab_so_report.



str_ls_type-sign = 'I'.


str_ls_type-option = 'EQ'.


str_ls_type-low = 'SCM_DP003'.


APPEND str_ls_type TO itab_so_type.



str_ls_type-sign = 'I'.


str_ls_type-option = 'EQ'.


str_ls_type-low = 'SCM_DP004'.


APPEND str_ls_type TO itab_so_type.



str_ls_type-sign = 'I'.


str_ls_type-option = 'EQ'.


str_ls_type-low = 'SCM_DP007'.


APPEND str_ls_type TO itab_so_type.



str_ls_type-sign = 'I'.


str_ls_type-option = 'EQ'.


str_ls_type-low = 'SCM_DP008'.


APPEND str_ls_type TO itab_so_type.



str_ls_type-sign = 'I'.


str_ls_type-option = 'EQ'.


str_ls_type-low = 'SCM_DP010'.


APPEND str_ls_type TO itab_so_type.



*Selection of process variants


SELECT *


  FROM rspcvariant


  INTO TABLE itab_lt_rspcvariant


  WHERE type IN itab_so_type.



*Process type SCM_DP003 Initialize (Create Time Series Objects)


PERFORM fm_final_list USING 'SCM_DP003' '/SAPAPO/TS_PAREA_INITIALIZE' 'PAREA' 'Initialize (Create Time Series Objects)'.


*Process type SCM_DP004 Deinitialize (Delete Time Series Objects)


PERFORM fm_final_list USING 'SCM_DP004' '/SAPAPO/TS_PAREA_DE_INITIALIZE' 'PAREA' 'Deintitialize (Delete Time Series objects)'.


*Process type SCM_DP007 Load Data from InfoCube


PERFORM fm_final_list USING 'SCM_DP007' '/SAPAPO/RTSINPUT_CUBE' 'P_AREA' 'Load Data from InfoCube'.


*Process type SCM_DP008 Copy Planning Version


PERFORM fm_final_list USING 'SCM_DP008' '/SAPAPO/RTSCOPY' 'P_AREA' 'Copy Planning Version'.


*Process type SCM_DP010 Time Series consistency Check


PERFORM fm_final_list USING 'SCM_DP010' '/SAPAPO/TS_LCM_CONS_CHECK' 'PAREA' 'Time Series consistency Check'.



*Sorting and deleting the duplicates


SORT itab_lt_final BY type description chain_id ASCENDING.


DELETE ADJACENT DUPLICATES FROM itab_lt_final.



*Build field catalog


str_ls_fcat-col_pos = '1'.


str_ls_fcat-fieldname = 'TYPE'.


str_ls_fcat-seltext_l = 'Process type'.


str_ls_fcat-seltext_m = 'Process type'.


str_ls_fcat-tabname = 'ITAB_LT_FINAL'.


str_ls_fcat-ref_tabname = 'RSPROCESSTYPEST'.


str_ls_fcat-ref_fieldname = 'TYPE'.


APPEND str_ls_fcat TO itab_lt_fcat.



str_ls_fcat-col_pos = '2'.


str_ls_fcat-fieldname = 'DESCRIPTION'.


str_ls_fcat-seltext_l = 'Description'.


str_ls_fcat-seltext_m = 'Description'.


str_ls_fcat-tabname = 'ITAB_LT_FINAL'.


str_ls_fcat-ref_tabname = 'RSPROCESSTYPEST'.


str_ls_fcat-ref_fieldname = 'DESCRIPTION'.


APPEND str_ls_fcat TO itab_lt_fcat.



str_ls_fcat-col_pos = '3'.


str_ls_fcat-fieldname = 'CHAIN_ID'.


str_ls_fcat-seltext_l = 'Process Chain'.


str_ls_fcat-seltext_m = 'Process Chain'.


str_ls_fcat-tabname = 'ITAB_LT_FINAL'.


str_ls_fcat-ref_tabname = 'RSPCCHAIN'.


str_ls_fcat-ref_fieldname = 'CHAIN_ID'.


APPEND str_ls_fcat TO itab_lt_fcat.



*ALV list display


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'


  EXPORTING


    i_callback_program = sy-repid


    it_fieldcat       = itab_lt_fcat


  TABLES


    t_outtab          = itab_lt_final


  EXCEPTIONS


    program_error     = 1


    OTHERS            = 2.


IF sy-subrc <> 0.


  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno


          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.


ENDIF.


*&---------------------------------------------------------------------*


*&      Form  FM_FINAL_LIST


*&---------------------------------------------------------------------*


*       text


*----------------------------------------------------------------------*


*      -->P_0486   text


*      -->P_0487   text


*      -->P_0488   text


*      -->P_0489   text


*----------------------------------------------------------------------*


FORM fm_final_list  USING p_type TYPE rspc_type


                          p_report TYPE raldb_repo


                          p_selname TYPE rsscr_name


                          p_description TYPE rstxtlg.


  LOOP AT itab_lt_rspcvariant


  INTO str_ls_rspcvariant


  WHERE type = p_type.


    c_lv_variant = str_ls_rspcvariant-low.


    CALL FUNCTION 'RS_VARIANT_VALUES_TECH_DATA'


      EXPORTING


        report              = p_report


        variant             = c_lv_variant


      TABLES


        variant_values      = itab_lt_values


      EXCEPTIONS


        variant_non_existent = 1


        variant_obsolete    = 2


        OTHERS              = 3.


    IF sy-subrc EQ 0.


      READ TABLE itab_lt_values


            INTO str_ls_values


        WITH KEY selname = p_selname.


      IF sy-subrc EQ 0 AND str_ls_values-low EQ Pl_area.


        SELECT SINGLE *


          FROM rspcchain


          INTO str_ls_rspcchain


          WHERE type EQ str_ls_rspcvariant-type


          AND variante EQ str_ls_rspcvariant-variante.


        IF sy-subrc EQ 0.


          str_ls_final-type = p_type.


          str_ls_final-description = p_description.


          str_ls_final-chain_id = str_ls_rspcchain-chain_id.


          APPEND str_ls_final TO itab_lt_final.


        ENDIF.


      ENDIF.


    ENDIF.


  ENDLOOP.


ENDFORM.                    " FM_FINAL_LIST



Result:

Please let me know in case if I missed any other process types related to planning area, so that I will update the same.

1 Comment