‎2008 Jun 24 12:59 AM
Hi,
I want to create a delivery from sales order using 'Submit'.
Is this a correct program? What needs to be populated in the table rspar_tab? Please provide your input.
data: rspar_tab TYPE TABLE OF rsparams.
SUBMIT SAPMV50A USING SELECTION-SCREEN '4001'
with selection-table rspar_tab.
Thanks in advance.
‎2008 Jun 24 1:08 AM
Hi Krishen,
Why dont u try using the BAPI.
You can use the BAPI BAPI_DELIVERYPROCESSING_EXEC.
Check this sample code..
PARAMETERS: p_vbeln LIKE vbak-vbeln.
DATA: BEGIN OF t_vbap OCCURS 0,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
kwmeng LIKE vbap-kwmeng,
matnr LIKE vbap-matnr,
werks LIKE vbap-werks,
END OF t_vbap.
DATA: t_request TYPE STANDARD TABLE OF bapideliciousrequest WITH HEADER LINE.
DATA: t_created TYPE STANDARD TABLE OF bapideliciouscreateditems WITH HEADER LINE.
DATA: t_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
SELECT vbeln posnr kwmeng matnr werks
INTO TABLE t_vbap
FROM vbap
WHERE vbeln = p_vbeln.
LOOP AT t_vbap.
t_request-document_numb = t_vbap-vbeln.
t_request-document_item = t_vbap-posnr.
t_request-quantity_sales_uom = t_vbap-kwmeng.
t_request-id = 1.
t_request-document_type = 'A'.
t_request-delivery_date = sy-datum.
t_request-material = t_vbap-matnr.
t_request-plant = t_vbap-werks.
t_request-date = sy-datum.
t_request-goods_issue_date = sy-datum.
t_request-goods_issue_time = sy-uzeit.
APPEND t_request.
ENDLOOP.
CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
TABLES
request = t_request
createditems = t_created
return = t_return.
READ TABLE t_return WITH KEY type = 'E'.
IF sy-subrc = 0.
MESSAGE e208(00) WITH 'Delivery creation error'.
ENDIF.
COMMIT WORK.
READ TABLE t_created INDEX 1.
Write: / 'Delivery ', t_created-document_numb.
‎2008 Jun 24 1:12 AM
Thank u very much, Raj!
But I am looking for the one with 'Submit'.
‎2008 Jun 24 6:57 AM
Hai Krishen!!
First go and check the table RSPARAMS in the transaction SE11 to know the fields in
it. The syntax of SUBMIT according to your requirement goes like this :
SUBMIT... [VIA SELECTION-SCREEN]
[WITH SELECTION-TABLE <rspar>].
I think this helps you.
Regards,
Swapna.
‎2008 Jun 24 2:51 PM
Thanks for your suggestions. I shall try that. Is there anyway that we can capture error messages with this 'Submit' statement. For ex: if the creation of delivery fails for any reason, how to capture those error messages like we do in BDC?
Experts, any helpful ideas appreciated.
Thanks.