on 09-01-2010 4:44 AM
In the sales order, we have main item and sub-items. The main item is a project item and it has a billing plan which gets copied from the project. Now the requirement is to copy the same billing plan(of the mainitem) to all its subitems- billing dates, billing type, billing rule, date category, percentage of the amount to be billed, etc. So that when we do billing for this sales order all the items and its sub items are copied in the milestone billing document.
The billing plan is not at header level since the sales order can have multiple project items and their milestones can differ.
Please suggest how to acheive this- coping of billing plan details from main item to all the subitems.
Rds,
sucmsss
I have a question.
You have items and sub-items.
which item is relevant for biling and which is not. Is the main item relevant for billing, you need not have billing plans at sub items. If it is otherway, main item need not have billing plan. You should not have billing plan both for main item and sub item.
In PS terms, the sub item also should ideally have the same WBS element as the main item. But same WBS element cannot have different milestones for different sales order items. If it is there, it is contradictory.
Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use the enhancement section in include mv45af0f_fplan_aktualisieren_c. In the below code, I am copying milestone lines from previous document, but you could adapt to copy from the higher level item. Copy and pretty print it in ABAP editor.
ENHANCEMENT 10 ZSD_SALES_DOC1. "active version * Generate Billing Plan without dialog. * Because copy control does not work with milestone billing plans, we need to perform the below tricks.
DATA: zlt_fplt TYPE TABLE OF fpltvb, zlt_fpla TYPE TABLE OF fplavb, zlv_fareg TYPE tfpla-fareg, zlv_fplnr TYPE fplnr, zls_vbkd TYPE vbkd. FIELD-SYMBOLS:TYPE vbkdvb, TYPE fplavb, TYPE fpltvb, TYPE fpltvb.
IF xvbkd-updkz = chari AND tvap-fpart IS NOT INITIAL AND * xfplt[] IS INITIAL AND vbkd-fplnr IS INITIAL AND "bill plan not created vbak-vbtyp CA 'CG'. "contracts and orders SELECT SINGLE fareg FROM tfpla INTO zlv_fareg WHERE fpart = tvap-fpart. IF zlv_fareg IS NOT INITIAL AND zlv_fareg <> '6'. READ TABLE cvbkd ASSIGNINGWITH KEY vbeln = vbap-vgbel posnr = vbap-vgpos. IF sy-subrc IS INITIAL. CALL FUNCTION 'BILLING_SCHEDULE_READ' EXPORTING fplnr =-fplnr tables ZFPLA = zlt_fpla zfplt = zlt_fplt. * Check if any of the lines are not periodic and not from milestone before proceeding. READ TABLE zlt_fplt ASSIGNINGWITH KEY MLSTN = abap_false nfdat = 0. IF sy-subrc IS INITIAL. CONCATENATE '$000' vbap-posnr INTO zlv_fplnr. ENDIF. ENDIF. IF sy-subrc IS INITIAL. LOOP AT zlt_fplt ASSIGNINGWHERE mlstn = abap_false. -fplnr = zlv_fplnr. APPENDTO xfplt. -updkz = chari. ENDLOOP. LOOP AT zlt_fpla ASSIGNING. -fplnr = zlv_fplnr. CLEAR-vbeln. -updkz = chari. APPENDTO xfpla. ENDLOOP. da_fplnr =-fplnr. ENDIF. ENDIF. ENDIF. CALL FUNCTION 'BILLING_SCHEDULE_GENERATE' EXPORTING I_FKDAT = VBKD-FKDAT I_FPLNR = DA_FPLNR I_WAERS = VBAK-WAERK I_FPART = TVAP-FPART I_VEDA = XVEDA I_VEDA_KOPF = VEDAVB I_UPD_FPLA = UPD_FPLA I_UPD_FPLT = UPD_FPLT I_KOMK = TKOMK I_KOMP = TKOMP I_KOMPAX = KOMPAX I_FKREL = VBAP-FKREL I_CREATE_DATES = US_FLG_CREATE_DATES I_KFPLAN = DA_KFPLAN I_KFPLNR = DA_KFPLNR I_NOMSG = US_NOMSG I_ABSAGEN = DA_ABSAGEN I_FPLAA = FPLAA IMPORTING E_FPLNR = XVBKD-FPLNR E_DATALOSS = DA_DATALOSS E_UPD_FPLA = UPD_FPLA E_UPD_FPLT = UPD_FPLT E_KOMPAX = KOMPAX TABLES FPLA_NEW = XFPLA FPLA_OLD = YFPLA FPLT_NEW = XFPLT FPLT_OLD = YFPLT I_FPLTS = TFPLTS I_FPLTNP = TFPLTNP I_KOMV = XKOMV I_TKOMK = TKOMK I_SVBAP = UVBAP. LOOP AT zlt_fplt ASSIGNING. READ TABLE xfplt ASSIGNINGWITH KEY mandt =-mandt fplnr =-fplnr fpltr =-fpltr. CHECK sy-subrc IS INITIAL. -updkz = chari. ENDLOOP. ENDENHANCEMENT.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.