• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Upload flat file in sap bi
 

Upload flat file in sap bi

on

  • 2,029 views

Upload flat file in sap bi

Upload flat file in sap bi

Statistics

Views

Total Views
2,029
Views on SlideShare
2,029
Embed Views
0

Actions

Likes
2
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Upload flat file in sap bi Upload flat file in sap bi Document Transcript

    • SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 1Upload Flat File in SAP BI/BWApplies to:SAP BI/BWSummaryThis Article demonstrates the step by step process to upload Flat file to an ABAP Table then load the sameinto SAP BI/BW objects via processAuthor: Obaidullah ShaikhCompany: AG TechnologiesCreated on: 15 September 2011Author BioObaidullah shaikh is a SAP BI Consultant with AG Technologies. He has good skill in technicalareas (ABAP) and he has experience of multiple custome reports development and hasexperience of Migration/upgradation projects as well.
    • Upload Flat File in SAP BI/BWSAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 2Table of ContentsIntroduction .........................................................................................................................................................3Create table ........................................................................................................................................................3ABAP Program ...................................................................................................................................................4Create Data source.............................................................................................................................................6Replicate that Datasource ..................................................................................................................................7Create Transformation........................................................................................................................................7Create Info Package...........................................................................................................................................8Create DTP.........................................................................................................................................................8Create Process chain .........................................................................................................................................9Create an Event................................................................................................................................................10Start Condition of Process Chain..................................................................................................................10Schedule the process chain..........................................................................................................................10Create a T-Code ...............................................................................................................................................11Run that T-Code ...............................................................................................................................................12Select File .........................................................................................................................................................12Check the Chain log .........................................................................................................................................13Related Content................................................................................................................................................14Disclaimer and Liability Notice..........................................................................................................................15
    • Upload Flat File in SAP BI/BWSAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 3IntroductionMost of the companies are maintaining some of the transactions in Flat file (Excel Sheet) and they want toload that flat file to SAP BI, there are multiple ways to load Flat file into BW. BI consultant will maintain the Data flow for that flat file and whenever file will come via an email orany other way, BI person will load it manually on daily basis but this is not the right way to load flatfile. BI consultant uses any tool to transfer the file from client to Application server and load from therevia process chain. But this is also not a best practice in all the types of operating system speciallyWindows. Because while transferring the file virus will also move and that will create problem inserver so the best way is to transfer it via ABAP Code. This document will discuss how can load data from file to ABAP table and then we will load the sameto BI object. User just needs to run a Transaction code and select the corresponding file, he want to load.Create tableCreate a table in BW that will store the records structure of that table will same as flat file
    • Upload Flat File in SAP BI/BWSAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 4ABAP ProgramWrite the following ABAP program in SE38DATA S_FILE TYPE STRING.“To Get Path of csv file that need to loaded in BICALL FUNCTION WS_FILENAME_GETIMPORTINGFILENAME = S_FILE.“ZTEST is ABAP TABLE in SAP BI System that will store the records coming from Flat fileTABLES ZTEST.DATA: BEGIN OF WA1,MAT(18) TYPE C,PLANT(5) TYPE C,END OF WA1,ITAB LIKE TABLE OF WA1,WA_FINAL LIKE ZTEST,ITAB_FINAL LIKE TABLE OF WA_FINAL.DATA STR TYPE STRING.DELETE FROM ZTEST.CALL FUNCTION GUI_UPLOADEXPORTINGFILENAME = S_FILEFILETYPE = ASCHAS_FIELD_SEPARATOR = XTABLESDATA_TAB = ITAB .DATA J TYPE I.DATA L TYPE I.CLEAR STR."The Following code will convert the data from internal table to Database TableLOOP AT ITAB INTO WA1.L = STRLEN( WA1-MAT ).“Since data is Comma separated thats why a record will be a string“e.g. M01, 1000 will be a single string that needs to be separated depending upon"Commas in between the stringWHILE WA1-MAT+J(1) <> , .CONCATENATE STR WA1-MAT+J(1) INTO STR.J = J + 1.
    • Upload Flat File in SAP BI/BWSAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 5ENDWHILE.WA_FINAL-MAT = STR.CLEAR STR.J = J + 1.WHILE J < L .CONCATENATE STR WA1-MAT+J(1) INTO STR.J = J + 1.ENDWHILE.WA_FINAL-PLANT = STR.CLEAR STR.APPEND WA_FINAL TO ITAB_FINAL.J = 0.INSERT INTO ZTEST VALUES WA_FINAL.ENDLOOP."FM to Trigger Event that will trigger Process chain of Data loadDATA EVENT TYPE STRING.EVENT = ZPATH_IP.CALL FUNCTION BP_EVENT_RAISEEXPORTINGEVENTID = EVENT.
    • Upload Flat File in SAP BI/BWSAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 6Create Data sourceCreate a DataSource in SAP BI (RSO2 T-code)You can also maintain generic delta also in this data source
    • Upload Flat File in SAP BI/BWSAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 7Replicate that DatasourceReplicate the Datasource from RSDS and activate itCreate Transformation
    • Upload Flat File in SAP BI/BWSAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 8Create Info PackageCreate DTP
    • Upload Flat File in SAP BI/BWSAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 9Create Process chain
    • Upload Flat File in SAP BI/BWSAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 10Create an EventCreate an event from SM64 that will trigger Chain.Start Condition of Process ChainSchedule the process chain
    • Upload Flat File in SAP BI/BWSAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 11Create a T-CodeCreate a T-code from SE93. User will just need to run this t-codeEnter descrition and select start object as “Program and selection screen(report transaction)”Enter the ABAP Program name (ZINS_PATH)
    • Upload Flat File in SAP BI/BWSAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 12Run that T-CodeSelect FileAfter running the T-code, A dialog will pop-up to select the file that is going to be loaded
    • Upload Flat File in SAP BI/BWSAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 13Check the Chain logData is successfully loaded to BW
    • Upload Flat File in SAP BI/BWSAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 14Related Contenthttp://forums.sdn.sap.com/thread.jspa?threadID=1281874https://www.sdn.sap.com/irj/scn/wiki?path=/display/SCM/Move%252ba%252bfile%252bfrom%252bsource%252bto%252btarget%252bdirectories%252bin%252bAPOhttps://www.sdn.sap.com/irj/scn/thread?messageID=7224879#7224879
    • Upload Flat File in SAP BI/BWSAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 15Disclaimer and Liability NoticeThis document may discuss sample coding or other information that does not include SAP official interfaces and therefore is notsupported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document,and anyone using these methods does so at his/her own risk.SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article orcode sample, including any liability resulting from incompatibility between the content within this document and the materials andservices offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of thisdocument.