cancel
Showing results for 
Search instead for 
Did you mean: 

Start routine ABAP

Former Member
0 Kudos

Experts,

I need some help coding this Abap.

Scenario: I am Loading some data from DSO1 to DSO2. I have to filter out some documents in a start routine looking up a master data table.

My master data table has the following fields

Key: K_MINMAX,K_BUSAREA,0PROD_HIER

Attributes: K_MINPRC,K_MAXPRC (These are key figures).

Now my logic in the start routine should say,

When K_MINMAX = 100 AND K_BUSAREA = 2000 AND 0PROD_HIER = SOURCE_FIELDS-MATERIAL_OPRODH3 (NAVAIGATIONAL)

AND SOURCE_FIELDS-PRICE < K_MINPRC (From the master data table) AND

SOURCE_FIELDS-PRICE > K_MAXPRC (From the master data table).

Delete Data Package.

Can somebody help me code this....

Thanks

Raj

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

select single k_minprc k_maxprc from <your master data table> into <some local declared variables based on your master data table fields or a work area>

where k_minmax eq '100'

and k_busarea eq '2000'

and 0prod_hier eq source_fields-<the extact fieldname>.

if source_fields-price lt <variable containing k_minprc>

and source_fields-price gt<variable containing k_maxprc>.

delete data_package.

endif.

logic sounds a bit weird... a price that's smaller than the "minimum" and greater than the "maximum"?

Former Member
0 Kudos

some more refinement:

DATA: it-tab like line of /BI0/P... (master data table).

select single k_minprc k_maxprc from <your master data table> into it_tab where k_minmax eq '100'

and k_busarea eq '2000'

and 0prod_hier eq source_fields-<the extact fieldname>.

if source_fields-price lt it_tab-k_minprc

and source_fields-price gt it_tab-k_maxprc.

delete data_package.

endif.

Former Member
0 Kudos

Thanks Raf. Yes that is the business logic.

I coded as suggest by you

here is my code but I am getting an error saying that "Unable to interpret "WA2". Possible causes: Incorrect spelling or comma" Can you suggest what I am doing wrong...

Data: WA1(20) TYPE N.

Data: WA2(20) TYPE N.

select single /BIC/k_minprc /BIC/k_maxprc from /BIC/PK_MINMAX into WA1 WA2.

where k_minmax eq '100'

and k_busarea eq '2000'

and 0prod_hier eq source_fields-K_MATERL__0PRODH2.

if source_fields-K_PCLAMT <= WA1

and source_fields-K_PCLAMT >= WA2.

delete data_package.

endif.

Thanks

Raj

Former Member
0 Kudos

Hi, this code will not work as it is.

remove the period after W2 first.

We need to know th value of k_minmax, k_busarea and 0prod_hier from the source package first.

try this:

Data: tab like line of source_package.

Data: WA1(20) TYPE N.

Data: WA2(20) TYPE N.

read table source_package into tab index 1.

select single /BIC/k_minprc /BIC/k_maxprc from /BIC/PK_MINMAX into WA1 WA2

where /BIC/PK_MINMAX-k_minmax eq '100'

and /BIC/PK_MINMAX-k_busarea eq '2000'

and /BIC/PK_MINMAX-0prod_hier eq tab-K_MATERL__0PRODH2.

if source_fields-K_PCLAMT <= WA1

and source_fields-K_PCLAMT >= WA2.

delete source_package.

endif.

Former Member
0 Kudos

Raj,

Thanks for you input.

I am still having problems when I check my routine

It still gives me the error for the line in bold below..It says "Unable to interpret "WA2". Possible causes: Incorrect spelling or comma"

Data: tab like line of source_package.

Data: WA1(20) TYPE N.

Data: WA2(20) TYPE N.

read table source_package into tab index 1.

select single /BIC/k_minprc /BIC/k_maxprc from /BIC/PK_MINMAX into WA1 WA2 where /BIC/PK_MINMAX-k_minmax eq '100'

and /BIC/PK_MINMAX-k_busarea eq '2000'

and /BIC/PK_MINMAX-0prod_hier eq tab-K_MATERL__0PRODH2.

if source_fields-K_PCLAMT <= WA1

and source_fields-K_PCLAMT >= WA2.

delete source_package.

endif.

Former Member
0 Kudos

Data: tab like line of source_package.

Data: WA1(20) TYPE N.

Data: WA2(20) TYPE N.

read table source_package into tab index 1.

select single /BIC/k_maxprc from /BIC/PK_MINMAX into WA2 where /BIC/PK_MINMAX-k_minmax eq '100'

and /BIC/PK_MINMAX-k_busarea eq '2000'

and /BIC/PK_MINMAX-0prod_hier eq tab-K_MATERL__0PRODH2.

select single /BIC/k_minprc from /BIC/PK_MINMAX into WA1 where /BIC/PK_MINMAX-k_minmax eq '100'

and /BIC/PK_MINMAX-k_busarea eq '2000'

and /BIC/PK_MINMAX-0prod_hier eq tab-K_MATERL__0PRODH2.

if source_fields-K_PCLAMT <= WA1

and source_fields-K_PCLAMT >= WA2.

delete source_package.

endif.

Former Member
0 Kudos

change the "into" statement as follows:

select single /BIC/k_minprc /BIC/k_maxprc from /BIC/PK_MINMAX into ( WA1 , WA2 )

where /BIC/PK_MINMAX-k_minmax eq '100'

and /BIC/PK_MINMAX-k_busarea eq '2000'

and /BIC/PK_MINMAX-0prod_hier eq tab-K_MATERL__0PRODH2.