Facing Problem in parsing a string to date

Hi,
I was trying to change a string into date with date format ("EEEE,MMM,d,h:mm") but I always get the year as 1970.
here is my code
String strDate="Saturday,Jan 19 7:31";
String dateFormat3="EEEE,MMM,d,h:mm";
     try {
     DateFormat myDateFormat = new SimpleDateFormat(dateFormat3);
     result1=myDateFormat.parse(strDate);
catch(ParseException pe) {
            System.out.println("ERROR: could not parse date in string \"" +
        }any solution for it.

This is my actual code
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class TestingDate {
      * @param args
     public static void main(String[] args) {
          // TODO Auto-generated method stub
          String dateFormat="EEEE, MMM d h:mm a";
          Date test=new Date(2007,0,19, 19, 31);
          System.out.println(" original date is "+test);
          String stringResult=DateToString(test,dateFormat);
          System.out.println("Date to string is "+stringResult);
          Date dateResult=stringToDate(stringResult,dateFormat);
          System.out.println(" String to date is "+dateResult);
          String stringResult2=DateToString(dateResult,dateFormat);
          System.out.println(" Date to string  is "+stringResult2);
public static String DateToString(Date test, String dateFormat) {
         String result = null;
         try {
              DateFormat myDateFormat = new SimpleDateFormat(dateFormat);
                 result = myDateFormat.format(test);
                 //System.out.println(" reslut date is "+result);
          } catch (Exception e) {
               System.out.println(" Exception is "+e);
          return result;
public static Date stringToDate(String strDate,String dateFormat1){
     Date result1=null;
     try {
          DateFormat myDateFormat = new SimpleDateFormat(dateFormat1);
          result1=myDateFormat.parse(strDate);
     catch(Exception e){
          System.out.println(" exception is "+e);
     return result1;
}I am facing problem in getting the actual date. Please suggest the solution.

Similar Messages

  • Problem in converting the String to Date with time zone GMT

    Hi,
    When I tried to convert the string 12/05/2009 to Date, the time zone is set to BST.On the other hand, for the date 12/12/2009, the time zone is set to GMT. What should I do to get the time zone as GMT all the time.?
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
    String dateString = "12/05/2009";
    System.out.println(myDate.toString());

    I think you are all missing the point. java.util.Date objects always alway always store the date as the number of milliseconds since 1/1/1970 UTC so the only TimeZone they have its the implicit UTC. When you use the Date.toString() method the toString() method gets the default time zone from your environment and formats the data accordingly. This means that the same Date object will, by default, produce a different result for France and Australia and the US.
    So, if you have the date "12/5/2009" as a String then to convert it to a java.util.Date you must specify what TimeZone is implied. If it is your system time zone then you can just create a SimpleDateFormat object with the correct format and then use the parse() method to create the java.util.Date object and this will automatically be converted to UTC. If the date String represents some other time zone then you must explicitly set the time zone of the SimpleDateFormat object before parsing the string.
    The same approach applies when converting a java.util.Date object to a String. If you want anything other than your system time zone then you must explicitly tell the SimpleDateFormat what time zone you want the result formatted for.

  • Date contructor deprecation : Parsing a String to Date

    Hi All,
    In Java 1.5 the Date() constructor Date(String s) is deprecated. As per the API Documentation DateFormat.Parse() method is used.
    The following code from Java 1.4 version has to be upgraded to Java 1.5.
    Existing Code:
    Date dDate = new Date(sDate);
    Modified Code:
    DateFormat df = DateFormat.getDateInstance();
    Date dDate = df.parse(sDate);
    Here the DateFormat accepts a default formatting style as "Feb 01, 2007" and parses the String.
    If the String sDate belongs to any other formatting style such as "01 Feb, 2007" or "01 Feb, 07" the code piece throws unparsable date error.
    Please give your thougts on this issue to parse the string of any format..
    Thanks,
    Rajesh.

    Hi All,
    In Java 1.5 the Date() constructor Date(String s) is
    deprecated. As per the API Documentation
    DateFormat.Parse() method is used.
    The following code from Java 1.4 version has to be
    upgraded to Java 1.5.
    Existing Code:
    Date dDate = new Date(sDate);
    Modified Code:
    DateFormat df = DateFormat.getDateInstance();
    Date dDate = df.parse(sDate);
    Here the DateFormat accepts a default formatting
    style as "Feb 01, 2007" and parses the String.
    If the String sDate belongs to any other formatting
    style such as "01 Feb, 2007" or "01 Feb, 07" the code
    piece throws unparsable date error.
    Please give your thougts on this issue to parse the
    string of any format..You can't. What date is this: "08/04/24"? 8 April, 1924? 4 August, 2024?
    >
    Thanks,
    Rajesh.

  • Double.parseDouble(String) : Problem to parse large String

    Hello,
    I need to convert A String to a Double in my application without rounding of digits.
    I have used the Double.parseDouble(String) method.
    The maximum string length can be 17 including dot(.)
    So if my String is (of length 17)
    Eg.
    S= �9999999999.999999� then I am getting the double value as
    d= 9999999999.999998(compare the last digit)
    If s = �9999999999.111111� then d = 9999999999.111110
    If s = �9999999999.555555� then d = 9999999999.555555 (result that I want)
    If s = �9999999999.666666� then d = 9999999999.666666 (result that I want)
    If s = �9999999999.777777� then d = 9999999999.777777 (result that I want)
    If s = �9999999999.888888� then d = 9999999999.888887
    If s = �9999999999.999999� then d = 9999999999.999998
    If s = �9123456789.123456� then d = 9123456789.123456
    But string length up to 16 is giving me the accurate result
    So any body can explain me that why it is happening? And how can i get the accurate result.
    Thanks in advanced.

    Hi,
    Thank You for your suggestion. By which i can store
    the big double number in Data base , but at some
    point i require to parse a double value from a Double
    reference.In that case if the Decimal value length
    => 16 then it the last digit changes or rounds.
    coverting 9999999999.999999 Decimal value to double
    value. It gives me 9999999999.999998 and
    9999999999.9999999 gives me the 10000000000.0000000.
    but the Double value 999999999.999999 is ok
    and 999999999.99999999 rounds.Err, is there a follow up question in there?

  • Parsing from string to date object

    How can I convert a time in String format to a Date object?
    ie. 14:30:05(String) to 14:30:05

    How about this?
    String sDate = "14:30:05";
    StringTokenizer tokenizer = new StringTokenizer(sDate, ":");
    Calendar calendar = new Calendar();
    int hour = Integer.parseInt(tokenizer.nextToken());
    int minute = Integer.parseInt(tokenizer.nextToken());
    int second = Integer.parseInt(tokenizer.nextToken());
    calendar.set(Calendar.HOUR_OF_DAY, int hour);
    calendar.set(Calendar.MINUTE, int minute);
    calendar.set(Calendar.SECOND, int second);
    Date dDate = calendar.getTime();I didn't try it, but it should be pretty close (unless you want to use deprecated methods, then it can be shorter...)

  • Problem in  Converting String to Date

    Hi All,
    I am having one String
    String date = "2006-01-17 15:19:57.0"
    I want to parse this String into Date object.
    I will really appriciate if somebody helps me out.
    Thanks.

    You're specifying a 'T' and a timezone in your format, but they're not present in the string you're parsing.
    I'm assuming from the way you're printing out the date, that your thinking is along these lines: "sdfInput will parse the input string, no matter what format it's in, and will produce a Date object. That Date object wil have the format specified in sdfInput."
    This is wrong on a couple of fronts:
    1) DateFormat doesn't magically figure out what format it's supposed to use for the String it's parse()ing. The String has to match the DF's format.
    2) Dates don't have formats. Only Strings do. A Date object is just a long. There's no relationship whatsoever between the Date that you get from parse() and the format that was used to produce it. When you print out a Date as you're doing, its toString method is called, which in turn uses a default format for your Locale.
    If you want to turn a date string in one format into a date string in another format, use two different DateFormat objects with two different formats. Date date = df1.parse(inputString);
    String outputString = df2.format(date);

  • Problems parsing a string

    Hi,
    I'm having a problem with parsing a string. Basically, I want to take a string for example: "TomWentToTheShop" and divide it into a coherent sentence (Tom went to the shop).
    I've started the code by breaking the string into a char array, and if the character is a capital then store the index in the array and then do a substring.
    But I don't think this is the best way to solve the problem, if anyone has any ideas it would be greatly appreciated.
    thanks.
    char[] charRequestTypeArray = string.toCharArray();
    for (int i = 1; i < (charRequestTypeArray.length -1); i++) {
    char c = charRequestTypeArray;
    if (Character.isUpperCase(c)) {
    Arrays.fill(storeCapitalIndex, i);
    else{
    Arrays.fill(storeNonCapitalIndex, i);

            String s = "TomWentToTheShop";
            System.out.println(s.charAt(0) + s.substring(1).replaceAll("((?<!^)[A-Z])", " $1").toLowerCase());or even just        System.out.println(s.charAt(0) + s.substring(1).replaceAll("([A-Z])", " $1").toLowerCase());Edited by: sabre150 on Nov 11, 2007 9:40 PM

  • How to parse string to date with defualt format?

    is there any possibilities to parse a string to date if we don't specify the format in SDF?
    In database we have different formats and we need to convert each one convert to date with common format(something like default), is there any possibilities to do in java?

    jwenting wrote:
    Tolls wrote:
    ColinAtWork wrote:
    SumantK wrote:
    In database we have different formats and we need to convert each one convert to date with common format(something like default), is there any possibilities to do in java?Why don't you store the date in the database as a DATE datatype then you can format anyway you like??Because some people seem to fear DATEs and prefer the supposed comforts of a VARCHAR2...after all, who knows what murky goings on occur with a DATE, but at least a VARCHAR2 is readable, or something like that anyway.Just because some people don't know how to work with DATE fields (which is the real reason for their "fear" doesn't mean you shouldn't use them.
    They're the appopriate solution, so use it.Often but not always true.
    For example neither MS SQL Server nor Oracle timestamp types will store the resolution capable with the Java Date type. So if one wants to maintain all of that resolution one requires either a varchar or two columns.
    And although I haven't been able to confirm it (recently at least) at one time one of the Oracle drivers had a bug that a timestamp would wipe out following columns. For that one either one was left with having only a single timestamp as the last column or using a varchar.

  • Problem in Coverting XML String into Document

    Hi,
    I am getting some problem while parsing a String XML in to Document object.
    CODE :
    public static Document converDocument(String xml){
    DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = null;
    try {
    builder = factory.newDocumentBuilder();
    } catch (ParserConfigurationException e) {
    e.printStackTrace();
    Document document = null;
    try {
    document = builder.parse(new InputSource(new StringReader(xml)));
    System.out.println("Document is after parsing ====>>>"+document);
    } catch (SAXException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    return document;
    The xml which I am passing is :
    <?xml version="1.0" encoding="UTF-8"?>
    <note>
    <to>Tove</to>
    <from>Jani</from>
    <heading>Reminder</heading>
    <body>abc</body>
    </note>
    It is giving the document as null;
    Can anybody please help?
    Regards,
    sheeetal.

    >
    Vikas Sridharan wrote:

    >       CALL TRANSFORMATION ('ID')
    >       SOURCE XML = lv_output_str "<============ ERRONEOUS = HERE
    >       RESULT ref = <fst_dyn_table> .
    >
    Remove the "=" sign, this code will work :
          CALL TRANSFORMATION ('ID')
          SOURCE XML lv_output_str
          RESULT ref = <fst_dyn_table> .

  • Problem in Uploading sales order text data using LSMW

    Hi All,
    I am facing Problem in uploading open sales order data from legacy to SAP using LSMW.
    We are trying to upload sales order data using LSMW Standard Batch/Direct input using program name RVINVB10 and program type D. We are not able to upload item text but have no problem in uploading remaining data.
    the details we are passing to BTEXHKOM structure are......
    BTEXHKOM-OLDNR = IHEADER-OLDORD_NO.
    BTEXHKOM-LAISO = 'EN'.
    BTEXHKOM-TDID = 'Z009'.
    and the for structure BTEXLKOM
    BTEXLKOM-OLDNR = IHEADER-OLDORD_NO.
    BTEXLKOM-TXPARGRAPH = '/'.
    CONCATENATE LITEM-DEPTID LITEM-DEPTNAME
    INTO BTEXLKOM-TXLINE SEPARATED BY ' '.
    we have three input source structures.
    IHEADER Header structure
    LITEM Line item structure ( Material data )
    IPARTN Partners structure
    The structure relationships are
    BTEXHKOM <<< IHEADER.
    BTEXLKOM <<< IHEADER.
    Please let me know if I am doing some thing wrong or some thing else need to be done.
    Thanks,
    Chindam.

    you can pass below values also
    OLDNR         :  order number and item nuber
    TXPARGRAPH  : VBBK
    TXLINE        : your text.....

  • Problem with Emailing the Internal table data as an excel attachment

    Hi Friends,
    I am facing problem with Emailing an internal table data as an excel file. I am using standard function module "SO_NEW_DOCUMENT_ATT_SEND_API1" which is using SOLI structure can have record with 255 character length. But my Internal table having each record means after concatenating all the fields it is going to be morethan 450 characters. so i t is not displaying all the data in excel file.
    Can somebody help me if there is any other function module or any other way that i need to follow.
    thanks for help
    venkat.

    You must use the the :
    CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB as a field seperator and
    CL_ABAP_CHAR_UTILITIES=>CR_LF as a record seperator.
    Check this example:
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
    Regards,
    Naimesh Patel

  • Problem in parsing date having Chinese character when dateformat is 'MMM'

    I m calling jsp page using following code:
    var ratewin = window.showModalDialog("Details.jsp?startDate="+startDate,window, dlgSettings );
    In my javascript when checked by adding alerts I m getting correct values before passing to jsp,
    alert("startDate:"+startDate);
    In jsp page my code is like below:
    String startDate = request.getParameter("startDate");     
    but here I m getting garbage values in month when the dateformat is 'MMM', because of which date parsing is failing.
    This happens only Chinese character.
    following 2 encoding are already in my jsp page,can anyone help to find solution?
         <%@ page pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
         <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"/>
    I have even tried to read it as UTF-8 but still that's failing.

    This is my actual code
    import java.text.DateFormat;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import java.util.Locale;
    public class TestingDate {
          * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              String dateFormat="EEEE, MMM d h:mm a";
              Date test=new Date(2007,0,19, 19, 31);
              System.out.println(" original date is "+test);
              String stringResult=DateToString(test,dateFormat);
              System.out.println("Date to string is "+stringResult);
              Date dateResult=stringToDate(stringResult,dateFormat);
              System.out.println(" String to date is "+dateResult);
              String stringResult2=DateToString(dateResult,dateFormat);
              System.out.println(" Date to string  is "+stringResult2);
    public static String DateToString(Date test, String dateFormat) {
             String result = null;
             try {
                  DateFormat myDateFormat = new SimpleDateFormat(dateFormat);
                     result = myDateFormat.format(test);
                     //System.out.println(" reslut date is "+result);
              } catch (Exception e) {
                   System.out.println(" Exception is "+e);
              return result;
    public static Date stringToDate(String strDate,String dateFormat1){
         Date result1=null;
         try {
              DateFormat myDateFormat = new SimpleDateFormat(dateFormat1);
              result1=myDateFormat.parse(strDate);
         catch(Exception e){
              System.out.println(" exception is "+e);
         return result1;
    }I am facing problem in getting the actual date. Please suggest the solution.

  • Facing problem during uploadation of Routing data using CA01-BDC - URGENT

    Dear All,
    When I am trying to upload Routing data using CA01 in the Table Control scenario, then I am facing problem as my last 2 records are not getting uploaded from my Test file.
    For example, I am having 47 records in my Test File and after setting ‘Default size’ parameters (to avoid screen resolution problem)
    I have 15 table control line items data per page. The Page down logic ('=P+') is working fine, but my below BDC code failed to take
    the remainder last 2 records from the Test File.
    Analysis: When I am running my “Call Transaction” bdc in foreground, then the 1st page down occurs after 15th record, 2nd page down occurs after 29th record( as in Table Control 1st page’s 15th record is coming on the Top of 2nd page). 3rd page down occurs after 43rd record
    (as 2nd page’s 29th record is coming on the top of 3rd page). In the 4th Table Control Page 43rd record of previous page is coming on top, and then it’s taking 44th & 45th records from the Test File and then it is triggering SAVE (=BU). Thus, our last 2 records
    (i.e. 46th, 47th record) are not getting uploaded in the routing screen from our Test File.
    If anybody has encountered this scenario previously, please help me URGENTLY in fixing the bugs here. It’s VERY, VERY URGENT…
    FYI. For others 45 successful records already uploaded, all the screen fields values are coming properly in the routing screen, and here there is no issue.
    Thanks very much…
    Thanks & Regards
    Sudipta – Project Lead
    Volvo Client Location
    I am pasting my BDC source code below:
    REPORT ZRT1_UPLOAD_CA01_F
                           NO STANDARD PAGE HEADING
                           LINE-SIZE 255.
                            I N C L U D E S                              *
    Include for Data Declarations
    INCLUDE zrout_top.
    Include for Forms
    INCLUDE zrout_form.
    INCLUDE zrout_include_f_ca01.
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR <field>
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    Attaching F4 help with filename
      PERFORM F1001_GET_F4.
               S T A R T   -   O F  -  S E L E C T I O N                 *
    START-OF-SELECTION.
    Perform to read the input file
      PERFORM f_read_file.
    Perform to fill the BDC data
      PERFORM f_fill_bdctab.
                   E N D   -   O F  -  S E L E C T I O N                 *
    END-OF-SELECTION.
      FREE: i_bdcdata,
            i_messtab,
            i_record.
    x----
    *&  Include           ZROUT_TOP                                        *
                      D A T A B A S E    T A B L E S                     *
    TABLES: t100.          "Messages
                    D A T A    D E C L A R A T I O N S                   *
    T A B L E    T Y P E S *****************************
    For input data
    TYPES: BEGIN OF ty_record,
            matnr(18),  "Material Number
            werks(4),   "Plant
            verwe(3),   "Usage
            statu(3),   "Status
            arbpl(8),   "Work Center
            steus(4),   "Control Key
            ltxa1(40),  "Description of Operation
            bmsch(13),  "Base Quantity
            meinh(3),   "Unit of Measure
            vgw01(11),  "Machine
            vge01(3),   "Unit of measure of activity
          END OF ty_record.
    I N T E R N A L    T A B L E S ***********************
    Internal Table for input file name
    DATA: i_file_tab  TYPE STANDARD TABLE OF sdokpath   INITIAL SIZE 0.
    Internal Table for BDC Data
    DATA: i_bdcdata   TYPE STANDARD TABLE OF bdcdata    INITIAL SIZE 0.
    Internal Table for BDC Messages
    DATA: i_messtab   TYPE STANDARD TABLE OF bdcmsgcoll INITIAL SIZE 0.
    Internal Table for Input file
    DATA: i_record TYPE STANDARD TABLE OF ty_record INITIAL SIZE 0.
    W O R K      A R E A S *************************
    Work Area for input file name
    DATA: wa_file_tab LIKE sdokpath.
    Work Area for BDC Data
    DATA: wa_bdcdata LIKE bdcdata.
    Work Area for BDC Messages
    DATA: wa_messtab LIKE bdcmsgcoll.
    Work Area for Input file
    DATA: wa_record TYPE ty_record.
    V A R I A B L E S ****************************
    DATA: v_filename TYPE string,
          v_fnam(40) TYPE c.
    DATA: wa_opt TYPE ctu_params.
    C O N S T A N T S ***************************
    CONSTANTS: c_werks TYPE rc27m-werks VALUE 'tp',
               c_steus TYPE plpod-steus VALUE 'PP01'.
    *Selection Screen.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETERS:
              Input file name
                P_FILE TYPE rlgrap-filename OBLIGATORY. " DEFAULT 'C:\'.
    SELECTION-SCREEN END OF BLOCK B1.
    x----
    *&  Include           ZROUT_FORM                                       *
    *&      Form  f_fill_bdctab
          Form to fill the BDC Data
    FORM f_fill_bdctab.
      TABLES mapl.          "Assignment of Task Lists to Materials
      DATA: l_cnt_item(3)  TYPE n VALUE 1.    "Line item counter
      DATA: first(3)  TYPE n VALUE 16.    "Line item counter
      DATA: next(3)  TYPE n .    "Line item counter
      DATA: lin(3) TYPE n .    "Line item counter
      DATA: l_v_bmsch(13),   "Base qty
            l_v_meinh(3),    "Unit of Measure
            l_v_vgw01(11),   "Machine
            l_v_vgw02(11),   "Labour
            l_v_vge01(3).    "Unit of measure of activity
      DATA l_v_nextline TYPE sy-tabix.
      DATA wa_temp TYPE ty_record.
        Initialize Counter
          l_cnt_item = 1.
      SORT i_record BY matnr.
      LOOP AT i_record INTO wa_record.
    AT NEW matnr.
        REFRESH: i_bdcdata,
                 i_messtab.
        SET PARAMETER ID 'PLN' FIELD space.
        SET PARAMETER ID 'PAL' FIELD space.
        PERFORM f_bdc_dynpro      USING 'SAPLCPDI' '1010'.
        PERFORM f_bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
      Material Number
        PERFORM f_bdc_field       USING 'RC27M-MATNR'
                                        wa_record-matnr.
       Plant
        PERFORM f_bdc_field       USING 'RC27M-WERKS'
                                        c_werks.
        PERFORM f_bdc_field       USING 'RC271-PLNNR'
      Check if routing already exits for the material
        SELECT * FROM mapl
                      INTO mapl
                                WHERE matnr EQ wa_record-matnr
                                  AND werks EQ c_werks
                                  AND plnty EQ 'N'.
          IF sy-subrc EQ 0.
            PERFORM f_bdc_dynpro      USING 'SAPLCPDI' '1200'.
            PERFORM f_bdc_field       USING 'BDC_OKCODE'
                                            '=ANLG  '.
          ENDIF.
        ENDSELECT.
        perform f_bdc_dynpro      USING 'SAPLCPDA' '1200'.
        perform f_bdc_field       USING 'BDC_OKCODE'
                                  '=VOUE'.
    Group Counter
        perform f_bdc_field       USING 'PLKOD-PLNAL'
      Usage
        PERFORM f_bdc_field       USING 'PLKOD-VERWE'
                                        '1'.
      Status
        PERFORM f_bdc_field       USING 'PLKOD-STATU'
                                        '4'.
    ENDAT.
        PERFORM f_bdc_dynpro      USING 'SAPLCPDI' '1400'.
      Check if page is full
        IF l_cnt_item EQ '16'.
        Page down
          PERFORM f_bdc_field       USING 'BDC_OKCODE'
                                               '=P+'.
          l_cnt_item = 1.
    ELSE.
    PERFORM f_bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    ENDIF.
       CLEAR v_fnam.
      Populate item level details
    Work Center
        CONCATENATE 'PLPOD-ARBPL(' l_cnt_item ')' INTO v_fnam.
        PERFORM f_bdc_field       USING v_fnam
                                        wa_record-arbpl.
      Control Key
        CONCATENATE 'PLPOD-STEUS(' l_cnt_item ')' INTO v_fnam.
        PERFORM f_bdc_field       USING v_fnam
                                        c_steus.
      Description of Operation
        CONCATENATE 'PLPOD-LTXA1(' l_cnt_item ')' INTO v_fnam.
        PERFORM f_bdc_field       USING v_fnam
                                        wa_record-ltxa1.
      Base Quantity
        CONCATENATE 'PLPOD-BMSCH(' l_cnt_item ')' INTO v_fnam.
        PERFORM f_bdc_field       USING v_fnam
                                        wa_record-bmsch.
      Unit of Measure
        CONCATENATE 'PLPOD-MEINH(' l_cnt_item ')' INTO v_fnam.
        PERFORM f_bdc_field       USING v_fnam
                                        wa_record-meinh.
      Machine
        CONCATENATE 'PLPOD-VGW01(' l_cnt_item ')' INTO v_fnam.
        PERFORM f_bdc_field       USING v_fnam
                                        wa_record-vgw01.
      Labour
       CONCATENATE 'PLPOD-VGW02(' l_cnt_item ')' INTO v_fnam.
       PERFORM f_bdc_field       USING v_fnam
                                       wa_record-vgw02.
      Unit of measure of activity
        CONCATENATE 'PLPOD-VGE01(' l_cnt_item ')' INTO v_fnam.
        PERFORM f_bdc_field       USING v_fnam
                                        wa_record-vge01.
          l_cnt_item = l_cnt_item + 1.
       CLEAR wa_record.
    AT END OF matnr.
         PERFORM f_bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
          PERFORM f_bdc_field         USING 'BDC_OKCODE'
                                  '=BU'.
         wa_opt-DISMODE = 'A'.
         wa_opt-DEFSIZE = 'X'.
         wa_opt-UPDMODE = 'S'.
        PERFORM f_bdc_transaction USING 'CA01'.
       Initialize Counter
         l_cnt_item = 1.
    ENDAT.
      ENDLOOP.
    ENDFORM.                    " f_fill_bdctab
    x----
    *&  Include           ZROUT_INCLUDE_F_CA01                             *
    *&      Form  f_read_file
          Form to read the file from presentation server
    FORM f_read_file .
    To get the file name
      DATA l_v_file TYPE string.
    l_v_file = P_FILE.
    CALL FUNCTION 'GUI_UPLOAD'
          EXPORTING
            filename                = l_v_file
            filetype                = 'ASC'
            has_field_separator     = 'X'
          TABLES
            data_tab                = i_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.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    ENDIF.
    ENDFORM.                    " f_read_file
    *&      Form  f_bdc_dynpro
          Form to populate BDC Tab for new screen
         -->fp_program   Screen program name
         -->fp_dynpro    Screen Number
           Start new screen                                              *
    FORM f_bdc_dynpro USING fp_program fp_dynpro.
      CLEAR wa_bdcdata.
      wa_bdcdata-program  = fp_program.
      wa_bdcdata-dynpro   = fp_dynpro.
      wa_bdcdata-dynbegin = 'X'.
      APPEND wa_bdcdata TO i_bdcdata.
    ENDFORM.                    "f_bdc_dynpro
    *&      Form  f_bdc_field
           Insert field                                                  *
    FORM f_bdc_field USING fp_fnam fp_fval.
      IF NOT fp_fval IS INITIAL.
        CLEAR wa_bdcdata.
        wa_bdcdata-fnam = fp_fnam.
        wa_bdcdata-fval = fp_fval.
        APPEND wa_bdcdata TO i_bdcdata.
      ENDIF.
    ENDFORM.                    "f_bdc_field
    *&      Form  f_bdc_transaction
          Call transaction and error handling
         -->fp_tcode   Transaction code
    FORM f_bdc_transaction  USING fp_tcode.
      DATA: l_mstring(480),
            l_color         TYPE i,
            l_mode          TYPE c.
      REFRESH i_messtab.
    CALL TRANSACTION fp_tcode USING i_bdcdata
                       OPTIONS FROM wa_opt
                       MESSAGES INTO i_messtab.
    Messages during upload
      LOOP AT i_messtab INTO wa_messtab.
        CASE wa_messtab-msgtyp.
          WHEN 'S'.
            l_color = 5.
          WHEN 'E'.
            l_color = 6.
          WHEN 'W'.
            l_color = 3.
        ENDCASE.
        FORMAT COLOR = l_color.
        SELECT SINGLE * FROM t100 WHERE sprsl = wa_messtab-msgspra
                                  AND   arbgb = wa_messtab-msgid
                                  AND   msgnr = wa_messtab-msgnr.
        IF sy-subrc = 0.
          l_mstring = t100-text.
          IF l_mstring CS '&1'.
            REPLACE '&1' WITH wa_messtab-msgv1 INTO l_mstring.
            REPLACE '&2' WITH wa_messtab-msgv2 INTO l_mstring.
            REPLACE '&3' WITH wa_messtab-msgv3 INTO l_mstring.
            REPLACE '&4' WITH wa_messtab-msgv4 INTO l_mstring.
          ELSE.
            REPLACE '&' WITH wa_messtab-msgv1 INTO l_mstring.
            REPLACE '&' WITH wa_messtab-msgv2 INTO l_mstring.
            REPLACE '&' WITH wa_messtab-msgv3 INTO l_mstring.
            REPLACE '&' WITH wa_messtab-msgv4 INTO l_mstring.
          ENDIF.
          CONDENSE l_mstring.
          WRITE: / wa_messtab-msgtyp, l_mstring(250).
        ELSE.
          WRITE: / wa_messtab.
        ENDIF.
        FORMAT COLOR OFF.
      ENDLOOP.
      SKIP.
    ENDFORM.                    " f_bdc_transaction
    FORM F1001_GET_F4.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                PROGRAM_NAME  = SY-REPID
                DYNPRO_NUMBER = SY-DYNNR
                FIELD_NAME    = P_FILE
           CHANGING
                FILE_NAME     = P_FILE
           EXCEPTIONS
                MASK_TOO_LONG = 1
                OTHERS        = 2.
      IF SY-SUBRC <> 0.
      File is not selected
       MESSAGE I000 WITH TEXT-M01.
      ENDIF.
    ENDFORM.                    " F1001_GET_F4

    Sudipta,
    Would request you to post this to ABAP-Forum for Immediate response.
    I had this problem, but the ABAP guy did something to correct this...it was more of screen resoultion difference between the recorded system and uploading system. Please try to use the same system which was used to record and try.
    Regards,
    Prasobh

  • Smartform Problem in Displaying a string data

    Hi Friends,
                     I am facing a problem while displaying a string data in smartform. Actually it is a one of the field's data in an internal table. It is a STRING field type of length 0. While populating in an internal table it is having a all the data(Around 700 char data). But while displaying in a smartform surprizingly only few characters(Around 225 char data). How can i overcome this problem?
    Regards,
    Sekhar.J

    Hi
    try this and see
    Declare some Variables of 72 char each and split that long string data of internal table text field into them and display these variables strings one below other in smartform
    var1 = itab-text+0(72)
    var2 = itab-text+72(72)
    var3 = itab-text+144(72)
    like that
    and display one below other in smartform.
    &VAR1&
    &VAR2&
    &VAR3&
    Reward points for useful Answers
    Regards
    Anji

  • Is there a problem on the pattern of SimpleDateFormat to parse a String ?

    Hello,
    I tried to parse a String to a Date using a SimpleDateFormat.
    I must be able to have on the pattern something like : "yyyyMMdd_HH00".
    To get a String from a Date with SimpleDateFormat.format(Date date) it works well, but when a try to parse a String into a Date with SimpleDateFormat.parse(String date) I get a : java.text.ParseException: Unparseable date.
    I try it on a JVM 1.4 and 1.5 for the same result.
    An exemple of code :
              String pattern = "yyyyMMdd_HH00";
              SimpleDateFormat currentFormat = new SimpleDateFormat(pattern);
              Date date = currentFormat.parse("20091223_1000");It seems that adding the '00' after 'HH' raise the exception...
    Has the 'HH00' a particular meaning like on Oracle 'HH24' ?
    Is there a way to add number after the 'HH' ?
    Thanks
    Edit :
    Oh yeah, I forgot, I tryied to use the pattern "yyyyMMdd_HH'00'" using '' to escape the 00 without better result...
    Edited by: Jeremy.Antonucci on 23 déc. 2009 15:25

    The context of this pattern :
    To get a file on a http server, I must build an Url String with a filename using the current date.
    I want to be able to change easily the pattern on a file parameters.
    The date must be ending with 00 for the minutes.
    I may have use a pattern with 'HHmm' and suppress the minutes but if it is change on the futur the code will not work...
    As I can't say if in the futur the url will change for the date pattern or not, I decide to use a pattern like "yyyyMMdd_HH00" that works fine for everything else than parsing a string.
    I create a String date based on the current date on UTC using this pattern and keep it to use it to compose an Url String.
    After I need to know how much time I must sleep before the next execution (on each Hour), so I use this date +1 hour to see if the currentDate during this calculation is higher than this date+1... (I'm surely not clear, but it is not the real problem just for curious ^^)
    A dirty solution is to avoid this problem is to catch this case and do substitution on a temporary pattern of the 'HH00' with 'HHmm'. It's really dirty because nothing says that later a 'HH00' mean always 'HHmm' but I have nothing better...
              String pattern2 = pattern;
              if (pattern.matches(".*HH00$")) {
                   pattern2=pattern.substring(0, (pattern.length()-2))+"mm";
              }Where can I do this bug report ?
    Do you see a good solution ?

Maybe you are looking for

  • How do I move contacts from 1 address book to another?

    I have tried to "select" then drag and drop contacts from the Mac OS x address book, and vice versa, to the personal address book but nothing happens.

  • Freight to get from Info record in Standard Cost Estimate

    Hello I want the cost estimate to pick up the freight value/% from the condition type from the purchase info record. Iu2019ve created a costing variant which has the valuation variant set to u201CPrice from purchasing info recordu201D and the strateg

  • Windows 8.1 Pro will not boot after clean install!

    Hello all recently went from a Win7pro to Win8.1pro I did a clean install and formatted my HDD just last night. Woke up this morning my machine was turned off I had let it stay on this night as I was installing updates for it. So i turned on the comp

  • 24" iMac allows login but does not startup

    My login screen comes up and I log in with my username and password, the login dialog goes away but it does not continue to start up. It remains with the "starfield" background on the screen. I've also tried logging in with an admin account, but got

  • Pdf create problem

    i generate the pdf with tamil "latha.ttf" font for some values using FOP i connot get clear result anybody know please send related topic guide thanks with regards iyyadurai