Skip to Content
Technical Articles
Author's profile photo Ruma Ghosh

Date difference calculation BW/4

Dear All,

 

Just a simple approach for a requirement to calculate date difference in BEx query without using Formula Variable with Replacement Path.

Eg : We need to find the difference of posting dates( Stock Age ) of material in inventory with posting date of movement type 531/101  as Stock_Out date and posting date of movement type 601/631 as Stock_In.

  1. Create 2 KFs with type date as below.

 

 

2. Add to ADSO and map both KFs to posting date with datasource in TRFN.

3. To restrict on Query level, add the KFs in query and create a selection, restrict on Movement type BWART as 531/101 for Stock_Out and 601/631 for Stock_In.

4. Create a new formula and put below ( If not 0 check is not performed, it will show garbage values in report for Stock Age).

IF(“[ZSTOCK_OU] Stock-Out Posting Date” <> 0 AND
“[ZSTOCK_IN] Stock-In Posting Date” <> 0; “[ZSTOCK_OU] Stock-Out Posting Date”
– “[ZSTOCK_IN] Stock-In Posting Date”; 0)

5. Report Output :

 

 

Regards

Ruma Ghosh

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Ravi Kiran
      Ravi Kiran

      thanks for sharing.. very useful one. if possible let me know where we need to write formula here..