cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Date In Bapi.

Former Member
0 Kudos

Hi,

My Scenario is Jdbc to Rfc ,The issue is by taking the values from the data base I need to update in hcm infotypes,But the issue is the infotype updation is totally depends up on Date  and It accepts only the format dd.mm.yyyy.While we are transforming the date in message mapping like dd.mm.yyyy

unparsable date eror was comming in Receiver communication channel.Even we tried changing the wsdl file date field as string and imported ,Even though the same error  was encountering can you please suggest the ways of an solution.

Accepted Solutions (0)

Answers (3)

Answers (3)

iaki_vila
Active Contributor
0 Kudos

Hi Venkata,

Are you sure the date format is "dd.MM.yyyy"?, it might be the date visualization in the ECC system.

Are you tried to pass the date with the format yyyyMMdd, for example?

Regards,

Former Member
0 Kudos

Hi,

We are doing date conversion as below.

In our case scenario is web service to IDOC.source field type date and target field type string.

Input date format is YYYY-MM-DD and target date format is YYYYMMDD.

When I/P date format is not valid then we are opening ZBAPIRET segment and populating text message .

Sorry not able to paste the screen shot

Regards

Venkat

Former Member
0 Kudos

dear venkat,

My simple concern is:

Take input date field replace '-' with empty space, then condense the element, you will get the target format.

as these two are strings you cannot use conversion exit FM.

regards

goudham

Former Member
0 Kudos

Hi,

Use the below re usable udf for date conversion.Modify it if you require any change.

In the below code for example if the input date is not valid we are opening ZBAPIRET segment and passing the failure info in message field.

public void dateValidationAndConversion(String[] inputDate, String[] inputDateFormat, String[] outputDateFormat, ResultList outputDate, ResultList error, Container container) throws StreamTransformationException{

SimpleDateFormat SDFInput = new SimpleDateFormat(inputDateFormat[0]);

SimpleDateFormat SDFOutputDate = new SimpleDateFormat(outputDateFormat[0]);

if(inputDate[0].length()==inputDateFormat[0].length()){

try{

    Date date = SDFInput.parse(inputDate[0]);

    outputDate.addValue(SDFOutputDate.format(date));

    error.addValue( "false");

}catch(Exception e)

{

    error.addValue("true");

    outputDate.addValue("");

}

}

else{

    error.addValue("true");

    outputDate.addValue("");

}

Cheers

Venkat

Former Member
0 Kudos

Hi Venkata,

You are getting error because you have fixed that filed as data-time format and dd.mm.yyyy format is not available in context of PI . And this is not standard date format , Only /,:,- are available as Date separator .

Make it as string and I  suggest you to write UDF to convert the date .

If you already done this with help of graphical function then just change it to string .

thanks and regards,

Anup Banerjee