Skip to Content
0

BAPI PO Create Function fails to pass Blank/Space/Empty/NULL values to date Field in SAP

Dec 16, 2016 at 03:31 PM

122

avatar image
Former Member

I am trying to Create a PO using the .NET Connector (C#) (Version 3.3) in SAP.

Delivery date field is optional in SAP but when trying to pass Blank/Space/Empty/NULL it fails.

Below mentioned is the code that im using for the Optional Field(Date Field)

IRfcStructure POItemSchedule = rfcRepository.GetStructureMetadata("BAPIEKET").CreateStructure(); POItemSchedule.SetValue("DELIV_DATE", "0000-00-00");

...

...

//Connect and create PO in SAP

BAPI_PO_CREATE_FuncOBJ.Invoke(rfcDestination); BAPI_TRANSACTION_COMMITOBJ.SetValue("WAIT", "X"); BAPI_TRANSACTION_COMMITOBJ.Invoke(rfcDestination);

I tried passing the following values.

"0000-00-00"

"000-00-00"

" "

"0"

String.Empty &

DBNULL

When trying these I get the below errors

"Cannot Convert String into Date" Or "Please enter a valid delivery date"

Please advise if there are any ways to overcome this error and pass the NULL/Empty Value.

Thanks in Advance.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

avatar image
Former Member Dec 17, 2016 at 05:25 PM
1

Date in SAP is in format YYYYMMDD so try to pass for example '20161217'

Share
10 |10000 characters needed characters left characters exceeded
Raymond Giuseppi
Dec 19, 2016 at 06:57 AM
0

If you want to use an external data format you must also set field DEL_DATCAT_EXT to a non initial value, else use internal format YYYYMMDD.

Regards,
Raymond

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Dec 19, 2016 at 03:30 PM
0

Thank you for responding, I am able to save the date values. I need help on saving NULL/EMPTY in the Delivery Date Field as it is optional.

Share
10 |10000 characters needed characters left characters exceeded
Jürgen L Dec 20, 2016 at 05:28 AM
0

Try it manually in ME22N and report what message you get

Share
10 |10000 characters needed characters left characters exceeded