Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
ccc_ccc
Active Contributor

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


Step 3

Provide description


Step 4

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

Step 5

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

Say YES

Step 6

Double click on highlighted implementation class

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).


Step 8

in IF_EX_RSR_OLAP_BADI~DEFINE

Write code as shown in screenshot



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


Report Output

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

5 Comments
Labels in this area