Skip to Content

Requirement: There is report which needs to display delivery status based on delivery date, let say if delivery date is less than or equal to current month then delivery status is “Completed” , if delivery date is greater than current month then delivery status is “Pending”.

Different Solutions:

  1. 1. Writing VB macros
  2. 2. Writing JAVA/HTML code
  3. 3. Writing code in transformation while modeling itself.
  4. 4. Using BADI mechanism with RSR_OLAP_BADI

Pros and Cons of each Solution

  1. 1.      Option only suitable when report output is in excel workbook,
  2. 2.      Option only suitable when report output is in web portal
  3. 3.      Option is not suitable at all because delivery date may change at any time its depends on the stock   availability
  4. 4.      Options is the best option to fit all requirement, hence choose virtual characters concept

Step 1

Goto SE19 transaction code

Step 2

Click on “Create Implementation” as shown in below image


/wp-content/uploads/2014/09/1_534237.png

Step 3

Provide description

/wp-content/uploads/2014/09/2_534238.png


Step 4

Provide info provider name for which you want implement virtual characteristics as shown in below screenshot

/wp-content/uploads/2014/09/3_534284.png

Step 5

Go to–>sample->Copy select menu as shown on below screenshot

/wp-content/uploads/2014/09/4_534287.png

Say YES

Step 6

Double click on highlighted implementation class

/wp-content/uploads/2014/09/5_534288.png

Step 7

In attribute column provide characteristics which you want read data from info provider and also provide virtual characteristics information, here in my case, provided two infoobjects one ZDLDATE (which contain delivery date) and second ZSTATUS (virtual characteristic to specify delivery status).

/wp-content/uploads/2014/09/6_534289.png


Step 8

in IF_EX_RSR_OLAP_BADI~DEFINE

Write code as shown in screenshot


/wp-content/uploads/2014/09/7_534290.png


IF_EX_RSR_OLAP_BADI~INITIALIZE

Do not change anything here, this code is copied while performing step 5, please check

Write code in COMPUTE as like below

IF_EX_RSR_OLAP_BADI~COMPUTE

METHOD if_ex_rsr_olap_badi~compute .

  FIELD-SYMBOLS:

    <fs_date> TYPE ANY,

    <fs_status> TYPE ANY.

  DATA: firstdate TYPE sy-datum,

        finaldate TYPE sy-datum,

        day(2) TYPE n,

        month(2) TYPE n,

        year(4) TYPE n.

  day = sy-datum+6(2).

  month = sy-datum+4(2).

  year = sy-datum+0(4).

  CONCATENATE year month day INTO firstdate.

  CALL FUNCTION ‘SLS_MISC_GET_LAST_DAY_OF_MONTH’

    EXPORTING

      day_in = firstdate

    IMPORTING

      last_day_of_month = finaldate

    EXCEPTIONS

      day_in_not_valid  = 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.

  IF p_cha_zdldate > 0 AND p_cha_zstatus > 0.

    ASSIGN COMPONENT p_cha_zdldate OF STRUCTURE c_s_data TO <fs_date>.

    ASSIGN COMPONENT p_cha_zstatus OF STRUCTURE c_s_data TO <fs_status>.

    IF <fs_date> <= finaldate.

      <fs_status> = ‘COMPLETED’.

    else.

      <fs_status> = ‘PENDING’.

    ENDIF.

  ENDIF.

  1. ENDMETHOD.

Infocube Data

Highlighted one is virtual char in infocube, no data in infocube


/wp-content/uploads/2014/09/8_534291.png

Report Output

Populated data at run-time for delivery status info object.

/wp-content/uploads/2014/09/9_534292.png

To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

      1. RUSHIKESH YEOLE

        FINALDATE calculation can be pushed to initialize method using global attribute.

        BADI option should not be used when there is large amount of data (COPA, Inventory) for performance.

        preferable options are  remodeling, Nav attributes, transformation end routines.

        (0) 

Leave a Reply