Infopackage Routine
Hi Friends,
I need help in ABAP code for accessing dynamically Flat File at Infopackage level.
I have written a code which is working perfectly but here I hae mentioned the Filename as 'Current' following with the system date.
My question is if user gives any filename like instead of 'Current' the filename changes everyday system date changes everyday as usual then How to capture the filename within the code.Kindly correct me please. Also I would like to delete the file loaded everyday from the drive can anyone suggest me code in regards to that as well.
My Code is as follows:
*$*$ begin of routine - insert your code only below this line *-*
* This routine will be called by the adapter,
* when the infopackage is executed.
DATA: Z_FILENAME TYPE RSFILENM.
DATA: Z_PATH(40) TYPE C.
DATA: Z_FILE(40) TYPE C.
DATA: Z_DAT(12) TYPE C.
DATA: Z_EXT(4) TYPE C.
DATA VC_DAT(12) TYPE C.
Z_PATH = 'D:\'.
Z_FILE = 'Current'. *This name can change everyday--Need solution for this..
Z_DAT = sy-datum.
Z_EXT = '.CSV'.
concatenate Z_DAT+6(2) Z_DAT+4(2) Z_DAT+0(4) into VC_DAT
separated by '.'.
SHIFT VC_DAT BY 1 PLACES RIGHT.
*SHIFT VC_DAT RIGHT DELETING TRAILING ' '.
CONCATENATE Z_PATH Z_FILE VC_DAT Z_EXT INTO Z_FILENAME.
p_filename = Z_FILENAME.
Thanks in Advance..
Hi ,
From where you are loading the file. Application server / Desktop ?.
For such type of requirements ( automation ) use application server ( DIR_HOME).
Simple shell script will work in putting the file to DIR_HOME with unique name always.
May be BASIS will help on this.
1. Users will put the files in specific folder.
2. Write a shell script to get the files from the folder and put it into the DIR_HOME with unique name.
3. In the info package maintain the DIR_HOME file address.
Hope it gives some idea.
Regards,
Sai
Similar Messages
-
Infopackage routine for changing file name
Hi Everyone,
I have to load flat files from application server directories. I get these files from different locations and they are saved in own (location) folders by a script). I would like to run these file from infopackage through process chain. the problem is that these files have changing names. The format is like this
Canada_co3300.csv
I can write a routine is my infopackage but "co3300" keeps changing as it represents different companies code in that particular location (Canada).
I have a routine
data: F1 type string value 'D:\usr\sap\FLAT_FILES\Inbound\Cayman\Canada_<b>co3300</b>_',
F2 type string '.csv'.
concatenate f1 f2 into p_filename.
How can I get a variable <b>co</b>---- in my routine so my infopackage can read the file if <b>co</b> has different value like co2000. Thanks In advance.
Regards,
AsadHi Saugata,
My flat file name has a naming convention based on company code in application server folder, so I get files with name
Canadaco<b>3000</b>.csv or
Canadaco<b>2000</b>.csv or
Canadaco<b>4000</b>.csv or something else <b>(co</b> number keeps changing)
So My file name keeps changing all the time. I would like my infopackage to read these files automatically thorugh a routine or logical file name. I have tried both, but donot know how to configure this scenerio thorugh my infopackage. Please give me steps to use that table you mentioned. Thanks . -
HI experts
My datasource is an external datasource. I want to load only those records with the field 'FECULMOD' like sysdate
To do this I have written an ABAP routine in my Infopackage with the code below:
<i>DATA: va_maxdat LIKE /BIC/ADSPX_0100-/BIC/TDPXMOD.
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = 'FECULMOD'.
l_idx = sy-tabix.
SELECT SINGLE /BIC/TDPXMOD
INTO va_maxdat
FROM /BIC/ADSPX_0100
WHERE /BIC/CHPXTDATM = 'MARG_ART'.
l_t_range-SIGN = 'I'.
l_t_range-OPTION = 'GT'.
l_t_range-LOW = va_maxdat.
APPEND l_t_range.
modify l_t_range index l_idx.
p_subrc = 0.</i>
My SELECT instruction returns values less than sysdate.
When I execute my IP, I got a dump with this message:
For the field FECULMOD, any selection with SIGN 'I', OPTION 'GT' is not autorised
Can anybody help me please.
ThankHi Eric,
you need to specify a upper limit ( high value of 9991231) and use BT as the option. That is what is possible in an infopackage. There is no option available to select for <, >, <=, >=, *. It is only = or bt for a specific value or a range.
regards
Siggi -
Infopackage routine to schedule yesterday's data!
Hi,
I have a infopacakge which has to be included in the Process chain in such a way so as to schedule the IP yesterday always.
How can i write a routine to make the required changes in Info package?
RajHi Raj Karan,
Check this......
call function in abap routine of infopackage
Re: ABAP Routine at infopackage dataselection
ABAP ROUTINE AT INFOPACKAGE FOR DATE RANGE
Re: InfoPackage Scheduling for Uploading FlatFile from Application Server
Regards,
Vijay. -
Infopackage routine --- Help!!
Hello all,
I am doing daily full loads to a cube.......there is no ODS....so when I do loads daily since its a full load the records are basically duplicating ...I would like to have a routine in my infopackage in such a way that if the request date is not a friday then delete that request and do a reload....I have other infosources also feeding data to that cube...so I cannot delete the whole contents of the cube...
thanks in advance...will assign points for your help......is there another way of doing this ?? like having an ODS and sending only delta records ?? and if this can be done using a routine in infopackage...and if its a yes then would like some help with the code...Hi Bose,
In the infopackage there is a setting in "Data Target" tab where you can delete the overlapping request based on conditions. You can use that.
Check this link:
http://help.sap.com/saphelp_nw04/helpdata/en/f8/e5603801be792de10000009b38f842/frameset.htm
Re: how to Delete previous request
Bye
Dinesh -
Infopackage Routine in flat file datasource
Hi,
There is a requirements to load the data from multiple flat files in folder into BI which source data is coming from other system. Each flat file has it own naming convention.
There are around more the 200 flat file (CSV.file) in folder,data source is flat file datasource.
Could any one help me in above issue.
Regards
RAMI assume they'll be using FTP to send the files... You have the layout defined and naming convention as well...
One option would be to create a user and folder in the BW server for the FTP to use it and put all files in the same place... From here you can define different Infopackages to read those files at specific times during the day or whatever schedule you guys agree...
A thing with the naming convention... Try to avoid using timestamps on the names and keep the names to be always the same... That way you just overwrite the existing files, the space usage won't grow much and you can make the loads automatic with the same file names...
Just some ideas... -
Infopackage routine for fiscal period
Hi experts,
can anyone send me the code to calculate fiscal year period in the infopackage. I think we can use the function date_to_period_convert. But i need the code that gets the period in mmm/yyyy format.
Thanks
daveHi Experts,
I tried the following code, and iam getting the following error.
<b>E:"= ..." expected after "CONCATENATE".</b>
The code is
data: l_idx like sy-tabix,
L_PER(7) TYPE C,
LOC_PERIOD LIKE T009B-POPER,
LOC_DATE LIKE SY-DATUM.
LOC_DATE = SY-DATUM.
l_idx = sy-tabix.
read table l_t_range with key
fieldname = 'FISCPER'.
DELETE l_t_range
WHERE iobjnm = 'FISCPER'.
L_t_RANGE-SIGN = 'I'.
L_t_RANGE-OPTION = 'BT'.
current fiscalyear period
call function 'DATE_TO_PERIOD_CONVERT'
exporting
I_DATE = LOC_DATE
I_MONMIT = 00
i_periv = '45'
importing
E_BUPER = LOC_PERIOD
E_GJAHR = LOC_YEAR
CONCATENATE LOC_PERIOD LOC_YEAR INTO L_PER.
L_t_RANGE-LOW = L_PER.
append l_t_range.
L_t_RANGE-HIGH = L_PER.
append l_t_range.
modify l_t_range index l_idx.
p_subrc = 0.
Can anyone tell me whether the code has got the right logic and the resloution for the error please. Thank you
Dave -
ABAP routine in the infopackage for Multiple Selection
Hi experts,
I want to include a abap routine in the infopackage for Multiple Selection so that I can fetch only the required Material Numbers when the InfoPackage is schedule. As I have the constraints that I have to select certain Material Numbers only, that are not in series - so I cannot select"BT' fuction. Tell me what ABAP Code will work in this scenario.
Kind regards,
Rajesh GiribuwaHi,
The Routine will have to use 'EQ' operator and Append each selections to the Structure.
ABAP Routine
InfoPackage definition for Bespoke SIS Structure
Infopackage routine !
Regards
Happy Tony -
Infopackage upload routine flat file
Hi,
I'm uploading a flat .csv file with an infopackage routine (called by a process chain).
First it checks the existence and if the file exists running it's ok, but if not (no file found) I want to stop the upload and do nothing (now the infopackage load stays in red like an error load) but I don't know the way to do it...
(maybe with sy-subrc??)
v_file = '/usr/sap/.../ZZ.CSV'.
CALL FUNCTION 'DX_FILE_EXISTENCE_CHECK'
EXPORTING
FILENAME = v_file
PC = ''
SERVER = ''
IMPORTING
FILE_EXISTS = v_file_exists.
if v_file_exists ='X'.
p_filename ='/usr/sap/.../ZZ.CSV'.
else.
??????????????????????????? What to do?????
endif.
Thanks for your help!Hi Marcel,
Since you are already executing the info package it will always turn red if there is no file found to be uploaded.
In that case you can upload a blank file onto the server, if the file is not found then update the infopackage path by the path of the blank file. This will ensure that the info package is always completed causing no impact on the data.
Another way of doing the same will be using a program, where in you can check the existence of the file. If file is found then update the package and trigger the load, else do nothing. This will also help in stopping the infopackage from turning red. Here in you can use BAPI BAPI_IPAK_CHANGE to update info package and function RSPC_API_CHAIN_START to trigger process chain.
regards,
Shyam. -
If I want to delete a line of data in say an update rule start routine, I can write for example the following:
DELETE DATA_PACKAGE WHERE <field> NE 'ABC'.
I am wondering if I can write the same in an info package and if so rather than DATA_PACKAGE what should I be referencing? ThanksHi Nitin,
Please note that is is not possiable to delete any data in InfoPackage routine, but surely you could ignore the value of a field when it is not equal to ABC or just load data for a field for value ABC. If that field is not present in the selection screen, you could get it into the selection screen by selecting it in RSA6, datasource maintenance.
No need to write a routine, it is just a simple selection is what you need to give.
Hope this helps.
Regards,
Pankaj -
Hi Experts,
Can anyone please post Infopackage routine that populates with below spec.
Spec1
Routine to populate date field
Lower Range should be 1st day of teh Fiscal Year period and
Upper Range should be the cuurent date minus 1. If current date is the 1st day of the Fiscal period, then this date shld be teh 1st day of the current period.
Spec2
Routine to populate Fical Year Period
Lower range and upper range should be cuurent period minus one.
Thanks,
DVThanks Sam,
Any help on the first spec?
DV -
Loading data from infopackage via application server
Hi Gurus,
I have a requirement where i need to load data present in the internal table to a CSV file in the application server (AL11) via open data set, and then read the file from the aplication server, via infopackage ( routine ) then load it to the PSA.
Now i have created a custom program to load data to AL11 application server and i have used the below code.
DATA : BEGIN OF XX,
NODE_ID TYPE N LENGTH 8,
INFOOBJECT TYPE C LENGTH 30,
NODENAME TYPE C LENGTH 60,
PARENT_ID TYPE N LENGTH 8,
END OF XX.
DATA : I_TAB LIKE STANDARD TABLE OF XX.
DATA: FILE_NAME TYPE RLGRAP-FILENAME.
FILE_NAME = './SIMMA2.CSV'.
OPEN DATASET FILE_NAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
XX-NODE_ID = '5'.
XX-INFOOBJECT = 'ZEMP_H'.
XX-NODENAME = '5'.
XX-PARENT_ID = '1'.
APPEND XX TO I_TAB.
XX-NODE_ID = '6'.
XX-INFOOBJECT = 'ZEMP_H'.
XX-NODENAME = '6'.
XX-PARENT_ID = '1'.
APPEND XX TO I_TAB.
LOOP AT I_TAB INTO XX.
TRANSFER XX TO FILE_NAME.
ENDLOOP.
now i can see the data in the application server AL11.
Then in my infopackage i have the following code,
form compute_flat_file_filename
using p_infopackage type rslogdpid
changing p_filename like rsldpsel-filename
p_subrc like sy-subrc.
Insert source code to current selection field
$$ begin of routine - insert your code only below this line -
P_FILENAME = './SIMMA2.CSV'.
DATA : BEGIN OF XX,
NODE_ID TYPE N LENGTH 8,
INFOOBJECT TYPE C LENGTH 30,
NODENAME TYPE C LENGTH 60,
PARENT_ID TYPE N LENGTH 8,
END OF XX.
DATA : I_TAB LIKE STANDARD TABLE OF XX.
OPEN DATASET P_FILENAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
DO.
READ DATASET P_FILENAME INTO XX.
IF SY-SUBRC <> 0.
EXIT.
ELSE.
APPEND XX TO I_TAB.
ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET P_FILENAME.
P_SUBRC = 0.
i have the following doubt,
while loading the data from internal table to application server, do i need to add any "data seperator" character and "escape sign" character?
Also in the infopackage level i will select the "file type" as "CSV file", what characters do i need to give in the "data seperator" and "escape sign" boxes? Please provide if there is any clear tutorial for the same and can we use process chain to load data for infopackage using file from application server and this is a 3.x datasource where we are loading hierarchy via flat file in the application server.
Edited by: Raghavendraprasad.N on Sep 6, 2011 4:24 PMHi,
Correct me if my understanding is wrong.. I think u are trying to load data to the initial ODS and from that ODS the data is going to t2 targets thru PSA(Cube and ODS)....
I think u are working on 3.x version right now.. make sure the following process in ur PC.
Start process
Load to Initia ODS
Activation of the Initial ODS
Further Update thru the PSA(which will update both ODS and Cube).
make sure that u have proper Update rules and Init for both the targets from the Lower ODS and then load the data.
Thanks -
Data selection at InfoPackage Level
HI Experts,
This is related to 0vendor.
0vendor is 10 digits in BI.
At the ECC side, there are some vendors with 7 digits (e.g 1834710).
When i pull vendor's using a IP into BI, I miss these records.
To pull these records, I need to Manually put the Selections at the IP by making them 10 digits (e.g 0001834710).
What can be done to avoid this selection.
Please Help.
Thanks,
Max.Hi,
You need to use the conversion for this.
Use this piece of code in your infopackage routine.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = value_without_zeroes
IMPORTING
OUTPUT =value_with_leading_zeroes.
This conversion exit will automatically add leading zeroes to the value as per the length of the object.
Regards,
Joe -
Sequence of routines performed in bw
hi all,
There are lot of routines in bw. like 1. start routine, 2. create routine, 3. transfer routine 4. abap routine. etc
Can anyone tell the sequence in which these routines are been performed.
Thanxs in advance
hariHi Hari,
If you are talking about the normal load process then for that the sequence of routines on the BW side would be any InfoPackage routine if you are using one, Start Routine (of transfer rules), Transfer Routine, Start Routine (of Update rules) and then Update routine (i.e. for a particular update rule).
Hope this helps... -
Data Selection in Info Package
Hi Gurus:
How to exclude say doc type 'ER' in a Info package...Where can I mention the <> operator in I.pKG..
Thanks & Regardshi MK K,
or try with infopackage routine, there is button to choose type 'abap routine' and try following code
DELETE l_t_range
WHERE fieldname = '[doc type]'
AND LOW = 'ER'.
hope this helps.
sample code
routine as selection in infopackage
Maybe you are looking for
-
How do I get Yosemite to appear in startup disc panel?
How do I get Yosemite to appear in startup disc panel?
-
Hi After I ran SharePoint configuration wizard successfully to upgrade to SharePoint 2013 / SP1. I can open Central Administration site just fine. but now when I open any Site collection, I got this error. Server Error in '/' Application This operat
-
CVI 8.0 / Diadem 10.0
Hi, I'm thinking about introducing DIAdem to our LabWindows/CVI applications. However, I learned on a DIAdem product presentations that CVI 8.0 does not yet has the full capabilities when it comes to generating TDM files. Can anyone list the limitat
-
Differences in "storage used" between iPad and iTunes
I have an iPad Mini 2 and there a differences between the stated "storage used" between the iPad and iTunes. Looking in the general settings "Storage" it states I have used 113GB and available is 413MB. Looking on iTunes, when the iPad is connected,
-
Std idoc matmas05 details in SAP
Hi, How to see the details (logic etc) in R/3 System for standard idoc MATMAS05 to prepare a FS to interface with external system. Please advise what should i mention in FS in this regard. thank you.