Skip to Content

How to invoke nested logic script in package

Hi,

We have multiple logic scripts using *INCLUDE in single logic script[DEPR_COPY].

Each sub Logic script will be triggered based on the *WHEN condition.

In the package we are calling DEPR_COPY.LGF, the package succeeds on execution but no value is getting recorded. DEPR_COPY triggers QUARTER3.LGF logic script.

This is the first time am trying to call one logic script in another. Is the syntax proper. Please let me know what am missing in the query.

CODE of QUARTER3.LGF:

*XDIM_MEMBERSET APL_CATEGORY = ACT,FINAL_PLAN,EST_Q2,%APL_CATEGORY_SET%
*XDIM_MEMBERSET APL_PLANYEAR = %APL_PLANYEAR_SET%,NOPLANYEAR
*XDIM_MEMBERSET APL_AUDITTRAIL = 301,325
*XDIM_MEMBERSET APL_CURRENCY = LC
*XDIM_MEMBERSET APL_KEYFIGURE = AMT,FACTOR, PERCENT
*XDIM_MEMBERSET APL_TIMES = UNASSIGNED,%APL_TIMES_SET%
*XDIM_MEMBERSET APL_WBS = 17.CAP.38_ADMN_0012,17.CAP.38_ADMN_0017
*XDIM_MEMBERSET APL_CC = 38_ADMN
*WHEN APL_ACCOUNTS
*IS S80001,S80002
*WHEN APL_AUDITTRAIL
*IS 325
*WHEN APL_CATEGORY
*IS FINAL_PLAN
*WHEN APL_PLANYEAR
*IS %APL_PLANYEAR_SET%
*WHEN APL_TIMES
*IS %APL_TIMES_SET%
*REC(FACTOR = 1, APL_AUDITTRAIL = 325,APL_CATEGORY = %APL_CATEGORY_SET%,APL_TIMES = %APL_TIMES_SET%,APL_PLANYEAR = %APL_PLANYEAR_SET%)
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*WHEN APL_ACCOUNTS
*IS S80020
*WHEN APL_AUDITTRAIL
*IS 325
*WHEN APL_CATEGORY
*IS EST_Q2
*WHEN APL_PLANYEAR
*IS %APL_PLANYEAR_SET%
*WHEN APL_TIMES
*IS %APL_TIMES_SET%
*REC(FACTOR = 1, APL_AUDITTRAIL = 325,APL_CATEGORY = %APL_CATEGORY_SET%,APL_TIMES = %APL_TIMES_SET%,APL_PLANYEAR = %APL_PLANYEAR_SET%)
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*WHEN APL_ACCOUNTS
*IS S80029
*WHEN APL_AUDITTRAIL
*IS 325
*WHEN APL_CATEGORY
*IS EST_Q2
*WHEN APL_PLANYEAR
*IS %APL_PLANYEAR_SET%
*WHEN APL_TIMES
*IS %APL_TIMES_SET%
*WHEN APL_KEYFIGURE
*IS PERCENT
*REC(FACTOR = 1,  APL_AUDITTRAIL = 325,APL_CATEGORY = %APL_CATEGORY_SET%,APL_TIMES = %APL_TIMES_SET%,APL_PLANYEAR = %APL_PLANYEAR_SET%)
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*WHEN APL_ACCOUNTS
*IS S80021
*WHEN APL_AUDITTRAIL
*IS 325
*WHEN APL_CATEGORY
*IS EST_Q2
*WHEN APL_PLANYEAR
*IS %APL_PLANYEAR_SET%
*WHEN APL_KEYFIGURE
*IS FACTOR
*WHEN APL_TIMES
*IS %APL_TIMES_SET%
*REC(FACTOR = 1,  APL_AUDITTRAIL = 325,APL_CATEGORY = %APL_CATEGORY_SET%,APL_TIMES = %APL_TIMES_SET%)
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*WHEN APL_ACCOUNTS
*IS S80004,S80005,S80006
*WHEN APL_AUDITTRAIL
*IS 301
*WHEN APL_CATEGORY
*IS ACT
*WHEN APL_PLANYEAR
*IS NOPLANYEAR
*WHEN APL_TIMES
*IS UNASSIGNED
*REC(FACTOR = 1, APL_AUDITTRAIL = 325,APL_CATEGORY = %APL_CATEGORY_SET%,APL_TIMES = %APL_TIMES_SET%,APL_PLANYEAR = %APL_PLANYEAR_SET%)
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN

Our Parent Logic Script which will host other scripts: DEPR_COPY.LGF

*XDIM_MEMBERSET APL_CATEGORY = ACT,FINAL_PLAN,EST_Q2,%APL_CATEGORY_SET%
*XDIM_MEMBERSET APL_PLANYEAR = %APL_PLANYEAR_SET%,NOPLANYEAR
*XDIM_MEMBERSET APL_AUDITTRAIL = 301,325
*XDIM_MEMBERSET APL_CURRENCY = LC
*XDIM_MEMBERSET APL_KEYFIGURE = AMT,FACTOR, PERCENT
*XDIM_MEMBERSET APL_TIMES = UNASSIGNED,%APL_TIMES_SET%
*XDIM_MEMBERSET APL_WBS = 17.CAP.38_ADMN_0012,17.CAP.38_ADMN_0017
*XDIM_MEMBERSET APL_CC = 38_ADMN
*WHEN APL_CATEGORY
*IS EST_Q3
*INCLUDE QUARTER3.LGF
//*REC(FACTOR = 1, APL_AUDITTRAIL = 325,APL_CATEGORY = %APL_CATEGORY_SET%,APL_TIMES = %APL_TIMES_SET%,APL_PLANYEAR = %APL_PLANYEAR_SET%)
*ENDWHEN

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Oct 31, 2018 at 06:42 AM

    Sorry, but *INCLUDE means inserting text of the included script into text of parent script. You can't insert script after *WHEN/*IS - incorrect syntax

    If you need more help, please provide info in line with: https://blogs.sap.com/2014/01/31/how-to-ask-questions-about-script-logic-issues/

    P.S. Please explain the required calculation logic

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 31, 2018 at 07:25 AM

    Sample correct version of QUARTER3.LGF with proper scoping and single WHEN/ENDWHEN loop:

    //Scope for *IS in *WHEN/*ENDWHEN
    *XDIM_MEMBERSET APL_ACCOUNTS = S80001,S80002,S80020,S80029,S80021,S80004,S80005,S80006
    *XDIM_MEMBERSET APL_CATEGORY = ACT,FINAL_PLAN,EST_Q2
    *XDIM_MEMBERSET APL_PLANYEAR = %APL_PLANYEAR_SET%,NOPLANYEAR
    *XDIM_MEMBERSET APL_AUDITTRAIL = 301,325
    *XDIM_MEMBERSET APL_KEYFIGURE = AMT,FACTOR, PERCENT
    *XDIM_MEMBERSET APL_TIMES = UNASSIGNED,%APL_TIMES_SET%
    
    //Constant scope
    *XDIM_MEMBERSET APL_CURRENCY = LC
    *XDIM_MEMBERSET APL_WBS = 17.CAP.38_ADMN_0012,17.CAP.38_ADMN_0017
    *XDIM_MEMBERSET APL_CC = 38_ADMN
    
    *WHEN APL_ACCOUNTS
    *IS S80001,S80002
      *WHEN APL_AUDITTRAIL
      *IS 325
        *WHEN APL_CATEGORY
        *IS FINAL_PLAN
          *WHEN APL_PLANYEAR
          *IS %APL_PLANYEAR_SET%
            *WHEN APL_TIMES
            *IS %APL_TIMES_SET%
              *REC(FACTOR = 1,APL_CATEGORY = %APL_CATEGORY_SET%)
            *ENDWHEN
          *ENDWHEN
        *ENDWHEN
      *ENDWHEN
    *IS S80020
      *WHEN APL_AUDITTRAIL
      *IS 325
        *WHEN APL_CATEGORY
        *IS EST_Q2
          *WHEN APL_PLANYEAR
          *IS %APL_PLANYEAR_SET%
            *WHEN APL_TIMES
            *IS %APL_TIMES_SET%
              *REC(FACTOR = 1,APL_CATEGORY = %APL_CATEGORY_SET%)
            *ENDWHEN
          *ENDWHEN
        *ENDWHEN
      *ENDWHEN
    *IS S80029
      *WHEN APL_AUDITTRAIL
      *IS 325
        *WHEN APL_CATEGORY
        *IS EST_Q2
          *WHEN APL_PLANYEAR
          *IS %APL_PLANYEAR_SET%
            *WHEN APL_TIMES
            *IS %APL_TIMES_SET%
              *WHEN APL_KEYFIGURE
              *IS PERCENT
                *REC(FACTOR = 1,APL_CATEGORY = %APL_CATEGORY_SET%)
              *ENDWHEN
            *ENDWHEN
          *ENDWHEN
        *ENDWHEN
      *ENDWHEN
    *IS S80021
      *WHEN APL_AUDITTRAIL
      *IS 325
        *WHEN APL_CATEGORY
        *IS EST_Q2
          *WHEN APL_PLANYEAR
          *IS %APL_PLANYEAR_SET%
            *WHEN APL_TIMES
            *IS %APL_TIMES_SET%
              *WHEN APL_KEYFIGURE
              *IS FACTOR
                *REC(FACTOR = 1,APL_CATEGORY = %APL_CATEGORY_SET%)
              *ENDWHEN
            *ENDWHEN
          *ENDWHEN
        *ENDWHEN
      *ENDWHEN
    *IS S80004,S80005,S80006
      *WHEN APL_AUDITTRAIL
      *IS 301
        *WHEN APL_CATEGORY
        *IS ACT
          *WHEN APL_PLANYEAR
          *IS NOPLANYEAR
            *WHEN APL_TIMES
            *IS UNASSIGNED
              *REC(FACTOR = 1,APL_AUDITTRAIL=325,APL_CATEGORY= %APL_CATEGORY_SET%,APL_TIMES=%APL_TIMES_SET%,APL_PLANYEAR=%APL_PLANYEAR_SET%)
            *ENDWHEN
          *ENDWHEN
        *ENDWHEN
      *ENDWHEN
    *ENDWHEN

    Add comment
    10|10000 characters needed characters exceeded