Skip to Content
avatar image
Former Member

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

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

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

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

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 19, 2016 at 06:57 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 19, 2016 at 03:30 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 20, 2016 at 05:28 AM

    Try it manually in ME22N and report what message you get

    Add comment
    10|10000 characters needed characters exceeded