Code help - start routine
I have two ODS's - ODS1 and ODS2 . ODS1 feeds data to ODS2 using an
uppdate rule .ODS1 data is as follows
Billno Itemno cond keyfig
10 1 a 1
10 1 b 3
10 1 c 5
20 1 d 7
20 1 e 8
20 1 f 1
20 1 g 1
30 2 h 4
30 3 h 2
I need to populate a field in ODS2 (say sum) by summing
all values of keyfig for each bill no . for example in the
above case ods2-sum should be filled with values 9 ,16 and 6
for billno's 10,20& 30 respectively .
can someone pls help me with required code.
thanks
Hi,
In the start routine write the selection:
DATA: begin of it_int occurs 0,
billno type ods2-billno,
sum type ods2-sum,
end of it_int.
select billno sum( keyfig ) from ods1
into table it_int groupby billno orderby billno.
In the update routine for ods2-sum read the it_init:
read table it_int with key
billno = COMM_STRUCTURE-billno.
if sy-subrc = 0.
result = it_int-sum.
endif.
Regards,
Prema
Similar Messages
-
Urgent : Doubt in writing a code in start routine
Hi all ,
I am BI 7.0 system , I have doubt in writing a code in start routine .
1) i have to extract the data first from a custom table based on one condition and then placing it into internal table .
2) Now i have to loop at source_package for a particular region field say "ASIA". with this result i have to check for the correponding entries in custoom table .
if condition is not true (i.e ) with entries or not matching then delete that particular record from source_package.
i have written a small logic for this . but this is producing any ouput , Please check it and also let me know for modifications .
thanks in advance.
select * from zcsp
into corresponding fields of TABLE itab_T
where
ZBUSINESSUNIT = 'BC'.
loop at SOURCE_PACKAGE into ls_SOURCE_PACKAGE where /BIC/DPREGION = 'XE'.
loop at itab_t into itab_w where zcategory =
ls_source_package-/BIC/DPMAT/BIC/DPCAT.
if sy-subrc ne 0.
delete SOURCE_PACKAGE.
endif.
endloop.
endloop.You're deleting the entire input package. You only want to delete the one row.
DATA: g_tabix TYPE sy-tabix.
SELECT * FROM zscp
INTO CORRESPONDING FIELDS OF TABLE itab_t
WHERE zbusinessunit = 'BC'.
SORT itab_t BY zcategory.
LOOP AT source_package INTO ls_source_package WHERE /bic/dpregion = 'XE'.
g_tabix = sy-tabix.
READ TABLE itab_t WITH KEY zcategory = ls_source_package-/bic/dpmat/bic/dpcat TRANSPORTING NO FIELDS BINARY SEARCH.
IF sy-subrc NE 0.
DELETE source_package INDEX g_tabix.
ENDIF.
ENDLOOP. -
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 -
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 to fill a field
Hello,
with the following code in the start routine in BW3.5 I am trying to fill Intercompany-Indicator based on Distribution Channel. The main code is marked bold.
Distribution Channel = DISTR_CHAN
InterCompany-Indicator = G_CWWR14
Pls help. Thanks.
SD
Intercompany Indicator
IF NOT wa_daten-customer IS INITIAL.
SELECT SINGLE /b05/s_rbkunde FROM /b05/mrbcust INTO l_rbcust
WHERE /b05/s_rbcust = wa_daten-customer
AND objvers = 'A'
AND datefrom <= l_date
AND dateto >= l_date.
IF sy-subrc EQ 0.
SELECT SINGLE g_cwwr14 FROM /b05/mrbkdbkrs INTO l_ii
WHERE comp_code = wa_daten-comp_code
AND /b05/s_rbkdbkrs = l_rbcust
AND objvers = 'A'
AND datefrom <= l_date
AND dateto >= l_date.
IF sy-subrc = 0.
wa_daten-g_cwwr14 = l_ii.
ELSE.
CLEAR wa_daten-g_cwwr14.
ENDIF.
ELSE.
CLEAR wa_daten-g_cwwr14.
ENDIF.
ELSE.
IF wa_daten-G_CWWR14 = ' '.
CASE wa_daten-DISTR_CHAN.
WHEN 'Y4'.
wa_daten-G_CWWR14 = '4'.
WHEN 'Y5'.
wa_daten-G_CWWR14 = '2'.
WHEN OTHERS.
wa_daten-G_CWWR14 = '0'.
ENDCASE.
ENDIF.
ENDIF. " NOT wa_daten-customer IS INITIAL
MODIFY DATA_PACKAGE FROM wa_daten.
ENDLOOP.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. -
ABAP code in start routine (delete no in)
In my start routine, I would like to delete some data package whose employee id is not in the selection list.
but there are some ABAP grammer error in the where condition. Can somebody help this? I tried to read the document for 'WHERE - IN seltab', but still I could not give the right code.
<p>
employeeid_itab type table of string.
select /bic/zpe_employeeid into table employeeid_itab from /bic/pzpe_employeeid.
DELETE SOURCE_PACKAGE where ZEMP_employee_ID NOT IN employeeid_itab.
It seems that internal table employeeid_itab could not be directly used after the IN keyword.
how can I do this?
Edited by: Ben Li on Feb 22, 2008 2:09 PMHi Oscar,
Actually I had tried this before, using the code like the following,
<p>
Types: EmployeeID(7) type c.
<p>
data: sel_itab type range of EmployeeID.
<p>
select /bic/zpe_employeeid into table sel_itab from /bic/pzpe_employeeid.
<p>
delete SOURCE_PACKAGE where zemp_employee_id not in sel_itab.
<p>
The grammer check is OK, but when I debug it, I found that there are records in sel_itab, but all the records just have one charactor, actually, my employeeID have 7 charactors in database. So it does not work, I think I miss something in define of the range table. Can you please figure out? Thanks a lot. -
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 -
hi,
i have a code in this way in update routine of that info object
instead of writng that code in update routine i want to write in start routine
can any one tell me what r the changes i have to made
please suggest me
i will assigfn points
CASE COMM_STRUCTURE-crm_ctstat.
Contact Achieved
WHEN '0'.
Finished faultless
RESULT = '20'.
RETURNCODE = 0.
Contact Not Possible (Missing Communication Data)
WHEN '1'.
Finished faulty
RESULT = '10'.
RETURNCODE = 0.
Contact Not Possible (Incorrect Communication Data)
WHEN '2'.
Finished faulty
RESULT = '10'.
RETURNCODE = 0.
Contact Not Permitted (Max. Usage BP List)
WHEN '3'.
Finished faulty
RESULT = '10'.
RETURNCODE = 0.
Contact Not Permitted (Block Indicator for BP)
WHEN '4'.
Finished faulty
RESULT = '10'.
RETURNCODE = 0.
Contact Not Possible (Technical Problems)
WHEN '5'.
Finished faulty
RESULT = '10'.
RETURNCODE = 0.
ENDCASE.Hi,
loop at datapackage.
CASE datapackage-crm_ctstat.
Contact Achieved
WHEN '0'.
Finished faultless
RESULT = '20'.
RETURNCODE = 0.
Contact Not Possible (Missing Communication Data)
WHEN '1'.
Finished faulty
RESULT = '10'.
RETURNCODE = 0.
Contact Not Possible (Incorrect Communication Data)
WHEN '2'.
Finished faulty
RESULT = '10'.
RETURNCODE = 0.
Contact Not Permitted (Max. Usage BP List)
WHEN '3'.
Finished faulty
RESULT = '10'.
RETURNCODE = 0.
Contact Not Permitted (Block Indicator for BP)
WHEN '4'.
Finished faulty
RESULT = '10'.
RETURNCODE = 0.
Contact Not Possible (Technical Problems)
WHEN '5'.
Finished faulty
RESULT = '10'.
RETURNCODE = 0.
ENDCASE.
endloop. -
Code help - start rout.
I have an ODS table with fields and data as follows
Billno Itemno cond
10 1 a
10 1 b
10 1 c
20 1 d
20 1 e
20 1 f
20 1 g
30 2 h
30 3 h
I need to fetch data (in start routine logic ) from from another ODS for all existing combinations
of Billno and Itemno . However as you can see the billno and itemno combination
can repeat.i need to do this in a way that best in terms of performance. pls help .Are you fetching a characteristics or Key figure? If it is a characteristics, then there is no problem, but key figure, it would be a problem.
Ex.
Billno ItemNo Cond
10 1 a
10 1 b
In the second ODS you have
BillNo ItemNo KF
10 1 5
then technically, where does the KF 5 should be?
Should it be for Condition a or b?
if you assign to one of them, then your report is not going to be right when you have condition in your report.
Before you do this, I would recommend you get very specific tech spec. spelled out well.
thanks.
Wond -
Start Routine Help - PLEASE...
Hello All BW/ABAP gurus, I am not good at ABAP and I need some help in writing Start routine.
Basically my (SIMPLIFIED) requirement is, I have the data coming in as series of 3 fields (data always will come) and if there are multiple values in those fields I have to create multiple records in the ODS with a sequence number.
For example if the data record is like
ABC01 00 99 88
Then my data record in ODS should be
ABC01 0001 99
ABC01 0002 88
And if the data record is:
ABC01 00 00 88
My record in ODS should be just
ABC01 0001 88
So thats the logic I am expecting in the start routine
So I kind of written the key part of code in the section below Any one who is good in ABAP and has written similar code in Start Routine, please correct if there are any mistakes thanks a ton in advance
CODE starts here:
DATA COUNT_SEQ N.
BEGIN ITAB_MAIN.
KEY_FLD_01 AS /BIC/ .
KEY_SEQ_01 AS /BIC/ ..
DATA_FLD_01 AS /BIC/
END ITAB_MAIN.
BEGIN ITAB_INNER.
KEY_SEQ_01 AS /BIC/ ..
DATA_FLD_01 AS /BIC/
END ITAB_INNER.
LOOP AT DATA_PACKAGE.
REFRESH ITAB_MAIN.
ITAB_MAIN-KEY_FLD_01 = DATA_PACKAGE-KEY_FLD_01.
COUNT_SEQ = 1.
IF DATA_PACKAGE- DATA_FLD_01 > 0.
ITAB_INNER-KEY_SEQ_01 = COUNT_SEQ.
ITAB_INNER-DATA_FLD_01 = DATA_PACKAGE- DATA_FLD_01.
COUNT_SEQ = COUNT_SEQ + 1.
IF COUNT_SEQ = 1.
MODIFY ITAB_INNER.
ELSE
APPEND ITAB_INNER.
END IF.
END IF.
IF DATA_PACKAGE- DATA_FLD_01 > 0.
ITAB_INNER-KEY_SEQ_01 = COUNT_SEQ.
ITAB_INNER-DATA_FLD_01 = DATA_PACKAGE- DATA_FLD_01.
COUNT_SEQ = COUNT_SEQ + 1.
IF COUNT_SEQ = 1.
MODIFY ITAB_INNER.
ELSE
APPEND ITAB_INNER.
END IF.
END IF.
IF DATA_PACKAGE- DATA_FLD_02 > 0.
ITAB_INNER-KEY_SEQ_01 = COUNT_SEQ.
ITAB_INNER-DATA_FLD_02 = DATA_PACKAGE- DATA_FLD_02.
COUNT_SEQ = COUNT_SEQ + 1.
IF COUNT_SEQ = 1.
MODIFY ITAB_INNER.
ELSE
APPEND ITAB_INNER.
END IF.
END IF.
IF DATA_PACKAGE- DATA_FLD_03 > 0.
ITAB_INNER-KEY_SEQ_01 = COUNT_SEQ.
ITAB_INNER-DATA_FLD_03 = DATA_PACKAGE- DATA_FLD_03.
COUNT_SEQ = COUNT_SEQ + 1.
IF COUNT_SEQ = 1.
MODIFY ITAB_INNER.
ELSE
APPEND ITAB_INNER.
END IF.
END IF.
ITAB_INNER [] ITAB_MAIN.
CLEAR ITAB_MAIN.
CLEAR ITAB_INNER.
END LOOP.I think could be as that:
DATA COUNT_SEQ N.
DATA_PACKAGE_NEW like DATA_PACKAGE occurs 0 with header line.
REFRESH DATA_PACKAGE_NEW .
LOOP AT DATA_PACKAGE.
ITAB_MAIN-KEY_FLD_01 = DATA_PACKAGE-KEY_FLD_01.
COUNT_SEQ = 1.
IF DATA_PACKAGE- DATA_FLD_01 > 0.
DATA_PACKAGE_NEW-KEY_SEQ_01 = COUNT_SEQ.
DATA_PACKAGE_NEW-DATA_FLD_01 = DATA_PACKAGE- DATA_FLD_01.
ADD 1 TO COUNT_SEQ.
APPEND DATA_PACKAGE_NEW.
END IF.
< same for 2, 3, 4>
END LOOP.
REFRESH DATA_PACKAGE.
DATA_PACKAGE[] = DATA_PACKAGE_NEW[].
I hope this help -
Need some help on Start routines,
Hi Gurus,
I am new to SAP ABAP, I am a BI consultant with 0 ABAP knowledge, Please help me writing a code for the following scenario.(START ROUTINE)
I have a DSO(S_DSO) as source and cube(T_CUBE) as target, and before extracting the data into T_CUBE i need to validate the data. for this I got one more DSO(LU_DSO) for look up.
structures of the dso's and cube :
S_DSO ............ T_CUBE ......... ..... LU_DSO
ZDOC_NO ......... ZDOC_NO ........... ZDOC_NO
ZPROD_FAM ........ ZPROD_FAM ......... ZPROD_FAM
QTY ......... ..................... QTY........
UNIT_PRICE .......... UNIT_PRICE.......
LOGIC
if S_DSO-ZDOC_NO = LU_DSO-ZDOC_NO AND S_DSO-ZPROD_FAM = LU_DSO-ZPROD_FAM
THEN
S_DSO-ZDOC_NO = T_CUBE-ZDOC_NO AND S_DSO-ZPROD_FAM = T_CUBE-ZPROD_FAM AND
S_DSO-QTY = T_CUBE-QTY AND S_DSO-UNIT_PRICE = T_CUBE-UNIT_PRICE
please help me to achieve this....please provide code from the initializations of internal tables not just the looping conditions.
You help will be most appreciated
Surabhi
Edited by: surabhi5579 on Mar 28, 2009 8:14 PM
Edited by: surabhi5579 on Mar 28, 2009 8:16 PM
Edited by: surabhi5579 on Mar 28, 2009 8:17 PM
Edited by: surabhi5579 on Mar 28, 2009 8:17 PMHi Viren,
I did applied the code in Start routine but the out put is not as required.
My Data model is as follows:
zmd_dso(source dso)
zdocno.. zprod_fam.. qty.. price
a001... A ... 10 ... 100
a002 ... B ... 20 ... 200
a003... C ... 30 ... 300
zmd_dsc(lookup dso)
zdocno ... zprod_fam
a001 .... A
a003 .... C
desired output
zdata_ic(target)
zdoc_no ... zprod_fam .. qty .. price
aoo1 ... A ... 10 ... 100
a003 ... C ... 30 ... 300
As per the above table zmd_dso is the source DSO and Zdata_ic is Target Cube, but in between there is DSO called zmd_dsc which contains zdoc_no and zprod_fam and after the transfermation u can see the cube filterd by the values in zmd_dsc which is a look up dso. the doc_no " a002" and the Zprod_fam "B" are not present in the lookup dso and that is the reason why the entries are not visible in the cube after extraction.
I tried ur code, but the result is same as source dso i can see all the records which are available in the source dso and it is not cross checking the lookup dso that is Zmd_dsc.
I hope ur understanding what i meant to say. sorry if i am confusing you.
Edited by: surabhi5579 on Mar 29, 2009 7:08 PM
Edited by: surabhi5579 on Mar 29, 2009 7:19 PM -
Need help in ABAP coding in start routine
Hi,
I have a requriement like
-To take the value of month which is an attribute of category(info Object) for which category value is 1. I need to apply the month obtained as the filter to another info object. I have opted to write this ABAP code in start routine. Can anyone guide me on this code.
Thanks in advance.do you not have an abap-er at your disposal? i don't imagine this to be quick & dirty that can be written without access to your system! some analysis work may also be required before the actual coding can be done...so I wouldn't post the entire functional spec (business requirement) here hoping for a solution; that would be too weird.
Regards. -
Start routine in DSO Self transformations
Hi SCN,
I need to write start routine to fill one of my target feild.
Here my info object is ZCust and attribute zpur_grp
My DSO have 0customer and zpur_grp.
Am creating self transformations for my dso and need to fill zpur_grp from zcust if dso-zpur_grp is blank.
condition is dso-0customer = info object-customer.
Am new to abap code part and confused about specifying fields and tables(/bic/).
Need suggestions to write sample format code.
Thanks in advance.
ChandraHi Chandra,
U need to write look-up code.
Below s sample code. it might be help you.
Declare Internal Table Like follow:
TYPES: BEGIN OF TY_CUST,
ZCust TYPE /BIC/ ZCust ,
zpur_grp TYPE /BIC/ zpur_grp
END OF TY_CUST.
select value for internal table.
SELECT /BIC/ ZCust /BIC/zpur_grp
FROM /BIC/PZCust
INTO TABLE IT_CUST
FOR ALL ENTRIES IN SOURCE_PACKAGE
WHERE /BIC/ZCust = SOURCE_PACKAGE-/BIC/0customer
AND OBJVERS = 'A'.
Then write Lookup code in start routine.
LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.
clear : WA_CUST_DBDIV.
* Read internal table for customer
READ TABLE IT_CUST
WITH KEY ZCust = <SOURCE_FIELDS>-/BIC/0custome
INTO WA_CUST_DBDIV
BINARY SEARCH.
*Populate the corresponding Customer and DB Division in RESULT_PACKAGE
IF SY-SUBRC = 0.
<SOURCE_FIELDS>-/BIC/0custome = WA_CUST_DBDIV-ZCust.
<SOURCE_FIELDS>-/BIC/zpur_grp = WA_CUST_DBDIV-zpur_grp.
ENDLOOP.
Hope it 'll help you.
Regards,
Mukesh -
Start Routine to Populate Account Group Field from Master data of 0Customer
Hello Friends. Please help me edit this ABAP code to make it work. I am putting this code in start routine in between two DSO. where I am using the
Start Routine to Populate Account Group Field from Master data of 0Customer. I do not want to use read from master data functionality since that field 0customer is not there in dso but similar field 0debitor is there. so i want to put this code
during the load from source DSO to Target DSO.
Error Explicit length specifications are necessary with types C, P, X, N und
DATA: L_S_DP_LINE TYPE DATA_PACKAGE_sTRUCTURE.
types: begin of comp,
CUSTOMER type /BI0/OICUSTOMER,
ACCNT_GRP type /BI0/OIACCNT_GRP,
end of comp.
DATA: l_S_comp type comp.
DATA: L_th_COMP TYPE HASHED TABLE OF COMP WITH UNIQUE KEY customer INITIAL SIZE 0.
IF L_th_COMP[] IS INITIAL.
SELECT CUSTOMER ACCNT_GRP FROM /BI0/PCUSTOMER APPENDING CORRESPONDING FIELDS OF TABLE L_th_COMP.
ENDIF.
LOOP AT SOURCE_PACKAGE INTO L_S_DP_LINE.
READ TABLE L_TH_COMP INTO L_S_COMP WITH TABLE KEY CUSTOMER = L_s_DP_LINE-CUSTOMER
IF SY-SUBRC = 0.
L_S_DP_LINE-/BIC/ACCNT_GRP = L_S_COMP-/BIC/ACCNT_GRP.
MODIFY SOURCE_PACKAGE FROM L_S_DP_LINE.
ENDIF.
ENDLOOP.
soniya kapoor
Message was edited by:
soniya kapoorHello Wond Thanks for Good Answer and good option, But Client does not like this option and does not like Nav Attribute so he does not want to turn on any Nav Attribute, In general also We hav requirement to read a third table while uploading 1 dso table to 2 dso table,
so Please help me edit this ABAP code to make it work. I am putting this code in start routine in between two DSO. where I am using the
Start Routine to Populate Account Group Field from Master data of 0Customer.
No syntax Error But during the load it is updating the source table and not the target table. how to define now target table.
***SOURCE DSO Table
types: begin of typ_tgl1.
include type /BIC/AZDAFIAR000.
types: end of typ_tgl1.
types: begin of comp,
CUSTOMER type /BI0/OICUSTOMER,
ACCNT_GRP type /BI0/OIACCNT_GRP,
end of comp.
DATA: L_th_COMP TYPE HASHED TABLE OF COMP WITH UNIQUE KEY customer
INITIAL SIZE 0.
data: wa_itab type COMP.
data: wa_zdtg type typ_tgl1.
IF L_th_COMP[] IS INITIAL.
***Master Data Table
SELECT CUSTOMER ACCNT_GRP FROM /BI0/PCUSTOMER APPENDING CORRESPONDING
FIELDS OF TABLE L_th_COMP.
sort L_th_COMP by CUSTOMER.
ENDIF.
LOOP AT L_th_COMP into wa_itab.
select * from /BIC/AZDAFIAR000 into wa_zdtg
where DEBITOR eq wa_itab-CUSTOMER. *** SOURCE DSO Table
IF SY-SUBRC = 0.
wa_zdtg-ACCNT_GRP = wa_itab-ACCNT_GRP.
MODIFY /BIC/AZDAFIAR000 from wa_zdtg. *** modify SOURCE DSO Table
ENDIF.
endselect.
endloop.
soniya kapoor -
Start Routine logic to delete records which do not satisfy a condition
Hello,
Iam trying to code a start routine to delete the records from the source_package if a certain set of conditions are not met.
It is failing at the last statement.
Pls help.
Thanks
Jagadish
code is as follows..
LOOP AT SOURCE_PACKAGE assigning <SOURCE_FIELDS>.
IF not (
( <SOURCE_FIELDS>-/BIC/ZCLSD_DT BETWEEN <SOURCE_FIELDS>-/BIC/ZWEEKOF
AND <SOURCE_FIELDS>-/BIC/ZNONWKOF )
AND
( <SOURCE_FIELDS>-/BIC/ZCLSD_DT IS INITIAL )
DELETE SOURCE_PACKAGE FROM <SOURCE_FIELDS>.
(is failing at the delete statement.)
ENDIF.
ENDLOOP.Thanks Pratap,
I used an internal table to load the records and used a delete statement out side the LOOP.
By using a Work Area assignment instead of the Source_fields, The delete statement is giving me an error saying "Conversion of Numeric Value to type Object is not valid".
Here is the code I have modified...
TYPES: BEGIN OF LINE,
WO(6) type c,
END OF LINE.
DATA: WA TYPE LINE,
ITAB TYPE TABLE OF LINE.
LOOP AT SOURCE_PACKAGE assigning <SOURCE_FIELDS>.
IF NOT (
( <SOURCE_FIELDS>-/BIC/ZCLSD_DT BETWEEN <SOURCE_FIELDS>-/BIC/ZWEEKOF
AND <SOURCE_FIELDS>-/BIC/ZNONWKOF
AND
<SOURCE_FIELDS>-/BIC/ZAPRD_DT IS NOT initial )
Append <SOURCE_FIELDS>-/BIC/ZWO_NBR to itab.
ENDIF.
ENDLOOP.
loop at itab into WA.
DELETE SOURCE_PACKAGE where /bic/ZWO_NBR = WA-wo.
endloop.
Maybe you are looking for
-
How can i change 'selected menu link' color in af:menuTree
Hi, Is there any selector specifically for highlighting the currently selected menu item in the af:menuTree. Right now in my skin it is taking the style of .AFDarkForeground:alias. I want my selected link to have different color other than AFDarkFore
-
Difference/Updation to SAP-BW Versions 3.0B,3.1C and 3.5
hello guys can anyone breif up with the difference/Updation to SAP-BW Versions 3.0B,3.1C and 3.5? Pl let me know atleast few of points? Many Thanks balaji
-
updated to ios6 and now when I receive an email where my address is part of a group, the email will not open and email closes automatically. I can open this email on my macbook. If i forward this email from my macbook to my iphone, i can then open th
-
Dear All, I am calling a storedProcedure for each row in viewobject(1-50 rows), which does some type of updations. Now actually i want to enable transaction for this operation, i am trying to get current connection(as mentioned below) on am, doing co
-
Macbook restarts radmomly, now will not not get past boot.
My friend's macbook which is one of the older style white ones with ddr2 ram would restart randomly at times. I replaced old Fijitsu the hd last May when it died with a 320GB WD Caviar blue series. It would boot up fine but if you tried to access the