How to transfer from key figure model into account model?
Hello,buddies:
If I have a datasource wich upload from FLAT FILE contains only key figures and I know every key figure's meaning,then I want to transfer it into account model.
For example,I have data like this
training fee salary compensation
20000 5000 5678
then I want to transfer this to:
training fee 20000
salary 5000
comp 5678
because the source contains no cost element,and the target contain elements.
How can I do this?
Hi Martin,
You can use result table functinality in routines of update rules.
Assuming 0COSTELMNT and 0AMOUNT are the target fields
in your cube, value1, value2, value3 represent fields
form flat file/commstructure code for 0AMOUNT could be like this :
RESULT_TABLE-Amount = COMM_STRUCTURE-Value1.
RESULT_TABLE-COSTELMNT = 'training fee'.
append RESULT_TABLE.
RESULT_TABLE-Amount = COMM_STRUCTURE-Value2.
RESULT_TABLE-COSTELMNT = 'salary'.
append RESULT_TABLE.
RESULT_TABLE-Amount = COMM_STRUCTURE-Value3.
RESULT_TABLE-COSTELMNT = 'comp'.
append RESULT_TABLE.
So you generate 3 records for Infoprovider from one out of commstructure.
Regards
Joe
Similar Messages
-
Convert key figure model into account model
Hi experts,
I'm trying to extract data from table GLPCP, which is based on the account model, i.e. every month in the table is represented by a column:
PC - ACC - AMTJAN - AMTFEB - AMTMAR etc
123 1000 100 120 110
Whereas in BW the data should look like this (key figure model):
PC - ACC - PER - AMT
123 1000 01 100
123 1000 02 120
123 1000 03 110
What would be the most elegant way to do this?
I think I would have to do the conversion in the Start Routine of the Transfer Rules?
As I'm a hopeless case when it comes to ABAP, any code examples would be highly appreciated!
Thanks in advance.
GerritHi Martin,
You can use result table functinality in routines of update rules.
Assuming 0COSTELMNT and 0AMOUNT are the target fields
in your cube, value1, value2, value3 represent fields
form flat file/commstructure code for 0AMOUNT could be like this :
RESULT_TABLE-Amount = COMM_STRUCTURE-Value1.
RESULT_TABLE-COSTELMNT = 'training fee'.
append RESULT_TABLE.
RESULT_TABLE-Amount = COMM_STRUCTURE-Value2.
RESULT_TABLE-COSTELMNT = 'salary'.
append RESULT_TABLE.
RESULT_TABLE-Amount = COMM_STRUCTURE-Value3.
RESULT_TABLE-COSTELMNT = 'comp'.
append RESULT_TABLE.
So you generate 3 records for Infoprovider from one out of commstructure.
Regards
Joe -
SAP Note 0407563: Key Figure Model versus Account Model in BW
I am reviewing a document on Key Figure Model versus Account Model in BW.
There are a number of references to "SAP Note 0407563", can anyone with access to this note post it here for me to review. Sometimes some otf there links prompt for password.
Thanks in advance.Hi,
<b>SAP Note 0407563</b>
Symptom
You would like to design a data model for SEM-BPS and you are not sure, whether to use the key figure or the account model.
You are looking for proposals for data modelling.
Additional key words
bps0, key figure, characteristic, model, data modelling, consultation
Cause and prerequisites
In the following you find a simple example by means of which the terms key figure and account model are defined.
In the example we want to assign several key figures (for example revenues) to a characteristic (for example customer), whose units (for example currency DM) are identical.A modeling option, which is called key figure model, contains all key figures in one data record.
Customer Revenue_1 Revenue_2 Revenue_3
A 10 DM 30 DM 50 DM
In the account model, on the other hand, an additional characteristic is added, which separates the revenue types.
Customer Type Revenue
A 1 10 DM
A 2 30 DM
A 3 50 DM
Advantages and disadvantages from the point of view of data modelling
You can easily add an additional revenue type in the account model, because you do not have to change the data structure.In the key figure model, on the other hand, you must add an additional key figure to the structure.It actually depends on the frequency of these changes occurring.
A data record that is to be changed by a processor, is exclusively locked by SEM-BPS for this processor.A lock that only concerns individual key figures of a data record is not possible.As a consequence the different revenue types can be changed simultaneously by different processors in the account model, wheras in the key figure model one processor automatically locks all key figures exclusively for his own use.
If you use a planning function in the account or key figure model, a different Customizing is required in general. Consequently, a conversion of the data model leads to a change of Customizing in general.
Advantages and disadvantages from the technical point of view
The transaction data is stored in the BW.Analyses have shown that the read time basically depends on the number and not on the size of the data records.In the above example you can see that by changing the key figure and account model the number of records increases by factor 3, which means that you must expect longer read times.When determining the factor you must take into account that normally not all key figures are used in every record in the key figure model.As a consequence only those records are created when changing to the account model, for which the key figures are not equal to zero.
Example:
So if in the above example the key figure Revenue_1 is not used, only two records are generated and consequently the value of the factor is also reduced to 2.
After the transaction data has been read from the BW, it is stored in the application server's memory.The amount of memory required depends, among other things, on the number and on the length of the records.The length can be influenced by the data model you choose:in the key figure model the records are longer than in the account model and therefore consume more memory for each record. Therefore, the key figure or account model will require less memory depending on the relationship between record length and number of records.
When the data model is changed, also the planning functions must be revised.Depending on the type of calculation there might be advantages for one of the models.
Example and rules of thumb
The following example contains 30 key figures, which were mapped to 3 key figures and one additional characteristic with a maximum of 10 characteristic values when you changed to the account model.In both models a price calculation between three key figures each was executed.Consider the specifications in the table as relative specifications:For the number of data records you for example find a and a*10.This means that in the second case the number of data records is larger by factor 10 than in the first case.The determination of the relationships is based on 5000 data records in the key figure model.
Example: all key figures are used (100%)
measured size : Key figure model, Account model
Number data records: a , a*10
Read time : l , l*10
Price calculation: t , t*9
Data record length: d*4 , d
Memory requirement : m , m*3
Example: Key figures are partially used (20%)
measured size : Key figure model ,Account model
Number data records : a , a*2
Read time : l , l*2
Price calculation : t , t*2
Data record length : d*4 , d
Memory requirement : m , m*0,8
How are the sizes determined?
Read the related notes for details on the use of the statistics.
1. a: In the statistics of SEM-BPS or BW this value is stored when you execute a planning function. The method has the name 0-DB1.
2. l: The above statistical record also contains the execution time.
3. t: In the statistics of SEM-BPS a record is stored for the planning function.The overall runtime of the planning function contains the database time. Therefore the database time must be subtracted from the runtime of the planning function to determine t.
4. d: The data record length corresponds to the data structure length (ABAP length), which is generated for every area.The name is made up as follows:
Prefix: /1SEM/_YS_DATA_
Client: mmm
Name of the area: gggggggg
The client must always be specified with three digits, the area only in its actual length.The name for an area called 'MYAREA' which is in client 001 is for example /1SEM/_YS_DATA_001MYAREA.When you determine the length, note that there is the dictionary and the ABAP length (Transaction SE11 => Extras => Structure width => ABAP length) and that the total of the two structures contained must be determined.In the structure stated above, for example /1SEM/_YS_CHAS_001MYAREA and /1SEM/_YS_KYFS_001MYAREA are contained.The total is the length you are looking for.
5. m: After executing the planning function, start Transaction STAD and find the appropriate statistical record for the dialog step, in which you have executed the planning function.The record contains a memory specification, which is the desired value for s.
Solution
Bear in mind that the values from the example are not generally valid, but were determined from a specific example.We recommend that you determine the parameters (both the values of the variables and of the relationships) for your specific case and to use it as the basis for discussion.You should not choose too few data records, because the fixed memory consumers predominate otherwise.
Regards-
Siddhu
Message was edited by: sidhartha -
How to transfer license key from Windows to Mac for adobe photoshop lightroom 5?
how to transfer license key from Windows to Mac for adobe photoshop lightroom 5?
You can download from this link and validate with your serial number. You can run LR5 on both machines.
http://www.adobe.com/support/downloads/detail.jsp?ftpID=5856 -
Hi friends...
I have a scenerio , where I have loaded the data from 3 different data sources say A , B and C in to 2 different DSO s and in to 2 different Info Cubes. And I have built Multi Provider from this 2 Info cubes.
In the data source B , I have BELNR (Parked document number ).WRBTR (for Amount). In the report I have to show a field called Nr of Documents Parked and Value of Documents Parked. Same thing for Data Source C, for Blocked Documents. Now My question is there is no Key Figure in My Data Model to Count the Nr of Parked / Blocked Docs....So in the Reporting how can I show this ? Do I need to use Customer Exits ? Do I need to have CKF /RKF ? if so , from what Key figures ? or Can I get the Count from the Backend (Modelling itself by using a Keyfigure with any Code)?...not only this 2 , I have lot many custom things to do in my Model...If any one can get me some idea on this , remaining will be very easier for me as they all are similar things to do....
Please let me know if you have any questions or I need to elabarate it more to get an Idea on this....
Thanks in advanceTHANKS GUYS ,
I wrote the transformation routiene to count all the parked documents as
IMPORTING
request type rsrequest
datapackid type rsdatapid
SOURCE_FIELDS-/BIC/ZPARKBEF TYPE /BIC/OIZPARKBEF
EXPORTING
RESULT type tys_TG_1-RSTT_IPTDA
DATA TMP TYPE tys_TG_1-RSTT_IPTDA.
IF SOURCE_FIELDS-/BIC/ZPARKBEF = 'Y'.
TMP = TMP + 1.
ENDIF.
RESULT = TMP .
But when I see the Infocube data its showing only 0 for Parked Before value 'N' and 1 for Parked Before vale 'Y'. But I want to calculate total number of parked documents ..How can I do this?
Thanks -
Computer was stolen--how to transfer from iPod to new computer
My computer was stolen and I want to transfer my iPod library to my new computer. I know how to transfer from one computer to another using an iPod but is there a way to do it when I don't have the computer that has my iTunes library?
There are a number of third party utilities you can use to retrieve the files from your iPod. This is just a selection.
YamiPod
PodUtil
PodPlayer
iPodAgent
There is also a manual method of accessing the iPod's hard drive posted in this thread: iPod to iTunes
If your iPod was set for automatic update change it to manual update. While connecting the iPod to the computer, hold down the Shift + Ctrl keys. This will stop the iPod from auto-syncing with iTunes and the iPod will appear in the source list. Wait until you are sure the iPod has mounted, and that it will not auto sync and then you can let the keys go. This may take between 3 and 30 seconds depending on your computer. Then go to Preferences>iPod and check the "Manually manage songs and playlists" box.
Keep your iPod in manual mode until you have reloaded your iTunes and you are happy with your playlists etc then it will be safe to return it auto-sync again.
Another way is to connect your iPod and before it starts to sync, click the little X on the right hand side of the display beside the "Do Not Disconnect" message. The display is the little window to the right of the iTunes control buttons: iPod Interface
Or you could look at the method described in this link: How to keep iTunes from automatically updating your iPod
Go with whichever method you feel most comfortable. If at any point you are asked if you want to link your iPod to a new library, click No. -
Data transfer from sap r/3 into excel sheet for mi01
hi gurus,
as i am a xi consultant i got requirement to write a program for data transfer from sap r/3 into excel sheet for MI01.can any body help me by giving sample code or example for this requirement.please help me.Hi Rohit,
This is an upload program and it has used both function modules to upload from an excel to R3 and to download from R3 onto excel.
GUI_UPLOAD
GUI_DOWNLOAD
are the function modules used.
Hope this helps,
*Output: Downloads error records onto presentation server,
* Displays report with number of success and error records
REPORT ZMCG047CONTR NO STANDARD PAGE HEADING
LINE-SIZE 255
MESSAGE-ID ZM.
*& Table declarations
TABLES : T001W, "Plants/Branches
T024E, "Purchasing Organizations
T001. "Company Codes
* TYPE-POOLS DECLARATION
TYPE-POOLS : SLIS.
* Types Declaration *
TYPES: BEGIN OF T_RECORD, "record storing contract info
LIFNR(010), "Vendor Number
EVART(004), "Agreement Type
EKORG(004), "Purchasing Organization
EKGRP(003), "Purchasing Group
WERKS(004), "Plant
LGORT(004), "Storage Location
KDATB(010), "Valid start Date
KDATE(010), "Valid End Date
ZTERM(004), "Payment Terms
KTWRT(020), "Target Value
EPSTP(001), "Item Category
EMATN(018), "Material Number
KTMNG(017), "Target Quantity
NETPR(014), "Net Price
PEINH(006), "Net Price Unit
BPRME(003), "Net Price Order Price Unit
IDNLF(035), "Vendor Material number
WEBRE(001), "GR Based-IV
MEPRF(001), "Pricing Date Category
LTEX1(040), "Info Text
DATAB(010), "Valid From
DATBI(010), "Valid To
KSCHL(004), "Condition Type
KBETR(016), "Condition Rate if scale is not given
KONWA(005), "Currency
KPEIN(005), "Condition Pricing Unit
KMEIN(003), "Condition Unit of Measure
KSTBM(019), "Scale
KBETR_01(016), "Scale Rate
DEL_FLAG, "Delete Flag Indicator
ERR_MSG(100), "Error Message
END OF T_RECORD,
BEGIN OF T_ERR_RECORD, "to have error records stored
LIFNR(010), "Vendor Number
EVART(004), "Agreement Type
EKORG(004), "Purchasing Organization
EKGRP(003), "Purchasing Group
WERKS(004), "Plant
LGORT(004), "Storage Location
KDATB(010), "Valid start Date
KDATE(010), "Valid End Date
ZTERM(004), "Payment Terms
KTWRT(020), "Target Value
EPSTP(001), "Item Category
EMATN(018), "Material Number
KTMNG(017), "Target Quantity
NETPR(014), "Net Price
PEINH(006), "Net Price Unit
BPRME(003), "Net Price Order Price Unit
IDNLF(035), "Vendor Material number
WEBRE(001), "GR Based-IV
MEPRF(001), "Pricing Date Category
LTEX1(040), "Info Text
DATAB(010), "Valid From
DATBI(010), "Valid To
KSCHL(004), "Condition Type
KBETR(016), "Condition Rate if scale is not given
KONWA(005), "Currency
KPEIN(005), "Condition Pricing Unit
KMEIN(003), "Condition Unit of Measure
KSTBM(019), "Scale
KBETR_01(016), "Scale Rate
DEL_FLAG, "Delete Flag Indicator
ERR_MSG(100), "Error Message
END OF T_ERR_RECORD,
BEGIN OF T_LOEKZ, "To have deletion indicators for materials
LOEKZ(001), "Deletion indicator in purchasing document
EMATN(018), "Material Number
WERKS(004), "Plant
LGORT(004), "Storage Location
BSTYP(001), "Purchasing document category
END OF T_LOEKZ,
BEGIN OF T_MATNR, " Type definition to store details of materials
MATNR(018), "Material Number
END OF T_MATNR,
BEGIN OF T_T001, " Type definition for company codes
BUKRS(004), " Company Code
END OF T_T001,
BEGIN OF T_ZMVXREF, "Cross-Reference table type
D_ALTKN(10), "Legacy Vendor Number
D_BUKRS(4), "Legacy Company Code
M_ALTKN(10), "SAP Company Code
END OF T_ZMVXREF,
BEGIN OF T_LFA1, "Master data of vendors
LIFNR(10), "Vendor Number
END OF T_LFA1,
* Type Declaration for T024E (Company Codes)
BEGIN OF T_T024E,
EKORG LIKE T024E-EKORG, "Purchasing organization
BUKRS LIKE T024E-BUKRS, "Company Code
END OF T_T024E,
* Type Declaration for t001w (Plant)
BEGIN OF T_T001W,
WERKS LIKE T001W-WERKS, "Plant
END OF T_T001W,
* Type Declatation for String Line
BEGIN OF T_STR1, "#EC NEEDED
SLINE(6000) TYPE C,
END OF T_STR1.
TYPES: BEGIN OF T_BDCDATA. "BDC Data
INCLUDE STRUCTURE BDCDATA.
TYPES: END OF T_BDCDATA.
* Internal Tables Declaration *
DATA:
* Internal table to store input file data
I_RECORD TYPE STANDARD TABLE OF T_RECORD INITIAL SIZE 0,
* Internal table to capture errors
I_ERR_REC TYPE STANDARD TABLE OF T_ERR_RECORD INITIAL SIZE 0,
* Internal table to check for deletion indicators
I_LOEKZ TYPE STANDARD TABLE OF T_LOEKZ INITIAL SIZE 0,
* Internal table to check for material numbers
I_MATNR TYPE STANDARD TABLE OF T_MATNR INITIAL SIZE 0,
* Internal table used for storing Cross-Reference data of Vendor
I_ZMVXREF TYPE STANDARD TABLE OF T_ZMVXREF INITIAL SIZE 0,
* Internal table for holding Vendor Numbers from Master table
I_LFA1 TYPE STANDARD TABLE OF T_LFA1 INITIAL SIZE 0,
* Internal table for holding Purchase Org and Company Codes
I_T024E TYPE STANDARD TABLE OF T_T024E INITIAL SIZE 0,
* Internal table for holding Plants
I_T001W TYPE STANDARD TABLE OF T_T001W INITIAL SIZE 0,
* Internal table for storing a list of Company Codes
I_T001 TYPE STANDARD TABLE OF T_T001 INITIAL SIZE 0,
* Internal table used for ALV Reporting
I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
* Internal table used for holding List Header
I_LISTHEADER TYPE SLIS_T_LISTHEADER, "EC NEEDED
* Internal table to hold ALV Event
I_ALV_EVENT TYPE SLIS_T_EVENT,
* Internal table to hold Sort Info for ALV Report
I_SORT TYPE SLIS_T_SORTINFO_ALV,
* Internal table for BDC Data
I_BDCDATA TYPE STANDARD TABLE OF T_BDCDATA INITIAL SIZE 0,
* Internal table for messages
I_MESSTAB TYPE TABLE OF BDCMSGCOLL,
* Internal table for String line
I_STR1 TYPE STANDARD TABLE OF T_STR1 INITIAL SIZE 0.
* Work Area Declaration *
DATA:
* Work Area to hold data for the Open Contract
WA_RECORD TYPE T_RECORD,
* Work Area to hold previous record data
WA_RECORDPREV TYPE T_RECORD,
* Work Area to hold errors
WA_ERR_REC TYPE T_ERR_RECORD,
* Work Area to hold the Deletion Indicator of materials
WA_LOEKZ TYPE T_LOEKZ,
* Work Area to hold Material numbers of required materials
WA_MATNR TYPE T_MATNR, "EC NEEDED
* Work Area to hold errors occured while performing BDC
WA_MESSTAB TYPE BDCMSGCOLL,
* Work Area to hold field catalog for ALV Reports
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
* Work Area to hold list header data for ALV reports
WA_LISTHEADER TYPE SLIS_LISTHEADER,
* Work Area to hold ALV Event
WA_ALV_EVENT LIKE LINE OF I_ALV_EVENT, "EC NEEDED
* Work Area to hold Layout of ALV Report
WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
* Work Area to hold Cross-Reference data of Vendor
WA_ZMVXREF TYPE T_ZMVXREF,
* Work Area to hold Vendor Numbers from Master table
WA_LFA1 TYPE T_LFA1, "EC NEEDED
* Work Area to hold Purchase Org and Company Codes
WA_T024E TYPE T_T024E,
* Work Area to hold Company Codes
WA_T001 TYPE T_T001,
* Work Area to hold Plants
WA_T001W TYPE T_T001W,
* Work Area to hold Sort Info for ALV Report
WA_SORT TYPE SLIS_SORTINFO_ALV,
* Work Area to hold BDC Data
WA_BDCDATA TYPE T_BDCDATA,
* Work Area for String line
WA_STR1 TYPE T_STR1.
* Variables Declaration *
DATA: V_ERRMSG(500), "To temporarily store the error message
V_CONV_DATE(10) TYPE C, "To capture the converted date format
V_DATE LIKE SY-DATUM,
V_REPID LIKE SY-REPID, "holds report id
V_CROSS_REFERENCE_ERROR TYPE I, " cross-reference error
V_INPUTERROR_FLAG VALUE '', " input error status
V_FILENAME TYPE STRING, " File Name
VEN_FLAG(1), " at new status
MAT_FLAG(1), " at new status
V_IND(2) TYPE N, " index of table control
V_IND2(2) TYPE N, " index of table control
V_IND3(2) TYPE N, " index of table control
V_EVRTP1(20),
V_EPSTP1(20),
V_EMATN1(20),
V_KTMNG1(20),
V_NETPR1(20),
V_PEINH1(20),
V_BPRME1(20),
V_TCSELFLAG1(20),
V_KSCHL2(20),
V_KBETR2(20),
V_KONWA2(20),
V_KPEIN2(20),
V_KMEIN2(20),
V_SELKZ2(20),
V_KBETR3(20),
V_KSTBM3(20),
V_LINE TYPE I,
V_STR TYPE X VALUE '09',
V_EXIST TYPE C,
V_EXIST1 TYPE C,
V_ISDIR TYPE C,
V_ISDIR1 TYPE C.
* Constants Declaration *
CONSTANTS: C_TCODE(5) VALUE 'ME31K', "Trx code - Open Contract Creation
C_TRUE VALUE 'X', " Del_Flag indicator
C_LOEKZ_MARKED VALUE 'X', "Deletion indicator for material
C_INPUTERROR_FLAG_YES VALUE 'X', "Input File Indicator
C_VEN_ERR1 VALUE 1, "Error Indicator
C_16(2) VALUE '16',
C_VEN_ERR2 VALUE 2, "Error Indicator
C_VEN_ERR3 VALUE 3, "Error Indicator
C_VEN_SUCS VALUE 0, "Success Indicator
C_SUCCESS LIKE SY-SUBRC VALUE '0',
C_STRUE VALUE 'S', "Del_flag for SAP Errors
C_YTRUE VALUE 'Y', "Del_flag for Success Records
C_MSGTYP_E VALUE 'E', "holds error message type
C_MSGTYP_S VALUE 'S', "holds success message type
C_BSTYP VALUE 'K', "Purchasing Document type is Contract
C_BACKGROUND VALUE 'N', "Background mode
C_FOREGROUND VALUE 'A', "All Screen mode
C_ERRORS VALUE 'E', "Error screen mode
C_WK(2) VALUE 'WK'. "Value Contract
* Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-033.
SELECTION-SCREEN SKIP.
SELECT-OPTIONS:
* Plant
S_WERKS FOR T001W-WERKS OBLIGATORY,
* Purchase Organization
S_EKORG FOR T024E-EKORG OBLIGATORY.
* Company Code
PARAMETER P_BUKRS LIKE T001-BUKRS OBLIGATORY.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN ULINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 3.
PARAMETER RB_SERVE RADIOBUTTON GROUP RBX DEFAULT 'X' USER-COMMAND U1.
SELECTION-SCREEN COMMENT 6(19) TEXT-036.
SELECTION-SCREEN POSITION 37.
PARAMETER RB_LOCAL RADIOBUTTON GROUP RBX.
SELECTION-SCREEN COMMENT 40(13) TEXT-035.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
PARAMETERS:
* Parameter holding Input File name
P_FILE LIKE RLGRAP-FILENAME
OBLIGATORY
LOWER CASE
DEFAULT 'C:\'
MODIF ID G1,
P_FILE1 LIKE RLGRAP-FILENAME
OBLIGATORY
LOWER CASE
DEFAULT '/celestica/interface/corp/in/work/'
MODIF ID G2,
* Parameter specifying Mode of calling the Transaction.
P_MODE DEFAULT 'N' OBLIGATORY,
* Check box used to test the input file.
P_TEST AS CHECKBOX DEFAULT 'X',
* Parameter holding Filename for holding Input File Errors
P_IPERR LIKE RLGRAP-FILENAME
OBLIGATORY
LOWER CASE
DEFAULT 'C:\'
MODIF ID G1,
P_IPERR1 LIKE RLGRAP-FILENAME
OBLIGATORY
LOWER CASE
DEFAULT '/celestica/interface/corp/in/work/047_Err.txt'
MODIF ID G2.
SELECTION-SCREEN END OF BLOCK B2.
* AT Selection Screen Events *
* Loop the screen to activate relative paths
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF RB_SERVE = C_TRUE AND SCREEN-GROUP1 = 'G1'.
SCREEN-OUTPUT = 0.
SCREEN-ACTIVE = 0.
SCREEN-INPUT = 0.
ELSEIF RB_LOCAL = C_TRUE AND SCREEN-GROUP1 = 'G2'.
SCREEN-OUTPUT = 0.
SCREEN-ACTIVE = 0.
SCREEN-INPUT = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
AT SELECTION-SCREEN ON BLOCK B2.
* Checking Access Authorization for the user
CALL FUNCTION 'ZU_DATA_ACCESS_AUTH_CHECK'
EXPORTING
ACTVT = C_16
P_BUKRS = P_BUKRS
TABLES
S_WERKS = S_WERKS
S_EKORG = S_EKORG
EXCEPTIONS
BUKRS_FAILED = 1
VKORG_FAILED = 2
VTWEG_FAILED = 3
EKORG_FAILED = 4
WERKS_FAILED = 5
LGNUM_FAILED = 6
OTHERS = 7.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
AT SELECTION-SCREEN ON P_BUKRS.
IF NOT P_BUKRS IS INITIAL.
SELECT SINGLE BUKRS INTO T001
FROM T001
WHERE BUKRS EQ P_BUKRS.
IF SY-SUBRC NE 0.
MESSAGE I000 WITH TEXT-089.
STOP.
ENDIF.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
* Search Help to select Input File path.
PERFORM GET_FILE_NAME USING P_FILE.
* Check for the existence of the file.
IF RB_LOCAL EQ C_TRUE.
CALL FUNCTION 'TMP_GUI_GET_FILE_EXIST'
EXPORTING
FNAME = P_FILE
IMPORTING
EXIST = V_EXIST
ISDIR = V_ISDIR
EXCEPTIONS
FILEINFO_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF V_ISDIR IS INITIAL.
IF V_EXIST IS INITIAL.
MESSAGE I000 WITH TEXT-018.
STOP.
ENDIF.
ELSEIF V_ISDIR EQ C_TRUE.
MESSAGE I000 WITH TEXT-068.
STOP.
ENDIF.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_IPERR.
* Search Help to select Input Error File path.
PERFORM GET_FILE_NAME USING P_IPERR.
AT SELECTION-SCREEN.
* Validate Transaction Mode
IF P_MODE <> C_BACKGROUND AND
P_MODE <> C_FOREGROUND AND
P_MODE <> C_ERRORS.
MESSAGE I000 WITH TEXT-034.
STOP.
ENDIF.
START-OF-SELECTION.
* Get the Input File Data
V_FILENAME = P_FILE.
PERFORM UPLOAD_FLATFILE_DATA TABLES I_RECORD
USING V_FILENAME.
* Sorting the data by all fields
SORT I_RECORD.
* Ensuring the padding of the empty spaces before the vendor No
CLEAR WA_RECORD.
LOOP AT I_RECORD INTO WA_RECORD.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = WA_RECORD-LIFNR
IMPORTING
OUTPUT = WA_RECORD-LIFNR.
MODIFY I_RECORD FROM WA_RECORD
INDEX SY-TABIX
TRANSPORTING LIFNR.
CLEAR WA_RECORD.
ENDLOOP.
* Input file validation
PERFORM VALIDATE_FLATFILE_DATA.
IF P_TEST = C_TRUE.
IF I_ERR_REC[] IS INITIAL.
MESSAGE I000 WITH TEXT-032.
STOP.
ELSE.
* Display all the error records at the input level.
PERFORM DISPLAY_INPERR_RECORDS.
* Download Error File
PERFORM DOWNLOAD_ERROR_FILE.
ENDIF.
ELSE.
* Build BDC Data
PERFORM BUILD_BDC_DATA.
* Download Error File
PERFORM DOWNLOAD_ERROR_FILE.
* Display the status report.
PERFORM DISPLAY_PROCESSED_RECORDS.
ENDIF.
END-OF-SELECTION.
REFRESH: I_RECORD,
I_ERR_REC,
I_LOEKZ,
I_MATNR,
I_ZMVXREF,
I_LFA1,
I_T024E,
I_FIELDCAT,
I_LISTHEADER,
I_ALV_EVENT,
I_SORT,
I_BDCDATA,
I_MESSTAB,
I_STR1.
FREE: I_RECORD,
I_ERR_REC,
I_LOEKZ,
I_MATNR,
I_ZMVXREF,
I_LFA1,
I_T024E,
I_FIELDCAT,
I_LISTHEADER,
I_ALV_EVENT,
I_SORT,
I_BDCDATA,
I_MESSTAB,
I_STR1.
*& Form GET_file_name
* Fetches the file and path from the presentation system
* --> p1 Path along with the file name
FORM GET_FILE_NAME USING L_FILE LIKE RLGRAP-FILENAME.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
MASK = ',*.TXT,*.txt.'
MODE = 'O'
TITLE = TEXT-011
IMPORTING
FILENAME = L_FILE
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
CASE SY-SUBRC.
WHEN 1.
MESSAGE I000 WITH TEXT-084.
STOP.
WHEN 2.
MESSAGE I000 WITH TEXT-085.
STOP.
WHEN 3.
MESSAGE I000 WITH TEXT-086.
STOP.
WHEN 4.
MESSAGE I000 WITH TEXT-087.
STOP.
ENDCASE.
ENDFORM. " GET_file_name
*& Form upload_flatfile_data
* Uploading data from Flat File
FORM UPLOAD_FLATFILE_DATA
TABLES I_L_RECORD STRUCTURE WA_RECORD
USING L_FILENAME TYPE STRING.
DATA WA_L_RECORD TYPE T_RECORD.
* Upload the Flat file data
IF RB_LOCAL EQ C_TRUE. "File is on the Local System
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = L_FILENAME
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = I_L_RECORD
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17.
CASE SY-SUBRC.
WHEN 0.
DESCRIBE TABLE I_L_RECORD LINES V_LINE.
IF V_LINE EQ 0.
MESSAGE I000 WITH TEXT-065.
STOP.
ENDIF.
WHEN 1.
MESSAGE I000 WITH TEXT-068.
STOP.
WHEN 2.
MESSAGE I000 WITH TEXT-069.
STOP.
WHEN 3.
MESSAGE I000 WITH TEXT-070.
STOP.
WHEN 4.
MESSAGE I000 WITH TEXT-071.
STOP.
WHEN 5.
MESSAGE I000 WITH TEXT-072.
STOP.
WHEN 6.
MESSAGE I000 WITH TEXT-073.
STOP.
WHEN 7.
MESSAGE I000 WITH TEXT-074.
STOP.
WHEN 8.
MESSAGE I000 WITH TEXT-075.
STOP.
WHEN 9.
MESSAGE I000 WITH TEXT-076.
STOP.
WHEN 10.
MESSAGE I000 WITH TEXT-077.
STOP.
WHEN 11.
MESSAGE I000 WITH TEXT-078.
STOP.
WHEN 12.
MESSAGE I000 WITH TEXT-079.
STOP.
WHEN 13.
MESSAGE I000 WITH TEXT-080.
STOP.
WHEN 14.
MESSAGE I000 WITH TEXT-081.
STOP.
WHEN 15.
MESSAGE I000 WITH TEXT-082.
STOP.
WHEN 16.
MESSAGE I000 WITH TEXT-083.
STOP.
ENDCASE.
CLEAR V_LINE.
ELSEIF RB_SERVE EQ C_TRUE. "File is on the Application Server
P_MODE = C_BACKGROUND.
OPEN DATASET P_FILE1 FOR INPUT IN TEXT MODE.
CHECK SY-SUBRC EQ C_SUCCESS.
CLEAR WA_STR1.
DO.
READ DATASET P_FILE1 INTO WA_STR1.
IF SY-SUBRC <> 0. " NE SUCCESS.
EXIT.
ELSEIF SY-SUBRC EQ C_SUCCESS.
APPEND WA_STR1 TO I_STR1.
CLEAR WA_STR1.
ENDIF. " ENDIF on SY-SUBRC 0 Check.
ENDDO. " ENDDO
DELETE I_STR1 WHERE SLINE EQ ' '.
DESCRIBE TABLE I_STR1 LINES V_LINE.
IF V_LINE EQ 0.
MESSAGE S000 WITH TEXT-065.
STOP.
ENDIF.
LOOP AT I_STR1 INTO WA_STR1.
CLEAR: WA_L_RECORD.
SPLIT WA_STR1-SLINE AT V_STR
INTO WA_L_RECORD-LIFNR
WA_L_RECORD-EVART
WA_L_RECORD-EKORG
WA_L_RECORD-EKGRP
WA_L_RECORD-WERKS
WA_L_RECORD-LGORT
WA_L_RECORD-KDATB
WA_L_RECORD-KDATE
WA_L_RECORD-ZTERM
WA_L_RECORD-KTWRT
WA_L_RECORD-EPSTP
WA_L_RECORD-EMATN
WA_L_RECORD-KTMNG
WA_L_RECORD-NETPR
WA_L_RECORD-PEINH
WA_L_RECORD-BPRME
WA_L_RECORD-IDNLF
WA_L_RECORD-WEBRE
WA_L_RECORD-MEPRF
WA_L_RECORD-LTEX1
WA_L_RECORD-DATAB
WA_L_RECORD-DATBI
WA_L_RECORD-KSCHL
WA_L_RECORD-KBETR
WA_L_RECORD-KONWA
WA_L_RECORD-KPEIN
WA_L_RECORD-KMEIN
WA_L_RECORD-KSTBM
WA_L_RECORD-KBETR_01
WA_L_RECORD-DEL_FLAG
WA_L_RECORD-ERR_MSG.
APPEND WA_L_RECORD TO I_L_RECORD.
CLEAR: WA_L_RECORD,
WA_STR1.
ENDLOOP.
REFRESH I_STR1.
CLOSE DATASET P_FILE1.
ENDIF.
ENDFORM.
*& Form BDC_DYNPRO
* Data populated into i_bdcdata table for program
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = PROGRAM.
WA_BDCDATA-DYNPRO = DYNPRO.
WA_BDCDATA-DYNBEGIN = C_TRUE.
APPEND WA_BDCDATA TO I_BDCDATA.
ENDFORM.
*& Form BDC_FIELD
* Data populated into i_bdcdata table for fields
FORM BDC_FIELD USING FNAM FVAL.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = FNAM.
WA_BDCDATA-FVAL = FVAL.
APPEND WA_BDCDATA TO I_BDCDATA.
ENDFORM.
*& Form convert_date
* Converting the data from the file format to mm/dd/yyyy format
* <--P_wa_record_kdatb Source Date
* <--p_l_conv_date Target Date
FORM CONVERT_DATE USING L_DATE
L_TAR_DATE.
CONCATENATE L_DATE+0(2)
L_DATE+3(2)
L_DATE+6(4)
INTO L_TAR_DATE.
ENDFORM. " convert_date
*& Form validate_flatfile_data
* Validating the input file
FORM VALIDATE_FLATFILE_DATA.
DATA: L_TODAY LIKE SY-DATUM,
L_STARTDATE_C LIKE SY-DATUM,
L_ENDDATE_C LIKE SY-DATUM,
L_ENDDATE_C1 LIKE SY-DATUM,
L_STARTDATE_C1 LIKE SY-DATUM,
L_STARTDATE(8),
L_ENDDATE(8).
* Fetch indicator for all records on the material, plant & storage
* location combination.
IF NOT I_RECORD[] IS INITIAL.
REFRESH I_LOEKZ.
SELECT EMATN " Material Number
WERKS " Plant
LGORT " Storage Location
BSTYP " Purchasing Document Category
LOEKZ " Deletion indicator
INTO TABLE I_LOEKZ
FROM EKPO
FOR ALL ENTRIES IN I_RECORD
WHERE EMATN = I_RECORD-EMATN
AND WERKS = I_RECORD-WERKS
AND LGORT = I_RECORD-LGORT
AND BSTYP = C_BSTYP
AND LOEKZ = C_LOEKZ_MARKED.
IF SY-SUBRC EQ 0.
SORT I_LOEKZ BY EMATN WERKS LGORT BSTYP LOEKZ.
ENDIF.
* Fetching Plants for all entries in the selection screen
REFRESH I_T001W.
SELECT WERKS "Plant
INTO TABLE I_T001W
FROM T001W
WHERE WERKS IN S_WERKS.
IF SY-SUBRC EQ 0.
SORT I_T001W BY WERKS.
ENDIF.
* Fetching materials for the plants listed in flat file
REFRESH I_MATNR.
SELECT MATNR " Material Number
INTO TABLE I_MATNR
FROM MARC
FOR ALL ENTRIES IN I_RECORD
WHERE WERKS = I_RECORD-WERKS.
IF SY-SUBRC EQ 0.
SORT I_MATNR BY MATNR.
ENDIF.
* Fetching Company Codes for repective Purchase Organizations
REFRESH I_T024E.
SELECT EKORG " Purchase Organization
BUKRS " Company Code
INTO TABLE I_T024E
FROM T024E
WHERE EKORG IN S_EKORG.
IF SY-SUBRC EQ 0.
SORT I_T024E BY EKORG.
ENDIF.
* Fetching SAP Data using Legacy Data.
REFRESH I_ZMVXREF.
SELECT D_ALTKN
D_BUKRS
M_ALTKN
INTO TABLE I_ZMVXREF
FROM ZMVXREF
FOR ALL ENTRIES IN I_RECORD
WHERE D_ALTKN = I_RECORD-LIFNR.
IF SY-SUBRC EQ 0.
SORT I_ZMVXREF BY D_ALTKN D_BUKRS.
ENDIF.
* Fetching Vendors from LFA1
IF NOT I_ZMVXREF[] IS INITIAL.
REFRESH I_LFA1.
SELECT LIFNR
INTO TABLE I_LFA1
FROM LFA1
FOR ALL ENTRIES IN I_ZMVXREF
WHERE LIFNR = I_ZMVXREF-M_ALTKN.
IF SY-SUBRC EQ 0.
SORT I_LFA1 BY LIFNR.
ENDIF.
ENDIF.
* Start Validating the flat file
CLEAR: WA_RECORD,
WA_T024E,
WA_ZMVXREF,
WA_LFA1,
WA_LOEKZ,
WA_MATNR.
LOOP AT I_RECORD INTO WA_RECORD.
L_TODAY = SY-DATUM.
L_STARTDATE = WA_RECORD-KDATB.
L_ENDDATE = WA_RECORD-KDATE.
IF WA_RECORD-DEL_FLAG IS INITIAL.
READ TABLE I_T001W INTO WA_T001W
WITH KEY WERKS = WA_RECORD-WERKS
BINARY SEARCH.
IF SY-SUBRC EQ 0.
* Cross-Reference check performed for the given Vendors
READ TABLE I_T024E INTO WA_T024E
WITH KEY EKORG = WA_RECORD-EKORG
BINARY SEARCH.
IF SY-SUBRC NE 0.
V_CROSS_REFERENCE_ERROR = C_VEN_ERR3.
ELSE.
READ TABLE I_ZMVXREF INTO WA_ZMVXREF
WITH KEY D_ALTKN = WA_RECORD-LIFNR
D_BUKRS = P_BUKRS
BINARY SEARCH.
IF SY-SUBRC EQ 0.
READ TABLE I_LFA1 INTO WA_LFA1
WITH KEY LIFNR = WA_ZMVXREF-M_ALTKN
BINARY SEARCH.
IF SY-SUBRC EQ 0.
V_CROSS_REFERENCE_ERROR = C_VEN_SUCS.
ELSE.
V_CROSS_REFERENCE_ERROR = C_VEN_ERR2.
ENDIF.
ELSE.
V_CROSS_REFERENCE_ERROR = C_VEN_ERR1.
ENDIF.
ENDIF.
* Legacy Vendor could not be mapped
IF V_CROSS_REFERENCE_ERROR EQ C_VEN_ERR1.
V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES. "Inp.file err. occurd
WA_RECORD-DEL_FLAG = C_TRUE.
WA_RECORD-ERR_MSG = TEXT-007.
MODIFY I_RECORD FROM WA_RECORD
TRANSPORTING DEL_FLAG
ERR_MSG
WHERE LIFNR = WA_RECORD-LIFNR.
* Legacy Vendor is mapped but the obtained SAP vendor doesn't exist.
ELSEIF V_CROSS_REFERENCE_ERROR EQ C_VEN_ERR2.
* Inp.file err. occurd
V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
WA_RECORD-DEL_FLAG = C_TRUE.
WA_RECORD-ERR_MSG = TEXT-008.
MODIFY I_RECORD FROM WA_RECORD
TRANSPORTING DEL_FLAG
ERR_MSG
WHERE LIFNR = WA_RECORD-LIFNR.
* Purchase Organization doesn't exist in T024E.
ELSEIF V_CROSS_REFERENCE_ERROR EQ C_VEN_ERR3.
* Inp.file err. occurd
V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
WA_RECORD-DEL_FLAG = C_TRUE.
WA_RECORD-ERR_MSG = TEXT-014.
MODIFY I_RECORD FROM WA_RECORD
TRANSPORTING DEL_FLAG
ERR_MSG
WHERE EKORG = WA_RECORD-EKORG.
* Vendor is mapped and validated successfully
ELSEIF V_CROSS_REFERENCE_ERROR EQ C_VEN_SUCS.
* Checking for the deletion indicator for that record
CONCATENATE WA_RECORD-KDATB+6(4)
WA_RECORD-KDATB+3(2)
WA_RECORD-KDATB+0(2)
INTO
L_STARTDATE.
MOVE L_STARTDATE TO L_STARTDATE_C.
CONCATENATE WA_RECORD-KDATB+6(4)
WA_RECORD-KDATB+0(2)
WA_RECORD-KDATB+3(2)
INTO
L_STARTDATE_C1.
CONCATENATE WA_RECORD-KDATE+6(4)
WA_RECORD-KDATE+3(2)
WA_RECORD-KDATE+0(2)
INTO
L_ENDDATE.
MOVE L_ENDDATE TO L_ENDDATE_C.
CONCATENATE WA_RECORD-KDATE+6(4)
WA_RECORD-KDATE+0(2)
WA_RECORD-KDATE+3(2)
INTO
L_ENDDATE_C1.
READ TABLE I_LOEKZ INTO WA_LOEKZ WITH KEY
EMATN = WA_RECORD-EMATN
WERKS = WA_RECORD-WERKS
LGORT = WA_RECORD-LGORT
BINARY SEARCH.
IF SY-SUBRC EQ 0.
* Inpfle err.occured
V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
WA_RECORD-ERR_MSG = TEXT-003.
WA_RECORD-DEL_FLAG = C_TRUE. "marking the record
MODIFY I_RECORD FROM WA_RECORD
TRANSPORTING DEL_FLAG
ERR_MSG
WHERE LIFNR = WA_RECORD-LIFNR
AND EVART = WA_RECORD-EVART
AND EKORG = WA_RECORD-EKORG
AND EKGRP = WA_RECORD-EKGRP
AND WERKS = WA_RECORD-WERKS
AND LGORT = WA_RECORD-LGORT
AND KDATB = WA_RECORD-KDATB
AND KDATE = WA_RECORD-KDATE
AND ZTERM = WA_RECORD-ZTERM
AND KTWRT = WA_RECORD-KTWRT
AND EPSTP = WA_RECORD-EPSTP
AND EMATN = WA_RECORD-EMATN.
* Validating the Purchasing Organization for Blank/Null
ELSEIF WA_RECORD-EKORG IS INITIAL.
* Inpfle err.occured
V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
WA_RECORD-ERR_MSG = TEXT-010.
WA_RECORD-DEL_FLAG = C_TRUE.
MODIFY I_RECORD FROM WA_RECORD
TRANSPORTING DEL_FLAG
ERR_MSG
WHERE LIFNR = WA_RECORD-LIFNR
AND EVART = WA_RECORD-EVART
AND EKORG = WA_RECORD-EKORG
AND EKGRP = WA_RECORD-EKGRP
AND WERKS = WA_RECORD-WERKS
AND LGORT = WA_RECORD-LGORT
AND KDATB = WA_RECORD-KDATB
AND KDATE = WA_RECORD-KDATE
AND ZTERM = WA_RECORD-ZTERM
AND KTWRT = WA_RECORD-KTWRT
AND EPSTP = WA_RECORD-EPSTP
AND EMATN = WA_RECORD-EMATN.
* Validating the Plant for Blank/Null
ELSEIF WA_RECORD-WERKS IS INITIAL.
* Inpfle err.occured
V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
WA_RECORD-ERR_MSG = TEXT-039.
WA_RECORD-DEL_FLAG = C_TRUE.
MODIFY I_RECORD FROM WA_RECORD
TRANSPORTING DEL_FLAG
ERR_MSG
WHERE LIFNR = WA_RECORD-LIFNR
AND EVART = WA_RECORD-EVART
AND EKORG = WA_RECORD-EKORG
AND EKGRP = WA_RECORD-EKGRP
AND WERKS = WA_RECORD-WERKS
AND LGORT = WA_RECORD-LGORT
AND KDATB = WA_RECORD-KDATB
AND KDATE = WA_RECORD-KDATE
AND ZTERM = WA_RECORD-ZTERM
AND KTWRT = WA_RECORD-KTWRT
AND EPSTP = WA_RECORD-EPSTP
AND EMATN = WA_RECORD-EMATN.
* Validating the Contract Validity Start Date
ELSEIF L_STARTDATE_C1 GT L_TODAY. "#EC PORTABLE
* Inpfle err.occured
V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
WA_RECORD-ERR_MSG = TEXT-004.
WA_RECORD-DEL_FLAG = C_TRUE. "marking the record
MODIFY I_RECORD FROM WA_RECORD
TRANSPORTING DEL_FLAG
ERR_MSG
WHERE LIFNR = WA_RECORD-LIFNR
AND EVART = WA_RECORD-EVART
AND EKORG = WA_RECORD-EKORG
AND EKGRP = WA_RECORD-EKGRP
AND WERKS = WA_RECORD-WERKS
AND LGORT = WA_RECORD-LGORT
AND KDATB = WA_RECORD-KDATB.
* Validating the Contract Validity End Date
ELSEIF L_ENDDATE_C1 LE L_TODAY. "#EC PORTABLE
* Inpfle err.ocrd
V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
WA_RECORD-ERR_MSG = TEXT-005.
WA_RECORD-DEL_FLAG = C_TRUE. "marking the record
MODIFY I_RECORD FROM WA_RECORD
TRANSPORTING DEL_FLAG
ERR_MSG
WHERE LIFNR = WA_RECORD-LIFNR
AND EVART = WA_RECORD-EVART
AND EKORG = WA_RECORD-EKORG
AND EKGRP = WA_RECORD-EKGRP
AND WERKS = WA_RECORD-WERKS
AND LGORT = WA_RECORD-LGORT
AND KDATB = WA_RECORD-KDATB
AND KDATE = WA_RECORD-KDATE.
* Checking for Material under the Plant for Agreement Type 'WK'
ELSEIF WA_RECORD-EVART = C_WK.
READ TABLE I_MATNR INTO WA_MATNR
WITH KEY MATNR = WA_RECORD-EMATN
BINARY SEARCH.
IF SY-SUBRC NE 0.
V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES. "Inpfle err.ocrd
WA_RECORD-ERR_MSG = TEXT-006.
WA_RECORD-DEL_FLAG = C_TRUE. "marking the record
MODIFY I_RECORD FROM WA_RECORD
TRANSPORTING DEL_FLAG
ERR_MSG
WHERE LIFNR = WA_RECORD-LIFNR
AND EVART = WA_RECORD-EVART
AND EKORG = WA_RECORD-EKORG
AND EKGRP = WA_RECORD-EKGRP
AND WERKS = WA_RECORD-WERKS
AND LGORT = WA_RECORD-LGORT
AND KDATB = WA_RECORD-KDATB
AND KDATE = WA_RECORD-KDATE
AND ZTERM = WA_RECORD-ZTERM
AND KTWRT = WA_RECORD-KTWRT
AND EPSTP = WA_RECORD-EPSTP
AND EMATN = WA_RECORD-EMATN.
ENDIF.
ENDIF. " checking of deletion indicator
ENDIF. " checking for success of vendor cross reference
ELSE.
V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES. "Inpfle err.ocrd
WA_RECORD-ERR_MSG = TEXT-041.
WA_RECORD-DEL_FLAG = C_TRUE. "marking the record
MODIFY I_RECORD FROM WA_RECORD
TRANSPORTING DEL_FLAG
ERR_MSG
WHERE WERKS = WA_RECORD-WERKS.
ENDIF. " Plant checked to selection screen
ENDIF. " the records for which del_flag is initial
CLEAR: WA_RECORD,
WA_T024E,
WA_ZMVXREF,
WA_LFA1,
WA_LOEKZ,
WA_MATNR,
L_TODAY,
L_STARTDATE_C,
L_ENDDATE_C,
L_STARTDATE,
L_ENDDATE.
ENDLOOP.
LOOP AT I_RECORD INTO WA_RECORD.
IF WA_RECORD-DEL_FLAG = C_TRUE.
APPEND WA_RECORD TO I_ERR_REC.
CLEAR WA_RECORD.
ENDIF.
ENDLOOP.
ELSE.
MESSAGE E000 WITH TEXT-013. " no records in the flat file
STOP.
ENDIF.
ENDFORM. " validate_flatfile_data
*& Form DOWNLOAD_ERROR_FILE
* Downloads all records along with the records encountering the
* input file validation error
FORM DOWNLOAD_ERROR_FILE.
DATA L_ISDIR TYPE C.
IF V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
V_FILENAME = P_IPERR.
* Check for the existence of the file.
IF RB_LOCAL EQ C_TRUE.
CALL FUNCTION 'TMP_GUI_GET_FILE_EXIST'
EXPORTING
FNAME = P_IPERR
IMPORTING
ISDIR = L_ISDIR
EXCEPTIONS
FILEINFO_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF L_ISDIR EQ C_TRUE.
MESSAGE I000 WITH TEXT-088.
STOP.
ENDIF.
ENDIF.
IF RB_LOCAL EQ C_TRUE.
* Download the Input Error File.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = V_FILENAME
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = '#'
TABLES
DATA_TAB = I_ERR_REC
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSEIF RB_SERVE EQ C_TRUE.
OPEN DATASET P_IPERR1 FOR OUTPUT IN TEXT MODE.
CHECK SY-SUBRC EQ 0.
CLEAR WA_ERR_REC.
LOOP AT I_ERR_REC INTO WA_ERR_REC.
IF WA_ERR_REC-DEL_FLAG = C_TRUE.
TRANSFER WA_ERR_REC TO P_IPERR1.
ENDIF.
CLEAR WA_ERR_REC.
ENDLOOP.
CLOSE DATASET P_IPERR1.
ENDIF.
ENDIF.
ENDFORM. " DOWNLOAD_ERROR_FILE
*& Form BUILD_BDC_DATA
* Populates BDC for all the fields neccessary for Open Contract Creation
FORM BUILD_BDC_DATA.
DATA: L_MAT_INDEX TYPE I,
L_CON_INDEX TYPE I,
L_SCA_INDEX TYPE I.
CLEAR WA_BDCDATA.
REFRESH: I_BDCDATA,
I_MESSTAB.
* Processing the bdc
CLEAR: WA_RECORD,
WA_RECORDPREV,
VEN_FLAG,
MAT_FLAG.
LOOP AT I_RECORD INTO WA_RECORD.
* Checks for the del_flag of the record.
IF WA_RECORD-DEL_FLAG EQ C_TRUE
OR WA_RECORD-DEL_FLAG EQ C_STRUE.
CLEAR WA_RECORD.
CONTINUE.
ELSE.
IF WA_RECORDPREV-LIFNR NE WA_RECORD-LIFNR
OR WA_RECORDPREV-EVART NE WA_RECORD-EVART
OR WA_RECORDPREV-EKORG NE WA_RECORD-EKORG
OR WA_RECORDPREV-EKGRP NE WA_RECORD-EKGRP
OR WA_RECORDPREV-WERKS NE WA_RECORD-WERKS
OR WA_RECORDPREV-LGORT NE WA_RECORD-LGORT
OR WA_RECORDPREV-KDATB NE WA_RECORD-KDATB
OR WA_RECORDPREV-KDATE NE WA_RECORD-KDATE
OR WA_RECORDPREV-ZTERM NE WA_RECORD-ZTERM
OR WA_RECORDPREV-KTWRT NE WA_RECORD-KTWRT.
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0200'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RM06E-LGORT'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
* Cross-Reference check performed for the given Vendors
CLEAR WA_T024E.
READ TABLE I_T024E INTO WA_T024E
WITH KEY EKORG = WA_RECORD-EKORG
BINARY SEARCH.
IF SY-SUBRC EQ 0.
CLEAR WA_ZMVXREF.
READ TABLE I_ZMVXREF INTO WA_ZMVXREF
WITH KEY D_ALTKN = WA_RECORD-LIFNR
D_BUKRS = P_BUKRS
BINARY SEARCH.
IF SY-SUBRC EQ 0.
PERFORM BDC_FIELD USING 'EKKO-LIFNR'
WA_ZMVXREF-M_ALTKN.
ENDIF.
CLEAR WA_ZMVXREF.
ENDIF.
CLEAR WA_T024E.
PERFORM BDC_FIELD USING 'RM06E-EVART'
WA_RECORD-EVART.
PERFORM BDC_FIELD USING 'EKKO-EKORG'
WA_RECORD-EKORG.
PERFORM BDC_FIELD USING 'EKKO-EKGRP'
WA_RECORD-EKGRP.
PERFORM BDC_FIELD USING 'RM06E-WERKS'
WA_RECORD-WERKS.
PERFORM BDC_FIELD USING 'RM06E-LGORT'
WA_RECORD-LGORT.
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0201'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'EKKO-KTWRT'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=AB'.
PERFORM CONVERT_DATE USING WA_RECORD-KDATB V_CONV_DATE.
PERFORM BDC_FIELD USING 'EKKO-KDATB'
V_CONV_DATE.
PERFORM CONVERT_DATE USING WA_RECORD-KDATE V_CONV_DATE.
PERFORM BDC_FIELD USING 'EKKO-KDATE'
V_CONV_DATE.
PERFORM BDC_FIELD USING 'EKKO-ZTERM'
WA_RECORD-ZTERM.
PERFORM BDC_FIELD USING 'EKKO-KTWRT'
WA_RECORD-KTWRT.
VEN_FLAG = 1.
L_MAT_INDEX = 1. "index for table-control of material
ENDIF.
* "first check for itemline
IF WA_RECORDPREV-EPSTP NE WA_RECORD-EPSTP
OR WA_RECORDPREV-EMATN NE WA_RECORD-EMATN
OR WA_RECORDPREV-KTMNG NE WA_RECORD-KTMNG
OR WA_RECORDPREV-NETPR NE WA_RECORD-NETPR
OR WA_RECORDPREV-PEINH NE WA_RECORD-PEINH
OR WA_RECORDPREV-BPRME NE WA_RECORD-BPRME
OR WA_RECORDPREV-IDNLF NE WA_RECORD-IDNLF
OR WA_RECORDPREV-WEBRE NE WA_RECORD-WEBRE
OR WA_RECORDPREV-MEPRF NE WA_RECORD-MEPRF
OR WA_RECORDPREV-LTEX1 NE WA_RECORD-LTEX1
OR VEN_FLAG EQ 1.
V_IND = L_MAT_INDEX.
IF V_IND GT 1.
V_IND = 2.
ENDIF.
CONCATENATE 'RM06E-EVRTP(' V_IND ')' INTO V_EVRTP1.
CONCATENATE 'RM06E-EPSTP(' V_IND ')' INTO V_EPSTP1.
CONCATENATE 'EKPO-EMATN(' V_IND ')' INTO V_EMATN1.
CONCATENATE 'EKPO-KTMNG(' V_IND ')' INTO V_KTMNG1.
CONCATENATE 'EKPO-NETPR(' V_IND ')' INTO V_NETPR1.
CONCATENATE 'EKPO-PEINH(' V_IND ')' INTO V_PEINH1.
CONCATENATE 'EKPO-BPRME(' V_IND ')' INTO V_BPRME1.
CONCATENATE 'RM06E-TCSELFLAG(' V_IND ')' INTO V_TCSELFLAG1.
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0220'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=NP'.
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0220'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
V_EVRTP1.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=DETA'.
PERFORM BDC_FIELD USING V_EPSTP1
WA_RECORD-EPSTP.
PERFORM BDC_FIELD USING V_EMATN1
WA_RECORD-EMATN.
PERFORM BDC_FIELD USING V_KTMNG1
WA_RECORD-KTMNG.
PERFORM BDC_FIELD USING V_NETPR1
WA_RECORD-NETPR.
PERFORM BDC_FIELD USING V_PEINH1
WA_RECORD-PEINH.
PERFORM BDC_FIELD USING V_BPRME1
WA_RECORD-BPRME.
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0211'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'EKPO-WEBRE'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=DETZ'.
PERFORM BDC_FIELD USING 'EKPO-IDNLF'
WA_RECORD-IDNLF.
TRANSLATE WA_RECORD-EVART TO UPPER CASE.
IF WA_RECORD-EVART EQ C_WK.
PERFORM BDC_FIELD USING 'EKPO-WEBRE' 'X'.
ENDIF.
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0212'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'EKPO-MEPRF'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=TXP'.
PERFORM BDC_FIELD USING 'EKPO-MEPRF'
WA_RECORD-MEPRF.
IF NOT WA_RECORD-LTEX1 IS INITIAL. "NE space.
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0106'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RM06E-SELKZ(02)'.
PERFORM BDC_FIELD -
Remove scaling factor from key figure - still shows in Report !
Hi all,
A key figure we use somehow had its scaling factor set to 100.
This was accidental, so I have changed the key figure to have no scaling factor and then activated it.
The query that uses this key figure still sees it as having the 100 scaling factor however. While this is the case, I cannot set it to no scaling factor as needed.
I have tried adding this key figure to a new report and it still comes in with the incorrect scaling factor setting.
So far I have tried,
Changed the scaling factor on the key figure to none and activated.
Regenerated the query through rsrt
Removing the key figure from the query and then readding as well as adding the key figure to a entirely new report. Incorrect scaling setting still comes through in both cases.
Checked table RSDIKYFPRO and RSDKYF - both of which have no scaling as their settings for this key figure.
I know that I could created a restricted key figure in the query from the original and set the scaling factor to none to get around the problem, however I would like the query to see the settings in the key figure.
Can anyone suggest how I can resolve this ?
Many thanks,
BlairWas there ever a solution to this problem? I, too, have noticed the same issue. The key figure properties (in my case, # of decimal places) is not inherited in the query, and the only solution was to change the kf properties directly in the query, which I shouldn't have to do. The selection of decimal places "from key figure (0)" does not work; I have to override this and select "0". Anyone seen any notes or anything to fix this?
Thanks.
Rachel -
Problems in using a calculated key figure in the Clustering Model
We have a problem in using a calculated key figure in the clustering model. With the limitation of the standard, in the Field tab, each calculated key figure cannot be selected from the selection screen directly. According to the SAP help, we have to use a dummy infoobject for a calculated key figure.
Are there any other ways to use a calculated key figure without using a dummy infoojbect?Hi,
Make use of aggragation property of the keyfigure, for summing the values of that KF.
Regards,
Rajkandula -
Lost my contacts, how to transfer from macbook pro to ipad
lost my contacts, how to transfer from macbook pro to ipad
Which OS X is installed on your Mac ?
Click the Apple () menu top left in your screen. From the drop down menu click About This Mac.
The version is noted there.
Minimum system requirements for syncing data from a Mac to an iPad is v10.6.8 > Apple - iPad: Technical Specifications
Your profile indicats your Mac has v10.4.11 installed ?? -
How use non cumulative key figure and noncumulative key figure screenshot
how use non cumulative key figure and noncumulative key figure screenshot
Hello,
Please see this docs for Non-Cumulative and Snapshot scenario,
[How to Handle Inventory Management Scenarios in BW (NW2004)|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f83be790-0201-0010-4fb0-98bd7c01e328]
[Non-Cumulative Values / Stock Handling|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0b8dfe6-fe1c-2a10-e8bd-c7acc921f366]
Thanks
Chandran -
How to identify which key figure will the numeric pointer for deltas?
Hi All,
I have created a numeric pointer for generic extraction ? but how to identify which key figure will the numeric pointer will use for deltas ?
how to identify the key figures which is suitable for numeric pointer. And the generic extraction is based upon the copa table?
Can anyone suggest me how the numeric pointer works and how to identify deltas are carried out at numeric pointer?
Thanks
PoojaPooja,
If you are using a generic extractor which is based on COPA table, then numeric pointer may not be the suggested delta extraction mechanism.
A time stamp would be the better one to use. In a time stamp, you can give a lower limit value of 300 seconds.. so that it will try to fetch the missed records.
Moreover, a delta would be based on a character, preferably a time char.
In your requirement, try to figure out the character on whichdeltas will be based.
Sasi -
How do transfer from iPad one to iPad three
Was wanting to know how u transfer from iPad one to iPad three
First, sync the iPad 1 to your computer with iTunes.
Then, sync the new iPad 3 through iTunes where you can restore the most recent backup to the new iPad. -
HT201250 how to transfer from mac to mac using time machine
how to transfer from mac to mac using time machine
See How do I set up a new Mac from an old one, its backups, or a PC?
-
How can we restrict Key Figure in the BI System
Hi All,
Can any one explain How can i restrict key figures in BI system.
So when i create a query a specific user can only execute it if a specific key figure is a part of query otherwise he is not allowed to execute a query.
For Example:
A user TEST123 is allowed to execute a query with keyfigure Quantity he is not allowed to execute the query if any other key figure is present in the query
Regards,
DeepakHay Diogo,
Bravo...
Your suggetions always work for me. The scenario was that
A user TEST_PLD08 should only allow to see output for the querys which consist of the keyfigure PLDQUACMP and not for other keyfigures while other user TEST_PLD07 is allowed to see the output for querys consist of any of the keyfiguers.
so I have assign a authorization profile PLD_TEST07 to the user TEST_PLD08 with KeyFigures authorization as mentioned below and it is working fine
I EQ :
I EQ PLDQUACMP
You can forward me more scenarios like this if you can think of more it will be really helpful for me
Regards,
Deepak
Maybe you are looking for
-
Parsing the query takes too much time.
Hello. I hitting the bug in в Oracle XE (parsing some query takes too much time). A similar bug was previously found in the commercial release and was successfully fixed (SR Number 3-3301916511). Please, raise a bug for Oracle XE. Steps to reproduce
-
Slow response when using Xcelsius web service connection witn input values
We've been very successful in using the Xcelsius Web Service Connection. We've recently moved forward toward using input values when calling a web service and having issues with response time. Without input values, it takes 3 - 6 seconds to retrieve
-
Got the MBPretina. Now, what High-end Monitor ?
After lots of waiting, weighing pros and cons and whether I should go iMac, Mac Mini or MacBook Pro High rez anti-glare, helped in that pilgrim quest by some encouraging users reviews and eventually compelled by a dealer's special, I fell for a 2013
-
Win 7 basic, failed to upgrade from iTunes 10.4 to 10.5
I was previously using iTunes 10.4 with no problem, so I doubt it's not really a Windows problem. However I was trying to update my iTunes to 10.5 because of iOS5, the Apple Software Update stuck on the installation. So I was advised to download the
-
Unable to find activation server
Just had my phone unlocked and then upgraded the O/S on my 3GS. Now I cannot activate it for some reason. Called Apple support who now say there is nothing they can do, however for £126 they will gladly sell me a replacement phone. They it is my choi