Transformation routine: delete 4 first characters..
Hi dear experts,
i need a transformation routine which deletes the first 4 characters from a field type CHAR.
Exemple: "VKIA1000000000" -> "1000000000"
do you know how it should look like?
thanks for your time!
j.
Hi,
You can try this in you routine:
Select single FieldXXX from /bic/aABC00 into t_Field
where
KEYFIELD = e_t_result-KEYFIELD. (condition)
SHIFT t_Field LEFT DELETING LEADING space.
if t_Field is NOT INITIAL.
E_T_RESULT-/bic/XXX = t_Field+4(10).
else.
E_T_RESULT-/bic/ycrtime = 0.
endif.
Rgs,
I.R.K
Similar Messages
-
Test for Permitted Characters in Transformation Routine
Hello,
Background: There is a data quality issue when loading 3rd party data to BW, which cannot be solved at source. Therefore, initial transformation rules when loading to data warehouse level DSO, should identify and deal with error values.
Possible Solution: Test validity of value within transformation routine via a custom function module.
Execution: Function module would require to check lowercase character handling of target InfoObject (RSDCHABAS-LOWERCASE) and scan source value against permitted character set (RSKC).
Questions: How can the permitted list of characters be returned within transformation routine? Is there an available delivered function module to handle accessing permitted character set?
I would appreciate any answers to the above questions or alternative suggestions to the above strategy.
Thanks -
Brendan.There is a function module "RSKC_ALLOWED_CHAR_GET". Use SE37 to check it out.
-
How to delete first few characters from all the elements of an array of strings
hi
I have a 2-dimensional array of strings length 104. I have to delete first 6 characters from all the elements of array and then change the strings to int. how to do it?? plz helpAttached you can find the screenshot showing how to do so.
Bye!
Licia
Attachments:
array.jpg 14 KB -
Calling a function module from within a transformation routine
I created a routine within a transformation and experience the following weird behavior now:
When I call a function module within that routine, the load fails with the following error message:
Exceptions in Substep: Rules
When I click on the button next to this text, it point me to my function module call.
What I do not understand is, that the following two scenarios work fine:
- Having the same function call (with fake values) in a plain ABAP program works beautilfully
- If I copy the content of my function module directly into my transformation routine, everything works fine as well
I am now wondering whether the routine does not "see" the function module I am calling. The module resides in a different package. Is that a problem? Do I have to include something first?
Here is the code that calls my FM (
CALL FUNCTION 'Z_CA_CONVERT_US_COST'
EXPORTING
PSOURCEVAL = SOURCE_FIELDS-/BIC/USFRZMFC
PSOURCEUOM = SOURCE_FIELDS-BASE_UOM
PUSITM = SOURCE_FIELDS-/BIC/USITM
PTARGETUOM = PRODUCTION_UOM
IMPORTING
PTARGETVAL = RESULT
EXCEPTIONS
CONVERSION_NOT_MAINTAINED = 1
PARTNO_NOT_FOUND = 2
OTHERS = 3.
Thanks a lot for your help. Points will be assigned.
DennisGood catch, BI Learner. This was exactly it: when assigning the values from SOURCEFIELDS directly to the import/export parameters, you have to make sure that the types are EXACTLY the same, otherwise it will not work (the routine stops with an error when calling the FM, but there is no dump).
Therefore, to solve my problem, I created the declarations precisely as expected by the FM and assigned the values to these fields:
DATA:
SOURCEVAL TYPE /BIC/OIINVQTY,
SOURCEUOM TYPE /BIC/OIUSUOM,
USITM TYPE /BIC/OIUSITM,
TARGETUOM TYPE /BIC/OIUSUOM,
CONVERTED_COST TYPE /BIC/OIINVQTY.
DATA PRODUCTION_UOM TYPE /BIC/OIUSUOM.
" get the Production UOM
SELECT SINGLE I~/BIC/USPRDUOM
FROM /BIC/PUSITM AS I
INTO PRODUCTION_UOM
WHERE I~/BIC/USITM = SOURCE_FIELDS-/BIC/USITM AND I~OBJVERS = 'A'.
IF ( SY-SUBRC = 4 ). " no records found
"RAISE PARTNO_NOT_FOUND.
RAISE EXCEPTION TYPE CX_RSROUT_SKIP_RECORD.
ENDIF.
" load the parameters
SOURCEVAL = SOURCE_FIELDS-/BIC/USFRZMFC.
SOURCEUOM = SOURCE_FIELDS-BASE_UOM.
USITM = SOURCE_FIELDS-/BIC/USITM.
" then you can call the FM
CALL FUNCTION 'Z_CA_CONVERT_US_COST'
EXPORTING
PSOURCEVAL = SOURCEVAL
PSOURCEUOM = SOURCEUOM
PUSITM = USITM
PTARGETUOM = PRODUCTION_UOM
IMPORTING
PTARGETVAL = CONVERTED_COST
EXCEPTIONS
CONVERSION_NOT_MAINTAINED = 1
PARTNO_NOT_FOUND = 2
OTHERS = 3.
" ... [do the rest]
Thanks for your help,
Dennis -
Help in transformation routine
I have to put an indicator for delivery block in transformation routine.
Logic: if headed delivery block 'LIFSK' is not blank, result is 'X'.
Here is my code which is not working:
IF SOURCE_FIELDS-LIFSK NE ''.
RESULT = 'X'.
ENDIF.
But this code is not doing anything. I tired using 'test' function in transformation, it gives abap dump.
What is the problem. Code is in right place in transformation routine.
A similar code for item level block is working:
More details:
$$ begin of routine - insert your code only below this line -
... "insert your code here
*-- fill table "MONITOR" with values of structure "MONITOR_REC"
*- to make monitor entries
... "to cancel the update process
raise exception type CX_RSROUT_ABORT.
... "to skip a record
raise exception type CX_RSROUT_SKIP_RECORD.
... "to clear target fields
raise exception type CX_RSROUT_SKIP_VAL.
IF SOURCE_FIELDS-ZZ_LIFSP ne ''.
RESULT = 'X'.
endif.
$$ end of routine - insert your code only before this line -
ENDMETHOD. "compute_ZDELIBLK
Thanks
Jeff
Edited by: Jeff Edwards on Aug 17, 2008 10:34 PMNo luck.
Error analysis
The following checkpoint group was used: "No checkpoint group specified"
If in the ASSERT statement the addition FIELDS was used, you can find
the content of the first 8 specified fields in the following overview:
" (not used) "
" (not used) "
" (not used) "
" (not used) "
" (not used) "
" (not used) "
" (not used) "
" (not used) "
ST22 / ABAP Editor :
*-- Get field name from source field with extern posit.
READ TABLE i_t_seg_source ASSIGNING <ls_s_seg_source>
WITH KEY segid = i_segid.
ASSERT sy-subrc = 0.
IF sy-subrc = 0.
READ TABLE <ls_s_seg_source>-t_field ASSIGNING <ls_s_field>
WITH KEY position = l_posit_source_ex.
> ASSERT sy-subrc = 0.
ENDIF.
*-- r_s_parameter-param_id has to be set out side due to type inheritance of RuleStepMapping
CONCATENATE '<' <ls_s_seg>-y__nm '>' INTO
c_s_connector-s__nm.
c_s_connector-f__nm = <ls_s_field>-fieldname.
ENDMETHOD. -
Table Declaration in Transformation Routine
Hi all,
I have declared a table in transformation routine as follows :
DATA : BEGIN OF VACATIONS OCCURS 0,
DATE TYPE D,
END OF VACATIONS.
System is giving following error on this :
' E:Tables with headers are no longer supported in the OO context.'
What should I do now?
Regards,
Aisha Ishrat
ICI Pakistan Ltd.Hi Al,
Let me explain here ... because you are doing what is being told to do without actually understanding your purpose. Let me take a scenario. You want to read a database table for sales orders populate it into the internal table. Then you wnat to loop at the internal table you populated and print the output. For this what you need is an internal table where your data will be stored - simply put its a 2 dimentional array. so your data once put into the internal table would look like:
Sales_Order Sold_To_Party
1 1
2 3
3 5
4 1
Now what you do is read it - which means you are going to read one line at a time, which means a structure not an internal table, which was the purpose of the header line. but since header lines are not supported you need a different work area (structure). So that when you read the first line your structure contains as follows:
1 1
When you read the second line your structure or work area contains the second line:
2 3
so on.....
From the explaination above you must be clear that you need an internal table to store data temporarily and a structure to manipulate a single record. Now the cod would look like:
DATA: it_vbak type table of VBAK.
DATA: wa_vbak type vbak.
Notice above that one is using a "table" while declaring and the other is not.
Select * from VBAK into table it_vbak.
loop at it_vbak into wa_vbak.
note above that you are looping at the internal table and populating one record
into the work area.
write:/ wa_vbak-vbeln.
endloop.
Hope this helps. Ask if you have any more concerns.
Best regards,
Kazmi -
Transformation routine on 2 different targets fields
Hi gurus,
I have been trying do some ABAP transformation routines, I did 1 and it was good works fine, then I tried to create another transformation routine on a different target field of the same DSO, and for some reason what I did on the global declaration on the other transformation is in this transformation and if I do a change in the second transformation it shows in the first transformation, other thing is that in the second transformation anything works, I got errors for everything and are not very specific. I may be skipping some basic steps; maybe I canu2019t create 2 transformation routines in the same transformation?
ThanksHi,
There can be just 1 start routine.
These are execute once. Also the declarations done in the global section remain visible in all the transformation routines.
You can write multiple transformation(field level) routines.
-Mayuri -
Is there a way to delete extra characters in a StringBuffer after the first occurance? For example, if I wanted to delete all comma's after the first occurance in a string, this seems to work:
if(custName.lastIndexOf(",") > custName.indexOf(","))
custName.replace(' ,' , ' ');
But how would you do this in a StringBuffer? I have tried using something like this:
int numComma = 0;
for(int i = 0; i < letter.length(); i++)
if(letter.charAt(begin) == ',')
numComma ++;
if( letter.charAt(begin) == ',' && numComma > 1)
letter = letter.deleteCharAt(begin);
but it deletes all commas, including the first occurrance..Would you use the same approach to delete extra spaces between words?[if there is more than one space] Any suggestions would be appreciated..if you use java.util.stringtokenizer you can tokenize by your delimiter.
-
Restrict on the first characters of a characteric value
Hi Experts,
I would like to restrict some characterics on the three or four first characters of the value. For example, imagine the value 'ABCD-1234'; i would like to filter only values which begin with ABC.
Is that possible unless doing a routine in the customer exit? If yes, how?
Thanks in advance.
LucI need to do this in the query def. The list of the values can change but the format will be always the same (beginning with ABC); that's why I can't make a range of values because I risk not to take into account all the good values.
This an example of values:
SEEC3-2004-321
SEEC3-2004-346
SEA31-2004-584
SEA31-2004-724
SCY54-2004-828
SCY54-2004-869
SEA31-2004-888
SCY54-2004-911
SEE54-2004-928
SEE31-2004-952
SEE54-2004-1034
I just want to restrict on values which begin with SEEC and SCY. Do you see a possible solution?*
Thank you all -
Data aggregation by the 2 first characters of a characteristic
Hi,
in a query, i'd like to extract the two first characters of a characteristic and aggregate a key figure.
For example, i have the characteristic material number and the quantity.
Mat numb 0Qty
01AAAA 1
01BBBB 1
01CCCC 2
02AAAA 2
02DDDD 3
AATTTTT 3
Here is the result i want :
Mat numb 0Qty
01 4
02 5
AA 3
i can't use the selection condition because i don't know what is the value of the 2 first Characters. i don't want to modify the infocube by adding a new characteristic?
Is there any regular expression in the selection condition i can use ( for ex : for characteristic Material Number, select the first character between 0 and A and the second between 0-A and *) ?
Do i have to do it by using a user exit ?
Thanks for your help.When I did that it juts brought over the text from the table of contence. I thought maybe that was needed. So I deleted what was their before and replaced it with what popped in. I did the same for the section pages. Just to see what happened. It brought in the section numbers and it did pretty much the same. I'm fine with relabeling my pages to match. The table of contents. I still would like that first chapter page in the table of contents to actually link to the page if possible. It still not linking right.
-
DTP can't be deleted, if transformation was deleted before it
DTP can't be deleted, if transformation was deleted before it
How I can delete that DTP?Hi,
if you want delete the Delta DTP or Full DTP use program deleting DTP's.
enter the T-CODE- SE38 -> run the program -> give the DTP technical name -> execute.
it will go permanently.
Thanks,
Phani. -
?xml version="1.0"? tag not appearing as first characters in document
Hi,
JSP below successfully creates a XML document but it includes a blank line before the <?xml version="1.0"?> tag.
This causes my PL/SQL to return a "ORA-20100: Error occurred while parsing: PI names starting with 'xml' are
reserved." error when using the XMLPARSER package.
I am outputting the XML to IE5.0 but even if I do a SYSTEM out I get the same blank line before the initial tag.
There are posts on here that confirm the PI error is caused by the tag not being the first characters in the document, but no solution/fix is provided.
Any ideas much appreciated.
JSP Code
<%@ page import="java.sql.*, oracle.jbo.*, oracle.jdeveloper.cm.*, oracle.jdbc.*,oracle.xml.sql.query.*" %>
<%String driver="oracle.jdbc.driver.OracleDriver";
Driver d = new oracle.jdbc.driver.OracleDriver();
String dbURL="jdbc:oracle:thin:@localhost:1521:mydb";
String login="i2k";
String password="fred";
Connection cn = null;
cn = DriverManager.getConnection(dbURL,login,password);
// SQL Statement from URL Parameters
String sql = request.getParameter("sql");
if(sql == null){
sql = "select * from vfi_trans";
// Create SQL-to-XML Handler
OracleXMLQuery q = new OracleXMLQuery(cn, sql);
// Use <TransactionList> as document element for Rowset
q.setRowsetTag("TransactionList");
// Use <Transaction> for each row in the result
q.setRowTag("Transaction");
// set encoding
q.setEncoding("iso-8859-1");
// ensure lower case element names
q.useLowerCaseTagNames();
// Generate XML results and write to output
String xmldoc = q.getXMLString();
out.println(xmldoc.trim());
//System.out.println(xmldoc.indexOf("\n"));
cn.close();%>
PL/SQL
PROCEDURE XML_HANDLER2 IS
-- MODIFICATION HISTORY
-- Person Date Comments
vfiURL VARCHAR2(100);
parser xmlparser.Parser;
vfiXML xmldom.DOMDocument;
transactions xmldom.DOMNodeList;
transactions_found NUMBER;
curNode xmldom.DOMNode;
textChild xmldom.DOMNode;
v_itrans_site vfi_trans.itrans_site%TYPE;
BEGIN
dbms_output.put_line('Integrator 2000 Transactions');
-- This is the URL to browse for an XML-based vfi feed of stories on XML
vfiURL := 'http://10.1.1.111:7070/i2k25_html/ShowQuery.jsp?sql=select%20*%20from%20vfi_trans';
-- Set the machine to use as the HTTP proxy server for URL requests
http_util.setProxy('MYPROXY');
-- Parse the live XML vfi feed from Moreover.com by URL
parser := xmlparser.newParser;
vfiXML := xml.parseURL( vfiURL );
xmlparser.freeParser(parser);
-- Search for all <headline_text> elements in the document we recieve
transactions := xpath.selectNodes(vfiXML,'/TransactionList/ITRANS_ID');
-- Loop over the "hits" and print out the text of the title
FOR j IN 1..xmldom.getLength(transactions) LOOP
-- Get the current <headline_text> node (Note the list is zero-based!)
curNode := xmldom.item(transactions,j-1);
-- The text of the title is the first child (text) node of
-- the <headline_text> element in the list of "hits"
-- textChild := xmldom.getFirstChild(curNode);
v_itrans_site := xpath.valueof(curNode, '.');
dbms_output.put_line('('| |LPAD(j,2)| |') '| | v_itrans_site);
END LOOP;
-- Free the XML document full of vfi stories since we're done with it.
xml.freeDocument(vfiXML);
EXCEPTION
WHEN OTHERS THEN
RAISE;
END; -- Procedure
nullCharles,
I believe that the blank line is caused by the JSP engine when it strips out the '<%@ page import...>' (replace bracket with brace) statement. God (or at least Larry E) forgive me for posting a link at IBM, but this article speaks to your issue:
http://www-106.ibm.com/developerworks/library/j-dynxml.html?dwzone=ibm
Maybe you need to put the <?xml?> tag in the jsp itself and strip it out of your xmldoc before outputting it.
Good luck. -
Error in Transformation Routine
Hi all,
I have written a code in transformation routine. I have debugged the code. The code which I have written is working fine. The value in 'Result' is correct and till here the code executes without any error. After that , system throws an error which I cannot understand as this is the system generated code.
I wanted to paste the error analysis here but i dont have any option to copy from there. Message class is "RSBK". Number is 299
Any ideas?
Regards,
Aisha Ishrat
ICI Pakistan Ltd.Hi AI,
As I told you earlier ... jsut copy and paste the code I sent you in the end routine ... if the end routine contains your data then we are sure that the transformations have worked fine ... if it does not contain any data then we are sure something has gone wrong during the transformation.... you cannot find the problem until you are sure where it is happening.... lets work on this and get it out of our way... I am waiting for your response.
Another point if anything has gone wrong while doing the transformations for location then the end routine will not have location info ... this is why I suggest you to put the code above in the end routine and debug ... this will give you a fair idea as to what has happened and where the problem arises.... Hope this helps.
best regards,
Kazmi -
Target value in transformation routine
Hi
How can I get the value of target field, which is already present, in the transformation routine?
For Example, I have a transformation between ODS DS1 and ODS DS2. DS1 has fields DS1_F1, DS1_F2 and DS2 has fields DS2_F1, DS2_F2. Now I have written a transformation routine for target field DS2_F1 with input DS1_F1. In this routine, I want to get the value of DS2_F1, which is already present, before the result is being updated. How can I get it?
Thanks & Regards
TejoHi,
Use end routine concept here .
Regards,
Anil Kumar Sharma .P -
CX_SY_NO_HANDLER triggered when call FM in Transformation Routine in BI
Hi,
Currently we are encountering an error whereby the Exception 'CX_SY_NO_HANDLER' will be triggered whenever we call a Function Module inside a Transformation Routine in BI.
Previously, this FM was a Custom FM, but even after changing to a standard FM this error still happens.
The process does not even enter into the FM, but immediately jumps to a 'Try - Catch' block of standard SAP, with the message "an exception (CX_SY_NO_HANDLER) occured".
Hence, we need to confirm:
does SAP/BI allow calling an FM inside a Transformation Routine?
if yes to above, how do we avoid encountering this error when calling a FM inside a Transformation Routine.
Your help is very much appreciated.
Thanks you.Yes, you can call a FM from function module.
Make sure your import and export parameters are of same type as defined in FM when passing values to FM from transformation.
For example:
in function module
xyz type i.
transformation
abc type char.
CALL FUNCTION 'dsjfh'
EXPORT
xyz = abc.
Regards,
San!
Maybe you are looking for
-
How can I write to the automation server job log file from my EDK AWS? This AWS does more then just return Groups and Users and I need to write to the log file the results of the additional operations. Please let me know how to implements this.
-
Bluetooth not available - at my wits end.
Hello Apple community, this is my first post. Problem: Bluetooth not available - i think it started after installing Lion, intermittent on and off for about 12 months, gave up about 6 months ago until now. System: Macbook 13.3 mid 2010 OSX Lion 10
-
Having problems with outlook 2007
I got outlook 2007 and am using it to receive my gmail account email and when it downloads a new message it deletes it from my phone. Does anyone have a fix for this?
-
How to open .doc attachments
Can anyone direct me to how I might open MS Word documents? It would be appreciated. (Iphone 3G v2.2.1)
-
When I try to turn on Home Sharing, I get the message: "Home Sharing could not be turned on because of an error (5506)." What does this mean please?!