Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

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

Former Member
0 Kudos
1,165

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.

4 REPLIES 4
Read only

Former Member
604

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

Read only

RaymondGiuseppi
Active Contributor
0 Kudos
604

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

Read only

Former Member
0 Kudos
604

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.

Read only

JL23
Active Contributor
0 Kudos
604

Try it manually in ME22N and report what message you get