Skip to Content
author's profile photo Former Member
Former Member

Date format

Hi,

I have an application which makes a call to a BAPI.

The input parameter for this BAPI is date.

The date in Webdynpro is of the format MM/dd/yyyy,

whereas in ABAP it is yyyymmdd.

Due to this my application is unable to make the right call.

Can anyone tell me how I can change the format from MM/dd/yyyy to yyyymmdd?

I have tried using Simpledateformat. But this returns a a value of type String, while I need to pass the value of type Date only.

Can anyone help me out?

(I have browsed through the other posts but in vain)

Thanks and Regards

Reena

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 15, 2005 at 02:06 PM

    Hi Reena,

    As per my experience, there is NO need to convert the format of the date from mm/dd/yyyy to yyyy,mm,dd while passing it to a BAPI. Web dynpro takes care of automatically converting the value into the required fromat.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 15, 2005 at 02:49 PM

    Hi,

    Please award points if u found my answer as helpful.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Prakash,

      dt = simpD.parse(date.getDate()"-"(date.getMonth()1)"-"(1900date.getYear()));

      Parse() takes a 'date' type as an argument. But what you have mentioned is in the 'string' format. Also the getDate(), getMonth(), and getYear() methods are deprecated and I cannot use them.

      Any other solution?

      Thanks in Advance

      Reena

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2005 at 04:42 AM

    Hi Reena,

    Can you confirm one thing :

    when you import the RFC, what is the data type for that particular entry. What I mean is when you write the code :

    <BAPI>_Input input = new <BAPI>_Input();

    <b>input.set<date_attribute_name>();</b>

    Please check what is the datatype of the parameter that this method is expecting.

    I ask this because, normally when you have date at the R/3 side, you can bind that to an attribute of type 'date' in webdynpro. Then when you enter a date in webdynpro and call the BAPI, the conversion is internally handled. And as far as I know, we cannot change the format in which a 'date' attribute stores it's value. We can only extract the value stored in a particular format.

    So, if your setter method is expecting a date in webdynpro, you can set it to a any normal date attribute. And if it is expecting a string, you very well know how to handle it 😊

    Hope this helps,

    Best regards,

    Nibu.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Reena,

      There is absolutely nothing wrong in what you are doing. If the data type in R/3 is 'DATS', it will be converted to 'Date' in webdynpro and you are setting it properly. When you execute this BAPI from WD, the conversion from 'MM/DD/YYYY' to 'YYYYMMDD' takes place internally.

      So you can be almost sure that the error is noth with the date format 😊

      Best Regards,

      Nibu.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.