Currency translation routine - pls correct ABAP code
Hi,
I am trying to implement a scenario for currency conversion at the transformation level.(i am using BI 7.0)
My source data is flat file.
My scenario here is like
I have 2 masters - country & supplier.
I added 0loc_currcy as an attribute to the country.
The master data of country is as below:
Cid cname local currency
C1 INDIA INR
C2 SWISS CHF
C3 America USD
For supplier master data is:
supp id Sname
S1 raghu
S2 tej
S3 harish
S4 reddy
I defined 2 key figures one Zprice1 & Zprice2.
Zprice1 has currency type 0DOC_CURRCY
Zprice2 has currency type 0LOC_CURRCY
In the PSA the data is as below:
cid sid 0calday price1 doc_curr
C1 S1 01.01.2007 300,00 INR
C1 S2 01.02.2007 400,00 CHF
C1 S3 03.01.2007 350,00 USD
C1 S4 15.04.2007 450,00 EUR
C2 S1 31.05.2007 600,00 INR
C2 S2 21.06.2007 250,00 CHF
C2 S3 01.01.2007 900,00 USD
C2 S4 01.02.2007 1.300,00 EUR
C3 S1 03.01.2007 1.250,00 INR
C3 S2 15.04.2007 500,00 CHF
C3 S3 31.05.2007 50,00 USD
C3 S4 21.06.2007 300,00 EUR
I am expecting my data in the cube to be as below:
cid sid 0calday price1 doc_curr price2 loc_curr
C1 S2 01.02.2007 400,00 CHF 350,00 INR
(bcoz c1->INR)
C3 S1 03.01.2007 1.250,00 INR 25,00 USD
(bcoz c3->USD)
Based on cid the loc_curr value(amount & currency after conversion) should be displayed.
in the transformation i assigned
/BIC/zprice1 -> zprice1
DOC_CURRCY -> zprice1
/BIC/zprice1 -> zprice2
DOC_CURRCY -> zprice2
For zprice2 i selected rule details.
In IOassignment of source fields i assigned ZPRICE1
and 0DOC_CURRCY.
In currency tab of rule details now it is like :
Target Currency 0LOC_CURRCY
Currency from source
Source Currency DOC_CURRCY
Now in rule type i selected routine and inserted code shown below:
data: ZResult_Val type f,
CALMONTH type rsgeneral-chavl .
CALL FUNCTION 'RSW_CURRENCY_TRANSLATION'
EXPORTING
I_CTTNM = 'ANYCALMON'
I_AMOUNT = SOURCE_FIELDS-/BIC/ZPRIC1
I_SCUR = SOURCE_FIELDS-DOC_CURRCY
I_TCUR = 'EUR' --- (what should i give here for target currency should be taken based on cid)
I_TIME_IOBJVL = CALMONTH
I_SCUR_IOBJVL =
I_TCUR_IOBJVL =
I_PERIV =
I_RATE = 'M'
I_VDATE =
IR_MSG =
I_MSG_TYPES =
IMPORTING
E_AMOUNT = ZResult_Val
E_RATE = 'M'
E_SCUR = SOURCE_FIELDS-DOC_CURRCY
E_TCUR = 'EUR'
EXCEPTIONS
SCUR_NOT_FOUND = 1
TCUR_NOT_FOUND = 2
DATE_NOT_FOUND = 3
CTT_NOT_FOUND = 4
SCUR_CONFLICT = 5
TCUR_CONFLICT = 6
DATE_CONFLICT = 7
INVALID_SCUR = 8
INVALID_TCUR = 9
RATE_NOT_FOUND = 10
X_MESSAGE = 11
INHERITED_ERROR = 12
OTHERS = 13
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 = ZResult_Val.
I am new to ABAP coding; infact this is my first peace of code.
Can any one tell me some tips of writing code-
->how to see all the syntax error at a time ; By clicking on check(ctrl+F2) i could see only the first syntax error.
-> how to check what each perameter mean? like what does I_CTTNM in this function call 'RSW_CURRENCY_TRANSLATION'. mean?
please help.
Thanks,
Raghu
I have written a test program as below:
<code>
REPORT ZCURRENCY.
data: tgtcurr type /BI0/OILOC_CURRCY,
ZResult_Val type F.
select LOC_CURRCY into tgtcurr from /BIC/PZCONTRY1 where /BIC/ZCONTRY1 =
'C3'.
endselect.
CALL FUNCTION 'RSW_CURRENCY_TRANSLATION'
EXPORTING
I_CTTNM = 'TEJ5' --currency trans type defined in RSCUR
I_AMOUNT = 10
I_SCUR = 'INR'
I_TCUR = tgtcurr
*I_TIME_IOBJVL = CALMONTH
IMPORTING
E_AMOUNT = ZResult_Val
E_TCUR = tgtcurr.
write: ZResult_Val
</code>
It is working fine
But the following code is not working for my scenario can some debug pls:
<code>
data: ZResult_Val type f,
ZSrc_val type f,
locvar type /BI0/OILOC_CURRCY.
Zsrc_val = SOURCE_FIELDS_RULE-/BIC/ZPRIC1.
select LOC_CURRCY into locvar from /BIC/PZCONTRY1 where /BIC/ZCONTRY1 =
SOURCE_FIELDS_RULE-/BIC/ZCONTRY1.
endselect.
CALL FUNCTION 'RSW_CURRENCY_TRANSLATION'
EXPORTING
I_CTTNM = 'TEJ5'
I_AMOUNT = 10
I_SCUR = 'INR'
I_TCUR = locvar
IMPORTING
E_AMOUNT = ZResult_Val
E_TCUR = locvar
RESULT = ZResult_Val.
</code>
Similar Messages
-
Error while running PING program using applet. Pls correct the code.-urgent
Can anyone pls correct the error in the below code.
Program : TestExec1
Using : Applet
Logic : Trying to display the ping status in the text area but it returns error...!
CODING
import java.awt.*;
import java.lang.*;
import java.io.*;
import java.net.*;
import java.awt.event.*;
import java.applet.*;
import java.*;
/*<applet code="TestExec1" width=380 height=150>
</applet>
public class TestExec1 extends Applet
String line = null;
TextArea outputArea;
Process p;
public void init()
outputArea = new TextArea(20,20);
public void start()
try
Process p= Runtime.getRuntime().exec("ping 192.168.100.192 -t");
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = in.readLine()) != null)
outputArea.append("\n" + line);
System.out.println(line);
catch (IOException e)
e.printStackTrace();
Error : C:\Program Files\Java\jdk1.6.0_02\bin>appletviewer TestExec1.java
java.security.AccessControlException: access denied (java.io.FilePermission <<AL
L FILES>> execute)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:323)
at java.security.AccessController.checkPermission(AccessController.java:
546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkExec(SecurityManager.java:782)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:447)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:431)
at java.lang.Runtime.exec(Runtime.java:328)
at TestExec1.start(TestExec1.java:31)
at sun.applet.AppletPanel.run(AppletPanel.java:458)
at java.lang.Thread.run(Thread.java:619)
Regards
ESMjava.security.AccessControlException: access denied (java.io.FilePermission
<<ALL FILES>> execute)This message tells you that the applet does not have permission to access/execute files. Access may be granted by either signing the applet, which allows the user to grant (or not grant) the access when running the applet, or by adding the necessary permission file to the user's computer.
See http://java.sun.com/javase/6/docs/technotes/guides/security/index.html -
Correct abap code - selectinf file by routine
Hi All,
Please correct my ABAP. I am selecting file by writing routine - BI7.0.
Following error I am getting:
When I clicked preview data i got "Fine Name wrong."
My file name. : 10042007.csv
Following code I wrote:
*TABLES: ...
DATA: str1(60) TYPE c,
str2(10) TYPE c,
str3(10) TYPE c.
str1 = 'C:\Documents and Settings\sun\Desktop/'.
str2 = SY-DATUM.
str3 = 'csv'.
$$ end of global - insert your declaration only before this line -
form compute_flat_file_filename
using p_infopackage type rslogdpid
p_datasource type rsoltpsourcer
p_logsys type rsslogsys
changing p_filename type RSFILENM
p_subrc like sy-subrc.
$$ begin of routine - insert your code only below this line -
This routine will be called by the adapter,
when the infopackage is executed.
concatenate str1 '\' str2 '.' str3 into p_filename.
p_subrc = 0.
When I click check button its giving me No systax error.
Thanks in advance1. if i were you, i will debugg your flat file determination code. put unconditional loop in your code (which should not end any more).
go to SM51, debugg the process from menu options.
or
try to keep file name without spaces i.e. Documents_settings like that.
Hope this helps.
Nagesh Ganisetti. -
Currency translation at transformations
Hi
I am getting one kf (internal wage cost) from 5 deffirent global systems. 5 deffireny curriencies are there. i want to laod into target with usd only based on calday i need to convery exchange rate from source to target.
i heared rscur is ther to create currency
ple let me know what steps what i need takeHi Suneel,
It would be better if you change the Currencies at Report level to USD.This will be easy way to achieve.
Create a Currency Translation by using RSCUR t-code.
It will be for Calday for any given currency & Target curr will be always USD.
And use this in the Properties of that Key figure in Currency Conversion Tab.
I think this should work........!
Best Regards,
VNK. -
Routine (ABAP Code) in Transformation error
Hi Experts
Please correct the ABAP CODE written as Field routine in Transformations
Requirment
If ZB_AMT = '0.00'
then result should be '0.00'
If ZB_AMT <> '0.00' and
SOURCE_FIELDS-/BIC/ZB_TPE1 = 'AMOUNT'
the result should be
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZB_AMT INTO RESULT.
If ZB_AMT <> '0.00' and
SOURCE_FIELDS-/BIC/ZB_TPE1 = 'PERCENTAGE'
the result should be
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
The code below is not working as it should please update me where i went wrong
Source Fields
SOURCE_FIELDS-/BIC/ZB_AMT (CHAR)
SOURCE_FIELDS-/BIC/ZB_TPE1 (CHAR)
CODE
IF SOURCE_FIELDS-/BIC/ZB_AMT = '0.00'.
RESULT = '0.00'.
ELSE.
IF SOURCE_FIELDS-/BIC/ZB_TPE1 = 'AMOUNT' AND
SOURCE_FIELDS-/BIC/ZB_AMT <> '0.00'.
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZBON_AMT INTO RESULT.
IF SOURCE_FIELDS-/BIC/ZB_TPE1 = 'PERCENTAGE' AND
SOURCE_FIELDS-/BIC/ZB_AMT <> '0.00'.
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
ENDIF.
ENDIF.
ENDIF.Your logic will not work, if your first check on amount is 0.00 fails, the other checks fail as well. I am not sure of the requirement but..try this..
IF SOURCE_FIELDS-/BIC/ZB_TPE1 = 'AMOUNT' AND SOURCE_FIELDS-/BIC/ZB_AMT = '0.00'.
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZBON_AMT INTO RESULT.
ELSEIF SOURCE_FIELDS-/BIC/ZB_TPE1 = 'PERCENTAGE' AND SOURCE_FIELDS-/BIC/ZB_AMT = '0.00'.
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
ELSEIF SOURCE_FIELDS-/BIC/ZB_AMT = '0.00'.
RESULT = '0.00'.
ELSE.
Do nothing or throw any message
ENDIF. -
Hi Experts
Please correct the ABAP CODE written as Field routine in Transformations
Requirment
If ZB_AMT = '0.00'
then result should be '0.00'
If ZB_AMT '0.00' and
SOURCE_FIELDS-/BIC/ZB_TPE1 = 'AMOUNT'
the result should be
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZB_AMT INTO RESULT.
If ZB_AMT '0.00' and
SOURCE_FIELDS-/BIC/ZB_TPE1 = 'PERCENTAGE'
the result should be
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
The code below is not working as it should please update me where i went wrong
Source Fields
SOURCE_FIELDS-/BIC/ZB_AMT (CHAR)
SOURCE_FIELDS-/BIC/ZB_TPE1 (CHAR)
CODE
IF SOURCE_FIELDS-/BIC/ZB_AMT = '0.00'.
RESULT = '0.00'.
ELSE.
IF SOURCE_FIELDS-/BIC/ZB_TPE1 = 'AMOUNT' AND
SOURCE_FIELDS-/BIC/ZB_AMT '0.00'.
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZBON_AMT INTO RESULT.
IF SOURCE_FIELDS-/BIC/ZB_TPE1 = 'PERCENTAGE' AND
SOURCE_FIELDS-/BIC/ZB_AMT '0.00'.
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
ENDIF.
ENDIF.
ENDIF.If ZB_AMT '0.00' and
SOURCE_FIELDS-/BIC/ZB_TPE1 = 'AMOUNT'
the result should be
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZB_AMT INTO RESULT.
If ZB_AMT '0.00' and
SOURCE_FIELDS-/BIC/ZB_TPE1 = 'PERCENTAGE'
the result should be
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
if zb_amt = '0.00' and SOURCE_FIELDS-/BIC/ZB_TPE1 = 'AMOUNT'.
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZB_AMT INTO RESULT.
endif.
if zb_amt = '0.00' and SOURCE_FIELDS-/BIC/ZB_TPE1 = 'PERCENTAGE'.
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
endif.
you can use a case statement as well
if zb_amt = '0.00'.
case SOURCE_FIELDS-/BIC/ZB_TPE1.
when 'AMOUNT'.
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZB_AMT INTO RESULT.
when 'PERCENTAGE'.
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
endcase.
endif. -
Needs sample ABAP code for field routine
Dear Expert,
There is a field "Pay Scale Group" in my DSO which stores the data in the format
AA1/B1/CCC2/DD2/EEE1, A1/BB2/CC2/DDD3/EE2 etc. These data has to be transferred to
InfoCube where "pay Scale Group" in the InfoCube will store the data like EEE1,EE2 etc.
I need to write a field routine on the transformation between DSO and Cube.
Can any one please help me with the sample ABAP code for this scenario.
Some more examples for better understanding of the requirement:-
Data in DSO(Source) Data in Cube(Target)
=================== ===================
AA1/B1/CCC2/DD2/EEE1 EEE1
AAA1/BB2/CC1/DDD3/EE2 EE2
A2/BBB2/CC2/DDD3/EEE5 EEE5
AA2/BB1/C1/DDD3/EE3 EE3
A3/B1/CC2/DDD1/EE4 EE4
Many thanks in advance.
Regards,
Prakash
Please do not dump your code requirements in SDN
Edited by: Pravender on May 18, 2011 11:37 AMHi,
You can use the following code :
Suppose the technical name of the field coming from DSO is ZPAY_SGRP.
And also for example let me take one record, that is ZPAY_SGRP = AA1/B1/CCC2/DD2/EEE1 .
My assumption is that there will always be 4 '/'.
In the field routine write the below code
data: V1(5) type c,
V2(5) type c,
V3(5) type c,
V4(5) type c,
V5(5) type c.
data : VAR1 TYPE /BIC/OIZPAY_SGRP.
split VAR 1 at '/' into V1 V2 V3 V4 V5.
result = V5.
V5 will be having the characters after the last '/' .That is V5 = EEE1.
Hope the above reply was helpful.
Kind Regards,
Ashutosh Singh
Edited by: Ashutosh Singh on May 17, 2011 3:53 PM
Edited by: Ashutosh Singh on May 17, 2011 4:17 PM -
ABAP code for BI 7.0 transformations start routine
Hi all,
I am trying to update data from DSO1 (Source1: transaction data) to Infocube(TARGET)
In the transformations Start routine, I have to read DSO2(Source2: Master data) for some fields.
DSO1 has CUSTOMER as part of key
DSO2 has CUSTOMER (key) and other fields....FIELD1, FILED2, FIELD3
Infocube to be updated with FIELDS1,2 & 3 WHILE READING DSO2.
WHERE DSO1 CUSTOMER matches with DSO2 CUSTOMER.
Also, data NOT TO BE UPLOADED into Infocube if FIELD1 in DSO2= NULL
Please give me the abap code for the above logic.
Appreciate any help in this regard.
Thanks.This is a doc from this site:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19
Ravi Thothadri -
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 -
ABAP Code Problem in Start Routine to Fill the value from Look-up Table ???
Hi all,
I am trying to fill the values of DOC_NUMBER & PLANT from look-up table /BIC/AZSD_O0700 (Billing Item ODS) for each BILL_NUM in Start Routine for Update Rules of Billing Header ODS and modify the data_package.
What is wrong with the below ABAP code, PLEASE ???
data: it_data type standard table of data_package_structure
with header line
with non-unique default key initial size 0.
types: begin of billing_item_type,
BILL_NUM like /BIC/AZSD_O0700-BILL_NUM,
DOC_NUMBER like /BIC/AZSD_O0700-DOC_NUMBER,
PLANT like /BIC/AZSD_O0700-PLANT,
end of billing_item_type.
refresh it_data.
clear it_data.
it_data[] = DATA_PACKAGE[].
refresh DATA_PACKAGE.
clear DATA_PACKAGE.
loop at it_data.
select DOC_NUMBER PLANT into (it_data-DOC_NUMBER, it_data-PLANT)
from /BIC/AZSD_O0700
where BILL_NUM = it_data-BILL_NUM
and FISCVARNT = it_data-fiscvarnt.
endselect.
if sy-subrc = 0.
move-corresponding it_data to DATA_PACKAGE.
endif.
endloop.
modify DATA_PACKAGE.
Thanks,
Venkat.Hi Venkat,
Two things -One is the performance and the other ... there is no Append within the loop.
Try moving the select statement ousdie the loop to improve performance and move the modify statement into the loop ... change modify to append. Code below.
Let me know if you need more help.
Best regards,
Kazmi
data: it_data type standard table of data_package_structure
with header line
with non-unique default key initial size 0.
types: begin of billing_item_type,
BILL_NUM like /BIC/AZSD_O0700-BILL_NUM,
DOC_NUMBER like /BIC/AZSD_O0700-DOC_NUMBER,
PLANT like /BIC/AZSD_O0700-PLANT,
end of billing_item_type.
refresh it_data.
clear it_data.
it_data] = DATA_PACKAGE[.
refresh DATA_PACKAGE.
clear DATA_PACKAGE.
loop at it_data.
select DOC_NUMBER PLANT into (it_data-DOC_NUMBER, it_data-PLANT)
from /BIC/AZSD_O0700
where BILL_NUM = it_data-BILL_NUM
and FISCVARNT = it_data-fiscvarnt.
endselect.
if sy-subrc = 0.
move-corresponding it_data to DATA_PACKAGE.
Append DATA_PACKAGE.
endif.
endloop. -
Execute ABAP code in Start Routine only once
I have ABAP code in a start routine that I only want to execute once. Is there a way to tell this is first execution of the start routine?
Also can I find out these value in the start routine ABAP:
1. How many data packets there are?
2. What data packet I am processing?
Regards,
Mike...Hi,
I've just setup a little test:
TRules, Start Routine Global Decl:
DATA: GVI TYPE I, GVN(5) TYPE N.
Start Routine:
IF GVI IS INITIAL.
GVI = 1.
ELSE.
ADD 1 TO GVI.
ENDIF.
MOVE GVI TO GVN.
This is basically counting the times the start routine is executed and populating the var GVN; I am posting GVN in a char ZTESTGV in the target cube. I am posting as well the datapakID in my cube.
I have loaded two requests (each 4 packets)
the first one first to PSA and then from the PSA to the target: this is Serially using one single process. Here's the result in the cube:
Request________________________________DATAPAKID_____ZTESTGV
REQU_8B5ASGQNYYNIV1OJN68HFH1SR____________1____________1
REQU_8B5ASGQNYYNIV1OJN68HFH1SR____________2____________2
REQU_8B5ASGQNYYNIV1OJN68HFH1SR____________3____________3
REQU_8B5ASGQNYYNIV1OJN68HFH1SR____________4____________4
In this case the global variable is persistent accross packets.
the second request is loaded in paralell: this is, multiple processes are executed at the time. Here's the result in the cube:
Request________________________________DATAPAKID_____ZTESTGV
REQU_14QVH21BSVH44FAJW94BD7N2H____________1____________1
REQU_14QVH21BSVH44FAJW94BD7N2H____________2____________1
REQU_14QVH21BSVH44FAJW94BD7N2H____________3____________1
REQU_14QVH21BSVH44FAJW94BD7N2H____________4____________1
In this case the global variable is always1 !!
This is logic since several a process cannot access the internal memory used by another one...
Conclusion; the global variable will work only if the load is serial...
hope this helps...
Olivier. -
ABAP Code in Start Routine for restricing the data records from ODS1 - ODS2
Hi
I need small ABAP Code in Start Routine Of Update rules Of ODS . Im in BW 3.5 .
I have records like below in first layer ODS and i want to restrict some records while going to second layer ODS ..
ODS1 :-
DocNO EventType Date
123 001 08/08/2008
123 003 08/08/2008
123 011 09/08/2008
I want one record in ODS2 for this document number whose EventType = 001 only and date of third record ... like below
Doc NO EventType From Date Todate
123 001 08/08/2008 09/08/2008
So how can i get like this record in the ODS2 which will get data from ODS1 . So i need to write the code in the start routine of the ODS2 .
So please give the me the code for start routine ....
Regards
SureshIts difficult in BW 3.5 to include this logic in START_ROUTINE as you cannot add the extra to_date field to the DATA_PACKAGE table.
You need to create a new global internal table with the same structure of DATA_PACKAGE with additional field to_date. then use the logic to fill in the global internal table
define a internal table new_data_package with the required structure like (docno, eventtype, fromdate todate)
data: l_w_datapkg_001 type data_package,
data: l_w_newdatapkg type new_data_package,
data: l_w_datapkg_011 type data_package
LOOP AT DATA_PACKAGE INTO l_w_datapkg_001 WHERE event_type = '001'.
l_w_newdatapkg-docno = l_w_datapkg_001-docno.
l_w_newdatapkg-event_type = l_w_datapkg_001-event_type.
l_w_newdatapkg-fromdate = l_w_datapkg_001-date.
MOVE CORRESPONDING FIELDS OF l_w_datapkg_001 INTO l_w_newdatapkg.
READ TABLE data_package INTO l_w_datapkg_011
WITH KEY docno = l_w_datapkg_001-docno
event_type = '011'.
l_w_newdatapkg-to_date = l_w_datapkg_011-date.
APPEND l_w_newdatapkg TO new_data_package
ENDLOOP.
Now the new datapackage contains the ODS2 data that u needed -
Hi,
I want to write a transfer routine, Can any one give me the ABAP Code...
Here is what I want to do:
1. Read by document Number at the Header level (identified by item = "#")
2. Read the Status of the Header
3. If the Status = deleted
4. Read all the line items related to the Header
5. Assign the Status of the line item = Status of the Header
Thanks
Edited by: tanu d on Aug 20, 2010 11:32 AMHi,
See the simple code.
IF SOURCE_FIELDS-N_WBSEOM = ' '.
RESULT = 'N'
ELSE.
RESULT = SOURCE_FIELDS-N_WBSEOM.
ENDIF.
OR
IF SOURCE_FIELDS-N_WBSEOM IS INITIAL.
RESULT = 'N'
ELSE.
RESULT = SOURCE_FIELDS-N_WBSEOM.
ENDIF.
Thanks
Reddy
Edited by: Surendra Reddy on Nov 25, 2009 5:38 AM -
Convert ABAP code in start routine/update rule to transform. start routine
Dear BW ABAPers,
I have created a custom purchasing info cube (YCP_PURC1) based on 0CP_PURC1 standard cube. I would like to convert this new data flow to BI7 (from 3.x), and convert the standard update rule to transformation. I would need to rewrite the below start routine from the standard update rule to a start routine ABAP code in the newly created transformation / start routine. My ABAP knowledge is limited. Will you please help?
*this is the start routine from the update rule. As a side note, the data source is 2LIS_02_SCL.
LOOP AT SOURCE_PACKAGE.
IF ( SOURCE_PACKAGE-cppvlc EQ 0
AND SOURCE_PACKAGE-cppvoc EQ 0
AND SOURCE_PACKAGE-cpquaou EQ 0 ).
DELETE SOURCE_PACKAGE.
CONTINUE.
ENDIF.
no_scl is initial ( e.g. for good receipts, billing)
value has to be set depending on storno
IF SOURCE_PACKAGE-no_scl IS INITIAL.
IF SOURCE_PACKAGE-storno = 'X'.
SOURCE_PACKAGE-no_scl = -1.
ELSE.
SOURCE_PACKAGE-no_scl = 1.
ENDIF.
MODIFY SOURCE_PACKAGE.
ENDIF.
ENDLOOP.
if abort is not equal zero, the update process will be canceled
ABORT = 0.
Many thanks and look forward to your kind feedback.
Kind regards,
CsabaDear All, Durgesh,
thanks to you all for your valuable input. Mainly the ABAP part was more interesting for me.
Durgesh, thanks for your input, it was useful. I just had to change the info objects to data source fields and add the lines before the loop:
DATA: I_PACKAGE TYPE TYT_SC_1.
FIELD-SYMBOLS <i_package> TYPE tys_sc_1.
I_PACKAGE[] = SOURCE_PACKAGE[].
LOOP AT SOURCE_PACKAGE assigning <i_package>.
IF ( <i_package>-BWGEO EQ 0
AND <i_package>-BWGEOO EQ 0
AND <i_package>-BWMNG EQ 0 ).
DELETE SOURCE_PACKAGE index sy-tabix.
CONTINUE.
ENDIF.
no_scl is initial ( e.g. for good receipts, billing)
value has to be set depending on storno
IF <i_package>-NOSCL IS INITIAL.
IF <i_package>-ROCANCEL = 'X'.
<i_package>-NOSCL = -1.
ELSE.
<i_package>-NOSCL = 1.
ENDIF.
ENDIF.
ENDLOOP.
Points have been assigned accordingly.
Thanks,
Csaba -
How to translate an excel macro to ABAP code
Hi Guys,
My requirement is need to put the subtotaling option w.r.t divison when i download the file to an excel sheet via OLE.
Iam able to get the records in the excel sheet but unable to write the macro in ABAP code.
the macro which i recorded in Excel is
Range("A1:C3").Select
Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(3), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
how do i convert this into ABAP code .Pls help. Thanks...
the data might be like
NAME DIVISION AMOUNT
ABC IT 400
DEF BPO 500
HTG IT 400Hi,
You can run an excel macro like this
CREATE OBJECT h_excel 'EXCEL.APPLICATION'.
Call Method of h_excel 'WORKBOOKS' = h_mapl.
set property of h_excel 'VISIBLE' = 0.
Call Method of h_mapl 'OPEN'
EXPORTING
#1 = d_file.
CALL METHOD OF H_EXCEL 'ActiveWorkbook' = h_book .
CALL METHOD OF H_book 'Activesheet' = H_sheet .
CALL METHOD OF h_excel 'RUN'
EXPORTING
#1 = ld_macro.
Check the links below as well
http://sample-code-abap.blogspot.com/2009/07/controlling-excel-using-ole-automation.html
http://arthur_ong.tripod.com/xab017.htm
Maybe you are looking for
-
Show/hide bahavior not working in firefox or safari
Here is my problem. The show hide behavior incorporated in DW CS3 is working fine in IE6 and 7 but not working at all in firefox and safari (both latest version). I have tried it on different event but nothing. My web site is configured that if someo
-
Any recommendations for selling some old Xserve RAID parts?
I have 6 unopened SFP to SFP cable kits and an original Xserve RAID that's missing drive modules. eBay seems like a ghost town for this stuff, any suggestions? Not looking to make a ton, I just want to get it out of the conference room corner...
-
Everytime I open firefox I get a window that opens. Doesn't happen with IE or Chrome
Every time I open Firefox I get another window that opens over the homepage. It is almost blank with a few lines at the top of the page and the words user registration. It has been happening ever since Firefox updated on my computer yesterday, even a
-
Hi how to restrict * in seelction screen
Hi abapers, In selection screen am having field s_matnr. After giving input as * and pressing F4 its fetches all the materials.But i want to restrcit using * and then pressing F4. How can i do it.
-
How do you actually achieve status level? I have seen users with 1 post that have a Level 2 Status Level or something crazy like that. What exactly does the Status Level symbolize?