ABAP code help for 0PROFIT_CTR (in Update rules)
Hi
Can you please give me the update rules code that would do the following in BW 3.5:
If Profit Center is 10 digits long, its ok but if Profit Center is 5 digits long, concatenate with 5 zeros.
Thanks
Jimi
Edited by: jimi ogun on Dec 1, 2011 1:44 PM
Hi Soorej
I tried teh code in my transfer rules but the result was blank. I guess it was because i didnt insert anything in the RESULT line... This is what i tried to do but i get a syntax error:
$$ begin of routine - insert your code only below this line -
DATA: l_s_errorlog TYPE rssm_s_errorlog_int.
data : len type i,
v1(10) TYPE c value 'abcde'.
len = strlen( v1 ).
if len = 5.
CONCATENATE v1 '00000' into v1.
endif.
RESULT = /BI0/OIPROFIT_CTR.
returncode <> 0 means skip this record
RETURNCODE = 0.
abort <> 0 means skip whole data package !!!
ABORT = 0.
The syntax error i get is below:
E:Field "/BI0/OIPROFIT_CTR" is unknown. It is neither in one of the
specified tables nor defined by a "DATA" statement. "DATA" statement.
Similar Messages
-
ABAP code help for Bex broadcasting by event!
Hello
I'm trying to broadcast a report for a specific time period as per factory calendar. I tried using System Time Point :RSRD_BROADCAST_FOR_TIMEPOINT but its not showing when In the broadcaster when I put restriction of factory calendar so i followed below link: Broadcasting timepoint scheduled after an event and created a PC to start after event and created variant for RSRD_BROADCAST_STARTER setting ID as my Bes broadcast setting technical name.
When I trigger the event its processed and report emailed to me as I expected. Now I want to run this (Trigger) this event every Wed day after fisc quarter close. I wrote the below logic in se38 PROGRAM. But Now I need little help on how to trigger /run only on wed days after fisc quarter close ? Please update the below code or guide me on how to achieve this.
CALL FUNCTION 'BP_EVENT_RAISE'
EXPORTING
EVENTID = ZFISC
endif.
Thanksin your ABAP code try this,
calculate whether current date falls after fiscal year quarter. If so then check whether its a Wednesday and call the event raise FM. You can schedule this program in background daily basis.
Use this FM for day calculation DATE_TO_DAY.
This FM for converting sy-datum to fiscal year/period - FI_PERIOD_DETERMINE,DATE_TO_PERIOD_CONVERT -
ABAP code Help for Customer Exit variable
Hello All,
Can anyone provide ABAP code for a customer exit variable please?
Requirement:
0CALYEAR(InfoObject) - ZCALCYR (Variable) <b>Calender year with default value actual year</b>.
Proiperties of variable: single value,mandatory,ready for input,can'be changed in query navigation.
i have read some docs on customet exit variables which i got from SDN but i found it's difficult for me to get this as i am not that good in ABAP.
Thanks,
Rakesh.Hi,
Just check the below code. You just need to make slight changes I believe. Hope this helps you.
In CMOD ..
Sample code
INCLUDE LXRSRF01 *
data: l_s_range type rsr_s_rangesid.
case i_vnam.
when 'ZCALCYR'.
if i_step = 1.
l_s_range-low = sy-datum+0(4).
append l_s_range to e_t_range.
Endif.
Endcase. -
Hey All,
Could any one suggest a replacement code for the below 3.5 code in 2004s.
If Movetype = 101 or 102 I want to update the result else I dont want to update that field. I couldnt find raise exception for thid in 2004s. Any other way to do it.
IF COMM_STRUCTURE-MOVETYPE = '101' or COMM_STRUCTURE-MOVETYPE = '102'.
RESULT = 'F'.
ELSE.
if the returncode is not equal zero, the result will not be updated
RETURNCODE = 1.
ENDIF.
in 2004s
IF SOURCE_FIELDS-MOVETYPE = '101' or SOURCE_FIELDS-MOVETYPE = '102'.
RESULT = 'F'.
ELSE
*-- 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.
ENDIF.
raise exception type CX_RSROUT_SKIP_VAL. looks to be close but it doesnt work. Can anyone explain what exactly the raise exception type CX_RSROUT_SKIP_VAL. does.
Thanks,
KKKK,
From the comment, it is obvious that CX_RSROUT_SKIP_VAL clears the contents of the field. If you want to keep the value that was sent by the source system, just don't do anything. Don't even raise an exception.
IF SOURCE_FIELDS-MOVETYPE = '101' or SOURCE_FIELDS-MOVETYPE = '102'.
RESULT = 'F'.
ENDIF.
If the above code doesn't work, then you might try saving the value temporarily and then reassigning it.
l_var = result.
IF SOURCE_FIELDS-MOVETYPE = '101' or SOURCE_FIELDS-MOVETYPE = '102'.
RESULT = 'F'.
ELSE
result = l_var.
endif. -
Abap Code help for retreiving user ID
Hi All,
I have a field N_BPIID(this field contains User IDs of Users) and variable on this field Z_PIID(Customer exit)...........
My requirement is
When i execute the report -
this variable Z_PIID should automatically retrive his ID frm BI/BW system..............
Please suggest
Edited by: Raj on Jan 12, 2010 4:59 AMHi,
A user that is signed on - system will populate field sy-uname - Not sure of your logic.In STEP 3 of your CMOD you could say :
Eg : If user is not user "USERABC" then dont allow them into queries.
Hope this helps Colin
IF sy-uname+0(7) <> 'USERABC'.
L_AUTH = 0.
EXIT.
ENDIF.
if sy-subrc <> 0.
CALL FUNCTION 'RRMS_MESSAGE_HANDLING'
EXPORTING
I_CLASS = 'RSBBS'
I_TYPE = 'E'
I_NUMBER = '013'
I_MSGV1 = 'Insufficient authorisation'.
RAISE wrong_entry.
endif. -
What are the special conversions for time in update rules?
What are the special conversions for time in update rules?
Hello,
Special conversions for time in update rules are automatically conversion rules.
Example: If the cube contains calendar month and your transfer structure contains date, the date to month is converted automatically.
Assign points if this helps,
Regards,
Jorge Diogo -
Hi Gurus,
I have a requiement, that is if there are 5 line items with in a document and each one has diffeerent tax jurisdiction code, then we should be showing only one tax jurisdiction code for a document. Line items are not displayed in report. The condition to pick up tax jurisdiction code is the one which has least ending zeros among all the lime items with in a document.
Supppose
Doc1 Item Tax Jurisdiction code
1800000002 1 CNQC00000000000
1800000002 2 CNQC00000000000
1800000002 3 CN0000000000000
1800000002 4 CNQC00000000000
1800000002 5 TXJOHNCLEBUR000
So here the value of Tax Jurisdiction code is TXJOHNCLEBUR000 as it has least ending zeros compared to other values with in a document.
Any help how to use the string function and acheive the desired result.
Thanks,
Raj.Hi Anand,
Thanks for the reply. we don't expect any non-zeros after seeing first zero. Now i have added another z object which will contain only least zeros for a doc. What I am doing is now after loading the data into the cube from ods i am doing loop back and updating the new z object. Below is the code I am trying to do
TABLES: /BIC/AZFGLO10100.
Defining an internal table as ods table****
Types: BEGIN OF ITAB_01,
doc_no LIKE /BIC/AZFGLO10100-AC_DOC_NO,
item_no LIKE /BIC/AZFGLO10100-ITEM_NUM,
taxjur LIKE /BIC/AZFGLO10100-TAXJURCODE,
length like num, ***** this will hold the length of the zeros
END OF ITAB_01.
loading the data from active ods table into defined internal table*****
select AC_DOC_NO ITEM_NUM TAXJURCODE from /BIC/AZFGLO10100 into table
Itab_01 where AC_DOC_NO = /BIC/AZFGLO10100-AC_DOC_NO and
item_num = /BIC/AZFGLO10100-ITEM_NUM.
sort itab_01 doc_no item_no
now I want to use code too populate the vlaue of length field in internal table (which shows how many zeros a tax jurisdiction code has for every corresponding line item)
then in the update rule of z tax jurisdiction i will wirte a routine such that
select taxjur into result from itab_01 where doc_no = COMM_STRUCTURE-doc_no and length = min(length).
now I have one more doubt , the number of items in a document will be varying so how to takecare of this...
If possible can you please provide me with the abap code that you have mentioned in earlier post.
Any more help on this is really appreciated.
Thanks,
Raj -
Inserting code in final steps of Update Rule transformation
Hi,
I am extracting data into a cube from an ODS and doing some aggregation in the process. E.g 3 records in the ODS might become 1 in the cube.
This is fine for some things like Quantity, but not ideal for things like unit price. One work around is for the ODS to have a counter.
e.g
MATERIAL QUANITITY UNIT_PRICE COUNTER
1234 13 $1.50 1
1234 21 $1.50 1
1234 45 $1.50 1
This comes across into a cube like
MATERIAL QUANITITY UNIT_PRICE COUNTER
1234 79 $4.50 3
- unit price can then be calculated by dividing unit price by counter - however it needs to be done within the query.
I thought perhaps we could perform this calculation when populating the cube, if the items were firstly collected within an interim table before being passed to the return_table.
i.e
1. Define key figure using ABAP routine and return table.
2. Append INTERIM_TABLE within update rules for each read of the ODS
3. Once all ODS records have been read and inserted at an aggregate level within INTERIM_TABLE, loop through INTERIM_TABLE, perform calculation and append RETURN_TABLE.
My question is: Is there a simple way to determine that all ODS items have been read (like an "at last" statement) and if so, where can this code be inserted? Can it be simply placed in the update rules routine if I have the appropriate logic to determine that all items have been read?
Thanks
AdrianHi Adrian,
Why cant you use Addition, minimum or maximum in update rules...?? Here you can use Maximum option for Unit Price.
http://help.sap.com/saphelp_nw04/helpdata/en/3f/0e503c3c0d563de10000000a114084/content.htm
Hope it Helps
Srini -
ABAP assistance - start routine logic in update rule
I have used an existing update rule and have based my logic around the same. The purpose of the rule is to look up customer master data and get a subset of customer numbers from the transaction records so that the values for customer number from the transactional data will not be updated if it does not match with existing master data customer numbers.
The loads are full and we drop the data before we load.
I have listed the logic below (the number at the front is to be considered as the line number) and a list of open questions that I have thereafter:
Start routine logic:
1 DATA: l_index LIKE sy-tabix.
2 DATA: BEGIN OF ls_customer,
3 customer TYPE /BI0/OICUSTOMER,
4 objver TYPE RSOBJVERS,
5 END OF ls_customer,
6 lt_customer LIKE TABLE OF ls_customer.
7 REFRESH: lt_customer.
8 LOOP AT DATA_PACKAGE.
all customers from data package
9 ls_customer-custno = DATA_PACKAGE-custid.
10 ls_customer-objver = 'A'
11 APPEND ls_customer TO lt_customer.
12 ENDLOOP.
12 SORT lt_customer.
13 DELETE ADJACENT DUPLICATES FROM lt_customer.
14 IF NOT lt_customer[] IS INITIAL.
15 SELECT /BI0/OICUSTOMER RSOBJVERS
16 FROM /BI0/PCUSTOMER
17 INTO CORRESPONDING FIELDS OF TABLE lt_customer
18 FOR ALL ENTRIES IN lt_customer
19 WHERE ls_customer-custno = DATA_PACKAGE-custid
20 AND ls_customer-objver = 'A'
21 SORT lt_customer BY customer ASCENDING
22 ENDIF.
Questions
Line
1 - what is the purpose of this line? What is it that is being declared
2 - in some code I have seen this line with OCCURS 0 at the end what does this mean with and without the term?
4 - I am using the Data Element name is this correct or should I use the field name?
3 - 5 here I declare an internal structure/table is that correct?
6 - here I declare a work area based on the internal table is that correct?
7 - What would happen if I avoided using the REFRESH statement?
8 - 12 - Is this syntactically correct, I am trying to get a set of data which is the customer numbers which match the master data customers and the master data record is án active version and than appendíng to the work area?
13 - My understanding is this will reduce the number of records in the work area is this correct and needed?
14 - 22 I am trying to identify my required set of data but feel I am repeating myself, could someone advise?
Finally what logic would I actually need to write in the key figure object, could I use something like:
Result = lt_customer.
Thanks
Edited by: Niten Shah on Jun 30, 2008 8:06 PM1. This line is not required
2. OCCURS 0 is the OLD way of defining an internal table with that structure. As it is, it just defines a flat structure.
3. Data element is usually best
3-5 Yes
6. No. Here you are declaring a table of the type of the flat structure. Just as the ABAP says!
7. Nothing. But by putting this in, you ensure that you know the state of the table (empty) before you start looping through the data package
8-12. You can tell if it is syntactically correct by pressing Ctrl-F2 when in the editor. Looks ok.
13. Ensures your list of customers contains no duplicated. The code up to this point is building a list of all the unique customers in the data package.
14-22. Goes to the database and brings back ONLY those customers which are found in the master data. Looks ok.
This is a start routine (that's why you've got a data package). You don't use result. You should update the datapackage. But this you haven't done. Double click on the table name /BIC/PCUSTOMER to get the correct field names.
So you have to loop through the data package again, and check if the customer in the datapackage is lt_customer. If it is, fine, otherwise you blank it and report an error, or set an error message or whatever.
I wouldn't do it like this. I'd do something like this:
STATICS: st_customer TYPE HASHED TABLE OF TYPE /bi0/oicustomer
WITH UNIQUE KEY TABLE_LINE.
* st_customer retains its value between calls, so only populate if empty
* In one run of the infopackage, this will mean you do only one read of
* the master data, so very efficient.
IF st_customer IS INITIAL.
SELECT customer FROM /BI0/PCUSTOMER
INTO TABLE st_customer
WHERE objvers EQ 'A'. " Only active values
ENDIF.
* Go through data package
LOOP AT DATA_PACKAGE.
* Check whether the customer exists.
READ TABLE st_customer TRANSPORTING NO FIELDS
WITH TABLE KEY table_line = DATA_PACKAGE-custid.
CHECK sy-subrc IS NOT INITIAL.
* If you get here, the customer isn't valid. So I'm just setting it blank
CLEAR DATA_PACKAGE-custid.
MODIFY DATA_PACKAGE. " Updates the datapackage record
ENDLOOP.
Even this is not fully optimised, but it's not bad.
I strongly suggest that you get yourself sent on the basic ABAP programming course if you're going to do a lot of this. Otherwise, read the ABAP documentation in the help.sap.com, and, from the editor, get the cursor on each ABAP keyword and press F1 to read the ABAP help.
matt -
Urgent: ABAP Code help reqd
Hi,
Can anyone please me provide me ABAP code for the following case:
Table1 JHAGA
Table2 JHAGVZ
Primary keys in JHAGA:
Order Item Number [POS_NR]
Billing Dataset [GRUPPABRNR]
Sales Document Number [AVM_NR]
This requirement is for an InfoSet. For each order ideally we can have multiple sales agent. Sales Agent is being pulled from JHAGVZ. For this InfoSet we are going to go with assumption that we wont have more then 10 sales agent for an order,
Consider 10 extra fields in InfoSet SA1 SA10 for 10 Sales Agent.
I need code which to populate this sales agent field. If an order exists in JHAGA then for that order in JHAGVZ populate the SA1-SA10 field.
JHAGA Order#10
JHAGVZ Order#10 SalesAgent11
SalesAgent12
SalesAgent13
Then SA1 should have SalesAgent11, SA2 should have SalesAgent12 and SA3 should have SalesAgent13 and so on
Thank you,
samHI ,
Are these two field a part of the table INFOROBJECT?
if they are, you can write a select statement like :
select 0CUSTOMER 0SALESORG YLEG_ENTITY
from INFOROBJECT
into Y_CUST_LE
where ( Yacc_SEQ <> ´ZROO´ and
0PRICE_LIST <> space).
Hope this helps.
If not, please explain problem clearly. -
Abap Code help in Extractor!!!
Hi all
I am not an abaper, I am using Bw 3.5; I need to write a code in "ZBSIS" and "ZBSAS" Extractor Include program ZXRSAU01: so that the report based on cube "ZBSISAS" shows values for field Transaction key "ZKTOSL".
The field "KTOSL" is not active in R/3 Directory and gets filled in program RFWERE00 in Tcode F.19 in R/3.
I have to use the same logic in extractor as used in that program.
The logic is:
FORM GET_'KTOSL USING IAMOUNT LIKE EXTRACT-DMBTR
CHANGING 'EKTOSL' LIKE POST_COLLECT-'KTOSL'.
IF IAMOUNT < 0.
'EKTOSL' = 'GNB'
ELSE.
'EKTOSL' = 'BNG'
ENDIF.
ENDFORM.
Can any of you advice me on abap code for this logic?
I appreciate your help.
Thanks in advance
IshiHi,
You can use the following code in ZXRSAU01.
CASE i_datasource.
WHEN 'ZBSIS'.
DATA: g_wa_extractstructure LIKE <give the extractstructure of your datasource from RSA2>.
LOOP AT C_T_DATA into g_wa_extractstructure.
IF g_wa_extractstructure-DMBTR LT 0.
g_wa_extractstructure-ZKTOSL = 'GNB'
ELSE.
g_wa_extractstructure-ZKTOSL = 'BNG'
ENDIF.
MODIFY c_t_data FROM g_wa_extractstructure.
ENDLOOP.
ENDCASE.
Note:- . The same code can be used for ZBSAS. Please make sure to give the extract structure name in the field marked in <->.
Thanks,
Nithin reddy. -
Hi Gurus;
Can some one send me the abap codes used mainly for reporting OR can some one give me some sample code used in reporting. my mail id "[email protected]".smod > rsr0001 > EXIT_SAPLRRS0_001 > ZXRSRU01 >
CASE I_VNAM.
WHEN 'ZE_FPPT'.
CALL FUNCTION 'Z_VAR_FP4'
EXPORTING
I_VNAM = i_vnam
I_STEP = i_step
I_T_VAR_RANGE = I_T_VAR_RANGE
IMPORTING
E_T_RANGE = E_T_RANGE.
FUNCTION Z_VAR_FP4.
""Local Interface:
*" IMPORTING
*" REFERENCE(I_VNAM) LIKE RSZGLOBV-VNAM
*" REFERENCE(I_STEP) TYPE I DEFAULT 0
*" REFERENCE(I_T_VAR_RANGE) TYPE RRS0_T_VAR_RANGE
*" EXPORTING
*" VALUE(E_T_RANGE) TYPE RSR_T_RANGESID
data: l_s_range type rsr_s_rangesid.
data: LOC_VAR_RANGE LIKE RRRANGEEXIT.
data: year(4).
data: mth(2).
IF I_STEP = 2 .
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE
( VNAM = '0I_FPER' ).
year = LOC_VAR_RANGE-HIGH+0(5).
mth = LOC_VAR_RANGE-HIGH+5(2).
if mth < 10.
concatenate '0' mth into mth.
endif.
concatenate year '0' mth into L_S_RANGE-HIGH.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
ENDLOOP.
ENDIF.
ENDFUNCTION.
Regards,
BWer
Assign points if helpful.
Message was edited by: BWer -
RE: Abap Code Flow for Multiple Authorization checks
Hi all,
I am basically a security person, but i have some doubts on Authority-check in ABAP code. so i thought this is best place to understand the execution of ABAP code.
Q1. I know that ABAP programmers will put Authority check in ABAP code and when program was executed Authority-check will compare whether user has access to this object or not.
for EX take some tcode ZXYY
i activated 3 objects out of some 20 objects for this tcode in SU24.
Authority checks are placed in the program.
when this tcode was executed and started the ABAP code, then i think it will do the authority check for the first object and if user has the profile to it then it will go for the second authority-check for which if user does not had profile ( i made inactive in role) will the code terminate and throw some error there it self or will it go for the for 3rd object for which again user has access. (user got access to this 3rd object)
can any explain?
Q2. Should the activities be same as in Authority-check.
I mean in Authority check if you give activities 02 and 03 and in user profile if i give only 02 will it work or not?
thanks,
SunRefer Below Code:
IF SY-TCODE = 'CJ40'.
AUTHORITY-CHECK OBJECT 'ZPS_VERSN' "'ZWMM_WERK'
ID 'VERSN' FIELD bpdy-VERSN
ID 'ACTVT' FIELD '01'
ID 'ACTVT' FIELD '02'
ID 'ACTVT' FIELD '03' .
IF SY-SUBRC = 0.
* continue.
elseif SY-SUBRC <> 0.
AUTHORITY-CHECK OBJECT 'ZPS_VERSN' "'ZWMM_WERK'
ID 'VERSN' FIELD bpdy-VERSN
ID 'ACTVT' FIELD '01'.
IF sy-subrc = 0.
* CONTINUE.
ELSEIF sy-subrc <> 0.
AUTHORITY-CHECK OBJECT 'ZPS_VERSN' "'ZWMM_WERK'
ID 'VERSN' FIELD bpdy-VERSN
ID 'ACTVT' FIELD '02'.
IF sy-subrc eq 0 .
* CONTINUE.
ELSEIF sy-subrc <> 0 .
AUTHORITY-CHECK OBJECT 'ZPS_VERSN' "'ZWMM_WERK'
ID 'VERSN' FIELD bpdy-VERSN
ID 'ACTVT' FIELD '03'.
IF sy-subrc = 0.
versn = bpdy-versn.
v_proj = proj-pspid.
wbs = PRPS-POSID.
set PARAMETER ID 'PSP' FIELD v_proj.
set PARAMETER ID 'BP2' FIELD VERSN.
set PARAMETER ID 'PRO' FIELD wbs.
LEAVE TO TRANSACTION 'CJ41' AND SKIP FIRST SCREEN.
ELSEIF sy-subrc ne 0.
MESSAGE 'You are not authorised for this version.' TYPE 'E'.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF. -
Survey creation abap code help needed
hello experts,
I need to create a survey in crm, by taking values from end-user from a webpage
A sample code help is needed.
Thanks in advanceTake a look at this SAP note - It does a pretty good job of detailing the steps for you. No coding necessary, it worked out of the box for us after patching this note.
https://service.sap.com/sap/support/notes/638320 -
Hi ,
I am trying to activate an ODS but it is failing the activation process . When I look into the application log I see this error "Value 'RAM???¿????????S RAM' (hex. '4D41524B3F3F3FBF3F3F3F3F3F3F3F3F5320574F524B') of characteristic ZEUID contains invalid characters "
I am new to ABAP and I need an ABAP code to filter this value when loading data into ODS .
Thanks a lot for your helpHI,
Write the code in the start routine.
IN the start routine you have a table called SOURCE_PACKAGE.
declare work area x_souce_package type source_package
data : lv_string(100).
loop at souce_package into x_source_package.
lv_string = x_source_package-value.
TRANSLATE LV_STRING TO UPPER CASE
if lv_string CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' .
ELSE.
DELETE SOURCE_PACKAGE INDEX SY-TABIX.
ENDIF.
endloop
Maybe you are looking for
-
How can I view two pages side by side in the new Pages?
I can not find the feature to allow me to do this (which was available in the old version). This is really causing problems with some of my documents that have been created to be viewed this way. Any help would be great!
-
I tried to update my Apple TV (per message displayed). The system began an update 1 of 2. I didn't see if it completed both updates, but now all I can see is a large iTunes icon displayed with an image of a wire with a USB connection. The Apple TV
-
I have my giftcard that i became from usa and it is actually 15$ worth, so i dont think i am completely unable to use it in germany.
-
In CS5 can I find out which brush is currently in use so that I can slect it again later?
in CS5 can I find out which brush is currently in use so that I can slect it again later? I can't figure this out
-
Hi everybody. I am writing because I need some help with my iPhone 3G. If anyone have the same problem... or have any suggest... please write me back. Well... that's the problem: when I click on the stanby button, and the iphone goes to standby mode,