month extraction in where clause of The ABAP Stage

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
saraswati
Premium Member
Premium Member
Posts: 149
Joined: Thu Feb 28, 2008 4:25 pm

month extraction in where clause of The ABAP Stage

Post by saraswati »

I am using ABAP Extract stage of the Ascential PACK for SAP R/3 to extract data from SAP.
In this stage in ABAP Program tab,
I am using Build SQL Query Option.

I have to select all records where a salesdate belongs to last month only.
Data type of salesdate is DATS in SAP.

Database used for SAP is SQL server 2000.

So I select
Build-->Where tab.

Can u suggest how to do it?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Looks like you and "mona lisa" need to talk.
-craig

"You can never have too many knives" -- Logan Nine Fingers
saraswati
Premium Member
Premium Member
Posts: 149
Joined: Thu Feb 28, 2008 4:25 pm

Post by saraswati »

The field salesdate contains data like '20090131'.
I used LEFT(salesdate,4) to have first four char of this field.
As per my understanding it should return 2009.

But it is throwing error when I try to "generate program" option.
Comma without preceding colon (after SELECT ?).

Please suggest.
arunsardana
Participant
Posts: 10
Joined: Sun Oct 08, 2006 8:01 am

Post by arunsardana »

Hello Saraswati,

You can use following WHERE CLAUSE to extract data for any particular or previous month:

SalesDate >= '20090601 and SalesData <= '20090630' ---this is an example for month of june.

If you want to change the month dynamically, you can parameterize WHERE clause and then pass the previous month to WHERE CLAUSE from a sequencer. we use this technique to send sales data for previous month on the first of every month - just an exmaple where we use it.

Regards,
Arun
Post Reply