Conversion Routine - DATES
Hello Gurus,
I am fetching dates from tables in source system, which is of type Decimal 15.
Now this in a very strange format, as you see in the source system tables.
Hence I want to use an conversion routine in BI, at the infoobject level.
I have created ZABCDATE, with a datatype DATS.
My 1st question is, is there a way to write your own conversion routine.
My 2nd question is, how can I define conversion routines at the datasource level.
Thanks in advance
Full points to correct answers
Edited by: bw on Jan 21, 2009 12:59 AM
Hi.......
1) is there a way to write your own conversion routine.
Yes..........u can write ur own ABAP code in the End routine of the Transformation..........
2) is, how can I define conversion routines at the datasource level.
If u write ur own ABAP code for conversion in the Transformation...........then that will be at datasource level........ie datasource specific.......
Regards,
Debjani.....
Similar Messages
-
COnVERSION ROUTINE in data element level
how can we write the CONVERSION ROUTINE in data element level for a field in data dictionary ?.........plz if possible give the EXAMPLE code also?
Hi,
You can refer to any of the standard conversion routines like ALPHA to get an idea. It is used in case of work order (AUFNR).
Regards
Sayee -
What is conversion routine which is found in data element
Hi all,
I was just trying to creating a data element assigned to a particular domain in se11. While i am creating i can see a conversion routine
Can anyone tell me what is the use of that conversion routine with an example.
thanxs in advance
hariHi,
Depending on the data type of the field, there is a conversion when the contents of a screen field are converted from display format to SAP-internal format and vice versa. If this standard conversion is not suitable, it can be overridden by defining a conversion routine in the underlying domain.
Conversion routines are identified by a five-place name and are stored as a group of two function modules. The function modules have a fixed naming convention. The following function modules are assigned to conversion routine xxxxx:
CONVERSION_EXIT_xxxxx_INPUT
CONVERSION_EXIT_xxxxx_OUTPUT
The INPUT module converts from display format to internal format, and the OUTPUT module converts from internal format to display format.
When is a Conversion Routine Executed?
If a screen field refers to a domain with a conversion routine, this conversion routine is executed automatically when entries are saved in this screen field or when values are displayed in this screen field. The conversion routine of the domain is also triggered when the field contents are output with the WRITE statement.
Table SPFLI in the flight model contains information about the flights offered by the carriers. The time for each flight is recorded in field FLTIME. Enter and display the time of the flight in input templates in the form HHH:MM (hours:minutes). Store the flight time entered in the database as an integer number (number of minutes of the flight). An entry 3:27 is therefore stored in the database as 207 (3 hours, 27 minutes = 207 minutes).
Field FLTIME refers to domain S_DURA, to which conversion routine SDURA is assigned. The value is thus converted by the two function modules <b>CONVERSION_EXIT_SDURA_INPUT</b> and <b>CONVERSION_EXIT_SDURA_OUTPUT</b>.
A conversion routine can also be triggered by specifying its five-place name in the attributes of a field in the Screen Painter or with the addition <b>USING EDIT MASK <Name of conversion routine></b> in the WRITE command in the program. With the USING NO EDIT MASK addition in the WRITE statement, you can skip a conversion routine defined for a domain when outputting.
Parameters
The two function modules of a conversion routine must have precisely two parameters with the names INPUT and OUTPUT for the value to be converted and the converted value.
The INPUT parameter in the INPUT conversion and the OUTPUT parameter in the OUTPUT conversion should not have any reference fields because the value passed in the call could have a different length than that expected.
Programming Conversion Routines
ABAP statements that result in an interruption of processing (such as CALL SCREEN, CALL DIALOG, CALL TRANSACTION, SUBMIT, COMMIT WORK, ROLLBACK WORK, MESSAGE I, MESSAGE W) are not allowed in conversion routines.
Only A messages are meaningful in output conversion, but A, E and S messages can be triggered in input conversion (although S messages are not very meaningful here). E messages result in an error dialog. Exceptions are not intercepted in the call.
The output conversion is also triggered with WRITE and WRITE TO. The conversion routine may therefore occur very frequently with lists. The output conversion should therefore be programmed as efficiently as possible.
No external performs should be used in conversion routines. Programs that are called externally use the table work areas of the first calling main program. In conversion routines this can result in errors that cannot be easily analyzed since they are sometimes called at unpredictable times in the program flow.
<b>Pls refer link which contains code as an example to conversion routine used in abap</b>.
<a href="http://www.bwexpertonline.com/downloads/source_code.doc">http://www.bwexpertonline.com/downloads/source_code.doc</a>
Pls reward points.
Regards,
Ameet -
Conversion routine PROJ in case master data doesn't exist
Hi gurus!
I have a problem with info-object 0PROJECT. It has a conversion routine PROJ, which converts the values nicely from external format to internal only if the master data for such project exists. If I use a interval variable in bex query the query user needs to give the upper value in internal value (for example Y3000 instead of Y-3000) in case he or she doesn't know if the value exists in database or not. That is understandable because of the logic of conversion routine PROJ (uses attribute project_ex).
But what explains the fact that query variable input value Y3000 doesn't give data of Y-3000, but only one smaller (Y-2999). To get data of project Y-3000 one has to give upper variable value Y3001.
Has anyone better understanding of this query/conversion behaviour?
SariCheck the example here
http://help.sap.com/saphelp_nw04s/helpdata/en/dd/f470375fbf307ee10000009b38f8cf/frameset.htm
In master data updates, you can either load time-dependent and time-constant data individually, or together.
Hope it Helps
Chetan
@CP.. -
WBS element conversion routines
Hey guys,
I recently added PS_PSP_PNR to 2LIS_11_VAHDR in order to extract the WBS element from the sales document header. So far so good and everything works fine. In the extractor checker I get the data as expected e.g. 'S-00017.02.09'.
The problem occurs as soon as the data is transferred to BW. In the transfer structure I see that PS_PSP_PNR har conversion routine ABPSP that converts the WBS from external format CHAR(24) to internal NUMC(8). And this is what is causing me the trouble! In the PSA the WBS from above is converted to '00029788'.
I tried several different approaches. If the field is mapped directly to 0WBS_ELEMT the value '00029788' is obviously also written to the DSO and further up the data flow.
I tried coding an ABAP routine in the transfer rules which does not seem to work:
call function 'CONVERSION_EXIT_ABPSP_OUTPUT'
exporting
input = TRAN_STRUCTURE-ps_psp_pnr
importing
output = RESULT.
RETURNCODE = 0.
ABORT = 0.
Since the routine above did not help me at all I tested the FM in SE37 and it does not return any values for '00029788'.
Any clues on this? How to proceed?
BR
Stefan.Well... Didn't want to wait any further for an answer, so I appended PS_POSID to the extract structure and filled this field in ZXRSAU01. In the exit I used 'CONVERSION_EXIT_ABPSP_OUTPUT' to convert to the correct format.
BR
Stefan -
What is use of Conversion Routine in Abap dictionary
Hi,
Can any body please tell me the proper use of <b>Conversion Routine in Abap dictionary.</b>
Please give me a practical example where it has been used.
Thanks
prabhuduttahi,
here is help for conversion routine
Conversion takes place when converting the contents of a screen field from display format to SAP-internal format and vice versa and when outputting with the ABAP statement WRITE, depending on the data type of the field.
If standard conversion is not suitable, it can be overridden by specifying a conversion routine in the underlying domain.
A conversion routine is identified by its five-place name and is stored as a group of two function modules. The function modules have a fixed naming convention. The following function modules are assigned to conversion routine xxxxx:
CONVERSION_EXIT_xxxxx_INPUT
CONVERSION_EXIT_xxxxx_OUTPUT
The INPUT module performs the conversion from display format to internal format. The OUTPUT module performs the conversion from internal format to display format.
If a screen field refers to a domain with a conversion routine, this conversion routine is executed automatically each time an entry is made in this screen field or when values are displayed with this screen field.
regards,
Raghavendra -
How to write conversion routine for key figure?
Our customer has this requirment:
we need to know the last time of some TV program in BEx report, If a TV program last 500 seconds, we need show the key figure like this: 00:08:20, If a TV program last 100000 seconds, we need show the key figure like 27:46:40 (27 hours and 46 minitues and 27 seconds), If we define a key figure as time, BW system will report a error that say it is not acceptable time. If we want to define a integer, but we need display it like hhmmss format. We know we can write conversion routine for char. but I don't how to write conversion routine for key figure. Please give me any hint if any other solutions?
Edited by: SY DONG on Dec 2, 2010 3:36 AMIf you want to do in Transformation Layer :
You can use routine ...break up the seconds into minute hour and seconds
you will have to handle few cases in this:
let say your variable lv_seconds holds the number of seconds you want to convert to hour min and seconds
DATA: lv_seconds type i,
lv_hrs type i,
lv_sec type i,
lv_min type i.
lv_hrs = lv_seconds / 3600
if lv_hrs >= 1.
lv_min = (lv_hrs - trunc(lv_hrs))*60
here again handle seconds if min >60.
else.
lv_hrs = '00'.
lv_min = lv_hrs*60
It is just hint ..how you can manipulate the seconds to get it...you will have to think about the complete algorithm
Regards,
RK -
Need help in Report.... Conversion of data elements
Hi All,
Iam doing a report. Chk the code below
SELECT roleid
FROM SRRELROLES
INTO gs_roleid
WHERE objkey = gs_guid
AND objtype = BUS2010020.
When i activate this it is throwin an error sayin dat <b>" GS_GUID and OBJKEY is not mutually convertible in a unicode program.... "</b>
<b>Here objkey is RAW 16 and gs_guid is char(70)..</b>
Can anybody help me out in this... and is there any conversion routines for doing this.
Thanks,
Shiva shekar kdeclare a gs_guid variable as raw data type .. and then convert it to char
and for conversion refer
convert raw type to char
Convert RAW 1022 TO CHAR 255
Convert RAW 1022 to CHAR 255 -
Info Object conversion routine
Hello,
I have a very simple question.
I have an infoObject which suppose to save texts. I dont care which kind of text is it. It can be anything. in the infoObject i removed the conversion routine and didnt put an X in the "lowercase letters" checkbox but still when i load data into the ODS the data cant be activated just because this infoObject have wrong charactaristics.
Please Advice,
DavidHi David,
allow lowercase letters or check out this one: /people/siegfried.szameitat/blog/2005/07/18/text-infoobjects-part-1
regards
Siggi -
Conversion Routine... plz help
Dear Gurus,
There is a text field in R3 called as SGTXT related to some finance table... some of the records in this field directly start with '#' character and then the details.. Well here is the problem.. I m loading to ODS 0FIAR_O04 and it ends up in error due to the above mentioned problem.. the infoobject which carry the data from SGTXT field is 0POSTXT...
I decided to go for a conversion routive in transfer rule for this field.. but i dont know how to write routines.. can you plz help me with the steps as well as the code to remove '#' from SGTXT.... Thanks.
For more help i m attaching the conversion routine with is automatically generated by system... only i hv to add code to remove '#' character... kindly go thru it and suggest me where to add and what to add...
here it is
PROGRAM CONVERSION_ROUTINE.
Type pools used by conversion program
TYPE-POOLS: RS, RSARC, RSARR, SBIWA, RSSM.
Declaration of transfer structure (selected fields only)
TYPES: BEGIN OF TRANSFER_STRUCTURE ,
InfoObject 0POSTXT: CHAR - 000050
SGTXT(000050) TYPE C,
END OF TRANSFER_STRUCTURE .
Global code used by conversion rules
$$ begin of global - insert your declaration only below this line -
TABLES: ...
DATA: ...
$$ end of global - insert your declaration only before this line -
FORM COMPUTE_POSTXT
Compute value of InfoObject 0POSTXT
in communication structure /BIC/CS0FI_AR_4
Technical properties:
field name = POSTXT
data element = /BI0/OIPOSTXT
data type = CHAR
length = 000060
decimals = 000000
ABAP type = C
ABAP length = 000120
reference field =
Parameters:
--> RECORD_NO Record number
--> TRAN_STRUCTURE Transfer structure
<-- RESULT Return value of InfoObject
<-> G_T_ERRORLOG Error log
<-- RETURNCODE Return code (to skip one record)
<-- ABORT Abort code (to skip whole data package)
FORM COMPUTE_POSTXT
USING RECORD_NO LIKE SY-TABIX
TRAN_STRUCTURE TYPE TRANSFER_STRUCTURE
G_S_MINFO TYPE RSSM_S_MINFO
CHANGING RESULT TYPE /BI0/OIPOSTXT
G_T_ERRORLOG TYPE rssm_t_errorlog_int
RETURNCODE LIKE SY-SUBRC
ABORT LIKE SY-SUBRC. "set ABORT 0 to cancel datapackage
$$ begin of routine - insert your code only below this line -
DATA: l_s_errorlog TYPE rssm_s_errorlog_int.
RESULT = .
returncode 0 means skip this record
RETURNCODE = 0.
abort 0 means skip whole data package !!!
ABORT = 0.
$$ end of routine - insert your code only before this line -
ENDFORM.
FORM INVERT_POSTXT
Inversion of selection criteria for InfoObject 0POSTXT
This subroutine needs to be implemented only for SAP RemoteCubes
(for better performance) and for the Report/Report Interface
(drill through).
--> I_RT_CHAVL_CS Ranges table for current InfoObject
--> I_THX_SELECTION_CS Selection criteria for all other InfoObjects
<-- C_T_SELECTION Selection criteria for fields of
transfer structure
<-- E_EXACT Flag: Inversion was exact
FORM INVERT_POSTXT
USING I_RT_CHAVL_CS TYPE RSARC_RT_CHAVL
I_THX_SELECTION_CS TYPE RSARC_THX_SELCS
CHANGING C_T_SELECTION TYPE SBIWA_T_SELECT
E_EXACT TYPE RS_BOOL.
$$ begin of inverse routine - insert your code only below this line-
DATA:
L_S_SELECTION LIKE LINE OF C_T_SELECTION.
An empty selection means all values
CLEAR C_T_SELECTION.
L_S_SELECTION-FIELDNM = 'SGTXT'.
Selection of all values may be not exact
E_EXACT = RS_C_FALSE.
$$ end of inverse routine - insert your code only before this line -
ENDFORM.It has been solved.. thanks everyone for inputs.. points awarded to concerened.. thanks.
-
How to use conversion routine?
hi,
in my z-table i have a field called matnr for the material number say.
its domain defines it as 18 char.
say i have created an entry say 200.
so it will be saved may be as 000000000000000200.
i want it should be displayed with as 200.
and if i search for say 200.
so it should not look for the proceeding zero's.
it should not give me an error that record doesn't exists.
please tell me how to use exaclty conversion routine.
thanks
ektahi all,
the problem has been solved.
CONVERSION_EXIT_MATN1_OUTPUT this FM module can only be used where the z-table has matnr of the type MATNR the standard matnr of the table mara.
so in my program it was not working.
my data element was not matnr.
i had used a popup for position finder.
so it could not read the material number which had zeros as prefixes.
thanks for all the help
thanks
ekta
below the code is mentioned...................
*******************************C O D E*******************************************
WHEN '&POS'.
popup_title = 'Choose The Material Number'.
CLEAR it_fields.
it_fields-tabname = 'Z10ET_TAB_MAT01'.
it_fields-fieldname = 'MATNR'.
it_fields-field_attr = ' '.
it_fields-field_obl = 'X'.
APPEND it_fields.
CALL FUNCTION 'POPUP_GET_VALUES'
EXPORTING
no_value_check = 'X'
popup_title = popup_title
start_column = '5'
start_row = '5'
IMPORTING
returncode = returncode
TABLES
fields = it_fields
EXCEPTIONS
error_in_fields = 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.
IF returncode = ' '.
MESSAGE i036 WITH it_fields-value.
SORT it_material_data BY matnr.
READ TABLE it_material_data INTO wa_material_data
WITH KEY matnr = it_fields-value.
IF sy-subrc = 0.
tab_ctrl1-top_line = sy-tabix.
REFRESH it_fields.
CLEAR returncode.
CLEAR ok_code_0101.
ELSE.
CONCATENATE concat it_fields-value INTO v_matnr.
READ TABLE it_material_data INTO wa_material_data
WITH KEY matnr = v_matnr.
IF sy-subrc = 0.
tab_ctrl1-top_line = sy-tabix.
REFRESH it_fields.
CLEAR returncode.
CLEAR ok_code_0101.
ELSE.
MESSAGE i037 WITH it_fields-value.
REFRESH it_fields.
CLEAR returncode.
CLEAR ok_code_0101.
ENDIF.
ENDIF.
ENDIF. -
How to remove conversion routine "ABPSN"
Dear gurus,
In my transfer rules, under the tab "DataSource/Trans. Structure", I have a field PSPID whose "Conversion Routine" has the value "ABPSN". This conversion routine converts the external format to the SAP format which, however, is not what I want. I want to remain the original format so I need to remove this "ABPSN" conversion routine. When I double clicked it, it linked to the InfoObject 0PROJECT maintanace screen. On that screen, I removed the conversion routine "PROJ" for 0PROJECT, but still ABPSN remains and the data loaded into the InfoCube have been converted.
So how can I remove this ABPSN convertion routine?
Thanks in advance.
Jin MingHi Jin Ming,
Conversion Exit ABSPN is related to WBS element and not project at R/3 side.
But at BW side this routine internally calls Project routine .
The Process is,
1. Delete all transactional data , from related ODS & Cube wherever 0PRoject is used .
2. Delete master data from 0Project.
3. Change object 0Project remove the conversion using Tcode RSD1.
4. Load master data for 0Project.
5. Load transaction data.
Hope that helps.
Regards
Mr Kapadia -
Conversion of Date field to 0FISCPER
Hi,
I have a field ZDATE from old legacy system.
The format of this field is like 05 - MAJ ; 06 - JUNI; 07 - JULI and so on.
I need to map this field to 0FISCPER in the BW system
Please advice a code for a conversion routine as such.Hi john,
Greetings.
For converting it to 0FISCPER, you will need the information of Year as well.
We will have to perform the operation in 2 steps.
1). To convert the legacy date into YYYYMMDD Format.
2). Once we achieve the first part, we can use the Function module 'DATE_TO_PERIOD_CONVERT' by passing the date and it will return the period and year. and you can pass the period to the result.
Sample code is as below. Let me know if it helps.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = wa_result-calday
i_monmit = 00
i_periv = 'Z2'
IMPORTING
e_buper = l_period
e_gjahr = l_year
EXCEPTIONS
t009b_notfound = 4
INPUT_FALSE = 4.
wa_calday-v_period = l_period.
Thanks
Sachin -
What is meant by matn1 conversion routine in info object
hi,
Can i know the exact meaning and usage of matn1 (type of conversion routine) in the infoobject level.
thanks in advanceHi Sankar,
Conversion takes place when converting the contents of a screen field from display format to SAP-internal format and vice versa and when outputting with the ABAP statement WRITE, depending on the data type of the field.
Check the info here:
http://help.sap.com/saphelp_nw04/helpdata/en/2b/e9a20d3347b340946c32331c96a64e/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/07/6de91f463a9b47b1fedb5be18699e7/content.htm
Hope this helps... -
Conversion Routines and Function Modules
Hi All,
I have to write the Conversion Routines and Transformation Process for below Fields,
I have a situation, where am having text files with the data having below fields, and before uploading the data to Database i have to do conversion.
So anybody Plz help me regarding this conversion topic how to write the process and how to write the code.
Table Field Name Type Length Short Text
BKPF BLART CHAR 2 Document Type
BKPF BUKRS CHAR 4 Company Code
BSEG BUKRS CHAR 4 Company Code
BSEG HKONT CHAR 10 General Ledger Account
BSEG KOSTL CHAR 10 Cost Center
BSEG VERTN CHAR 13 Contract Number
KNA1 KUNNR CHAR 10 Customer NumberHi Bala
Supposing all the fields exist in internal table itab. You can add the code simple as below:
loop at itab.
perform conv_fld changing: itab-bukrs,
itab-blart,
itab-hkont,
itab-kostl,
itab-vertn,
itab-kunnr.
endloop.
*& Form conv_fld
FORM conv_fld CHANGING fld.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = fld
IMPORTING
OUTPUT = fld.
ENDFORM. " conv_fld
So for each field depending on its length the conversion routine acts and gives the right output. Please make sure, that your internal table if defined with the right field references or length.
Kind Regards
Eswar
Maybe you are looking for
-
FOLLOW UP ON brokendownIPOD THREAD
brokendownIPOD wrote that to solve the iPod not being recognized by iTunes or iPod installer, she simply "reformat[ted] the drive the USB cable is plugged into." Does anyone know what she means, or, more importantly, how one would do this? I've got a
-
I have 2 apple ID's, one for an IPAD and the other for an IPHONE. I have just purchased a new macbook air and when setting it up, I receive a 'server error' meesage when attamepting to sign in with either of the 2 pre existing apple id's. These pre
-
I have been using the following code to add a page to the document. Utils<ILayoutUIUtils>()->AddNewPage(); It has been working fine in CS3 and CS4. However in CS5 (mac), it is inserting pages. So in a 2-page document, any objects that were on the 2nd
-
Hello Everybody! I'm a new iPhone user and new at iPhoneFans. I'm from Brazil and I have an iPhone 3Gs without jailbreak and locked to my mobile company (Vivo). Next week I'm gonna to Orlando. It will work in roaming, but I will not use data connecti
-
SCOM 2007 to monitor Exchange 2010 Backups
Hi Is there any way of getting SCOM 2007 to monitor Exchange 2010 backups. I'm using Commvault as the backup solution, was wondering if there's anything i can check for to ensure successful or failed bakcups