Fields in Flat File are separated by special characters

hello every one,
   fIf fields in Flat File are separated by special characters
and If Flat File is given in Excel sheet , how to handle this kind of issues.
to Upload data into R/3 system, in BDC.
   If u have sample program ,please send it ot me and explain ?
others give me hints...

Hi,
you can use the function module ALSM_EXCEL_TO_INTERNAL_TABLE .
Check this sample code.
hi,
use the FM ALSM_EXCEL_TO_INTERNAL_TABLE.
PARAMETERS:
P_INFL like RLGRAP-FILENAME.
DATA:
BEGIN OF T_DATA1 OCCURS 0,
RESOURCE(25) TYPE C,
DATE(10) TYPE C,
DURATION TYPE P DECIMALS 2,
ACTIVITY(25) TYPE C,
B_NBILL(1) TYPE C,
END OF T_DATA1,
T_DATA TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE,
BEGIN OF T_FINAL OCCURS 0,
RESOURCE(25) TYPE C,
DATE(10) TYPE C,
DURATION(15) TYPE C,
ACTIVITY(25) TYPE C,
B_NBILL(10) TYPE C,
END OF T_FINAL.
DATA : HEADER TYPE XSTRING.
Work Variables Declaration.
CONSTANTS:
W_Y TYPE C VALUE 'Y',
W_N TYPE C VALUE 'N'.
Work area.
DATA:
WA_DATA LIKE T_FINAL.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INFL.
PERFORM GET_FILENAME CHANGING P_INFL.
START-OF-SELECTION.
PERFORM UPLOAD_DATA_FROMEXCEL.
FORM UPLOAD_DATA_FROMEXCEL.
Downloading the data from presentation server
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_infl
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = 8
I_END_ROW = 1000
TABLES
INTERN = T_DATA
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " upload_data_fromexcel
*& Form process_data
text
FORM PROCESS_DATA .
T_FINAL-RESOURCE = 'Resource'.
T_FINAL-DATE = 'Date'.
T_FINAL-DURATION = 'Duration'.
T_FINAL-ACTIVITY = 'Activity'.
T_FINAL-B_NBILL = 'Billable'.
APPEND T_FINAL.
SORT T_DATA BY ROW COL.
LOOP AT T_DATA.
CASE T_DATA-COL.
WHEN 3.
T_DATA1-RESOURCE = T_DATA-VALUE.
WHEN 4.
T_DATA1-DATE = T_DATA-VALUE.
WHEN 5.
T_DATA1-DURATION = T_DATA-VALUE.
WHEN 6.
t_data1-activity = t_data-value.
WHEN 7.
T_DATA1-B_NBILL = T_DATA-VALUE.
ENDCASE.
AT END OF ROW.
COLLECT T_DATA1.
ENDAT.
ENDLOOP.
LOOP AT T_DATA1.
T_FINAL-RESOURCE = T_DATA1-RESOURCE.
T_FINAL-DATE = T_DATA1-DATE.
T_FINAL-DURATION = T_DATA1-DURATION.
T_FINAL-ACTIVITY = T_DATA1-ACTIVITY.
T_FINAL-B_NBILL = T_DATA1-B_NBILL.
APPEND T_FINAL.
ENDLOOP.
ENDFORM. " process_data
*& Form get_filename
FORM GET_FILENAME CHANGING P_FILENAME.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = SPACE
DEF_PATH = P_FILENAME
MASK = ',. ,..'
MODE = 'O' " O = Open, S = Save
TITLE = BOX_TITLE
IMPORTING
FILENAME = P_FILENAME
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
CASE SY-SUBRC.
WHEN 1.
MESSAGE I999 WITH
'File selector not available on this windows system'(046).
WHEN 2.
MESSAGE E999 WITH
'Frontend function cannot be executed in background'(047).
WHEN 3.
MESSAGE I999 WITH 'Selection was cancelled'(048).
WHEN 4.
MESSAGE E999 WITH 'Communication error'(049).
WHEN 5.
MESSAGE E999 WITH 'Other error'(050).
ENDCASE.
ENDFORM. " get_filename
<b>Kindly Reward points if you found the reply helpful.</b>
Cheers,
CHAITANYA.

Similar Messages

  • Need to read a field from flat file

    Hi All,
        In flat file i have  one field which may contain 100 enteries separated by delimanator ',' (comma).  There can be 1 , 10 or 100 enteries.   I need to put them in the internal table . Please suggest me .
        I have used the below logic .
    i split the field in 100 variables and then appending the internal table . the problem here is even if there is only one entry , the logic will append 99 blank enteries .  so can any one suggest , is there any other way do it . any Functon Modules available .
    Thanks.

    Hi Chetan,
    If i understand your requirement it is as below,
    Flat file.
    1,2,3,4,5,6,7,8,9,....
    1,2,3,4,5,6,7,8,9,....
    1,,,,,,,,,,,,,,,,,,,,
    Now you read the first line and split into an itab of type string, and you are worried about the third line where not all the fields have values and end up creating blank entries. to fix this, simply
    Sort the Itab, and use delete itab statement with the where clause as where column is ''.
    This should solve it.
    types: begin of t_data,
                line type string,
               end of data.
    data: li_file_line type standard table of t_data.
    split l_file_line at ',' into li_file_line.
    delete li_file_line where line = ''.

  • Selecting fields for flat file input

    I've built a scenario that uses the File adapter to load a flat file into SAP and fully understand the concepts. My problem is that I have fixed length file I need to load which has 50+ fields per row. I only need 10 fields per row and those fields are spread throughout the row. Using fieldFixedlengths I specify the length of each field - and it appears they must be consecutive fields. How can I specify the fields that I need.
    For example my input file may be as follows
    AAAAAAABBBBBBBCCCCCCCDDDDDDEEEEEEE
    I only need AAAAAAA CCCCCCC and EEEEEEE. Is there a way to do this?

    Hi Robert,
    I don't know why you want to upload all junk data there apart from importing only relevent fields. if i am concered to do so, i'll do this in outside the XI BOX. If that file is in come fixed format or lets say its in csv format, just open that file into excel and then try to remove the row you don't want and then save it again to the same file format. and then import and map inside XI it will be simple.
    Also if you don't wanna to do this, then tell us what logic you wanna use to find which rows you don't want. I don't think if you are not sure or you already know what rows/fields u want.
    Regards
    Aashish Sinha
    PS : reward points if helpful

  • Could not find the fields in Flat file, But able to see the fields in receiver Communcication channel

    Hi All,
    My scenario is Proxy to file, After testing my scenario the flatfile is getting generated without any errors.
    I can able to see all the fields in receiver communication channel payload. But some fields are missing in flatfile which is generated after conversion.
    This is my structure below
    Record
    ---Header
          a
          b
          e
          g
    ---Trailer
          c
          d
    ---Details
          e
          f
    And here is my content  conversion below
    Header.fieldFixedLengths   2,4,6,7
    Header.endSeparator         'nl'
    Trailer.fieldFixedLengths     3,5
    Trailer.endSeparator           'nl'
    Details.fieldFixedLengths    6,7
    Details.endSeparator          'nl'
    Actually in header there are nearly 34 fields, I can able to see all the 34 fields in reciever CC, But in generated flat file I can able to see only first 30 fields remaing 4 are missing in flat file.
    it is like in the above structure In Header there are a,b,e,g fields.I am getting a, b fields e and f are missing in flatfile.
    Thanks in advance.
    Please suggest me the solution.
    Thanks & Regards,
    Satish

    Hi Satish
    As you said 4 fields values are missing out of 34. Are those fields values are coming as blank in the file or not at all coming.
    Ex:
    you have 4 fields a,b,e,g and in channels you have defined length as 2,4,6,7
    If values for fields a,b,e,g are coming as 1,22,33,44444 respectively then the flat file is generated as
    1-22--33----4444--- (Consider - as space here)
    Now if you say e and g value then is the flat file generated as
    1-22---------------
    or
    1-22--
    Regards
    Osman

  • Short dump while reading a currency field from Flat file into internal tabl

    Hi,
    I am getting a short dump........saying number conversion dump (while reading a currency value into field in internal table from a fixed lenght flat file).........
    Do I need to use a string variable to get the value from flat file or how ??
    Please suggest.

    Santosh,
    Thanks for your inputs,
    But my internal table type is of DEC (5,2) , I am getting that... it needs to be of type 'C'. Can you suggest.
    Ex :
    MOVE wa_temp-infile_string+106(8)  TO wa_item-QT_PERCENT
    This didnt work
    so i tried moving into a seperate variable
    MOVE wa_temp-infile_string+106(8)  TO v_percent.
    and then write to
    WRITE v_percent to  wa_item-QT_PERCENT.

  • Flat files are not getting generated in ftp

    Hi Expers
    In my scenario,R/3 system is sending IDOC's to FTP(POS) server,but issue was occured in generating the flat files for 3 articles.
    Can anybody please tell me the steps how to resolve this issue...
    Regards
    Raj

    Hi Ramesh,
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--
    Request Message Mapping
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="MAPPING">GENERIC</SAP:Code>
      <SAP:P1>com/sap/xi/tf/_IXRIMandPriceToGMStore_</SAP:P1>
      <SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException</SAP:P2>
      <SAP:P3>RuntimeException in Message-Mapping transformatio~</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>com/sap/xi/tf/_IXRIMandPriceToGMStore_com.sap.aii.utilxi.misc.api.BaseRuntimeExceptionRuntimeException in Message-Mapping transformatio~</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    This is the error message i am getting in Moni...Could u please suggest me in this..
    Regards
    Raj

  • Mapping problem - trying to map lowerlevel field to flat file

    Dear experts,
    I have a rpoblem mapping my data.
    my input-xml looks like this:
    . orderheader
    ...orderdetail (1..n)
    .....delivery header (1..n)
    .......delivery detail (1..n)
    .........invoice header (always max 1 per delivery detail)
    ...........invoice detail (always max 1 per invoiceheader)
    .......delivery detail
    etc
    I have a flat file as output which looks like this
    . RECORD
    ...ORDERNR
    ...ORDERPOSITION
    ...DELIVERYNUMBER
    ...DELIVERYPOSITION
    ...INVOICENUMBER
    ...INVOICEPOSITION
    If there are 2 invoicelines in the input xml, the outputfile should contain 2 records with all same data except invoiceposition. For each delivery-detail line a line in the outputfile must be created. So I mapped "deliverydetail" to RECORD. No problems here.
    Further I mapped invoicenumber (within the invoice header tag) to INVOICENUMBER.
    But when for instance deliverydetail 1 and 2 don't have an invoice, and deliverydetail 3 does, I see this invoicenumber not in record 3 but in record 1. Record 2 and 3 contain no invoicenumber.
    What am I doing wrong here?
    Thanks in advance,
    William

    Hi William,
    One header has multiple items, so here you have to use the oneAsMany node function.
    first input for oneasmany node function is Invoice number and 2nd and 3rd input is InvoiceDetail node.
    Regards
    Ramesh

  • The starting quote marks at the end of a line in my epub file are separated from the words quoted.

    The starting quote marks at the end of a line in my epub file are routinely separated from the word quoted which appears on the next line. The formatting contractor accurance.com who prepared this epub file tells me that this is a feature of Adobe Digital Edition 2.0 and that there is nothing they can do to correct this. Are they correct, or else how can this problem be overcome?

    I'm not sure about buying css style sheets. 
    You don't need one for each book; if you want to have a series of books all with the same general format,
    then they should all use the same style sheet on a given device, but maybe different style sheets for different devices.
    All the books will then have one consistent look on a given device, and a different consistent look on another device.
    ADE only runs on PCs and Macs.  There are lots of different ereader software apps out there for running on different devices.
    For a dedicated device, you are stuck with the reader the device provides.
    For tablets you can download different ereader apps, for example Bluefire (my favourite, ios, Android), Aldiko (android) and DReader and DL Reader (windows RT).
    I don't know if the readers/apps are derived from the same root as ADE in any way and likely to show similar bugs.
    If it is not DRM, you should certainly try on Calibre, which is the most popular (free) ereader app for computers.
    If you care to create a very short non DRM extract (complete with css) and post it somewhere on the web I'll have a quick look.
    If you have inclination to get more involved yourself,
    there is free software called sigil (https://code.google.com/p/sigil/) that will help you get off the ground and experiment.

  • Ignore unwanted field in flat file

    Hi experts,
    If I am loading a flat file but one of the field has to be ignored. Do I need to add it in Datasource and not map in transformation.

    You would need to add the field to the DataSource, so that reading the Flat File in would be correct. From that point forward, there would be no need to map it to target InfoProviders.
    Edited by: Dennis Scoville on Nov 4, 2009 12:28 PM

  • Field in Flat File DataSource

    I created a Flat File DataSource.
    In the DataSource, I enetered InfoObject 0OUTAGTARGT in the Fields tab ->InfoObject Template column. I want this InfoObject to be mapped
    into field KTWRT (Target Value) in R/3 table EKKO.
    However, when I enter the the InfoObject 0OUTAGTARGT and hit Enter key, system prompts me to copy the properties. I choose Copy.
    And then it says:
    Reference field 0DER_CURR was added automatically.
    Now I have ORDER_CURR entered in the Field column, with InfoObject Template 0ORDER_CURR.
    In the Field column, I replaced the field ORDER_CURR with WAERS (Currency field from R/3).
    When I save it, I hit the following:
    Missing currency field / unit field ORDER_CURR
    System expect the field ORDER_CURR to be entered in the Field column. But in my source file, there is no field call
    ORDER_CURR. It is actually WAERS.
    How can I overcome this?

    Maintain 0ORDER_CURR as it is needed by 0OUTAGTARGT.
    Next, simply map WAERS to the ORDER_CURR field.
    But it doesnt allow me to change. In DataSource ->Fields tab, I try to replaced the field ORDER_CURR with WAERS. When I click on Activate, I
    hit the following:
    Missing currency field / unit field ORDER_CURR
    Please help.

  • Date field in flat file

    I ve date filed in flat file, like this
    5/5/2007  12:00:00 AM
    1/1/2007  12:00:00 AM
    HOW could i take above date characteristic in my time dimension.
    I m new to bw.
    thanks
    KS

    Hi,
    The date format should be YYYYMMDD in flat file.
    IF the date format is not the above mentioned way, then you can change setting.
    Going to System in Menu
    System->User Profile->Own data.
    Under Owndata you can change the date format to your requirement.
    Check the below link also for detain info of coding:
    Mandatory for Date field
    Reg
    Pra

  • Download dynpro fields to flat file

    Hi,
    I have a requirement to capture the value of fields like customer, job name and functional location from a service notification (IW51-create/ IW52- change/ IW53 - display) and download them to a flat file.
    As it is a common requirement for create, change and display of service notification, placing the user exit for reading the required data, upon save, will not be the best option.
    Can someone suggest a better way to do this?
    Thanks,
    Rugmani.

    Hi,
    You can use dynp_values_read fn module to get all values during runtime.
    DATA : l_progname TYPE sy-repid,
          l_dynnum TYPE sy-dynnr.
    DATA : dynpread_tab LIKE STANDARD TABLE OF dynpread WITH HEADER LINE.
      l_progname = sy-repid.
      l_dynnum = sy-dynnr.
      CLEAR dynpread_tab.
      REFRESH dynpread_tab.
      dynpread_tab-fieldname = 'fieldname'.
      APPEND dynpread_tab. " apped all the fields in this table for which u want to get all the values at runtime.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname               = l_progname
          dynumb               = l_dynnum
        TABLES
          dynpfields           = dynpread_tab
        EXCEPTIONS
          invalid_abapworkarea = 1
          invalid_dynprofield  = 2
          invalid_dynproname   = 3
          invalid_dynpronummer = 4
          invalid_request      = 5
          no_fielddescription  = 6
          invalid_parameter    = 7
          undefind_error       = 8
          double_conversion    = 9
          stepl_not_found      = 10
          OTHERS               = 11.
      IF sy-subrc <> 0.
      ENDIF.
    dynpread_tab-fieldvalue will get the value of the field.
    Once you get all the values - use GUI_Download fn module to download them to a flat file.
    Award me points if it helps.
    Thanks,
    Sheel

  • Loading Date fields from flat file to Oracle tables

    Hi,
    I have a flat file with a few date columns. I have given the format for the date field while creating the data store for the flat file. The format I used is 'YYYY-MM-DD'.
    But I get an error when I execute it after associating the module with LKM & IKM.
    The error message is as follows:
    org.apache.bsf.BSFException: exception from Jython: Traceback (innermost last):
    File "<string>", line 3, in ?
    OS command has signalled errors
    Can anyone help me out.
    Thanks

    At the time of DataStore creation. You take that date field as string.
    After this, in interface, when you map this date field with table field. You should use CONVERT(<field name>,DATE) in expression editor.

  • Reading data from a serialized file(Data is in special characters &symbols)

    Please help me.... I struck up at reading data in a serialized file. It is a text file with some special characters. My question is - Is it a real serialized file or some bad file? If it a real good one please tell me which method i have to use to read? Actually i have to read records with time stamps from this file and have to do some calculations on them.
    FILE CONTENTS :
    &not;&iacute; sr java.util.ArrayListx&Ograve;^TM^&Ccedil;a I sizexp w sr *com.progress.recruitment.test.email.Record&uml;&fnof;&ugrave;~&lsaquo;6 I aI bI cI dI idI timexp                  sq ~                      &yen;&curren;sq ~            
    &Ucirc;sq ~ g&Ograve;sq ~ 5&aacute;sq ~ E.x

    It looks like it might contain serialized Java objects, since it contains Java class names. Have you tried reading it as such to see what happens?
    Or are you asking how to do that? In which case why not just start with the code in the Java serialization tutorial and go from there?
    Or did you not know there was such a tutorial? Google keywords: "java serialization tutorial".

  • Rename Files while uploading, having special characters in File Name.

    Hello Forum,
    In our SharePoint environment, we are having many document library. Our users regularly uploads files to the documents library. As SharePoint doesn't allow to use "&"  character in file name, it'll throw an exception regarding the file
    name.
    Now what I needed is :
    Is there any way to remove "&" character while uploading files? Can we replace "&" with any other character while uploading files.
    If is there any paid solution available, leave comment.
    Thanks in Advance.

    You have to change the folder/file names before hand then upload them to Sharepoint.
    here is the script which will scan the files/folder and find the special charaters and fix for you.
    http://get-spscripts.com/2011/11/use-powershell-to-check-for-illegal.html
    Courtesy :Waqas
    Sarwar(MCSE 2013)
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

Maybe you are looking for