We are using BAdI SD_BIL_DATA_TRANSFER to calculate a value for a custom field with data from a work package.
This is causing the billing document to not properly determine billing date (field is empty) and also the sales tax determination in the pricing procedure is not executed correctly (getting a 208 error)
I can add the billing date manually and when re-pricing the document, it determines sales tax correctly.
Any idea what causes this behaviour?
This is the code for the custom logic:
SELECT
SINGLE wbselementinternalid
FROM i_projectbillingelemententry AS ent
INNER JOIN i_projectbillingelemententrflw AS flw
ON flw~projbillgelmntentritmuuid = ent~projbillgelmntentritmuuid
WHERE flw~projectbillingrequest = @bil_doc_item-referencesddocument
AND flw~billingdocrequestitemreference = @bil_doc_item-referencesddocumentitem
INTO @DATA(lv_wbs) PRIVILEGED ACCESS.
SELECT
SINGLE yy1_monthlymax_cpd, yy1_quarterlymax_cpd, yy1_annualmax_cpd
FROM i_workpackage AS fnl
INNER JOIN i_wbselementbasicdata AS wbs
ON fnl~workpackage = wbs~wbselement
WHERE wbs~wbselementinternalid = @lv_wbs
INTO @DATA(ls_thresholds) PRIVILEGED ACCESS.
IF sy-subrc = 0.
IF bil_doc_item-billingquantity < ls_thresholds-yy1_monthlymax_cpd.
bil_doc_item_res-YY1_TOBEBILLED_QTY_BDI = '0'.
ELSE.
bil_doc_item_res-YY1_TOBEBILLED_QTY_BDI = bil_doc_item-billingquantity - ls_thresholds-yy1_monthlymax_cpd.
ENDIF.
bil_doc_item_res-YY1_TOBEBILLED_QTY_BDIU = bil_doc_item-BASEUNIT.
ENDIF.SELECT
SINGLE wbselementinternalid
FROM i_projectbillingelemententry AS ent
INNER JOIN i_projectbillingelemententrflw AS flw
ON flw~projbillgelmntentritmuuid = ent~projbillgelmntentritmuuid
WHERE flw~projectbillingrequest = @bil_doc_item-referencesddocument
AND flw~billingdocrequestitemreference = @bil_doc_item-referencesddocumentitem
INTO @DATA(lv_wbs) PRIVILEGED ACCESS.
SELECT
SINGLE yy1_monthlymax_cpd, yy1_quarterlymax_cpd, yy1_annualmax_cpd
FROM i_workpackage AS fnl
INNER JOIN i_wbselementbasicdata AS wbs
ON fnl~workpackage = wbs~wbselement
WHERE wbs~wbselementinternalid = @lv_wbs
INTO @DATA(ls_thresholds) PRIVILEGED ACCESS.
IF sy-subrc = 0.
IF bil_doc_item-billingquantity < ls_thresholds-yy1_monthlymax_cpd.
bil_doc_item_res-YY1_TOBEBILLED_QTY_BDI = '0'.
ELSE.
bil_doc_item_res-YY1_TOBEBILLED_QTY_BDI = bil_doc_item-billingquantity - ls_thresholds-yy1_monthlymax_cpd.
ENDIF.
bil_doc_item_res-YY1_TOBEBILLED_QTY_BDIU = bil_doc_item-BASEUNIT.
ENDIF.
Request clarification before answering.
Hi @MichaelNielsen,
This will not work for you, even though you might see there is a referencesddocument and referencesddocumentitem, but they are not yet persisted, just in memory, and even the i_projectbillingelemententrflw is still not saved.
Try to find another way, and you can usually only depend on the input, so you might not even see the billing quantities of other items.
It might be an option to save your temporary values in a custom table.
Thanks,
Arafat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 13 | |
| 13 | |
| 7 | |
| 7 | |
| 5 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.