Abap Code help in update rule
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
Similar Messages
-
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 PMHi 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. -
ABAP Help on Update Rule Needed
Hello. I am trying to write a routine on an key figure in an update rule. Basically, I am trying to load a custom key figure with either a 1 or a 0.
Here is the pseudocode:
IF
(((GI_DATE - ACT_GI_DTE) < 0) OR
((GI_DATE - ACT_GI_DTE) > 3)
THEN
NEW_KEY_FIGURE = 1
ELSE
NEW_KEY_FIGURE = 0
ENDIF.
Here is the code I currently have in the routine. Any ideas on where I am going wrong here? I am not an ABAP developer so please keep this in mind when responding.
result value of the routine
CLEAR RESULT.
if the returncode is not equal zero, the result will not be updated
IF COMM_STRUCTURE-GI_DATE - COMM_STRUCTURE-ACT_GI_DTE < 0 OR
COMM_STRUCTURE-GI_DATE - COMM_STRUCTURE-ACT_GI_DTE > 3.
COMM_STRUCTURE-NEW_KEY_FIGURE = 1.
ELSE.
COMM_STRUCTURE-NEW_KEY_FIGURE = 0.
ENDIF.
RESULT = COMM_STRUCTURE-NEW_KEY_FIGURE.
RETURNCODE = 0.
if abort is not equal zero, the update process will be canceled
ABORT = 0.
Thanks for any help you can give.Hi,
I think you can not put "-" in if command, so code should be like this:
data: datediff type n.
result value of the routine
CLEAR RESULT.
clear datediff.
detediff = COMM_STRUCTURE-GI_DATE - COMM_STRUCTURE-ACT_GI_DTE.
IF datediff < 0 OR datediff > 3.
Result = 1.
ELSE.
Result = 0.
ENDIF.
RETURNCODE = 0.
if abort is not equal zero, the update process will be canceled
ABORT = 0.
Regards,
Andrzej -
ABAP objects for transfer/update rules - does this apply to include stateme
I have a question about the new requirement for the code in the update/transfer rules to be written in ABAP Objects standards. Does this still apply if in your update rules you using include programs? Does this mean that when we upgrade we will have to follow the ABAP Objects standards (ie no header lines)?
Routines will method based.
In addition to what Chetan has sent, check this how to also.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19
Ravi Thothadri -
Need hints to bring BC400(ABAP) knowledge to BW update rules/routines.
Hi,
I have just completed the BC400 (ABAP) course at SAP but the instructor had no clue about BW.
From se80, he thought how to create packages, programs, functions modules, classes/Interfaces, etc. but whenever, I asked how these fit into the BW update rules and transfer rules, he said he knew nothing about BW.
For example, how do I bring in a program written in se80 into my update rule or transfer routine which updates and ODS or cube?
i.e. The main reasoning for learning this BC400(ABAP) is to be comfortable in writing update rule or transfer routine to update ODS/Cubes in BW but the instructor failed me in making the link between the ABAP class and BW.
Can you give me some guide on this?
Can I work in se80 as I was taught and bring codes from there to update a cube?
i.e. if I need to write an update routine to update a cube from an ODS, can this be done in se80 (on BW)
I will appreciate any guidelines to bring in my new found knowledge to the BW environment.
ThanksMost Bw transformations are already includes inside programs or cmods or BTEs
By double cliking on start routines and end routines it already takes you into the ABAP enviroment
Have a look at the sappress book - user exits and BADIs in BW (it's not a brillaitn book by any means - it's just about passable and is short on detail - but it will get you a head start) -
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 -
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. -
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. -
Need help in Update rule coding - URGENT
Hi Gurus,
I am creating an update rule there i need to compare some filed with the fields in inforsouce so here what should be the name used for the infosource can i use something like this
read table TAB where
<fields1> = DATA_PACKAGE-<field1>.
where DATA_PACKAGE is the infosource
is this the rite method
waiting for reply
RaviHi,
Use this in Update Routine.
IF COMM_STRUCTURE-field1 = 'value1' AND
COMM_STRUCTURE-field2 = 'value2'.
RESULT=field3*100.
ELSE.
RESULT=field*10.
END IF.
here field name will be in format of : /bic/fieldname
Regards,
rik -
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 -
ABAP routine/lookup in update rule
Hello Gurus, I am trying to do a lookup from 2 ODS's into one. I am trying to join sales and delivery data.
My current idea is that I will use the 2LIS_11_V_SSL extractor that has SO, SOitm, DO, DOitm data and bring that into an ODS that has those four items as the key.
During that update, I will need specific fields (mostly key figures - Net Price from the SalesOrder ODS, and Del. Qty from the DelOrder ODS).
The SO and DO ODSs each have a key of SO/SOitm and DO/DOitm respectively.
What I am trying to do is write a routine for each of the necessary fields to do a lookup on the source ODS and bring in the field value according to the SO/SOitm or DO/DOitm key.
A simplified example
<u>Target ODS</u> Initially coming from 2LIS_11_V_SSL (keys)
<b>SO
SOitm
DO
DOitm</b>
Net Price
Del. Qty
<u>SO ODS</u>
<b>SO
SOitem</b>
Net Price
<u>Del Order ODS</u>
<b>DO
DOitm</b>
Del Qty.
I have the 4 key fields coming from another extractor, need to lookup the key figures from the other ODSs on the load
If I could get some example code on how to do this I would greatly appreciate it! I was told an internal table might do the trick, but after scouring the forums I can't find anything that seems close enough.
Thanks!
Justin
Message was edited by: Justin Molenaur
Message was edited by: Justin MolenaurAjay (or anyone else)...one more question
Is there a way to limit the number of times that the net price field may be written.
for example, a SO item may be associated with multiple delivery order items, so you only want to write the net price field once PER sales order item. If we did it just like above, everytime a sales order item had multiple delivery order items, there would be multiple net price values for each delivery order item, which is not correct (see spreadsheet).
Sales Order Sales Order item Delivery Order Delivery Order item Net Price (SO) Del Qty (Del)
1 10 100 10 15 150
2 10 101 10 25 200
<u>2 20 101 20 <b>50</b> 250
2 20 101 30 <b>50</b> 299</u>
3 10 102 10 23 213
4 10 102 20 27 476
So the challenge would be to create a counter(?) or something that will only allow a SOitm to have only one net price.
Thanks for you help!
Justin
Message was edited by: Justin Molenaur
Message was edited by: Justin Molenaur -
Hi All,
My requirement is below :
In my DSO I have the data as below
doc number item con type Agreement
100 10 adc 1234
efg 5678
hij ' '
200 20 adc 1234
efg ' '
hij 5678
Now I have created a New Info object named flag. So now I am doing a self myself data mart where i need to write my routine to set data in the flag.
The data should be like
doc number item con type Agreement Flag
100 10 adc 1234 X
efg 5678 X
hij ' ' X
200 20 adc 1234 X
efg ' ' X
hij 5678 X
Note:- even if agreement is blank for hij we need to put X since agreement is available for the remaining two condition types.
Please can any one help with the code.and also please let meknow whether we shold write it in start routine or end routine
Thanks In advance
SreeHi Rookie ,
If i write the code below
DATA: ITAB TYPE TABLE OF tys_TG_1,
ITAB_WA TYPE tys_TG_1.
MOVE RESULT_PACKAGE[] TO ITAB[].
LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
IF <RESULT_FIELDS>-AGREEMENT IS NOT INITIAL.
<RESULT_FIELDS>-FLAG = 'X'.
ELSE.
LOOP AT ITAB INTO ITAB_WA WHERE AGREEMENT IS NOT INITIAL AND
DOC_NO = <RESULT_FIELDS>-DOC_NO AND
ITM_NO = <RESULT_FIELDS>-DOC_NO.
<RESULT_FIELDS>-FLAG = 'X'.
EXIT.
ENDLOOP.
ENDIF.
ENDLOOP.
My requirement doesnt match
My requirement is below
doc number item con type Agreement
100 10 adc 1234
efg 5678
hij ' '
200 20 adc ' '
efg ' '
hij ' '
Expected result is
doc number item con type Agreement flag
100 10 adc 1234 x
efg 5678 x
hij ' ' x
200 20 adc ' ' ' '
efg ' ' ' '
hij ' ' ' '
regards
Sree -
SAP Query :: ABAP Code Help
Hi,
I have created a query which reads a material Table and has consumption by date. What I want the report to do is show me a total number of PO's by month. i.e. below
Any idea how can I go about this? I can understand ABAP but don't know how to put it in buckets via a query i know i have to create 12 fields called Jan, Feb, March, April etc but need the code to put date in the tables by month
E.g.
Material January Feb March April etc
MAT1 23 22 21 11
MAT2 35 67 89 33 etc
THanksABAP Program created
Maybe you are looking for
-
More about drums. . .
Inspired by WarriorAnt's thread about programming drums (since drums are one of the most difficult things to properly capture in the recording process. . . you know . .. mic'ing, gates, ridiculous compression, the likes) does anyone know of any GB co
-
I created a report based on Service request History subject area and picked Service Request#, Status, Priority and External System Id of the Dealer object.Then I added the filter to the field External System ID as "Is Prompted". Then I created a Web
-
I signed up for Verizon on September 26th and my new data starts on the 27th of October. I am on the 2GB single line plan. I used exactly 1306 mb or 1.3 gb to simplify. My phone confirmed this which also keeps track. I was charged $15 overage becaus
-
SOFTWARE INSTALLED INCORRECTLY, PLEASE READ
I am just about to download music to my ipod and when it tries to download this message comes up "The software required for communicating with the ipod is not installed correctly. Please reinstall itunes to install the i'pod's software" I uninstalled
-
I have problem with my G4t4400-VTD
Did MSI ever release their Geforce 4 Ti 4400 products without Video IN function?although my card is G4T4400 VTD(The package box writes video in /tvout) , i don't find a Philips 7108 chip on the board only a conexant 27851 video encoder and sil64ct64