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:
Pros and Cons of each Solution
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 |