Difference between Start Routine and End Routine in Transformations
Hi Friends,
I'm using BI 7.0... here in Transformations step we have two options..that is START ROUTINE... and END ROUTINE... What is the Difference between Start Routine and End Routine in Transformations..
When we go for Start Routine.. and when we go for End Routine..
Plz clarrify... points will be rearded..
thanks
babu
Hi,
One real time scenario for End Routine.
We have a scenario where in a datasource field is mapped to three infoobjects on the datatarget side. There are 2 key figures which need to get data after these these Infoobjects are filled. The best place for this to happen would be in a End Routine, where in we would loop through the results package and using the values of the infoobjects from the data target ( Cube in this case).
Hope this helps,
HD
Similar Messages
-
Difference between Message monitoring and end tot end monitoring.
Hi,
What exactly is the difference between message monitoring and end to end monitoring?
I read that message monitoring is used by end to end monitoring. Then why do we have two separate monitoring options?
Thanks
Hari.End-to-End Monitoring
You use end-to-end monitoring in the following cases:
● If you want to monitor message processing steps in a number of SAP components (to be configured).
● If you want to monitor the path of individual messages through these SAP components, from start to end.
Message Monitoring
You use message monitoring in the following cases:
● To track the status of messages
● To find errors that have occurred and establish what caused them
for detail see this
Message Monitoring
http://help.sap.com/saphelp_nw04/helpdata/en/2f/4e313f8815d036e10000000a114084/frameset.htm
End-to-End Monitoring
http://help.sap.com/saphelp_nw04/helpdata/EN/82/9e8dfe9eadbd4b9194c433e646b84e/content.htm -
What is the difference between Message Monitoring and End-to-End monitoring
Hi experts,what is the difference between Message Monitoring and End-to-End monitoring? and What is the difference between Value Mapping and Fix value?
Thanks,
ManojHII
You use message monitoring in the following cases:
● To track the status of messages
● To find errors that have occurred and establish what caused them
Check this help for further info:
http://help.sap.com/saphelp_nw04/helpdata/en/2f/4e313f8815d036e10000000a114084/content.htm
You use end-to-end monitoring in the following cases:
● If you want to monitor message processing steps in a number of SAP components (to be configured).
● If you want to monitor the path of individual messages through these SAP components, from start to end.
Check this help for further info:
http://help.sap.com/saphelp_nw04/helpdata/en/82/9e8dfe9eadbd4b9194c433e646b84e/content.htm
also refer this doc...gives more insight on various monitoring:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0b4580be-0601-0010-d3ad-bd6ce51ae916
... End-to-end monitoring in SAP XI provides a graphical overview of the different XI
components and the message flow between them. It is based on the Process Monitoring Infrastructure (PMI).
ans also
http://help.sap.com/saphelp_nw2004s/helpdata/en/7c/14b5765255e345a9e3f044f1e9bbbf/frameset.htm
You use message monitoring in the following cases:
1 To track the status of messages
2 To find errors that have occurred and establish what caused them
Check this help for further info:
http://help.sap.com/saphelp_nw04/helpdata/en/2f/4e313f8815d036e10000000a114084/content.htm
You use end-to-end monitoring in the following cases:
1 If you want to monitor message processing steps in a number of SAP components (to be configured).
2 If you want to monitor the path of individual messages through these SAP components, from start to end.
Check this help for further info:
http://help.sap.com/saphelp_nw04/helpdata/en/82/9e8dfe9eadbd4b9194c433e646b84e/content.htm
End-to-end monitoring includes message monitoring, adapter monitoring, BPE if BPM is involved.. so end-to-end monitoring tells you complete description of your scenario......but message monitoring is concerned only with source message coming to target message successfully generated. -
Calculate duration between start date and end date
Hi everyone,
I'm facing with problem when calculating duration between start & end with this function below . This fuction is working well, but i want to change working time from 8:00 am to 17:30 pm instead of 17:00 , and lunch time from 12:00 to 13:30 instead
of 13:00 as present . Problem is , i changed data type of start hour and end hour from INT to decimal . But it is still wrong .
Pls help me . It's very urgent bcoz i need it for monthly report .
Many thanks .
Here is function which im using :
ALTER Function [dbo].[GetWorkingMin](@pStartDate DateTime, @pEndDate DateTime) Returns Int
AS
Begin
Declare @StartDate DateTime = @pStartDate
Declare @EndDate DateTime = @pEndDate
Declare @WorkMin int = 0 -- Initialize counter
Declare @Reverse bit -- Flag to hold if direction is reverse
Declare @StartWorkingHour int = 8 -- Start of business hours (can be supplied as an argument if needed)
Declare @EndWorkingHour int = 17 -- End of business hours (can be supplied as an argument if needed)
Declare @Holidays Table (HDate DateTime) -- Table variable to hold holidayes
Declare @LunchHour int = 12
Declare @StartHour int = DatePart(HH, @StartDate)
Declare @EndHour int = DatePart(HH, @EndDate)
-- If dates are in reverse order, switch them and set flag
If @StartDate>@EndDate
Begin
Declare @TempDate DateTime=@StartDate
Set @StartDate=@EndDate
Set @EndDate=@TempDate
Set @Reverse=1
End
Else Set @Reverse = 0
-- Get country holidays from table based on the country code
Insert Into @Holidays (HDate) Select HDate from HOLIDAY Where HDATE>=DateAdd(dd, DateDiff(dd,0,@StartDate), 0)
If DatePart(HH, @StartDate)<@StartWorkingHour
begin
Set @StartDate = DateAdd(hour, @StartWorkingHour, DateDiff(DAY, 0, @StartDate))
-- If Start time is less than start hour, set it to start hour
Set @StartHour = DatePart(HH, @StartDate)
end
If DatePart(HH, @StartDate)>=@EndWorkingHour
begin
Set @StartDate = DateAdd(hour, @StartWorkingHour+24, DateDiff(DAY, 0, @StartDate))
-- If Start time is after end hour, set it to start hour of next day
Set @StartHour = DatePart(HH, @StartDate)
--return DatePart(day, @StartDate)
end
If DatePart(HH, @EndDate)>=@EndWorkingHour
begin
Set @EndDate = DateAdd(hour, @EndWorkingHour, DateDiff(DAY, 0, @EndDate))
-- If End time is after end hour, set it to end hour
Set @EndHour = DatePart(HH, @EndDate)
end
If DatePart(HH, @EndDate)<@StartWorkingHour
begin
Set @EndDate = DateAdd(hour, @EndWorkingHour-24, DateDiff(DAY, 0, @EndDate))
-- If End time is before start hour, set it to end hour of previous day
Set @EndHour = DatePart(HH, @EndDate)
end
If (@StartHour>=@LunchHour and @StartHour < (@LunchHour +1))
Begin
Set @StartDate = DateAdd(hour, @LunchHour + 1, DateDiff(DAY, 0, @StartDate))
-- If Start time is in lunch time, set it to 12
Set @StartHour = @LunchHour + 1
End
If (@StartHour>=@LunchHour and DatePart(DW, @StartDate) = 7)
Begin
Set @StartDate = DateAdd(hour, @StartWorkingHour + 24, DateDiff(DAY, 0, @StartDate))
Set @StartHour = DatePart(HH, @StartDate)
End
If (@EndHour>=@LunchHour and @EndHour < (@LunchHour +1))
Begin
Set @EndDate = DateAdd(hour, @LunchHour +1, DateDiff(DAY, 0, @EndDate))
-- If End time is in lunch time, set it to 13
Set @EndHour = @LunchHour + 1
End
If (DatePart(DW, @EndDate) = 7 and DatePart(HH, @EndDate) >= @LunchHour) Set @EndDate = DateAdd(hour, @LunchHour, DateDiff(DAY, 0, @EndDate)) -- If End day is Saturday and End time is after end hour, set it to end hour of saturday
If @StartDate>@EndDate Return 0
-- If Start and End is on same day
If DateDiff(Day,@StartDate,@EndDate) <= 0
Begin
If (Datepart(dw,@StartDate)>1 And DATEPART(dw,@StartDate)<7)
-- If day is between sunday and saturday
If (Select Count(*) From @Holidays Where HDATE=DateAdd(dd, DateDiff(dd,0,@StartDate), 0)) = 0
-- If day is not a holiday
If @EndDate<@StartDate Return 0 Else
Begin
Set @WorkMin=DATEDIFF(MI, @StartDate, @EndDate)
-- Calculate difference
If (@StartHour <= @LunchHour and @EndHour >= @LunchHour + 1)
Set @WorkMin = @WorkMin - 60;
End
Else Return 0
Else Begin
if (DATEPART(dw,@StartDate)=7) set @WorkMin = @WorkMin + DATEDIFF(MI, @StartDate, @EndDate);
Return @WorkMin
End
End
Else Begin
Declare @Partial int=1
-- Set partial day flag
While DateDiff(Day,@StartDate,@EndDate) > 0
-- While start and end days are different
Begin
If Datepart(dw,@StartDate)>1 And DATEPART(dw,@StartDate)<7 -- If this is a weekday
Begin
If (Select Count(*) From @Holidays Where HDATE=DateAdd(dd, DateDiff(dd,0,@StartDate), 0)) = 0 -- If this is not a holiday
Begin
If @Partial=1
-- If this is the first iteration, calculate partial time
Begin
Set @WorkMin=@WorkMin + DATEDIFF(MI, @StartDate, DateAdd(hour, @EndWorkingHour, DateDiff(DAY, 0, @StartDate)))
If (@StartHour <= @LunchHour) Set @WorkMin = @WorkMin - 60;
Set @StartDate=DateAdd(hour, @StartWorkingHour+24, DateDiff(DAY, 0, @StartDate))
Set @Partial=0
End
Else Begin
-- If this is a full day, add full minutes
Set @WorkMin=@WorkMin + (@EndWorkingHour-@StartWorkingHour - 1)*60
Set @StartDate = DATEADD(DD,1,@StartDate)
End
End
Else Set @StartDate = DATEADD(DD,1,@StartDate)
End
Else Begin
If (DATEPART(dw,@StartDate)=7)
Begin
Set @WorkMin = @WorkMin + DATEDIFF(MI, @StartDate, DateAdd(hour, @LunchHour, DateDiff(DAY,
0, @StartDate)));
End
--Set @StartDate = DATEADD(DD,1,@StartDate)
Set @StartDate = DateAdd(hour, @StartWorkingHour + 24, DateDiff(DAY, 0, @StartDate))
Set @StartHour = DatePart(HH, @StartDate)
End
End
If Datepart(dw,@StartDate)>1 And DATEPART(dw,@StartDate)<7
-- If last day is a weekday
If (Select Count(*) From @Holidays Where HDATE=DateAdd(dd, DateDiff(dd,0,@StartDate), 0)) = 0
-- And it is not a holiday
Begin
If @Partial=0 Set @WorkMin=@WorkMin + DATEDIFF(MI, @StartDate, @EndDate) Else
Set @WorkMin=@WorkMin + DATEDIFF(MI, DateAdd(hour, @StartWorkingHour, DateDiff(DAY, 0, @StartDate)), @EndDate)
If (@EndHour >= (@LunchHour + 1)) Set @WorkMin = @WorkMin - 60;
End
If (DATEPART(dw,@EndDate)=7)
Begin
Set @WorkMin = @WorkMin + DATEDIFF(MI, DateAdd(hour, @StartWorkingHour, DateDiff(DAY, 0, @EndDate)),@EndDate);
End
End
If @Reverse=1 Set @WorkMin=-@WorkMin
Return @WorkMin
EndThe problem is you cannot specify partial hours.
I think your best bet would be to alter the function sufficiently so it will accept times instead of hours, and where you're making comparisons to the hour, use dates/date functions instead.
Then, just set the variable as a full time (or datetime, if you need). -
Lookup DSO in Start Routine and End Routine to update date
Hi Gurus,
I need a Start Routine & help, while loading the data from DSO to Info Cube.
In the DSO ( /BIC/AZSD_O0300 ) & in the InfoCube I have a common fields are
0DOC_NUMBER ( DOCUMENT NUMBER), 0S_ORD_ITEM ( Sales Document Item Number ), 0SCHED_LINE ( Schedule Line ) and 0MATAV_DATE ( Material Available Date ).
Data in DSO is as follows
0DOCNUMBER_ 0SORD_ITEM_ 0SCHEDLINE_ 0MATAVDATE_
1001 10 1 05/21/2011
1001 20 2 05/26/2011
1001 10 2 05/22/2011
1001 20 1 05/18/2011
1002 20 1 05/20/2011
1002 10 1 05/24/2011
1002 10 2 05/28/2011
Data should load in the InfoCube as below.
0DOCNUMBER 0S_ORD_ITEM 0SCHED_LINE 0MATAV_DATE
1001 10 1 05/21/2011
1001 20 2 05/18/2011
1001 10 2 05/21/2011
1001 20 1 05/18/2011
1002 20 1 05/20/2011
1002 10 1 05/24/2011
1002 10 2 05/24/2011
When ever schedule line is 2 for the record we have to check both Document number and 0S_ORD_ITEM are same change the Material moving date to the date schedule line is 1 for the same document and same order item number.
Your help is really appreciated.
Thanks
Ganesh Reddy.Thanks Parth and Raj. I have written code almost as you suggested just little changes.
Start Routine
TABLES:/BIC/AZSD_O0300.
DATA:ITAB_DSO LIKE /BIC/AZSD_O0300.
TYPES: BEGIN OF ITABTYPE,
DOC_NUM TYPE /BI0/OIDOC_NUMBER,
SAL_DOC_NUM TYPE /BI0/OIS_ORD_ITEM,
SCHED_NUM TYPE /BI0/OISCHED_LINE,
MAT_AV_DATE TYPE /BI0/OIMATAV_DATE,
END OF ITABTYPE.
DATA : ITAB TYPE STANDARD TABLE OF ITABTYPE
WITH HEADER LINE
WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
data: wa_itab type ITABTYPE.
SELECT DOC_NUMBER S_ORD_ITEM SCHED_LINE MATAV_DATE
FROM /BIC/AZSD_O0300
INTO TABLE ITAB
WHERE SCHED_LINE = '1'.
Field Routine.
if SOURCE_FIELDS-S_ORD_ITEM <> '1'.
read table itab into wa_itab with key doc_num =
SOURCE_FIELDS-DOC_NUMBER
SAL_DOC_NUM =
SOURCE_FIELDS-S_ORD_ITEM.
if sy-subrc = 0.
RESULT = wa_itab-MAT_AV_DATE.
endif.
endif.
I haven't check how the data is coming. But for now I am closing this issue.
Thanks Again
Ganesh Reddy. -
Hi All,
In BI 7 we have a start routine and end routine. In end routine we delete all the transformed records that need not be updated to the infocube. Which we can also do it in the start routine. In that case Y do we need a End routine.
Regards.Hi,
1. Start Routine : whenever you create a start routine, the system will automatically give you some predefined data declaration like structure of the type of your source. In start routine you can declare a local data declaration and Global data declaration also. I will give one example.
Suppose you are creating Start routine for transformation from Datasource to DSO. Then when you create start routine the System will provide you a structure of your datasource. By using this structure it will also define an internal table which will be used as changing parameter of a method of a class. It is this changing parameter where you have to do all sorts of manipulation. The changing parameter is both export as well as import parameter. This changing parameter will contain data in the package wise.
In start routine you can also read some database table and store that data into an internal table and this internal table data can then be read in the field level routine. In this case it acts as a substitute of master data look up in the field level transformation.
2. End routine : The end routine is also same as start routine, the only difference is that here the system will provide you with a structure of the target not the source. and rest is all same as start routine.
assign points if it helps
Thanks & Regards
santo -
Difference between BW3.5 and BI 7.0 version
difference between BW3.5 and BI 7.0 version
Hi ,
Differences between BW 3.5 and BI 7.0
Major Differences between Sap Bw 3.5 & sapBI 7.0 version:
1. In Infosets now you can include Infocubes as well.
2. The Remodeling transaction helps you add new key figure and characteristics and handles historical data as well without much hassle. This is only for info cube.
3. The BI accelerator (for now only for infocubes) helps in reducing query run time by almost a factor of 10 - 100. This BI accl is a separate box and would cost more. Vendors for these would be HP or IBM.
4. The monitoring has been imprvoed with a new portal based cockpit. Which means you would need to have an EP guy in ur project for implementing the portal !
5. Search functionality hass improved!! You can search any object. Not like 3.5
6. Transformations are in and routines are passe! Yess, you can always revert to the old transactions too.
7. The Data Warehousing Workbench replaces the Administrator Workbench.
8. Functional enhancements have been made for the DataStore object:
New type of DataStore object
Enhanced settings for performance optimization of DataStore objects.
9. The transformation replaces the transfer and update rules.
10. New authorization objects have been added
11. Remodeling of InfoProviders supports you in Information
Lifecycle Management.
12 The Data Source:
There is a new object concept for the Data Source.
Options for direct access to data have been enhanced.
From BI, remote activation of Data Sources is possible in SAP source systems.
13.There are functional changes to the Persistent Staging Area (PSA).
14.BI supports real-time data acquisition.
15 SAP BW is now known formally as BI (part of NetWeaver 2004s). It implements the Enterprise Data Warehousing (EDW). The new features/ Major differences include:
a) Renamed ODS as DataStore.
b) Inclusion of Write-optmized DataStore which does not have any change log and the requests do need any activation
c) Unification of Transfer and Update rules
d) Introduction of "end routine" and "Expert Routine"
e) Push of XML data into BI system (into PSA) without Service API or Delta Queue
f) Intoduction of BI accelerator that significantly improves the performance.
g) Load through PSA has become a must. I am not too sure about this. It looks like we would not have the option to bypass the PSA Yes,
16. Load through PSA has become a mandatory. You can't skip this, and also there is no IDoc transfer method in BI 7.0. DTP (Data Transfer Process) replaced the Transfer and Update rules. Also in the Transformation now we can do "Start Routine, Expert Routine and End Routine". during data load.
New features in BI 7 compared to earlier versions:
i. New data flow capabilities such as Data Transfer Process (DTP), Real time data Acquisition (RDA).
ii. Enhanced and Graphical transformation capabilities such as Drag and Relate options.
iii. One level of Transformation. This replaces the Transfer Rules and Update Rules
iv. Performance optimization includes new BI Accelerator feature.
v. User management (includes new concept for analysis authorizations) for more flexible BI end user authorizations.
Regards
KP -
Search on basis of start date and end date
Hi,
I have added two fields 'Start Date' and 'End Date' on a search page.
I have done the VO extension also.
Now, I have to implement search logic to get all the records created in between 'Start Date' and 'End Date' after pressing the 'GO' button on that page.
Can anyone please provide guidance to extend the controller.
Thanks in advance.
Gaurav.Hi Anil,
Thanks for ur reply.
As per the link, I have written following code in the controller :
package oracle.apps.irc.vacancy.webui;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.table.OAAdvancedTableBean;
public class xxVacancyCriteriaCO extends VacancyCriteriaCO
public xxVacancyCriteriaCO() {}
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
// Pressing the Go button causes the search to be executed.
OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
OAViewObject oaviewobject = (OAViewObject)am.findViewObject("XXIrcVacancySearchCriteriaVO");
if (pageContext.getParameter("Go") != null)
String created = pageContext.getParameter("ViewDate");
oaviewobject.setWhereClauseParam(0, created);
oaviewobject.executeQuery();
OAAdvancedTableBean table = (OAAdvancedTableBean)webBean.findChildRecursive("ResultsTable");
table.queryData(pageContext, false);
But while compiling it, I am getting the error as :
"Error(14,42): PerTransactionTopCOImpl not found in class oracle.apps.irc.common.webui.IrcOAControllerImpl in class oracle.apps.irc.vacancy.webui.VacancyCriteriaCO in class oracle.apps.irc.vacancy.webui.xxVacancyCriteriaCO"
Can u please suggest where the mistake is?
Thanks again.
Gaurav.
Edited by: Gaurav on Jan 14, 2011 12:51 AM -
Is difference between update routine,start routine and transfer routine
Hi All,
What is difference between transfer routine and update routine.Hi Venkat,
Routine is a set of ABAP code which is used to select a record or transform the field value at the time of loading the data.
Types of routines:
Tranfer Routines in Transfer Rules:
Start Routines in Transfer Rules:
Update Routines in Update Rules:
Start Routines in Update Rules:
Transfer/Update routine:
It's the set of ABAP code used in Transfer/Update rules. Transfer/Update routine is used to change the value of a particular field/object at the time of loading data.
Ex: Populate the amount/discount field by using Price and Quantity based on the given conditions.
Start Routine:
Start routine can be used in both Transfer Rules and Update Rules. Start routine is used to determine whether to load a particular record or not.
Ex: From the data related to the year 2005, we can select only the records which belong to a particular month or fiscal period.
Ultimately Transfer/Update routines are to update the value of a particular field. Start routines are used to select entire record.
You can get more details about routines at :
Routines
ROUTINES
Routines and Examples
Start Routines
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/60cecb1d-0a01-0010-8289-b14fd99062fa
take a look this doc for abap used in bw
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/4493c4a6-0301-0010-62a2-efd6ded61e04
ABAP book that always mentioned :
http://cma.zdnet.com/book/abap/
assign points if useful ***
Regards
CSM Reddy -
What is the difference between start() and run()
Hi:
what is the difference between start() and the run()???
in my app, i have
Console.debug( "starting thread to listen for clients" );
_server = new Server( this );
_server.start();
_server extends Thread..
why everytime i use server.start(); my app will terminate on it is own, even though in my servr.run() method, i have a while loop
and if i call _server.run() explicitly in my code, that while loop will be in execution
can someone let me know??
thnxwhat is the difference between start() and the
run()???start() is a method on Thread that tells it to start.
run() is a method in the object that the thread executes.
why everytime i use _server.start(); my app will
terminate on it is own, Err.... I'm not convinced this is true. It'll throw an IllegalThreadStateException, if you try to restart an existing thread.
If that's what you're saying.
even though in my _servr.run()
method, i have a while loopI don't see the connection. Are you saying that the while loop never terminates, and you don't see why the thread is terminating?
and if i call _server.run() explicitly in my code,
that while loop will be in executionIf you call server.run() explicitly, then run() will be executed in the same thread that you called it in. -
How to add new records in Start routine or end routine.
Hi All,
My requirement is to transfer data from one DSO to anothe DSO. But while transfering a single record frorm DSO1 i want to add 7 records to DSO2 for each record in DSO1 with slight change in data( with a different key). I want to do it in start routine or end routine. How can i do it. If you have any ABAP code for this then please send.
Regards
Amlanyou can use this code, replace the fields where i have marked with <>.
DATA : WA_RESULT_PACKAGE TYPE DSO2,
WA_RESULT_PACKAGE1 LIKE WA_RESULT_PACKAGE.
DATA : IT_RESULT_PACKAGE LIKE TABLE OF WA_RESULT_PACKAGE.
DATA : DATE1 TYPE SY-DATUM.
DATA : DAYDIFF TYPE i.
DATA : RECORD_NO type rsarecord.
SORT RESULT_PACKAGE BY <KEY FIELDS> "specify the key fields here
RECORD_NO = 1.
LOOP AT RESULT_PACKAGE INTO WA_RESULT_PACKAGE.
IF WA_RESULT_PACKAGE_1-<KEYFIELDS> NE WA_RESULT_PACKAGE-<KEYFIELDS>.
WA_RESULT_PACKAGE_1 = WA_RESULT_PACKAGE.
DAYDIFF = WA_RESULT_PACKAGE-ENDDATE - WA_RESULT_PACKAGE-STARTDATE.
WHILE DAYDIFF NE 0.
DATE1 = WA_RESULT_PACKAGE-STARTDATE + DAYDIFF.
MOVE DATE1 TO WA_RESULT_PACKAGE-<KEYFIELDDATE>.
MOVE RECORD_NO TO WA_RESULT_PACKAGE-RECORD.
APPEND WA_RESULT_PACKAGE INTO IT_RESULT_PACKAGE.
DAYDIFF = DAYDIFF - 1.
RECORD_NO = RECORD_NO + 1.
CLEAR DATE1.
ENDWHILE.
CLEAR DAYDIFF.
ENDIF.
ENDLOOP.
DELETE RESULT_PACKAGE[].
RESULT_PACKAGE[] = IT_RESULT_PACKAGE[].
Reg Point 3.
The Key figures will then show up in the report aggregated.Hope that is fine with you.
Note:
Before loading data, in DTP set the semantic key with the key field of the DSO1.This brings all the similar data w.r.t the key fields from the PSA together in a single package.
rgds, Ghuru -
DIFFERENCE BETWEEN "AT NEW " AND "AT FIRST" , "AT END OF" AND "AT LAST" ?
WHAT IS THE DIFFERENCE BETWEEN "AT NEW " AND "AT FIRST" , "AT END OF" AND "AT LAST" WITH REFERENCE TO CONTROL BREAK STATEMENTS ? PLEASE EXPLAIN IN DETAIL.
BEST REGARDS
RYAN.Hi
i am sending you a simple program in which i had write program on that events
you can understand very easily
Using AT FIRST , AT NEW, AT THE END OF , AT LAST.
DATA: BEGIN OF ITAB OCCURS 0,
F1 TYPE I,
F2(6) TYPE C,
F3(10) TYPE N,
F4(16) TYPE P DECIMALS 2,
END OF ITAB.
DATA: SUB_TOT(10) TYPE P DECIMALS 3.
**--1
ITAB-F1 = 1.
ITAB-F2 = 'ONE'.
ITAB-F3 = 10.
ITAB-F4 = '1000.00'.
APPEND ITAB.
CLEAR ITAB.
ITAB-F1 = 1.
ITAB-F2 = 'ONE'.
ITAB-F3 = 20.
ITAB-F4 = '2000.00'.
APPEND ITAB.
CLEAR ITAB.
ITAB-F1 = 1.
ITAB-F2 = 'ONE'.
ITAB-F3 = 30.
ITAB-F4 = '3000.00'.
APPEND ITAB.
CLEAR ITAB.
*--2
ITAB-F1 = 2.
ITAB-F2 = 'TWO'.
ITAB-F3 = 10.
ITAB-F4 = '1000.00'.
APPEND ITAB.
CLEAR ITAB.
ITAB-F1 = 2.
ITAB-F2 = 'TWO'.
ITAB-F3 = 20.
ITAB-F4 = '2000.00'.
APPEND ITAB.
CLEAR ITAB.
*-- 3
ITAB-F1 = 3.
ITAB-F2 = 'THREE'.
ITAB-F3 = 10.
ITAB-F4 = '1000.00'.
APPEND ITAB.
CLEAR ITAB.
ITAB-F1 = 3.
ITAB-F2 = 'THREE'.
ITAB-F3 = 20.
ITAB-F4 = '2000.00'.
APPEND ITAB.
CLEAR ITAB.
SORT ITAB BY F1.
LOOP AT ITAB.
AT FIRST.
WRITE: /35 ' MATERIAL DETAILS:'.
ULINE.
ENDAT.
AT NEW F1.
WRITE: / 'DETAILS OF MATERIAL:' COLOR 7 , ITAB-F1.
ULINE.
ENDAT.
WRITE: / ITAB-F1, ITAB-F2, ITAB-F3, ITAB-F4.
SUB_TOT = SUB_TOT + ITAB-F4.
AT END OF F1.
ULINE.
WRITE: / 'SUB TOTAL :' COLOR 3 INVERSE ON, SUB_TOT COLOR 3 INVERSE ON.
CLEAR SUB_TOT.
ENDAT.
AT LAST.
SUM.
ULINE.
WRITE: 'SUM:', ITAB-F4.
ULINE.
ENDAT.
ENDLOOP.
Using AT FIRST , AT NEW, AT THE END OF , AT LAST.
DATA: BEGIN OF ITAB OCCURS 0,
F1 TYPE I,
F2(6) TYPE C,
F3(10) TYPE N,
F4(16) TYPE P DECIMALS 2,
END OF ITAB.
DATA: SUB_TOT(10) TYPE P DECIMALS 3.
**--1
ITAB-F1 = 1.
ITAB-F2 = 'ONE'.
ITAB-F3 = 10.
ITAB-F4 = '1000.00'.
APPEND ITAB.
CLEAR ITAB.
ITAB-F1 = 1.
ITAB-F2 = 'ONE'.
ITAB-F3 = 20.
ITAB-F4 = '2000.00'.
APPEND ITAB.
CLEAR ITAB.
ITAB-F1 = 1.
ITAB-F2 = 'ONE'.
ITAB-F3 = 30.
ITAB-F4 = '3000.00'.
APPEND ITAB.
CLEAR ITAB.
*--2
ITAB-F1 = 2.
ITAB-F2 = 'TWO'.
ITAB-F3 = 10.
ITAB-F4 = '1000.00'.
APPEND ITAB.
CLEAR ITAB.
ITAB-F1 = 2.
ITAB-F2 = 'TWO'.
ITAB-F3 = 20.
ITAB-F4 = '2000.00'.
APPEND ITAB.
CLEAR ITAB.
*-- 3
ITAB-F1 = 3.
ITAB-F2 = 'THREE'.
ITAB-F3 = 10.
ITAB-F4 = '1000.00'.
APPEND ITAB.
CLEAR ITAB.
ITAB-F1 = 3.
ITAB-F2 = 'THREE'.
ITAB-F3 = 20.
ITAB-F4 = '2000.00'.
APPEND ITAB.
CLEAR ITAB.
SORT ITAB BY F1.
LOOP AT ITAB.
AT FIRST.
WRITE: /35 ' MATERIAL DETAILS:'.
ULINE.
ENDAT.
AT NEW F1.
WRITE: / 'DETAILS OF MATERIAL:' COLOR 7 , ITAB-F1.
ULINE.
ENDAT.
WRITE: / ITAB-F1, ITAB-F2, ITAB-F3, ITAB-F4.
SUB_TOT = SUB_TOT + ITAB-F4.
AT END OF F1.
ULINE.
WRITE: / 'SUB TOTAL :' COLOR 3 INVERSE ON, SUB_TOT COLOR 3 INVERSE ON.
CLEAR SUB_TOT.
ENDAT.
AT LAST.
SUM.
ULINE.
WRITE: 'SUM:', ITAB-F4.
ULINE.
ENDAT.
ENDLOOP.
<b>Reward if usefull</b> -
Can any one explain me abt start routine and transfer routine with example?
Hi all,
Can anyone explaing me the use of start routine and update routines with an real time example.
regds
hariHi
Start routine is at a datapackage level and u generally use select statement and delete state ment
transfer routine is at a data source level.
for ex i have an 3 ODS (X,Y,Z) and one DS D and one Infosoure I and a cube C
flow is DS -
>IS-->ODS's(X,Y,Z)---> and cube C from ODS X, ODS Y,ODS Z
Transfer Routine:If u write any routine in IS it will be applicable to all the the ODS's when u load data becuase it is at the DS level
start routine: now if u write a start routine betwn ODS X and a cube it will be applicable only for the Update rule betwn ODS X and a cube it wont affect the Update rules betwn OD Y and cube or ODS Z and the cube becuase start routine is at a datapackage level
Transfer routine is in the IS
hope this is helpful asssingn points if applicable
thanks
puneet -
What is difference between bex analyser and bex browser
what is difference between bex analyser and bex browser . please explain what are use of both and what we do in both.
hi
Bex Browser
The Business Explorer Browser (BEx Browser) makes it possible for you to access all document types of the Business Information Warehouse that are assigned to your role or that you have stored in your favorites. You can select and open documents assigned to you in the BEx Browser or store and manage new documents in the BEx Browser.
Document types that you can work with in the BEx Browser are:
· BW workbooks
· Documents that are stored in the Business Document Service (BDS)
· Links (references to file system, shortcuts)
· Links to internet sites (URLs)
· SAP transaction calls.
· Web applications and Web templates
· Crystal Reports
Bex Analyser
The Business Explorer Analyzer (BEx Analyzer) is the analysis and reporting tool of the Business Explorer that is embedded in Microsoft Excel.
Features
You can call up the BEx Query Designer in the BEx Analyzer, in order to define queries. Subsequently, you can analyze the selected InfoProvider data by navigation to the query created in the Query Designer and create different query views of the data. You can add the different query views for a query or for different queries to a work book and save them there. You can save the workbook in your favorites or in your role on the BW Server. You can also save the workbook locally on your computer.
Beyond that, you can precalculate the workbook and distribute it by e-mail to recipeients or you can export it to the Enterprise Portal and make it accessible to other employees in the company.
You can start queries in a standard view (with a Standard Web Template set up in Customizing) in the Web browser and forward the URL or continue to navigate on the Web. Similarly, you can export the Web query to MS Excel 2000.
Overview of the Functional Area of the BEx Analyzer:
· BEx toolbar
You access the functions of the BEx Analyzer from the BEx toolbar, which takes you to the BEx Open dialog box where you can open existing queries, or to the BEx Query Designer where you can create new queries or change existing queries.
· Evaluating Query Data
The BEx Analyzer offers convenient functions for evaluating and presenting InfoProvider data interactively. In the BEx Analyzer, you can add queries to workbooks, navigate within them and refresh the data. You can also process the queries further in Microsoft Excel or display them in the Web browser in a default view.
Navigation of a query allows you, for example, to filter characteristics on a single value, drilldown on all values for a characteristic, regroup characteristics and key figures in the rows and columns of the results area, or hide key figures. Navigation results in different views of the InfoProvider data. In addition, a range of further functions is available which allow you to edit a query interactively (for example, sorting, cumulated output, among others). In addition, you can use the editing functions in Microsoft Excel in order to set up individual format templates, to print results areas, or to create graphics.
· Queries in Workbooks
Queries are inserted into workbooks so you can display them. When you insert a query, a link is made between the cell areas of the worksheet and the data of the InfoProvider upon which the query is based. A link therefore exists between the Business Explorer and the Business Information Warehouse Server (BW Server).
When inserting a query into the workbook, a VBA routine is automatically generated in the workbook. You can also connect the Business Explorer with your own VBA programs (Visual Basic for Applications).
You can create workbook templates, into which you can insert your queries. Workbook templates can contain pre-determined items for the area of the query, formatting settings, logos, VBA macros, and so on.
· Precalculating workbooks
You can precalculate and distribute workbooks with the BEx Broadcaster, which is a Web application you get to form the BEx toolbar. The system generates MS Excel workbooks with historical data. You determine the time for precalculation yourself: You can have workbooks precalculated at a predefined time or they can be precalculated whenever data in the underlying InfoProvider changes. You can have the precalculated workbooks sent by e-mail or you can export them into the Enterprise Portal, where you can make them available to employees within your company.
Activities
To start the BEx Analyzer, choose Start ® Programs ® SAP Front-end Business Information Warehouse ® SAP Business Explorer Analyzer.
You can also access the BEx Analyzer via SAP Easy Access ® SAP Business Information Warehouse ® SAP Menu ® Business Explorer ® Analyzer or in the Business Explorer Browser using the Business Explorer Analyzer symbol in the menu bar.
Hope this will solve your issu
nagarjuna -
Difference between Session method and call transaction
Hi,
please give me the differences between session method and call transaction,
briefly explaining synchronus , asynchronus, process, update.
Thanks in advanceHi Vijay Kumar
CLASSICAL BATCH INPUT (Session Method)
CALL TRANSACTION
BATCH INPUT METHOD:
This method is also called as CLASSICAL METHOD.
Features:
Asynchronous processing.
Synchronous Processing in database update.
Transfer data for more than one transaction.
Batch input processing log will be generated.
During processing, no transaction is started until the previous transaction has been written to the database.
CALL TRANSACTION METHOD :
This is another method to transfer data from the legacy system.
Features:
Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.
Updating the database can be either synchronous or asynchronous. The program specifies the update type.
Transfer data for a single transaction.
Transfers data for a sequence of dialog screens.
No batch input processing log is generated.
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
Among the two methods call transaction is better compared to session bcoz data transfer is faster in it.
Differences between call transaction and session.
Session Method:
1) Data is not updated in the database table until the session is processed.
2) No sy-subrc is returned.
3) Error log is created for error records.
4) Updation is always synchronous.
Call Transaction Method:
1) Immediate updation in the database table.
2) sy-subrc is returned.
3)Error need to be handled explicitly.
4) updation can be synchronous as well as asynchronous.
2) ya u can use using the N mode no screen.
3)u can't handle multiple transaction in call transaction.
4) u can handle multiple transaction in session using the BDC_INSERT fm.
5)When u go to SM35 u can able to see the error records.
Which is best?
That depends on your requirement. Both of them have there advantages.
According to the situation u can choose any one of these.
difference between batch input and call transaction in BDC Session method.
1) synchronous processing.
2) can tranfer large amount of data.
3) processing is slower.
4) error log is created
5) data is not updated until session is processed.
Call transaction.
1) asynchronous processing
2) can transfer small amount of data
3) processing is faster.
4) errors need to be handled explicitly
5) data is updated automatically
For session method,these are the function modules to b used.
BDC_OPEN_GROUP
BDC_INSERT
BDC_CLOSE_GROUP
For call transaction,this is the syntax.
CALL TRANSACTION TCODE USING BDCDATA
MODE A or E or N
UPDATE A or S
MESSAGES INTO MESSTAB.
Take a scenario where we need to post documents in FB01 and the input file has say 2000 records (2000 documents, not line items in FB01 but 2000 records)
In the BDC call transaction method
We call the transaction FB01 2000 times (once for each record posting) and if the processing fails in record no 3 it can be captured and start with reocord 4.
Eg: Loop at itab.
call transaction FB01
capture errors
endloop.
In the session method.
We do not explicity call the transaction 2000 times, but all the records are appeneded into a session and this session is stored. The processinf of the session is done wwhenever the user wants it to be done. Hence the errors cannot be captured in the program itself
Check these link:
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
http://www.sap-img.com/abap/question-about-bdc-program.htm
http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/
http://www.planetsap.com/bdc_main_page.htm
Batch Input Session method is asynchronous as told by others here. But the advantage of this is that you have all the error messages and the data for each transaction held persistantly. You don't have to code anything for processing them or writing the logs.
But at the same time, the same feature can be disadvantageous if you need to react to an error or if there are too many errors to manually correct in a session. Since the session are created in the program and its execution is done seperately, you loose the trackability of such transactions.
With a call transaction, what was a disadvantage above will become an advantage. Call transaction immediately gives you messages back and you can react to it in your program. But the disadvantage is that, if you have several hundreds of transactions to run, running them from within the program can be resource crunching affair. It will hamper the system performance and you cannot really distribute the load. Of course, you have some mechanisms with which you can overcome this, but you will have to code for it. Also, storing the messages and storing the errored transaction data etc will have to be handled by you in the program. Whereas, in batch input session, your program's job is to just create the session, after that everything is standard SAP system's responsibility.
Ideally, you should do a call transaction if the resources are not a problem and if it fails, put the errored transaction into a session.
You can decide based on the data volume that your BDC is processing. If data volume is high go for session else call transaction will do.The call transaction updates will be instantaneous where as session needs to be processed explictly after creation.
Session Method
1) Session method supports both small amount of data aswell as large amount of data
2) data processing is asynchronus and data updation is synchronus.
3) it process multiple apllication while perfomaning validations.
4) in session method data will be updated in data base only after processing session only.
5) system provide by default logfile for handling error records.
6) it supports both foreground aswell as background process
in bdc we use FM ...
bdc_open_group " for creating Session
bdc_insert " adding transaction and bdcdata table for updating database
bdc_close_group " for closing Session
Call Transaction
1) Call transaction exclusively for small amout of data
2) it supports only one apllication while perfoming validations
3) there is no default logfile, We can explicitly provide logic for creating logfile for handling error records.
we can create logfile by using structure....BDCMSGCOLL
4) it doesn't support background processing.
5) data processing is synchronous and Data updation is Synchronous( default), in
this method also supports daya updation in asynchronus process also.
syntax:
Call transaction <transaction-name> using BDCDATA
mode <A/N/E>
update <L/A/S>
messages into BDCMSGCOLL.
BDC:
Batch Data Communication (BDC) is the process of transferring data from one SAP System to another SAP system or from a non-SAP system to SAP System.
Features :
BDC is an automatic procedure.
This method is used to transfer large amount of data that is available in electronic medium.
BDC can be used primarily when installing the SAP system and when transferring data from a legacy system (external system).
BDC uses normal transaction codes to transfer data.
Types of BDC :
CLASSICAL BATCH INPUT (Session Method)
CALL TRANSACTION
BATCH INPUT METHOD:
This method is also called as CLASSICAL METHOD.
Features:
Asynchronous processing.
Synchronous Processing in database update.
Transfer data for more than one transaction.
Batch input processing log will be generated.
During processing, no transaction is started until the previous transaction has been written to the database.
CALL TRANSACTION METHOD :
This is another method to transfer data from the legacy system.
Features:
Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.
Updating the database can be either synchronous or asynchronous. The program specifies the update type.
Transfer data for a single transaction.
Transfers data for a sequence of dialog screens.
No batch input processing log is generated.
For BDC:
http://myweb.dal.ca/hchinni/sap/bdc_home.htm
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&
http://www.sap-img.com/abap/learning-bdc-programming.htm
http://www.sapdevelopment.co.uk/bdc/bdchome.htm
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm
http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html
Check these link:
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
http://www.sap-img.com/abap/question-about-bdc-program.htm
http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/
http://www.planetsap.com/bdc_main_page.htm
call Transaction or session method ?
Check the following links:
http://www.sap-img.com/bdc.htm
See below example code :
Call three FM : BDC_OPEN_GROUP,BDC_INSERT and BDC_CLOSE_GROUP.
Once you execute the program and it creates the session at SM35 Transaction.
Report : ZMPPC011
Type : Data upload
Author : Chetan Shah
Date : 05/05/2005
Transport : DV3K919557
Transaction: ??
Description: This ABAP/4 Program creates new Production Versions
(C223). It accepts tab-delimited spreadsheet input and
creates BDC sessions.
Modification Log
Date Programmer Request # Description
06/10/2005 Chetan Shah DV3K919557 Initial coding
report zmppc011 no standard page heading line-size 120 line-count 55
message-id zz.
pool of form routines
include zmppn001.
Define BDC Table Structure
data: begin of itab_bdc_tab occurs 0.
include structure bdcdata.
data: end of itab_bdc_tab.
Input record layout of Leagcy File
data: begin of itab_xcel occurs 0,
matnr(18) type c,
werks(4) type c,
alnag(2) type c,
verid(4) type c,
text1(40) type c,
bstmi like mkal-bstmi,
bstma like mkal-bstma,
adatu(10) type c,
bdatu(10) type c,
stlal(2) type c,
stlan(1) type c,
serkz(1) type c,
mdv01(8) type c,
elpro(4) type c,
alort(4) type c,
end of itab_xcel.
data: begin of lt_pp04_cache occurs 0,
matnr like itab_xcel-matnr,
werks like itab_xcel-werks,
alnag like itab_xcel-alnag,
plnnr like mapl-plnnr,
arbpl like crhd-arbpl,
ktext like crtx-ktext,
end of lt_pp04_cache.
data: v_ssnnr(4) type n,
v_lines_in_xcel like sy-tabix,
v_ssnname like apqi-groupid,
v_trans_in_ssn type i,
wa_xcel LIKE itab_xcel,
l_tabix like sy-tabix,
v_matnr like rc27m-matnr,
v_plnnr like mapl-plnnr,
v_plnal like mapl-plnal,
v_tcode like sy-tcode value 'C223',
v_plnty like plas-plnty value 'R',
v_objty like crhd-objty value 'A',
v_plpo_steus like plpo-steus value 'PP04',
v_verwe like crhd-verwe value '0007'.
Parameters
selection-screen: skip 3.
selection-screen: begin of block 1 with frame.
parameters: p_name like rlgrap-filename
default 'C:\My Documents\InputFile.txt'
obligatory,
bdc session name prefix
p_bdcpfx(6) default 'ZPVCRT'
obligatory,
number for transction per BDC session
p_trnssn type i
default 2000 obligatory,
retain the BDC session after successfull execution
p_keep like apqi-qerase
default 'X',
user who will be executing BDC session
p_uname like apqi-userid
default sy-uname
obligatory.
selection-screen: end of block 1.
possible entry list (F4 dropdown) for input file name
at selection-screen on value-request for p_name.
*-SELECT FILE FROM USERS LOCAL PC
call function 'WS_FILENAME_GET'
exporting
DEF_FILENAME = ' '
def_path = 'C:\Temp\'
mask = ',.,..'
mode = 'O'
title = 'Select File '(007)
importing
filename = p_name
RC =
exceptions
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
others = 5.
if sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
begin the show
start-of-selection.
read data from input file
perform transfer_xcel_to_itab.
loop at itab_xcel.
hang on to xcel line num
l_tabix = sy-tabix.
each line in the xcel file marks begining of new prod.version defn
if num-of-trnas-in-session = 0, create new BDC session
if v_trans_in_ssn is initial.
perform bdc_session_open.
endif.
begin new bdc script for rtg create trans
fill in bdc-data for prod.version maintenance screens
perform bdc_build_script.
insert the bdc script as a BDC transaction
perform bdc_submit_transaction.
keep track of how many BDC transactions were inserted in the BDC
session
add 1 to v_trans_in_ssn.
if the user-specified num of trans in BDC session is reached OR
if end of input file is reached, close the BDC session
if v_trans_in_ssn = p_trnssn or
l_tabix = v_lines_in_xcel.
perform bdc_session_close.
clear v_trans_in_ssn.
endif.
endloop.
top-of-page.
call function 'Z_HEADER'
EXPORTING
FLEX_TEXT1 =
FLEX_TEXT2 =
FLEX_TEXT3 =
FORM TRANSFER_XCEL_TO_ITAB *
Transfer Xcel Spreadsheet to SAP Internal Table *
form transfer_xcel_to_itab.
Read the tab-delimited file into itab
call function 'WS_UPLOAD'
exporting
filename = p_name
filetype = 'DAT'
IMPORTING
filelength = flength
tables
data_tab = itab_xcel
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_table_width = 4
invalid_type = 5
no_batch = 6
unknown_error = 7
others = 8.
if sy-subrc = 0.
sort the data
sort itab_xcel by matnr werks.
clear v_lines_in_xcel.
if no data in the file - error out
describe table itab_xcel lines v_lines_in_xcel.
if v_lines_in_xcel is initial.
write: / 'No data in input file'.
stop.
endif.
else.
if file upload failed - error out
write: / 'Error reading input file'.
stop.
endif.
endform.
FORM BDC_SESSION_OPEN *
Open BDC Session *
form bdc_session_open.
create bdc session name = prefix-from-selectn-screen + nnnn
add 1 to v_ssnnr.
concatenate p_bdcpfx v_ssnnr into v_ssnname.
open new bdc session
call function 'BDC_OPEN_GROUP'
exporting
client = sy-mandt
group = v_ssnname
keep = p_keep
user = p_uname
exceptions
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
others = 11.
endform.
FORM BDC_BUILD_SCRIPT *
Build BDC *
form bdc_build_script.
data: l_arbpl like crhd-arbpl,
l_text1 like mkal-text1,
l_mdv01 like mkal-mdv01,
l_mapl like mapl.
clear bdc-data itab - begin of new bdc transaction
clear itab_bdc_tab.
refresh itab_bdc_tab.
read material cross reference tables to determine sap part#
clear : v_matnr, v_plnnr, v_plnal.
perform read_matnr_cross_ref using itab_xcel-matnr
itab_xcel-werks
changing v_matnr.
determine the version description to use
if itab_xcel-text1 is initial.
l_text1 = itab_xcel-verid.
else.
l_text1 = itab_xcel-text1.
endif.
determine the routing group# and group ctr# to use
perform read_routing .
determine the production line to use
if itab_xcel-mdv01 is initial.
if not provided in the file then:
prod line = work ctr on the last PP04 op of the rtg determined above
perform read_wc_on_last_pp04 using v_plnnr v_plnal
changing l_mdv01.
NOTE: when executing the above form\routine, if v_plnnr is initial
or v_plnal is initial, THEN l_mdv01 will automatically be
returned blank (ie initial)
else.
l_mdv01 = itab_xcel-mdv01.
endif.
build bdc script
perform bdc_build_script_record
fill in initial screen
using: 'X' 'SAPLCMFV' '1000',
' ' 'BDC_OKCODE' '=ENTE',
' ' 'MKAL-WERKS' itab_xcel-werks,
' ' 'MKAL-MATNR' v_matnr,
' ' 'MKAL_ADMIN-DISPO' space,
' ' 'MKAL-PLNNR' space,
' ' 'MKAL_ADMIN-STTAG' space,
' ' 'MKAL-PLNNG' space,
' ' 'MKAL-MDV01' space,
' ' 'MKAL-PLNNM' space,
click create button on initial screen and go to detail screen
'X' 'SAPLCMFV' '1000',
' ' 'BDC_OKCODE' '=CREA',
fill in the detail screen and go back to initial screen
'X' 'SAPLCMFV' '2000',
' ' 'BDC_OKCODE' '=CLOS',
' ' 'MKAL_EXPAND-MATNR' v_matnr,
' ' 'MKAL_EXPAND-VERID' itab_xcel-verid,
' ' 'MKAL_EXPAND-TEXT1' l_text1,
' ' 'MKAL_EXPAND-BSTMI' itab_xcel-bstmi,
' ' 'MKAL_EXPAND-BSTMA' itab_xcel-bstma,
' ' 'MKAL_EXPAND-ADATU' itab_xcel-adatu,
' ' 'MKAL_EXPAND-BDATU' itab_xcel-bdatu,
' ' 'MKAL_EXPAND-PLTYG' v_plnty,
' ' 'MKAL_EXPAND-PLNNG' v_plnnr,
' ' 'MKAL_EXPAND-ALNAG' v_plnal,
' ' 'MKAL_EXPAND-STLAL' itab_xcel-stlal,
' ' 'MKAL_EXPAND-STLAN' itab_xcel-stlan,
' ' 'MKAL_EXPAND-SERKZ' itab_xcel-serkz,
' ' 'MKAL_EXPAND-MDV01' l_mdv01,
' ' 'MKAL_EXPAND-ELPRO' itab_xcel-elpro,
' ' 'MKAL_EXPAND-ALORT' itab_xcel-alort,
save the production version from initial screen
'X' 'SAPLCMFV' '1000',
' ' 'BDC_OKCODE' '=SAVE'.
endform.
FORM BDC_SUBMIT_TRANSACTION *
Submit BDC Session *
form bdc_submit_transaction.
Load BDC script as a trqansction in BDC session
call function 'BDC_INSERT'
exporting
tcode = v_tcode
tables
dynprotab = itab_bdc_tab
exceptions
internal_error = 01
not_open = 02
queue_error = 03
tcode_invalid = 04.
endform.
FORM BDC_BUILD_SCRIPT_RECORD *
form bdc_build_script_record using dynbegin name value.
clear itab_bdc_tab.
if dynbegin = 'X'.
move: name to itab_bdc_tab-program,
value to itab_bdc_tab-dynpro,
'X' to itab_bdc_tab-dynbegin.
else.
move: name to itab_bdc_tab-fnam,
value to itab_bdc_tab-fval.
shift itab_bdc_tab-fval left deleting leading space.
endif.
append itab_bdc_tab.
endform.
FORM BDC_SESSION_CLOSE *
Close BDC Session *
form bdc_session_close.
close the session
call function 'BDC_CLOSE_GROUP'
exceptions
not_open = 1
queue_error = 2
others = 3.
skip 2.
if sy-subrc ne 0.
write: / 'Error Closing BDC Session ' , 'RETURN CODE: ', sy-subrc.
else.
write : / 'Session created:', v_ssnname,
50 '# of transactions:', v_trans_in_ssn.
endif.
endform.
*& Form read_routing_cache
*FORM read_routing_cache USING pi_matnr
pi_werks
pi_alnag
pi_verid
pi_mdv01.
DATA: BEGIN OF lt_plpo OCCURS 0,
vornr LIKE plpo-vornr,
objty LIKE crhd-objty,
objid LIKE crhd-objid,
arbpl LIKE crhd-arbpl,
END OF lt_plpo,
l_mapl_plnnr LIKE mapl-plnnr.
determine the routing group#
CLEAR lt_pp04_cache.
chk if its in the cache first, if not then get it from MAPL table
and put it in the cache
READ TABLE lt_pp04_cache WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
IF sy-subrc = 0.
do nothing - lt_pp04_cache header line has rtg#
ELSE.
get the routing group # from MAPL
SELECT plnnr INTO l_mapl_plnnr
FROM mapl UP TO 1 ROWS
WHERE matnr = pi_matnr AND
werks = pi_werks AND
plnty = 'R' AND
plnal = pi_alnag AND
loekz = space.
ENDSELECT.
put it in the cache internal table
IF NOT l_mapl_plnnr IS INITIAL.
lt_pp04_cache-matnr = pi_matnr.
lt_pp04_cache-werks = pi_werks.
lt_pp04_cache-alnag = pi_alnag.
lt_pp04_cache-plnnr = l_mapl_plnnr.
APPEND lt_pp04_cache.
ENDIF.
ENDIF.
if the rtg# was determined AND
-- the work center was not determined yet AND
-- work center was really needed for this line in the input file
then
-- read the work center from last PP04 operation on the routing
-- update the cache accordingly
IF NOT lt_pp04_cache-plnnr IS INITIAL AND
lt_pp04_cache-arbpl IS INITIAL AND
( pi_verid IS INITIAL OR
pi_mdv01 IS INITIAL ).
read the last PP04 operation
CLEAR lt_plpo.
REFRESH lt_plpo.
SELECT vornr eobjty eobjid e~arbpl
INTO CORRESPONDING FIELDS OF TABLE lt_plpo
FROM plas AS b
INNER JOIN plpo AS c
ON bplnty = cplnty AND
bplnnr = cplnnr AND
bzaehl = czaehl
INNER JOIN crhd AS e
ON carbid = eobjid
WHERE b~plnty = v_plnty AND
b~plnnr = lt_pp04_cache-plnnr AND
b~plnal = lt_pp04_cache-alnag AND
c~loekz = space AND
c~steus = v_plpo_steus AND
e~objty = v_objty AND
e~werks = lt_pp04_cache-werks AND
e~verwe = v_verwe.
SORT lt_plpo BY vornr DESCENDING.
READ TABLE lt_plpo INDEX 1.
IF NOT lt_plpo-arbpl IS INITIAL.
lt_pp04_cache-arbpl = lt_plpo-arbpl.
read work center description
SELECT SINGLE ktext INTO lt_pp04_cache-ktext
FROM crtx WHERE objty = lt_plpo-objty AND
objid = lt_plpo-objid AND
spras = sy-langu.
the following read will get the index of the correct record to be
updated in the cache
READ TABLE lt_pp04_cache
WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
MODIFY lt_pp04_cache
INDEX sy-tabix
TRANSPORTING arbpl ktext.
ENDIF.
ENDIF.
*ENDFORM. " read_last_pp04_operation_cache
*& Form read_routing
form read_routing.
data: begin of lt_mapl occurs 0,
plnnr like mapl-plnnr,
plnal like mapl-plnal,
end of lt_mapl,
l_arbpl like crhd-arbpl.
get all the rtg# and grp ctr# from MAPL
select plnnr plnal
into corresponding fields of table lt_mapl
from mapl
where matnr = v_matnr and
werks = itab_xcel-werks and
plnty = v_plnty and "Rate Routing
loekz = space. "with del flag = OFF
sort lt_mapl by plnal.
if not itab_xcel-verid is initial.
if the verid=0001 then use the 1st good rtg-grp# and grp-ctr#
if itab_xcel-verid = '0001'.
read table lt_mapl index 1.
v_plnnr = lt_mapl-plnnr.
v_plnal = lt_mapl-plnal.
else.
if the verid0001 then use the rtg-grp# and grp-ctr# of the routing
whose work center on the last PP04 operation matches the given verid
loop at lt_mapl.
clear l_arbpl.
get the work center from the last PP04 operation
perform read_wc_on_last_pp04 using lt_mapl-plnnr
lt_mapl-plnal
changing l_arbpl.
if itab_xcel-verid = l_arbpl.
v_plnnr = lt_mapl-plnnr.
v_plnal = lt_mapl-plnal.
exit.
endif.
endloop.
endif.
else.
do nothing
endif.
For version IDs that are other then '0000' or 'ZWIP' :--
if itab_xcel-verid NE '0000' and
itab_xcel-verid NE 'ZWIP'.
if routing group# or group counter was not determined, make the
valid-to date 99/99/9999 so that the BDC, on execution, errors out.
if v_plnnr is initial or
v_plnal is initial.
itab_xcel-bdatu = '99/99/9999'.
endif.
endif.
determine the routing group#
CLEAR lt_pp04_cache.
chk if its in the cache first, if not then get it from MAPL table
and put it in the cache
READ TABLE lt_pp04_cache WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
IF sy-subrc = 0.
do nothing - lt_pp04_cache header line has rtg#
ELSE.
get the routing group # from MAPL
put it in the cache internal table
IF NOT l_mapl_plnnr IS INITIAL.
lt_pp04_cache-matnr = pi_matnr.
lt_pp04_cache-werks = pi_werks.
lt_pp04_cache-alnag = pi_alnag.
lt_pp04_cache-plnnr = l_mapl_plnnr.
APPEND lt_pp04_cache.
ENDIF.
ENDIF.
if the rtg# was determined AND
-- the work center was not determined yet AND
-- work center was really needed for this line in the input file
then
-- read the work center from last PP04 operation on the routing
-- update the cache accordingly
IF NOT lt_pp04_cache-plnnr IS INITIAL AND
lt_pp04_cache-arbpl IS INITIAL AND
( pi_verid IS INITIAL OR
pi_mdv01 IS INITIAL ).
read the last PP04 operation
CLEAR lt_plpo.
REFRESH lt_plpo.
SELECT vornr eobjty eobjid e~arbpl
INTO CORRESPONDING FIELDS OF TABLE lt_plpo
FROM plas AS b
INNER JOIN plpo AS c
ON bplnty = cplnty AND
bplnnr = cplnnr AND
bzaehl = czaehl
INNER JOIN crhd AS e
ON carbid = eobjid
WHERE b~plnty = v_plnty AND
b~plnnr = lt_pp04_cache-plnnr AND
b~plnal = lt_pp04_cache-alnag AND
c~loekz = space AND
c~steus = v_plpo_steus AND
e~objty = v_objty AND
e~werks = lt_pp04_cache-werks AND
e~verwe = v_verwe.
SORT lt_plpo BY vornr DESCENDING.
READ TABLE lt_plpo INDEX 1.
IF NOT lt_plpo-arbpl IS INITIAL.
lt_pp04_cache-arbpl = lt_plpo-arbpl.
read work center description
SELECT SINGLE ktext INTO lt_pp04_cache-ktext
FROM crtx WHERE objty = lt_plpo-objty AND
objid = lt_plpo-objid AND
spras = sy-langu.
the following read will get the index of the correct record to be
updated in the cache
READ TABLE lt_pp04_cache
WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
MODIFY lt_pp04_cache
INDEX sy-tabix
TRANSPORTING arbpl ktext.
ENDIF.
ENDIF.
endform. " read_last_pp04_operation_cache
*& Form read_wc_on_last_pp04
form read_wc_on_last_pp04 using pi_plnnr
pi_plnal
changing pe_arbpl.
data: begin of lt_plpo occurs 0,
vornr like plpo-vornr,
objty like crhd-objty,
objid like crhd-objid,
arbpl like crhd-arbpl,
end of lt_plpo.
get all the PP04 operations for the given rtg# & grp-ctr#
select vornr eobjty eobjid e~arbpl
into corresponding fields of table lt_plpo
from plas as b
inner join plpo as c
on bplnty = cplnty and
bplnnr = cplnnr and
bzaehl = czaehl
inner join crhd as e
on carbid = eobjid
where b~plnty = v_plnty and "Rate Routing
b~plnnr = pi_plnnr and
b~plnal = pi_plnal and
c~loekz = space and "Oper Del Flag = OFF
c~steus = v_plpo_steus and "PP04
e~objty = v_objty. "WC Obj Type = 'A'
read the last operation
sort lt_plpo by vornr descending.
read table lt_plpo index 1.
pe_arbpl = lt_plpo-arbpl.
endform. " read_wc_on_last_pp04
Goto LSMW-> Select Direct Input method in 1st step. These are the standard programs for data transfer.
Otherwise goto SPRO->SAP Reference IMG-> Under this you'll find standard data transfer programs module wise.
Reward points,
Shakir
Maybe you are looking for
-
Data is not updated to Infocube (BI 7.0) when i load from flat file
Hi Experts, when I try to load data from flat file to Infocube (BI 7.0) with full or Delta, I am gettin following errors. 1) Error while updating to data target, message No: RSBK241 2) Processed with Errors, Message No: RSBK 257. Til
-
I am unable to login to the 11g EM website on Windows x64 2003 server. I get the below error: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; WOW64; Trident/4.0) Timestamp: Wed, 6 Oct 2010 10:41:18 UTC Message: Ob
-
Hi Expertise, I need to create a mass upload program for appraisal document creation for manager and his multiple employee at a time using tcode appcreate. Please help me out. Best regards, Priyaranjan
-
HOW DO I GO BACK TO TIGER ?
HI, I WISH TO GO BACK TO TIGER SINCE LEOPARD FEELS MORE LIKE A LEPER . I HAVE A IMAC INTEL CORE 2 . SPENT 129 $ FOR THAT BIG CAT BUT LOTS OF PROBLEMS SINCE INSTALL. DO I JUST PUT THE TIGER CD IN AND LEOPARD WILL RUN AWAY? PS. is that ok a
-
How do i get my Iphone 5 to turn back on from the flashing apple logo?
I kist [icked it up and the screen was black so i put it on the charger and now its a flashing apple logo and i cannot get it to do anything else.