2008 Nov 19 6:54 AM
Hi all,
In one scenario,it's used SD_DOCUMENT_COPY_ONE_STEP to create documents .Is there any FM to find the newly created document number ?. See the code below
types: BEGIN OF ty_vbak,
vbeln TYPE vbeln_va,
auart TYPE vbak-auart,
vkorg TYPE vbak-vkorg,
vtweg TYPE vbak-vtweg,
END OF ty_vbak.
DATA :it_vbak TYPE TABLE OF ty_vbak,
wa_vbak type ty_vbak.
SELECT vbeln auart vkorg vtweg FROM vbak
INTO TABLE it_vbak WHERE erdat = sy-datum
AND auart IN ( <so doc types>).
LOOP AT it_vbak INTO wa_vbak.
CASE wa_vbak-auart.
WHEN gc_so_doc_type_1.
lv_auarn = gc_so_doc_type_10.
WHEN gc_so_doc_type_2.
lv_auarn = gc_so_doc_type_20.
ENDCASE.
CALL FUNCTION 'SD_DOCUMENT_COPY_ONE_STEP'
EXPORTING
i_auarn = lv_auarn
i_vbeln = wa_vbak-vbeln.
*find newly created doc no of type 10 or 20
SELECT vbeln
erdat
INTO TABLE it_vbeln_new_so
FROM vbak
WHERE auart = lv_auarn AND
erdat = sy-datum. .
ENDLOOP.
Instead of using SELECT query after 'SD_DOCUMENT_COPY_ONE_STEP', is there any FM to get the same as the select is not reccomended inside the LOOP.
Thanks and regards
Jijo
2008 Nov 19 7:10 AM
Hi,
Check
SD_SALESDOCUMENT_CREATE
BAPI_SALESORDER_CREATEFROMDAT2
2008 Nov 19 7:10 AM
Hi,
Check
SD_SALESDOCUMENT_CREATE
BAPI_SALESORDER_CREATEFROMDAT2
2008 Nov 19 7:15 AM
Hi,
The above FM used only to create sales orders with header and item details.
I used FMs.
BAPI_SALESORDER_GETLISTBOS Sales Order with BOS: List of all Orders for Cus
BS01_SALESORDER_GETDETAIL Sales Order: Display Order Data of Order
BS01_SALESORDER_GETLIST Sales Order: List of all Orders for Customer
But all are terminated with errors.
Thanks and regards
Jijo