Update routine code
Hi friends,
I have a field YREPCURR in the update rules, it needs to updated based on the attribute of /BIC/YREPCURR in 0salesorg
plz help me writing a routine for this field
help will be really appreciated, points would be fully awarded
regards,
veer
Hi
I'm giving it a try as a ABAP beginner myself!?!
TABLES: /BI0/PSALESORG.
data: YREPCURR like /BIC/YREPCURR-/BI0/PSALESORG.
select single /BIC/YREPCURR from /BI0/PSALESORG into YREPCURR where objvers = 'A' and
SALESORG = comm_structure-SALESORG.
if sy-subrc = 0.
result = YREPCURR.
endif.
OR
You can also use the option of Attribute of in the Update ruled mapping.
Regards,
Similar Messages
-
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. -
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 -
End Routine Code not Working after Support Pack Upgrade
Hi BI Community,
We have recently upgraded to SPS17 (BW SP19) for our production system and the code deriving the values of several attributes in the end routine of the transformation for one InfoObject (as info provider) does not work anymore. We have been trying to identify the root cause but the fact is that we did not change anything to the InfoObject and its transformation and this used to work fine. The strange thing is that when we debugged the code we could see the value of the aforementioned attributes was derived correctly but the value is just not updated to the InfoObject where we still see the old values for these attributes.
We have a similar InfoObject with the same end routine code in the transformation and it is working fine. We are out of idea what could have caused this during the SP upgrade.
Thanks in advance for your feedback.
Regards,
PeterCannot say what might have caused it but one check you can perform.
Open your transformation in change mode and you can see a button next to create end routine button, titled ' Update Behavior of End Routine Change', click on that and say all fields.
Hope it helps...
Regards,
Ashish -
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 to populate value for field ZDOCCATG(Document category)
Hi Experts,
I need to populate data for field ZDOCCATG(Document Category) based on the value of the below two fields,
1. 0deb_cre_lc(Debit / credit Amount)
2. 0ac_doc_typ(Belegart)
The logic is as follows:
if 0deb_cre_lc > '0'.
if 0ac_doc_typ == 'dz'.
ZDOCCATG = Disputes.
else
ZDOCCATG = Invoices.
end If.
else
if 0ac_doc_typ < '0'.
ZDOCCATG = Credits.
end if.
I need to write the update routine to get the values assigned for Document category based on these two fields. When i open the routine for the field ZDOCCATG, i can see the below screen:
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/CS80FIAR_O03 - (Communication structure)
RECORD_NO LIKE SY-TABIX
RECORD_ALL LIKE SY-TABIX
SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
CHANGING RESULT LIKE /BIC/AZOARFSCM00-/BIC/ZDOCCATG
RETURNCODE LIKE SY-SUBRC "Do not use!
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 abort is not equal zero, the update process will be canceled
ABORT = 0.
$$ end of routine - insert your code only before this line -
ENDFORM.
Please let me know the code to be inserted (based on the logic mentioned above) in the above screen . Thanks
Regards,
Kavitha JagannathHi Kavitha,
Supposing the technical name of fields is /bic/0deb_cre_lc and /bic/0ac_doc_typ use the code below at the marked position.
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/CS80FIAR_O03 - (Communication structure)
RECORD_NO LIKE SY-TABIX
RECORD_ALL LIKE SY-TABIX
SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
CHANGING RESULT LIKE /BIC/AZOARFSCM00-/BIC/ZDOCCATG
RETURNCODE LIKE SY-SUBRC "Do not use!
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
<----- Paste the code below as shown here --->
if comm_structure-/bic/0deb_cre_lc > 0.
if comm_structure-/bic/0ac_doc_typ == 'DZ'.
result = 'DISPUTES'.
else
result = 'INVOICES'.
endIf.
elseif comm_structure-/bic/0deb_cre_lc < 0.
result = 'CREDITS'.
end if.
<----
>
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.
Regards:
Jitendra
Edited by: Jitendra Gupta on Oct 15, 2009 3:05 PM -
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 -
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,
XibiThanks 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 -
ABAP Routine code for the below logic
Hello BW Experts ,
I need to write a complex ABAP routine in BW .
Following is the detail explaination .
Can anyone tell me the ABAP code for the below logic?
It would be a greate help as I am unable to do this
since last two days.
WBS Elements are maintained at IOS and Warranty levels in R/3 side.
The IOS WBS is a top level of WBS element and below that the Warranty WBS level.
The IOS and Warranty WBS elements can be differentiated by means of priority field.
When priority = i , WBS Element is known as IOS Level WBS Element and
When priority = Y the WBS element is known as Warranty WBS element.
The Equipment Number is maintained compulsorily at IOS Level WBS elements only.
It is not maintained at Warranty WBS Element.
But the Cost is maintained at Warranty WBS Elements.
In BW I need all Warranty WBS ( priority = Y) along with their cost figures and Equipment Numbers.
But as the Equipment Number is not maintained compulsorily at Warranty WBS level we have asked to
Copy it from IOS WBS ( priority = i ) and assign it to Warranty WBS level ( priority = Y ).
So I have included the Equipment Number in the ODS and in update rules I need to write the routine for it as
per the above logic.
The Equipment Number is coming from Master data of WBS Element.
The WBS element master data we are loading in BW .
Also the same WBS Element transaction data is coming from the transaction data data source in BW.
Following fields / infoobjects and the table names in BW :
1. Equipment Number : /BIC/ZEQUIPMNT and table name /BIC/MZWBS_ELEM.
2. WBS Element : ZWBS_ELEM is coming from transaction data data source as well as master data.
In ODS update rules it is coming from transaction data data source Comm_structure-ZWBS_ELEM.
Also we are loading separetly the master data for ZWBS_ELEM.
The ZEQUIPMNT is an attribute of ZWBS_ELEM.
3. Priority : PRIORITY and table name /BIC/MZWBS_ELEM.
The info object name for Priority is 0Priority but in master data table /BIC/MZWBS_ELEM
the field name is PRIORITY.
When PRIORITY = ' i ' then ZWBS_ELEM is at IOS Level
When PRIORITY = ' y ' then ZWBS_ELEM is at Warranty Level.
4. ODS name : /BIC/AZCOST00 and same is table name active data table .
So please tell me the routine Code .
Best Regards ,
Amol.Hi Dinaker,
Did you find any solution for this issue. I too have a similar requirement of pulling all the service orders for a specific Purchase Order in the BW report.
Thanks,
SAPBWI -
Which is better transfer routine or update routine???
HI ALL,
I have read some documents, but I didnt get the real concept.
Can any one explain in detail as to how do we decide where to write the code i.e a start routine or transfer routine or update routine...and which one is better for a given scenario..
with example?My scenario is like this:
master data InfoObject for e.g. Z_MATERIAL1 with 10 fields as attributes. It has two Source Systems feeding it; SAP and a flat file from a system called Product Catalog (PCAT).
The PCAT data is generally more reliable, hence, if a material XYZ comes from PCAT then PCAT is the owner of the material. SAP should not be able to update five critical fields of that material if PCAT owns the material.
For e.g. the below values comes from PCAT and Master data is updated.
PCAT
Material Group Type Price Curr Unit Prod Desc. Lang Class
XYZ ABC BRU 10.00 USD PC Inh To EN 001
When the data comes from SAP R/3, it should not update anything other than the last 4 fields.
SAP
Material Group Type Price Curr Unit Prod Desc. Lang Class
XYZ ABC BRU 20.00 USD BOX In The DE 003
Finally the data in the Master Data Object should be as below.
Material Group Type Price Curr Unit Prod Desc. Lang Class
XYZ ABC BRU 10.00 USD PC In The DE 003
where do i write the code...i have written this in start routine of transfer rules...i want to know the performance issues... -
Return tables in Update routines
Hi,
Can anyone send me some documents on the use of return tables in Update Routines?
email id: [email protected]
Thanks in advance,
RPHi Ram,
<b>Table as a return</b>
In general, routines in the update rules have only one return code.
If you select this field, the corresponding key figure routine no longer
has a return code (defined in RESULT), rather a return table (defined in
RESULT_TABLE). In this case you can create as many key figure values
from the data record as you wish. You can find the calculated
characteristic values in the structure ICUBE_VALUES.
<b>Activities</b>
If you change these values accordingly, then you fill the field for the
relevant key figure and use this to fill RESULT_TABLE.
Regards
Happy Tony
<b>Points == Thanks</b> -
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 -
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 -
Syntax error in Update Routine
Dear All,
While trying to update infoobject /BIC/ZGROSSPRI in an ODS in BI through an update routine, a syntax error is thrown when I am defining a variable of type tys_TG_1-/BIC/ZGROSSPRI.
For instance,
DATA: VALUE TYPE tys_TG_1-/BIC/ZGROSSPRI.
The error is :
E:Field "_ty_s_TG_1-/BIC/ZGROSSPRI" is unknown. It is neither in one of the
specified tables nor defined by a "DATA" statement. "DATA" statement.
Below given is the code which I am using for the same. Kindly advise how to correct this error.
Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
Edited by: Suneeth Sebastian on Apr 7, 2010 4:11 PM
Edited by: Rob Burbank on Apr 7, 2010 1:19 PMDear All,
While trying to update infoobject /BIC/ZGROSSPRI in an ODS in BI through an update routine, a syntax error is thrown when I am trying to define a variable of type tys_TG_1-/BIC/ZGROSSPRI. How is it possible to define a variable of type target field(Infoobject) ?
For instance,
DATA: VALUE TYPE tys_TG_1-/BIC/ZGROSSPRI.
The error is :
E:Field "_ty_s_TG_1-/BIC/ZGROSSPRI" is unknown. It is neither in one of the
specified tables nor defined by a "DATA" statement. "DATA" statement.
tys_TG_1-/BIC/ZGROSSPRI is already defined in the Class section as below
TYPES:
BEGIN OF tys_TG_1,
InfoObject: ZGROSSPRI Gross Price in Statistical Currency.
/BIC/ZGROSSPRI TYPE /BIC/OIZGROSSPRI,
END OF tys_TG_1. -
No RETURNCODE 0 allowed in update routines in transfer mode
Hi,
After Applying a RETURNCODE = 4 to one characteristic in my update routine i get the following message:
No RETURNCODE <> 0 allowed in update routines in transfer mode
Message no. RSAU492
It seems that i doesn't allow me to modify a certain characteristic in my target ODS.
Any suggestions?
BR,
XibiHi,
could it be this problem (as described in an OSS note) ?
"Symptom
Various errors occur when you load reporting point data from CRM with the DataSource 0CRM_UT_POD_ATTR and update the data in BW:
1. Insufficient data is delivered, and all fields are empty except for the external reporting point name (EXT_UI_BW).
2. The restriction according to the external reporting point name (EXT_UI_BW) in the BW scheduler has no effect.
3. The update in BW to the InfoObject 0UCCRMPOD terminates with the error message RSAU-492 (Return code <> 0 is invalid in overwrite MODE in update routines).
Other terms
Sales, commercial and industrial customers, IS-U-CRM integration, IS-U, quotation controlling, quotation planning
Reason and Prerequisites
There is an error in the extractor. In addition, the selection according to EXT_UI_BW cannot be supported in the InfoPackage for technical reasons. The case was not caught when the texts for 0UCCRMPOD were updated because the texts for 0UC_POD (IS-U reporting point) had not yet been loaded from IS-U.
Solution
The error is eliminated in CRM 4.0 Support Package 05 and BI Content Add-On 3.20 Support Package 11 or BI Content Add-on 3.30 Support Package 04 or BI Content Add-On 3.51 Support Package 01.
Correction instructions for the CRM section are attached."
/manfred
Maybe you are looking for
-
Merging Different Files Using XI
Hi All, I hav a scenrio where i have to merger 'n' no of files into a single file and push it to some location on the FTP. <u><b>Details:</b></u>: <u><b>Source</b></u> <u><i>File1</i></u> abc def ghi <u><i>File2</i></u>: xxx yyy zzz <u><i>File3</i></
-
CUP - Using several Parameters ID in User Default
Hello everybody, I have a problem with using User Default section in CUP. In fact I want to use the User Default Mapping to define two different parameter ID in the SU01. For example: the Company Code (BUK parameter) and the Cost Center (KOS paramete
-
i have bought triple play blu ray with digital copy and when i try to redeem it does not recognise the code
-
I want the Infromation and Documents about the OBIEE
Hi Friends, First of all a wish you all a happy christmas. I want the information about the modules in OBIEE and documents or totorials. I am Business Objects Expert since 4 years I am working for Business Objects. I am planning to learn OBIEE my com
-
Why won't some of my apps work after I did an update for my iPad?
it has been three days since I did an update that was recommended from my general section of my iPad, now I can not use an application or two as well as most others are not working correctly. I have tried to restart my system but it still is acting u