on 11-16-2005 8:09 PM
Hi ,
i am looking for a sample code for a update rule. I have to look to see in a ods table \bic\AXXX to see if there is a matching Delivery number and if there is, i have to pick a date field(ZDAT2) from that record to populate my ODS field (eg.ZDAT). When i do this , do i have to load a internal table or something like that????if yes, where do i do the loading???
Thank you
Southie
Hi,
I have worked on some thing similar, here it is sample code.
/code
select single * from /bic/azfpofi0600 where
/BIC/ZCSOURCE = COMM_STRUCTURE-/BIC/ZCSOURCE
and COUNTRY = COMM_STRUCTURE-COUNTRY
and /BIC/ZCGRACOY = COMM_STRUCTURE-/BIC/ZCGRACOY
and /BIC/ZCSEGMNT = COMM_STRUCTURE-/bic/zcsegmnt
and /BIC/ZCBS_UNIT = COMM_STRUCTURE-/BIC/ZCBS_UNIT
and /BIC/ZCFUNC = COMM_STRUCTURE-/BIC/ZCFUNC
and /BIC/ZCCST_CAT = COMM_STRUCTURE-/bic/zccst_cat
and FISCPER = v_pper
and /BIC/ZCCOA = COMM_STRUCTURE-/bic/zccoa
and FISCVARNT = COMM_STRUCTURE-FISCVARNT
and /BIC/ZCRVIEW1 = COMM_STRUCTURE-/BIC/ZCRVIEW1
and /BIC/ZCRVIEW2 = COMM_STRUCTURE-/BIC/ZCRVIEW2
and /BIC/ZCRVIEW3 = COMM_STRUCTURE-/BIC/ZCRVIEW3
and /BIC/ZCRVIEW4 = COMM_STRUCTURE-/BIC/ZCRVIEW4
and currency = COMM_STRUCTURE-currency
and /BIC/ZCRVIEW5 = COMM_STRUCTURE-/BIC/ZCRVIEW5.
if sy-subrc is initial.
v_mamt = COMM_STRUCTURE-AMOUNT - /bic/azfpofi0600-amount .
endif.
RESULT = v_mamt .
else.
v_mamt = COMM_STRUCTURE-AMOUNT.
result value of the routine
RESULT = v_mamt .
/code.
you can use internal table used to store all the data from ODS in the strat routin of the update rule and later you need to read that internal table in the update routine.
hope this helps.
cheers,
Balaji
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Balaji,
i am a novice in BAP and have never written a piece of Code. So this question may sound stupid, but in the piece of code, which one is the internal table??? And how do u load the internal table in the start routine, A sample code is what i am looking for in the start routine to load the internal table with respect to the code u sent me.........
Thank You
Hi ,
The sample code I had not used internal table. I will send you another sample code where I had used internal in the update start routine .
/Code***********
Internal table declarations***
TABLES: /bi0/mcostcenter.
DATA: i_mcostcenter LIKE /bi0/mcostcenter OCCURS 0 WITH HEADER LINE,(Internal table used).
wa_calquart LIKE umc_ys_dimvals.
$$ end of global - insert your declaration only before this line -
LOOP AT DATA_PACKAGE.
CLEAR ws_comp.
READ TABLE i_mcostcenter
WITH KEY costcenter = DATA_PACKAGE-costcenter
co_area = DATA_PACKAGE-co_area.
IF sy-subrc IS INITIAL.
ws_comp = i_mcostcenter-comp_code.
ELSE.
SELECT SINGLE * FROM /bi0/mcostcenter INTO i_mcostcenter
WHERE co_area = DATA_PACKAGE-co_area
AND costcenter = DATA_PACKAGE-costcenter
AND dateto GE sy-datum
AND datefrom LE sy-datum
AND objvers = 'A'.
IF sy-subrc IS INITIAL.
ws_comp = i_mcostcenter-comp_code.
APPEND i_mcostcenter.
ENDIF.
ENDIF.
IF ws_comp IN rcomp.
rcctr-sign = 'I'.
rcctr-option = 'EQ'.
rcctr-low = DATA_PACKAGE-costcenter.
APPEND rcctr.
ENDIF.
ENDLOOP.
/Code ***********************
hope this helps.
Cheers,
Balaji
Hi Southie,
1. You can read data from ODS table:
select * from ODS into INTERNAL_TABLE where... .
...
endselect.
But in this case perfomance will bad.
2. You can load data from ods to internal table once:
if INTERNAL_TABLE is initial.
select * from ODS into INTERNAL_TABLE where... .
...
endselect.
endif.
This IF will protect your load into intenal table (only once time per loading data_package). And then read data from this internal table for every record. In this case perfomance will better.
3. You should define this intenal table in Start routine and load the data from ODS. In routine for particular key figure or characteristic you can read the data from this intenal table.
\bic\AXXX - it is a database table.
data: lt_table like \bic\AXXX. - it is definition of an internal table. Press F1 to get help for this definition.
B.R.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.