Explain me the (ABAP) Routine in Transformation
Hi,
Can any one explain me what this code doing
This is written to cal age of emp based on DOB as a routine in Transpormation
if i_week ne SOURCE_FIELDS-/bic/week_kbc.
clear: i_period, i_year, i_date, i_week.
i_week = SOURCE_FIELDS-/bic/week_kbc.
i_year = SOURCE_FIELDS-/bic/week_kbc(4).
concatenate '0' SOURCE_FIELDS-/bic/week_kbc+4(2) into i_period.
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
I_GJAHR = i_year
I_MONMIT = 00
I_PERIV = 'TM'
I_POPER = i_period
IMPORTING
E_DATE = i_date.
endif.
IF NOT SOURCE_FIELDS-/bic/emp_dob IS INITIAL.
RESULT = i_date0(4) - SOURCE_FIELDS-/bic/emp_dob0(4).
IF i_date4(4) LT SOURCE_FIELDS-/bic/emp_dob4(4).
RESULT = RESULT - 1.
ENDIF.
endif.
This is calculating the age of the employee based on the field Zweek_kbc.
Similar Messages
-
In which cases can the ABAP statement CALL TRANSFORMATION be used?
Hi friends,
here is my questions with options below.
In which cases can the ABAP statement CALL TRANSFORMATION be used? (T/F)
-To transform as iXML document object into and ABAP data structure using
XSLT.
- To transform an XML document contained in a string into another XML
document
using and XSLT program.
- To get canonic XML display of an ABAP data structure.
- To transform an XML document contained in an xstring into another XLM
document using an ST program (Simple Transformation).
- To transform and ABAP data structure into an SML document using ST.
Kindly give me the expalnation to each statement with either True or False.CALL TRANSFORMATION is a new language element in ABAP that we can use to <b>call up the transformation</b>.
The type of transformation:
XML to XML
XML to ABAP
ABAP to XML or
ABAP to ABAP is already determined by the two additions SOURCE and RESULT in CALL TRANSFORMATION.
Check this link for more details.
http://help.sap.com/saphelp_nw04/helpdata/en/a8/824c3c66177414e10000000a114084/content.htm
Regards,
Maha -
ABAP routine in Transformations syntax fix
Hi
As i am beginner in ABAP please correct the Start/End routine which i have written in Transformations for the below requirment
DSO1------->DSO2
While load data to DSO1-->DSO2 in need a look that refer active table of DSO3 and perform if condition to fill value to a field in DSO2
DSO1 (SOURCE FIELDS)
Field X
Field Y (X,Y are Key fields)
Field Z
Field W
DSO2 (Result Field)
Field P (The field which i want to update with Value by routine)
DSO3 (Look up)
Field A
Field B (A,B are Key fields) (A=X,B=Y)
Field C
Requirement:
While loading data from DSO1-->DSO2...We should read active table of DSO3 and pass it to Internal Table (A,B,C)with a key (A=X,B=Y)
and in the end routine
First check wether if Field C is not initial...then Result Field P should be updated with E
ELSE CHECK SOURCE FIELD Field Z = 1..then Result Field P should be updated with F
ELSE CHECK SOURCE FIELD Field W = T..then Result Field P should be updated with G
else if all the above conditions are not met .then Result Field P should be updated with H
Syntax i wrote (Not working correctly)
GLOBAL DECLARATION:
TYPES:
BEGIN OF ty_sou,
W TYPE /bi0/W,
Z TYPE /bi0/Z,
END OF ty_sou,
BEGIN OF ZDSO_3,
A TYPE /bi0/oiA,
B TYPE /bi0/oiB,
C TYPE /bi0/oiC,
END OF ZDSO_3.
DATA : ty_ZDSO_3_wa TYPE ZDSO_3,
ty_ZDSO_3_tab TYPE TABLE OF ZDSO_3,
ty_ZDSO_3_tab_temp TYPE TABLE OF ZDSO_3.
DATA : ty_sou_tab TYPE TABLE OF ty_sou,
ty_sou_wa TYPE ty_sou.
START ROUTINE
$$ begin of routine - insert your code only below this line -
LOOP AT SOURCE_PACKAGE ASSIGNING <source_fields>.
IF <source_fields>-XIS NOT INITIAL AND
<source_fields>-Y IS NOT INITIAL.
ty_ZDSO_3_wa-A = <source_fields>-X.
ty_ZDSO_3_wa-B = <source_fields>-Y.
ty_sou_wa-Z = <source_fields>-Z.
ty_sou_wa-W = <source_fields>-W.
COLLECT ty_sou_wa INTO ty_sou_tab.
COLLECT ty_ZDSO_3_wa INTO ty_ZDSO_3_tab.
ENDIF.
ENDLOOP.
*Select Statement to select values from ZDSO_3 Active Table
SELECT A B C
FROM /bic/aZDSO_300 INTO TABLE ty_ZDSO_3_tab_temp FOR ALL
ENTRIES IN
ty_ZDSO_3_tab WHERE A = ty_ZDSO_3_tab-A.
SORT ty_ZDSO_3_tab BY A B.
END ROUTINE
LOOP AT RESULT_PACKAGE ASSIGNING <result_fields> .
Read table ty_ZDSO_3_tab_temp into ty_ZDSO_3_wa with key
A = <result_fields>-P
B = <result_fields>-Q
binary search.
If sy-subrc = 0.
IF ty_ZDSO_3_wa-C IS NOT INITIAL.
<result_fields>-/BIC/P = 'E'.
ELSEIF
ty_sou_wa-Z = 1.
<result_fields>-/BIC/P = 'Fu2019.
ELSEIF ty_sou_wa-W= 'T'.
<result_fields>-/BIC/P = 'G'.
ELSE.
<result_fields>-/BIC/P = 'H'.
ENDIF.
Endif.
ENDLOOP.
But this is not working...i tried to debug but as i am a learner in ABAP i am not familiar....
Please advise me where or what is wrong with my code and greatful if you can make changesRoutine End
LOOP AT RESULT_PACKAGE ASSIGNING<RESULT-FIELD>-/ .
Read table ty_ZDSO_3_tab_temp into ty_ZDSO_3_wa
with key A = -P B = -Q binary search.
If sy-subrc = 0.
IF ty_ZDSO_3_wa-C IS NOT INITIAL.
<RESULT-FIELD>-/BIC/P = 'E'.
ELSEIF ty_sou_wa-Z = 1.
<RESULT-FIELD>-/-/BIC/P = 'Fu2019.
ELSEIF ty_sou_wa-W= 'T'.
<RESULT-FIELD>-/-/BIC/P = 'G'.
ELSE.
<RESULT-FIELD>-/-/BIC/P = 'H'.
ENDIF.
Endif.
ENDLOOP. -
ABAP Routine in Transformations Syntax Correction
Hi,
As i am beginner in ABAP please correct the Start/End routine which i have written in Transformations for the below requirement
DSO1------->DSO2
While load data to DSO1-->DSO2 in need a look that refer active table of DSO3 and perform if condition to fill value to a field in DSO2
DSO1 (SOURCE FIELDS)
Field X
Field Y (X,Y are Key fields)
Field Z
Field W
DSO2 (Result Field)
Field P (The field which i want to update with Value by routine)
DSO3 (Look up)
Field A
Field B (A,B are Key fields) (A=X,B=Y)
Field C
Requirement: While loading data from DSO1-->DSO2...We should read active table of DSO3 and pass it to Internal Table (A,B,C)with a key (A=X,B=Y) and in the end routine First check wether
if Field C is not initial...then Result Field P should be updated with E
ELSE CHECK SOURCE FIELD Field Z = 1..then Result Field P should be updated with F
ELSE CHECK SOURCE FIELD Field W = T..then Result Field P should be updated with G
else if all the above conditions are not met .then Result Field P should be updated with H
Syntax i wrote (Not working correctly)
Declaration-Global
TYPES: BEGIN OF ty_sou,
W TYPE /bi0/W,
Z TYPE /bi0/Z, END OF ty_sou,
BEGIN OF ZDSO_3,
A TYPE /bi0/oiA,
B TYPE /bi0/oiB,
C TYPE /bi0/oiC, END OF ZDSO_3.
DATA : ty_ZDSO_3_wa TYPE ZDSO_3,
ty_ZDSO_3_tab TYPE TABLE OF ZDSO_3,
ty_ZDSO_3_tab_temp TYPE TABLE OF ZDSO_3.
DATA : ty_sou_tab TYPE TABLE OF ty_sou,
ty_sou_wa TYPE ty_sou.
Routine Start
LOOP AT SOURCE_PACKAGE ASSIGNING .
IF -XIS NOT INITIAL AND -Y IS NOT INITIAL.
ty_ZDSO_3_wa-A = -X.
ty_ZDSO_3_wa-B = -Y.
ty_sou_wa-Z = -Z.
ty_sou_wa-W = -W.
COLLECT ty_sou_wa INTO ty_sou_tab.
COLLECT ty_ZDSO_3_wa INTO ty_ZDSO_3_tab.
ENDIF.
ENDLOOP.
*Select Statement to select values from ZDSO_3 Active Table
SELECT A B C FROM /bic/aZDSO_300 INTO TABLE ty_ZDSO_3_tab_temp FOR ALL ENTRIES IN ty_ZDSO_3_tab WHERE
A = ty_ZDSO_3_tab-A.
SORT ty_ZDSO_3_tab BY A B.
Routine End
But this is not working...i tried to debug but as i am a learner in ABAP i am not familiar.... Please advise me where or what is wrong with my code and greatful if you can make changes
Edited by: SAP7593 on Jan 21, 2010 7:56 AM
Edited by: SAP7593 on Jan 21, 2010 7:56 AMRoutine End
LOOP AT RESULT_PACKAGE ASSIGNING<RESULT-FIELD>-/ .
Read table ty_ZDSO_3_tab_temp into ty_ZDSO_3_wa
with key A = -P B = -Q binary search.
If sy-subrc = 0.
IF ty_ZDSO_3_wa-C IS NOT INITIAL.
<RESULT-FIELD>-/BIC/P = 'E'.
ELSEIF ty_sou_wa-Z = 1.
<RESULT-FIELD>-/-/BIC/P = 'Fu2019.
ELSEIF ty_sou_wa-W= 'T'.
<RESULT-FIELD>-/-/BIC/P = 'G'.
ELSE.
<RESULT-FIELD>-/-/BIC/P = 'H'.
ENDIF.
Endif.
ENDLOOP. -
Write ABAP routine in transformation rule
Dear all,
I am very new to ABAP. Currently I would like to transfer some data from cube A to cube B. The problem is
Cube A and B have different Unit of Mesure. The product standard cost is based on each Item's UOM. For example:
Cube A data:
ItemNo } UOM } Standard cost
ABC } P5 } 30
Cube B data:
ItemNo } UOM } Standard cost
ABC } EACH } 5 (30/5)
In transformation rule, I plan to use ABAP routine to calculate each record to new Stand cost if Cube A has different UOM than Cube B.
Can I call a program in this ABAP routine?
In ABAP routine, how can I delare other source table and fields?
Thanks for you help!The preferable method, if you're on BI 7 or later, is to create a filter in the DTP so that the records where 0CLR_DOC_NO is blank aren't even passed into the Transformation.
If not, then you can add the following code into the Start Routine of your Transformation.
DELETE
source_package
WHERE
clr_doc_no EQ ' '. -
Hi Experts,
I am new to ABAP...Please explain me the below simple ABAP code written in transformation
IF date of birth + 4(2) > sy-datum + 4(2).
age = sy-datum(4) - date of birth(4) - 1.
ELSE.
age = sy-datum(4) - date of birth(4).
ENDIF.
What is it refering to sy-datum + 4(2)
01012008
Please update
Thankssy-datum + 4(2) refers to the system date and "4(2)" represents the display of the characters.
For example, if sy-datum is equal to 19850825 (YYYYMMDD), then sy-datum + 4(2) represents 08 (MM) only month here in this case.
sy-datum(4) represents the 4th character in the system date. -
Not able to remove the ABAP code from Transformation
Hello Experts,
We have transformation for DSO in that for one infoobject, field routine is written, Break Point is hard coded there and it's move to production. Now we are trying to remove that break point from development and then move it production.
we are doing following activity to remove the break point.
1. Open the transformation.
2. Open the field routine.
3. Going to ABAP code in field routine.
4. Remove the hard coded Break Point from ABAP code.
5. Saving the code.
6. It's taking to again filed routine window.
7. We close the window and activate the transformation.
8. When again check the ABAP code in field routine then it shows hard coded Break Point again.
9. Not able to remove the hard coded break point.
Can anyone know how to do this.
Help will be appreciated.
ThanksHi,
As pointed above, after point 6 don't simply close the window but click on Transfer Value and then activate your transformation. Refresh the system and check again.
Regards,
Arminder -
Error while Migrating the custom routines in Transformations
Dear All,
I am in the process of migrating BW 3.5 to BI 7.0.I migrated the Standard cubes and DSO's from BW3.5 to BI 7.0 flow successfully.
But while migrating the transformations which are having the custom routines,I am facing the below errors.
The data object "COMM_STRUCTURE" does not have a component called BIC/ZGROSSPRI".But the routine contains BIC/ZGROSSPRI.
I tried to change the BW 3.5 terminology to BI 7.0 terminology.(Like COMM_STRUCTURE replaced by SOURCE_FIELDS).But unable to solve.There are nearly 20 custome routines written in all transformations.
Can any one guide me who faced the same tyepe of problem?
Thanks & Regards,
DinakarHI,
We need to include Source and Target see the below article.
http://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
How to Correct Routines in Transformations
http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/g-i/how%20to%20correct%20routines%20in%20transformations.pdf
Thanks
Reddy -
Convert Date to Week - ABAP Routine in transformation
Hi all,
I am trying to convert a date to a week using ABAP in a transformation.
The date is coming from an external database and has the format YYYYMMDD. I want to convert this into the standard 0CALWEEK format.
I thought that converting the date to the SAP internal format, and then running DATE_GET_WEEK on it, would work. Firstly I am running the FM 'CONVERSION_EXIT_PDATE_OUTPUT' to get the date into the DDMMYYYY format then running DATE_GET_WEEK on the result of the first FM.
This works up until the end of the first step; the internal date format is returned. However, the code fails when it hits the 'DATE_GET_WEEK' FM.
I would be really grateful if someone could tell me where I am going wrong. Thanks, Mischa
My code so far is:
DATA:
WEEK(6) TYPE C,
CS_DT(8) TYPE C,
TEMP_DT TYPE D,
RESULT1 TYPE D.
CLEAR RESULT.
CLEAR RESULT1.
CS_DT = SOURCE_FIELDS-CASE_DT.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
INPUT = CS_DT
IMPORTING
OUTPUT = TEMP_DT
MOVE TEMP_DT TO RESULT1.
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
DATE = RESULT1
IMPORTING
WEEK = WEEK
EXCEPTIONS
DATE_INVALID = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
RESULT = WEEK.Hi all,
Thanks for your replies, but the automatic conversion doesn't work. I assume this is because the source field is a CHAR field with 8 characters, rather than a Date field as recognised by SAP. Literally the field contains 8 characters YYYYMMDD for example 20090601.
If I try to assign directly, I get the error
"Automatic time conversion is not possible for source field CASE_DT
Cannot establish automatic time conversion to 0CALWEEK for source field CASE_DT. The source is a DataSource and consists of fields, not InfoObjects. Time conversion can only be performed automatically for InfoObjects."
This is why I assumed I needed some ABAP code. I have tried assigning the time char 0CALDAY to my source field CASE_DT in the transformation, and this is not accepted either - I get the message
"The properties of the InfoObject selected, 0CALDAY, do not match the properties of the available source field."
Again, grateful for any help.
Mischa -
Can anyone explain me the abap code ?
Hi gurus,
can any one explain me about this code please
IF rsallowedchar-allowchar IS INITIAL.
SELECT SINGLE
allowchar
INTO (rsallowedchar-allowchar)
FROM rsallowedchar
WHERE allowkey = 'S'.
ENDIF.
regards
raju'rsallowedchar' is a table. 'allowchar' is a field in the structure rsallowedchar.
IF rsallowedchar-allowchar IS INITIAL.
this line does a check whether the field allowchar is empty or not. If it is empty then a selection is made from the table reading one row of records matching the condition when allowkey is 'S'.
Hope this gave a clear explanation. -
Hi Can anyone explain how the abaper's first day will be in office
Hi all,
Thank you very much to all of you ..
I have got a job in Texas..
Can anyone let me know .. how the real time work will be ..
I mean how the first day will be...
Wht are the necessary things to be prepared...
Wht are the topics i need to concentrate on....
Kindly respond this is the problem of my life...
Thanks and Regards
SantoshI have to say it really depends on the position you are being hired for.. if it is a brand new implementation, you will have a fairly smooth learning curve.. like what was mentioned in the previous post.. but if they need you to fix something that is broken, the client will expect something right away.. I have been to a place where the Manager logged me in on her user id & just showed a couple of screens & what she expected me to do.. I was literally on my own within an hour, entering their premises..this is not to scare you.. but just that be mentally prepared if you are going to a client that has already been using SAP for a while.. expect fairly knowledgeable colleagues.. if you can show you some result in the first few days, then you automatically win their trust..
Good Luck,
~Suresh -
How to convert the 3.x ABAP Routines into BI 7 ABAP Routines
Hi All,
I am trying to convert a BI 3.x data flow into BI 7 data flow suing DTP's.
But i am stuck at Transformations. We have used several Routines in 3.X data flow and those routines are not converted automatically into the new data flow.
Is there any other tool or program whcih will convert the ABAP routines automatically into the new ABAP format.
my sample ABAP 3.x Code looks like this in Start routine,
LOOP AT DATA_PACKAGE.
IF ( DATA_PACKAGE-CPPVLC EQ 0
AND DATA_PACKAGE-CPPVOC EQ 0
AND DATA_PACKAGE-CPSTLC EQ 0
AND DATA_PACKAGE-CPQUAOU EQ 0
AND DATA_PACKAGE-CPSVLC EQ 0 ).
DELETE DATA_PACKAGE.
CONTINUE.
ENDIF.
I tried to replace DATA_PACKAGE with SOURCE_PACKAGE, but it did not work.
any help will be appreciated.
Cheers
POPSI tried to replace DATA_PACKAGE with SOURCE_PACKAGE, but it did not work.
When you use SOURCE_PACKAGE it will not have header line so you need to use workarea.
Use something like
LOOP AT SOURCE_PACKAGE into WA_SOURCE_PACKAGE.
Define WA_SOURCE_PACKAGE of type SOURCE_PACKAGE.
and replace further data_package in the code with WA_SOURCE_PACKAGE
Hope this helps.
Edited by: Praveen G on Jan 27, 2009 4:10 AM -
ABAP Logic in Transformations-Start or Field Routine Error
Hi,
Below is the field routine in transformations that will calculacte No of Years between 2 dates (Source Field & System Date)
It is showing me no systex Error but when i started data load ,Load is failing due to below mentioned error
Routine:
IF NOT SOURCE_FIELDS-/BIC/ZCYB_DOB IS INITIAL.
CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
EXPORTING
I_DATE_FROM = SOURCE_FIELDS-/BIC/ZCYB_DOB
I_KEY_DAY_FROM = 00
I_DATE_TO = SYST-DATUM
I_KEY_DAY_TO = 00
I_FLAG_SEPERATE = 'X'
IMPORTING
E_YEARS = RESULT.
ENDIF.
Error:
The exception CX_STATIC_CHECK is neither caught nor is it declared in
the RAISING clause of "EXECUTE".
Please update me where i was doing wrong
ThanksIt must have something to do with your input variables - I ran this FM locally using my DOB and today's date and it worked fine.
make sure your input date types are in the correct format for the FM. -
Read filter values of DTP by ABAP routine
I am trying to read the filter values of a DTP by ABAP routine in transformation.
I could do it in the past by using the code
DATA: t_filter_values TYPE rsbk_th_range.
t_filter_values = p_r_request->get_th_range( ).
After patching (SAPKW70019), the code does not seem to work.
Are there any other ways to retrieve the DTP filter values in ABAP?Thank you Simon.
Table RSSELDTP contains the filter values comma separated.
But it would be really dirty to read the values from there.
I would have to split the comma separated values. Furthermore, low and high value are just concatenated by a minus sign. I would have to split these values as well.
Is there a better solution to the problem? -
Call function in abap routine of infopackage
Experts,
Good day. I have a problem concerning the data to be imported in my ods.I can't find a similar thread corcerning my problem. My File date field should contain only 2 years and 3months data of recent data. I'm using a call function fima_date_create to filter values of zfile_date.
CALL FUNCTION 'FIMA_DATE_CREATE'
EXPORTING
I_DATE = sy-datum
I_FLG_END_OF_MONTH = ' '
I_YEARS = 2-
I_MONTHS = 3-
I_DAYS = 0
I_CALENDAR_DAYS = 0
I_SET_LAST_DAY_OF_MONTH = ' '
IMPORTING
E_DATE =
E_FLG_END_OF_MONTH =
E_DAYS_OF_I_DATE =
The sy-datum becomes the High value and the date generated by this FM will be the low value. I already tested this function module and it is what i want. How Should I write the ABAP code for this in the abap routine for my infopackage? Or what steps do I need to take.Hi,
When you choose the option to write a routine for one of the characteristics in the infopackage selections, you get a window to write your code with some prewritten code as below. Modify it as shown below, for your requirement.
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = 'CALDAY'.
l_idx = sy-tabix.
START of YOUR CODE
<----
Required logic -
>
L_T_RANGE-LOW = <lower limit of range>.
L_T_RANGE-HIGH = <upper limit of range>.
L_T_RANGE-SIGN = 'I'.
L_T_RANGE-OPTION = 'BT'.
END of YOUR CODE
modify l_t_range index l_idx.
p_subrc = 0.
Hope this helps.
Maybe you are looking for
-
Problem while saving list output as local file.
Hi Gurus! i want to save the list output of classical report into excel but complete data is not coming into excel file. [SYSTEM - > LIST ->SAVE -> LOCAL ->SPREADSHEET ] when same output is transfer to unconverted file [notepad ] then completed data
-
What is that means and how to fix it ,, PLZ Help
Hello , I have FMS installed on my dedicated server Core2Due With 4g Ram and 100Mbps dediacted port ..Win 2003 standrd. I use it for live streaming but i have a problem Admin console showing this error in the application log Dropping application (liv
-
Hi there, I'm pretty new to all this stuff but I've been doing a LOT of processing of images of late. I'm sure what I want to do can be done with scripts or automation though. My scenario is this: I have a folder with a lot of subfolders, many with a
-
I tried using Rhythmbox, Banshee, gtkpod, but any of them won't work for me. Banshee and gtkpod even can not see my iTouch 4G with iOS 5.0.1, Rhythmbox can, but shows, that there is no any content on iPod. Nothing works for me, neither ifuse, nor itu
-
1130 Radio Mounting Best practice
Hi Everyone. In discussions with cisco and other users, we are confused on mounting and radio coverage practices. should we be mounting the radio vertically with the ethernet to the side or Horizontal to the floor (drop ceiling). According to others,