cancel
Showing results for 
Search instead for 
Did you mean: 

Info on FM SD_SALES_DOC_CHECK_ATP for ATP Check

galindo
Explorer
0 Kudos

Hi,

I had a client requirement recently, asking for automatic ATP Check on a given sales order. They wanted to emulate the same functionality of the transaction VA02 and one time delivery, for instance.

I tried some methods, from batch input to old BAPIs on the system, then I came across this one: SD_SALES_DOC_CHECK_ATP and it worked perfectly! Exactly what I was looking for. I suppose this is a new FM, since the last modification on my client's S/4 environment is from 2017. And I couldn't find anything online about it.

My question is: after updating the ATP, I have to read the values on the VBBE table. On debugging, it works fine, but on background it doesn't. I made a common workaround using "WAIT" but I would like to know if there is another method to do it.

Here is my code:

CALL FUNCTION 'SD_SALES_DOC_CHECK_ATP'
  EXPORTING
    iv_vbeln              = <sales_doc_number>
*   it_posnr              = 
*   iv_atp_read_result    = 
*   iv_no_commit          =
*   iv_no_authority_check = 
  IMPORTING
    et_messages           = lt_messages.

READ TABLE lt_messages WITH KEY msgty = 'S' TRANSPORTING NO FIELDS.
IF sy-subrc = 0.

* Need to read VBBE values after updating
  WAIT UP TO <N> SECONDS.

* Confirmed Qty
  SELECT *
    INTO TABLE lt_vbbe
    FROM vbbe
    WHERE vbeln = <sales_doc_number>.

* Etc...

ENDIF.

What is the parameter IV_ATP_READ_RESULT used for? Intuitively, I thought I could use it to get an internal table as return, and then get the confirmed quantity straight after the FM calling, but it doesn't work like that. So I had to use the WAIT as a workaround to get the values on VBBE.

Does anyone know anything about this new FM?

Thank you

Accepted Solutions (0)

Answers (0)