09-08-2008 2:49 PM
09-08-2008 4:44 PM
It seems there is an enhancement is going on in SDN. My reply got posted these many times:-)
Thanks,
Vinod.
09-08-2008 4:12 PM
Hi Hari .
1. the Reason Why it is not passing Billing document number is you have to give PID of VBELN .
SET Parameter ID 'AUN' Field OBJECT-KEY.
Call Transaction 'VA02' and SKIP FIRST SCREEN.
SET Parameter ID 'FAKSK' Field '02'.
but here you can not Pass value for FAKSK as there is No PID for the field .
2. The solution for your issue is Use BDC . Please find the code .
include bdcrecx1.
START-OF-SELECTION .
perform open_group.
perform bdc_dynpro using 'SAPMV45A' '0102'.
perform bdc_field using 'BDC_CURSOR'
'VBAK-VBELN'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'VBAK-VBELN'
OBJECT-KEY . " VBELN Value
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'SICH'.
perform bdc_field using 'VBAK-FAKSK'
'02'.
perform bdc_dynpro using 'SAPLSPO2' '0101'.
perform bdc_field using 'BDC_OKCODE'
'SICH'.
perform bdc_transaction using 'VA02'.
perform close_group.
Please test and do if any minor modifications needed .
thanks
Sreenivas Reddy
Edited by: Sreenivas Reddy Dommata on Sep 8, 2008 5:12 PM
09-08-2008 4:36 PM
Hi Hari,
SET parameter ID only sets the value to an input field. It wont saves to the database. More over i don't find any parameter ID for billing block in VA02.(May be because it is a drop down).
Use BAPI BAPI_SALESORDER_CHANGE Pass the sales order number, ORDER_HEADER_IN-BILL_BLOCK = ur blocking code, ORDER_HEADER_INX-BILL_BLOCK = X.
After calling the BAPI call BAPI_TRANSACTION_COMMIT.
Above procedure is to programativally.
If u want to do it manually then directly open VA02 and change the billing block and save.
I dont think we can set parameter ID for billing block
Thanks,
Vinod.
09-08-2008 4:38 PM
Hi Hari,
SET parameter ID only sets the value to an input field. It wont saves to the database. More over i don't find any parameter ID for billing block in VA02.(May be because it is a drop down).
Use BAPI BAPI_SALESORDER_CHANGE Pass the sales order number, ORDER_HEADER_IN-BILL_BLOCK = ur blocking code, ORDER_HEADER_INX-BILL_BLOCK = X.
After calling the BAPI call BAPI_TRANSACTION_COMMIT.
Above procedure is to programativally.
If u want to do it manually then directly open VA02 and change the billing block and save.
I dont think we can set parameter ID for billing block
Thanks,
Vinod.
09-08-2008 4:38 PM
Hi Hari,
SET parameter ID only sets the value to an input field. It wont saves to the database. More over i don't find any parameter ID for billing block in VA02.(May be because it is a drop down).
Use BAPI BAPI_SALESORDER_CHANGE Pass the sales order number, ORDER_HEADER_IN-BILL_BLOCK = ur blocking code, ORDER_HEADER_INX-BILL_BLOCK = X.
After calling the BAPI call BAPI_TRANSACTION_COMMIT.
Above procedure is to programativally.
If u want to do it manually then directly open VA02 and change the billing block and save.
I dont think we can set parameter ID for billing block
Thanks,
Vinod.
09-08-2008 4:44 PM
It seems there is an enhancement is going on in SDN. My reply got posted these many times:-)
Thanks,
Vinod.
09-09-2008 10:47 AM
Vinodh,
U solved a big issue of mine u really deserve as many points as possible.Thanks a lot. But plz suggest me will the same bapi work for Contract ans scheduling Aggrement.
Regards,
Hari
Edited by: hari on Sep 9, 2008 3:18 PM
09-08-2008 4:56 PM
Hi Hari,
You can follow the call transaction batch input processing approach.
Check the code below
DATA: bdcdata_wa TYPE bdcdata,
bdcdata_tab TYPE TABLE OF bdcdata.
DATA opt TYPE ctu_params.
CLEAR bdcdata_wa.
bdcdata_wa-program = 'SAPMV45A'. "SAPLSEOD
bdcdata_wa-dynpro = '0102'.
bdcdata_wa-dynbegin = 'X'.
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'BDC_CURSOR'.
bdcdata_wa-fval = 'VBAK-VBELN'.
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'VBAK-VBELN'.
bdcdata_wa-fval = '3'. " Document number
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'BDC_OKCODE'.
bdcdata_wa-fval = space.
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-program = 'SAPMV45A'. "SAPLSEOD
bdcdata_wa-dynpro = '4001'.
bdcdata_wa-dynbegin = 'X'.
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'BDC_CURSOR'.
bdcdata_wa-fval = 'VBAK-FAKSK'.
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'VBAK-FAKSK'.
bdcdata_wa-fval = '02'.
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'BDC_OKCODE'.
bdcdata_wa-fval = 'SAVE'. " Find the ok_code for SAVE
APPEND bdcdata_wa TO bdcdata_tab.
opt-dismode = 'E'.
opt-defsize = 'X'.
CALL TRANSACTION 'VA02' USING bdcdata_tab OPTIONS FROM opt.
Hope this helps.
Regards,
Kinshuk
09-08-2008 10:17 PM
hari, it is not clear from any of your posts whether the requirement is to apply the billing block (by the way, workflow has nothing to do with this part) while saving the document or you need to identify the existing documents and then modify all of them.
In the 1st case you need to use a user exit MV45AFZZ, only not the USEREXIT_FIELD_MODIFICATION, as suggested, but most likely USEREXIT_SAVE_DOCUMENT_PREPARE, because not all the conditions might be available in earlier user exits.
In the 2nd case you'll need to write a program to identify the orders and then call BAPI_SALESORDER_CHANGE and BAPI_TRANSACTION_COMMIT to apply the billing block. You'll find numerous examples for this BAPI here on SDN. I would strongly suggest not to use BDC (CALL TRANSACTION ... ) since I know for the fact that BAPI will work just fine. This will save you some headache when it comes to the next upgrade.
P.S. Please avoid creating duplicate posts, as this is confusing to those who post replies and to those who might be later searching for the same information.