2007 Jun 02 9:58 PM
Hi all!
my Z program has to pass delivery number to RV_INVOICE_CREATE in order to create debit / credit memo invoice, but before retrieving delivery number, post goods issue must have been done. Any ideas?
Reminding - sequency is like this:
1 Order 2 Delivery 3 Billing
Will award points.
Kind regards,
Mindaugas
2007 Jun 02 11:50 PM
Use FM for post goods issue WS_DELIVERY_UPDATE
2007 Jun 02 10:42 PM
Hi,
I worked on similar issue earlier, just try whether my solution will work for you or not ..
1) First check the table 'SHP_IDX_GDSI', to findout whether the PGI done for the delivery or not, The table SHP_IDX_GDSI will store all the deliveries for whose PGI not done.
2) If you are sure that PGI is not done for the delivery then, you can use the below logic, when order quantity is confirmed.
DATA: l_kostk TYPE vbuk-kostk."Picking
*If order quantity is picked completely
*Check the status of picking
SELECT SINGLE kostk FROM vbuk
INTO l_kostk
WHERE vbeln = w_del.
if l_kostk = c_charC.
f_flag2 = c_charx.
else.
clear f_flag2.
endif.
READ TABLE i_idoc_data WITH KEY segnam = c_e1edl18 INTO wa_idoc_data.
IF sy-subrc = 0.
MOVE wa_idoc_data-sdata TO wa_e1edl18.
If its completely delivered
IF f_flag2 = c_charx.
change the qulifier to PGI
wa_e1edl18-qualf = 'PGI'.
else.
clear wa_e1edl18-qualf.
endif.
MOVE wa_e1edl18 TO wa_idoc_data-sdata.
MODIFY i_idoc_data FROM wa_idoc_data
TRANSPORTING sdata WHERE segnam = c_e1edl18.
ENDIF.
CALL FUNCTION 'IDOC_INPUT_DELVRY'
EXPORTING
input_method = w_in_method
mass_processing = w_mass
TABLES
idoc_contrl = idoc_contrl
idoc_data = i_idoc_data
idoc_status = idoc_status
return_variables = return_variables
serialization_info = serialization_info.
Regards,
Donepudi.
Reward, if its helpful.
2007 Jun 02 11:50 PM
2007 Jun 03 12:05 PM
Thanks Seshu.
A few things still not clear: for example, I have orders in VBAK and deliveries in LIKP... what is the first step for posting goods issue? What info I must have before this step?
Probably at first I need to retrieve order and after to do PGI and after PGI to retrieve delivery nr and to create invoice?
BR, M.
2007 Jun 03 12:40 PM
First step is create sales order ( if you have sales order ) ,get the sales order from vbak,then create delivery then post goods issue,then billing document ?
what is your requirement ? do you want create complete cycle ..
Sales order -> Delivery ->post goods issue -> Billing document
Just let me know ,so that i will send you the complete Function module to all.
Thanks
Seshu
2007 Jun 03 1:15 PM
My case is this: XI is reading Excel file with info about orders: customer nr, material nr, invoiced price and so on.
As well XI creates orders with info from Excel file and my Z program has to create credit / debit memo invoices from those orders...
The sequence is ok:
Sales order -> Delivery ->post goods issue -> Billing document
So Z program has to take Sales order and to create Delivery, after to post goods issue and to create billing doc. If so, what is the key to take the order from VBAK ? I mean how program knows that current order was not proceeded before?
BR, M.
2007 Jun 03 1:36 PM
Just take sales order from vbak and pass ur sales order number to Delivery Function Module..
VBAK-VBELN ( sales order Number)
VBAP-VSTEL ( Shiiping point)
Date - give ur sy-datum to ur delivery Function Module
then pass delivery number to fm(Post goods issue ) then create Invoice ( RV_INVOICE_CREATE).
2007 Jun 03 2:05 PM
oki clear, thanks.
One more thing - let's say there are new orders in VBAK and if I run my program it will create invoices for all orders in VBAK... how to recognize that some orders are new and some are invoiced already (to skip invoiced orders)?
BR, M.
2007 Jun 03 2:08 PM
check with vbfa table ,give ur sales order ,it will giv you delivery number and also invoice nuber.
if it is available then do not proceed ..
2007 Jun 03 2:47 PM
2007 Jun 03 3:03 PM
use RV_DELIVERY_CREATE to create delivery or search bapi FM 'bapidelvcre*
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |