Update Routine ABAP question
Hi,
I am updating data between two ODS objects using some update routines. I would like to write the following routine (in pseudo code):
++++++++++++++++++++++++++++++++++++++++++++++++++++
Check if the characteristic i am updating is not null
IF COMM_STRUCTURE-field1 = 'value1' AND
COMM_STRUCTURE-field2 = 'value2'.
RESULT COMM_STRUCTURE-field3.
ELSE.
Don't update anything
END IF
+++++++++++++++++++++++++++++++++++++++++++++++++++
My questions:
1. How i tell the routine not to update anything (as specified in the pseudo code)?
2. How i can check that the characteristic i woul like to update is not null?
3. What is the preferred debug method in case i do not use the PSA?
BR,
Xibi
Thanks Siggi for your prompt and helpful answer. There are however some fundamental things which are not fully clear to me (BTW, where i can find some good documentation on ABAP for BW??):
> Hi,
>
> 1. How i tell the routine not to update anything (as
> specified in the pseudo code)?
>
> set the returncode to a value <> 0.
I wrote the following:
returncode = 1.
Consequently the updated failed. Maybe i am doing something wrong but my intention is not to have the whole thing fail, but rather skip the update for some records.
> 2. How i can check that the characteristic i woul
> like to update is not null?
>
> if not comm_structure-<fieldname> is initial.
The problem is that the characteristic i am trying to update is not contained in the source ODS but only in the target one. Will "if not comm_structure-<fieldname> is initial" still work in this case?
>
> 3. What is the preferred debug method in case i do
> not use the PSA?
>
> Without psa, you need to add a endless loop:
> statics: st_flag type c value '0'.
>
> while st_flag = '0'.
> break-point.
> endwhile.
>
>
> Hope this helps!
>
> regards
>
> Siggi
Similar Messages
-
Hi,
I am trying to write an update routine to calculate and populate fields in my ODS infoprovider.
one of the key figure field in my update rules is 'No. of Days'. Based on the 'No. of Days' range, I want to send a key figure(Infoobject:Due amount) value to another infoobject(Bucket1, Bucket2, Bucket3 ect.)in my ODS infoprovider. For example, let's say,
IF NO. OF DAYS = >0 AND <=30
THEN TAKE THE DUE AMOUNT PUT IN BUCKET1
ENDIF.
ELSE IF
NO. OF DAYS = >31 AND <=60
THEN TAKE THE DUE AMOUNT PUT IN BUCKET2
ENDIF.
ELSE IF
NO. OF DAYS = >61 AND <=90
THEN TAKE THE DUE AMOUNT PUT IN BUCKET3
ENDIF.
I think, I know the data flow logic but I don't know how to code in ABAP language. If someone can give me some psuedo like ABAP code, I would appreciate your help with points.Hi Roa,
I would do this in the start routine of the update rule.
Here is a sample on how do this. You could use a case statement for this code also.
Loop at Data_Packet.
IF NO. OF DAYS = >0 AND <=30
Data_Packet-BUCKET1 = DUE AMOUNT
ELSEIF
NO. OF DAYS = >31 AND <=60
Data_Packet-BUCKET2 = DUE AMOUNT
ENDIF.
ELSEIF
NO. OF DAYS = >61 AND <=90
Data_Packet-BUCKET3 = DUE AMOUNT
ENDIF.
modify data_packet.
endlloop.
Cheers! Bill -
Hi All,
I am new in SAP BW and I am trying to learn more on the ABAP Routine in the Update Rule.
Questions:
1. The program name is always UPDATE_ROUTINE?
2. There will always be a default subroutine "compute_data_field"?
3. What do you mean by MONITOR STRUCTURE RSMONITOR?
4. Is COMM_STRUCTURE a keyword in ABAP?
5. Is it possible to give me a details of each MONITOR STRUCTURE part of the code?
PROGRAM UPDATE_ROUTINE.
$$ begin of global - insert your declaration only below this line -
TABLES: ...
DATA: ...
$$ end of global - insert your declaration only before this line -
FORM compute_data_field
TABLES MONITOR STRUCTURE RSMONITOR "user defined monitoring
USING COMM_STRUCTURE LIKE /BIC/CS8ZD2C_O05
RECORD_NO LIKE SY-TABIX
RECORD_ALL LIKE SY-TABIX
SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
CHANGING RESULT LIKE /BIC/VZD2C_C05T-/BIC/ZABLSTCST
RETURNCODE LIKE SY-SUBRC
ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
$$ begin of routine - insert your code only below this line -
fill the internal table "MONITOR", to make monitor entries
result value of the routine
RESULT = .
if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
if abort is not equal zero, the update process will be canceled
ABORT = 0.
$$ end of routine - insert your code only before this line -
ENDFORM.Found out through self-study
-
Converting Tx Routines and Update Routines in to Tranformation in 2004's
Hi,
I have to get all the data from the existing BW 3.5 system in to the BI 7.0 system.
While the conversion process if I choose to create the transformation instead and installing the update rules and tranfer rules and migrating those to the tranformations.
Here I have three similiar questions:
i. So, if I copy the transfer routines in to the Transformation, then do I have to change any ABAP Code? Is there any syntax changes that have to be take care off.
ii. If I copy the Update routines in to the Transformation, then do I have to change any ABAP Code? Is there any syntax changes that have to be take care off.
iii. If I copy the Start routines in to the Transformation, then do I have to change any ABAP Code? Is there any syntax changes that have to be take care off.
I appreciate your help. Thanks!1) TRAN_STRUCTURE to SOURCE_FIELDS
2) COMM_STRUCTURE to SOURCE_FIELDS
3) DATA_PACKAGE to SOURCE_PACKAGE
http://help.sap.com/saphelp_nw04s/helpdata/en/44/bd9b5be97c112ce10000000a11466f/content.htm -
Diff between Start ,transfer,update routines
hi
Plz tell me what is the difference between Start routine,transfer routine and update routine. Send me some real time examples.I would be very glad.
Regards
AjayHi!
it is simple all of them are small program used in ETL process while loading in to BW.
<b>Start routine:-</b> is used in Transfer rules and update rules, this abap code is executed before starting the load and used in scenarios where we want to perform some operations on all the data example deleting some records before processing records in Update rules or transfer rules.
<b>Update routine:-</b> abap code used in update rules to transform or finding some field. ex:- may be you want to retrieve the field data from some data base tables based on the other data present in the infosource
<b>Transfer Routine:-</b> similar to the update routine but used in transfer rules.
with regards
ashwin
<i>PS n: Assigning point to the helpful answers is the way of saying thanks in SDN. you can assign points by clicking on the appropriate radio button displayed next to the answers for your question. yellow for 2, green for 6 points(2)and blue for 10 points and to close the question and marked as problem solved. closing the threads which has a solution will help the members to deal with open issues with out wasting time on problems which has a solution and also to the people who encounter the same porblem in future. This is just to give you information as you are a new user.</i> -
Urgent help required to write the code in update routine
Hi all,
i want to calculate open purchase order qty in update routine
formula is
open purchase order qty = scl qty - rec qty
where schd line date is less then or equal to 90 days from the current date.
I have written one code : but its giving error that comm_structure is not defined in abap dictionary,can any body help to write appropriate routine. this calculation i am making for MM, and data source and cube are 2lis_02_scl and cube is zc_pur01 ( made by coping the 0pur_c01), data source scl has all fields required in the foumula...here is my code
DATA: COMM_STRUCTURE LIKE /BIC/CS2LIS_02_SCL.
DATA: SCL_QTY LIKE COMM_STRUCTURE-/BIC/ZK_SCLQTY.
DATA: GR_QTY LIKE COMM_STRUCTURE -/BIC/ZK_GRQTY.
DATA: SCL_DATE.
SCL_DATE = SY-DATUM + 90.
SELECT COMM_STRUCTURE -/BIC/ ZK_SCLQTY COMM_STRUCTURE -/BIC/ ZK_GRQTY FROM
/BIC/CS2LIS_02_SCL INTO SCL_QTY GR_QTY
WHERE
COMM_STRUCTURE -/0SCHED_DATE LE SCL_DATE.
IF SYSUBRC = 0
RESULT = SCL_QTY - GR_QTY.
ELSE = NOVALUE.
ENDIF.
Can any body help me soon its very urgent.
thanksHi Anupam,
I am not a very good ABAP Programmer, but found some things to notify u inyour code..
DATA: COMM_STRUCTURE LIKE /BIC/CS2LIS_02_SCL,
SCL_QTY LIKE COMM_STRUCTURE-/BIC/ZK_SCLQTY,
GR_QTY LIKE COMM_STRUCTURE -/BIC/ZK_GRQTY.
DATA SCL_DATE LIKE SY-DATUM.
SCL_DATE = SY-DATUM + 90.
SELECT COMM_STRUCTURE -/BIC/ ZK_SCLQTY COMM_STRUCTURE -/BIC/ ZK_GRQTY FROM
/BIC/CS2LIS_02_SCL INTO SCL_QTY GR_QTY
WHERE
COMM_STRUCTURE -/0SCHED_DATE LE SCL_DATE.
IF SYSUBRC = 0
RESULT = SCL_QTY - GR_QTY.
ELSE.
What should be the return value if you dont have to calculate the result."
ENDIF.
try it.. and see..
regards,
kishore. -
Update Routine & Start Routine in BI 7.0
Hi Experts,
We have recently upgraded from BI 7.0 , I am confused about where to write start routine & update routine in transformations of BI 7.0?
Please mention any pointers?
Thanks.
Sharat.Hi
When you open the start routine you will see a routines info which gives you help on this.
A summary would be:
Update routine in transformation.
RESULT = source_field-material.
Basically you can acess the value of the record by using source_field.
Start routine.
The data comes in the form of an internal table with name SOURCE_PACKAGE.
You can access the values by looping into a work area.
LOOP AT SOURCE_PACKAGE assigning <source_fields>.
ENDLOOP.
End routine(This is a new feature in BI 7.0 where you can modify data when transformations are complete and before data is updated to info-providers)
The data comes in the form of an internal table with name RESULT_PACKAGE.
You can access the values by looping into a work area.
LOOP AT RESULT_PACKAGE assigning <result_fields>.
ENDLOOP.
Hope this helps you to understand the basics of the abap used in the transformations .
Regards
Samarpita -
Update Routine to populate 0VENDOR from either of the 2 data source fields
Hi,
I have a requirement to write an update routine for 0VENDOR based on the below logic :
Create routines to populated BW Info Object u201CVendoru201D (0VENDOR) based on the following logic:
IF field u201CVendoru201D (ITM_VENDOR_ID) is populated from data source 0BBP_SC_TD_1, THEN populate 0VENDOR with that value
ELSE IF u201CPreferred Vendoru201D (ITM_PROPVEN_ID) is populated from data source 0BBP_SC_TD_1, THEN populate 0VENDOR with that value
ELSE IF neither u201CVendoru201D (ITM_VENDOR_ID) or u201CPreferred Vendoru201D (ITM_PROPVEN_ID) are populated from data source 0BBP_SC_TD_1, then 0VENDOR = NULL
Can anyone help me in converting this logic into ABAP routine.
Thanks,
SuchitraHi Suchitra,
In the Transfer Rules ... You will be mapping each field then the mapping field click on the button with Triangle then you can see the which type you want.
Then select the routine and select the datasource fields (don't forget to select the both fields VENDOR and PROPITM)...
Then give a name to routine ...
and in the code just change the COMM_STRUCTURE to TRANSFER_STRUCTURE.
Then you can get this .... done..
Regards,
Ravi Kanth -
Update routine - Performance Tuning
Hi,
To increase the performance, I have deleted some records in the data_package but these changes are not reflecting in the ALV output. We are getting old data only.
If we toutch the standard ALV program it is a problem for other update routinies. Please tell me the solution.
Thanks,
Suresh KashimallaPlease be more specific, and elaborate on your issue. What are you referring to with ALV (ABAP List Viewer?). In which respect? Are you on SAP NetWeaver 2004s?
Cheers
SAP NetWeaver BI Organisation -
Update routine for 0proc_unit conversion
Hi all,
My infoobject 0OPR_ACTWRK uses 0PROC_UNIT for units. It holds data in days and in hours. When I load it to a cube, I want to convert all values to working hours.
I figured out that I have to use an update routine in my update rules. A lot of forum threads about unit conversion mention the function module UNIT_CONVERSION_SIMPLE. Can I use this function for my problem? Or should I use a different function module?
This will be my first ABAP code, so can anyone help me and tell me what I have to fill in exactle in the routine format below?
$$ begin of routine - insert your code only below this line -
fill the internal table "MONITOR", to make monitor entries
result value of the routine
RESULT = .
result value of the unit
UNIT = .
if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
if abort is not equal zero, the update process will be canceled
ABORT = 0.
$$ end of routine - insert your code only before this line -
Thanks in advance!
Regards, PieterDear Pieter,
I am not infront of the system..
the following surely will give error.. :).. so post back here.. so that me or someone else will reply you..
So let us start witht he following coding in the 'Start routine'.
LOOP AT DATA_PACKAGE.
IF DATA_PACKAGE-UNIT= 'DAY'.
DATA_PACKAGE-opr_pldwrk = DATA_PACKAGE-opr_pldwrk * 8.
ELSE.
Do nothing.
ENDIF.
MODIFY DATA_PACKAGE.
ENDLOOP.
Regards,
Hari
Message was edited by: Hari Kiran Y
Message was edited by: Hari Kiran Y -
Friends,
I am intrigued with the following date comparison logic. This is a small snippet that I cut&paste from SAP code and modified to check whether the logic is correct.
the logic below writes STATUS 68. From SAP point of view and I agree, that it should not write 68.
Can you please elaborate the problem here.
Thanks in advance.
William
DATA: i_aedat type sy-datum, " Equipment Change date in the decentral
l_aedat type sy-datum. " Equipment Change date in the central.
I_aedat = '20120119'. "From deployed
L_aedat = '20120118'. "In central
* posting in Central
if l_aedat is not initial.
*...change mode
if I_aedat < L_aedat.
*.....existing entry is the actual one,
*.....we don't won't overtake old data
write: / 'status 68'.
endif.
endif.
Moderator message: please choose more descriptive titles for your posts, everybody here has ABAP questions...
Edited by: Thomas Zloch on Feb 20, 2012Ok, here is the function module
Please note i_aedat is the change date in the decentral and l_aedat is the changed date in the central
The function module determine whether the existing central date is before the Decentrla date.
If so it would update the central data with decentral data.
Code below produce 68 at our installation and it does not with Vijaj and Patrick. I concur with their reply.
The code that I have provided is how the function module behaves.
So is it a kernel issue?
Any help is much appreciated.
Thanks
William
function /isdfps/etups_maintain_chk.
""Lokale Schnittstelle:
*" IMPORTING
*" REFERENCE(I_EQUNR) TYPE EQUNR
*" REFERENCE(I_AEDAT) TYPE AEDAT
*" EXCEPTIONS
*" NOT_ALLOWED
data: l_aedat like equi-aedat.
select single aedat into l_aedat
from equi
where equnr = i_equnr.
if sy-subrc is initial and
l_aedat is not initial.
*...change mode
if i_aedat < l_aedat.
*.....existing entry is the actual one,
*.....we don't won't overtake old data
raise not_allowed.
endif.
endif.
endfunction. -
Routine (ABAP Code) in Transformation for the below sceaniro
Hi Experts,
Please update me with the routine (ABAP)(transformations)
Source Char:
Policy Start Date: ZSTRT_DTE (CHAR:Data Type: DATS)
Target Char:
Policy Expiry Date: ZEXP_DTE (CHAR:Data Type: DATS)
FM: FIMA_VTBKOND_CALC_DATES
Months(I_MONTHS) = 6
Using Policy Start Date as input need to call the FM and months input is 6 MOnths and pass that result to Target char.
ThanksHi,
try the following :
CALL FUNCTION 'FIMA_VTBKOND_CALC_DATES'
EXPORTING
i_date = source_fields-/bic/ZSTRT_DTE
i_months = '6'
IMPORTING
e_date = result.
hope it helps...
regards,
Raju -
Havent a clue! Please help! Easy ABAP Question!
Helly Gurus
I am loading from a dso to a cube and doing a lookup on a second dso.
eg
'Name' is in the DSO1
I lookup 'Address' from DSO2
Then load to the cube.
The problem is there may be more than one address so although I have coded the lookup to
find all addresses, I do know how to get these into my results.
Only the first address it finds is there.
loop at DATA_PACKAGE.
select * from DSO1 where
NAME = DATA_PACKAGE-NAME.
if sy-subrc = 0.
move-corresponding DSO2 to itab1. collect itab1.
endif.
endselect.
endloop.
What do I need to do to get all of the results?
I am in 3.5 so do not have the use of an End Routine.
Thanks
Tom Tomyou need to do several treatments in fact you need to add records on the data_package (by the way it is not an easy ABAP question as you mentioned !)
So
Treatment 1: select all the records from ods2 table of adresses outside the loop
select names adresses
from ods2
into table g_itab_ods2
for all entries in data_package
where name eq data_package-name.
Treatment 2: delete double records of the internal table.
delete adjacent duplicates from g_itab_ods2 comparing names adresses.
Treatment 3: loop over the data_package. Within this loop read the internal ods2 table and loop over it to assign the corresponding adresses. Then append the results to the temporary data_package_tmp and move all the records to the initial data_package.
loop at data_package assigning <data_fields>.
read table g_itab_ods2 into l_g_itab_ods2
with key name = <data_fields>-name.
if sy-subrc eq 0.
loop at g_itab_ods2 assigning <adresses>
where name = <data_fields>-name.
<data_fields>-adresses= <adresses>-adresses.
append <data_fields> to lt_data_package_tmp.
endloop.
endif.
endloop.
data_package[] = lt_data_package_tmp[].
free lt_data_package_tmp.
this should do what you want to do. hope this could help you out. -
How to create monitor entries from an update routine?
Hi,
Does anyone try to create monitor entries in ABAP routine in update rules?
I have How-to guide "How to... Create monitor entries from an update routine". I applied code from it.
RETURNCODE = 1.
MONITOR-MSGID = 'RSM'.
MONITOR-MSGTY = 'W'. *** I also tried MONITOR-MSGTY = 'E'
MONITOR-MSGNO = '799'.
MONITOR-MSGV1 = 'My message '.
MONITOR-MSGV2 = COMM_STRUCTURE-<MY_FIELD>.
append MONITOR.
EXIT.
But it doesn't work. I don't see new lines on Details tab in AWB Monitor.
What's wrong?
BW 3.0BHi, hope you had a good weekend.
I tried with MSGTY = 'I' and I didn't get any errors or warnings at load.
In the monitor, on the detail tab, I find hidden under:
Processing (data packet)
-> Data Package x
-> Transfer rules
-> Data records for package x
-> Record 0:
-> Record 0:
-> Record 0:
When I select "Display Message(s)" from the dropdown-menu on one of these "Record 0:" lines, I get to see
my message text: S:RSM:000 test1 test2
1) how can I change the text that appears in the monitor tree ("Record 0:") ?
2) The status of these nodes is always a green led (also with MSGTY = 'W')... shouldn't it be a yellow triangle?
Like this it is hell to find your warnings/information messages.
3) I cannot find my monitor messages with transaction SLG1... should I be able to find them there?
Kind regards,
Edwin -
Look up at master data in update routine
Hi all,
I am loading from flat file in to an infocube. My transaction data comes in the format Subcategory, Area,Date, Sales qty,UOM. But my infocube should be filled with Category,Subcategory,Region,Area,Date,SalesQty,UOM. My business requirements want me to model Category, Subcategory,Region area as characteristics of dimension. ie I cannot model Category as navigational attribute of Subcategory and Region as navigational attribute of Area.
But I can get the master data file for Subcategory in Sucategory, Category format and Area in Area, Region format. So when I load the transaction data I can make a table lookup on these master data table and fill the required fields.
But the problem is I donot have much experince in ABAP routines.
Can any one help me with a sample start/update routine on how to do this.
Any help will be appreciated.
Regards,
AmithAmith,
Actually, you may everything do in a start routine of the URs (including lookup itself).
There is no need to declare internal table in a global part of routine and then read values in routines.
The code may look the following. (Don't have the system on hand. So, some syntax may require some modification.)
TABLES: <Your Master Data Table>.
DATA: wa_temp TYPE DATA_PACKAGE_STRUCTURE OCCURS 0 WITH HEADER LINE,
wa_md TYPE <Your Master Data Table> OCCURS 0 WITH HEADER LINE.
SELECT * FROM <Your Master Data Table> INTO wa_md.
SORT wa_md ASCENDING BY <Basic Char Key>.
LOOP AT DATA_PACKAGE INTO wa_temp.
READ TABLE wa_md WITH KEY <Basic Char Key> = wa_temp-<Basic Char Key>.
wa_temp-<YourLookupIO> = wa_md-<YourLookupAttribute>.
MODIFY DATA_PACKAGE FROM wa_temp.
ENDLOOP.
Best regards,
Eugene
Maybe you are looking for
-
Printer driver for brady ip600 not found
Hi Friends, I need to print barcode label through Brady IP600 Model Printer, I didn't found the specific drivers for sap for this printer and please give some idea how i can make a device type for this model printer to print my Barcode Label. Thanks
-
HT5422 Different versions of Remote Desktop Admin 3.6.1
How do Remote Desktop Admin 3.6.1 from 24 Sept with Download ID SL1595 and 14.73 MB in size and another from 3 Dec labelled DL1570 and 14.75 MB in size differ? Perhaps this is a version labelling problem, the one from 3 Dec perhaps is actually 3.6.2
-
Ical and finding shared calendars
Ical is working fine on my emac with 10.4.7 OSX except for the following: When I try to download a shared calendar for on the "search shared calendar"such as the ACT testing calendar it pops up as an error stating iCal is not installed. Safari can't
-
Trying to install IE 11 for windows 7 but get prompted that I need sp1 for it to work. When I look at my updates I have SP2. Have things changed? Does not SP2 superceed SP1? Do I need to install SP1? Will this cause issues?
-
Error downloading app - code 30511
I've just tried to download a slide lock app, and the money has been taken from my account. At the end, I got an error message - "Error getting the license", code 30511, and telling me to contact Blackberry App World. I can't even work out how to c