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

Material availability date cannot be in past Error

tharu
Contributor
0 Likes
4,671

Dear All Gurus,

In my program I am using the BAPI 'SD_SALESDOCUMENT_CREATE'reate sales orders But I am getting an errro message 'Material availability date cannot be in past ' and the Document is not saved.

Below is my Code

..........................

        WA_SALES_SCHEDULES_IN-ITM_NUMBER = ITEM.

        WA_SALES_SCHEDULES_IN-REQ_DATE = SY-DATUM.

        WA_SALES_SCHEDULES_IN-REQ_QTY = WA_INT_LINES-REQUEST_QTY.
        INSERT WA_SALES_SCHEDULES_IN INTO TABLE SALES_SCHEDULES_IN.

        WA_ITEMS_IN-ITM_NUMBER = ITEM.

        WA_ITEMS_IN-ITEM_CATEG = 'TAD'.

        CLEAR: IT_MARA. REFRESH: IT_MARA.

        SELECT MATNR FROM MARA INTO TABLE IT_MARA WHERE MATNR = WA_ITEMS_IN-MATERIAL AND EXTWG = 'T077'.

        IF SY-SUBRC EQ 0.

        IS_VALUE = 'Y'.

        ENDIF.

        WA_ITEMS_IN-PO_ITM_NO = WA_INT_LINES-ITEM_ID.

        INSERT WA_ITEMS_IN INTO TABLE ITEMS_IN.

      CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
        EXPORTING
          SALES_HEADER_IN     = WA_HEADER_IN
        IMPORTING
          SALESDOCUMENT_EX    = DOCUMENT_EX
        TABLES
          RETURN              = RETURN
          SALES_ITEMS_IN      = ITEMS_IN
          SALES_PARTNERS      = PARTNERS
          SALES_SCHEDULES_IN  = SALES_SCHEDULES_IN
          SALES_CONDITIONS_IN = CONDITIONS_IN.

      COMMIT WORK AND WAIT.

3 REPLIES 3
Read only

former_member189779
Active Contributor
0 Likes
2,320

Hi,

Here what I think:

You are passing WA_SALES_SCHEDULES_IN-REQ_DATE = SY-DATUM. So if the delivery date for order is today then considering picking packing transportation time for perticular  material it should be avialable may be 2 days back and system tries to determine avialbility date in past as backward scheduling.

Try changing this date to say 4-5 days in future and check if it works. If yes may be ask functional consultant how to pass this date?

Read only

Former Member
0 Likes
2,320

Hi,

I would recommend not to pass req_date at all . Leave it blank and try.

Priya.

Read only

Former Member
0 Likes
2,320

Hi,

    We had similiar issue and resolved by removing duplicate schedule lines.