Uploaded by anil.narad

Extensibility Billing Document Output

advertisement
Extensibility for Billing Document Printout
S/4 HANA Cloud
Table of Contents
1 Provide Purchase Order Date in Billing Document Output
1.1
Aim
4
4
1.2 Steps to do
1.2.1 Creation of an extension field at Billing Document
1.2.2 Extend the Form Template with the Extension Field
1.2.3 Creation of an extension logic
4
4
4
5
2 Provide Exchange Rate in Billing Document Output
7
2.1
Aim
2.2 Steps to do
2.2.1 Creation of an extension field at Billing Document
2.2.2 Extend the Form Template with the Extension Field
2.2.3 Creation of an extension logic
3 Provide Net Amount in Billing Document Output
3.1
Aim
7
7
7
8
8
10
10
3.2 Steps to do
3.2.1 Creation of an extension field at Billing Document
3.2.2 Extend the Form Template with the Extension Field
3.2.3 Creation of an extension logic
10
10
10
11
4 Provide Created On Date in Billing Document Output
13
4.1
Aim
4.2 Steps to do
4.2.1 Creation of an extension field at Billing Document
4.2.2 Extend the Form Template with the Extension Field
4.2.3 Creation of an extension logic
5 Provide Customer Material in Billing Document Output
5.1
Aim
13
13
13
13
14
16
16
5.2 Steps to do
5.2.1 Creation of an extension field at Billing Document Item
5.2.2 Extend the Form Template with the Extension Field
5.2.3 Creation of an extension logic
16
16
16
17
6 Provide Country Of Origin in Billing Document Output
19
6.1
Aim
19
6.2
Steps to do
19
6.2.1
6.2.2
6.2.3
Creation of an extension field at Billing Document Item
Extend the Form Template with the Extension Field
Creation of an extension logic
19
19
20
7 Provide Commodity Code in Billing Document Output
23
7.1
Aim
7.2 Steps to do
7.2.1 Creation of an extension field at Billing Document Item
7.2.2 Extend the Form Template with the Extension Field
7.2.3 Creation of an extension logic
8 Provide Tax Code in Billing Document Output
8.1
Aim
8.2 Steps to do
8.2.1 Creation of an extension field at Billing Document Item
8.2.2 Extend the Form Template with the Extension Field
8.2.3 Creation of an extension logic
9 Provide ATF License in Billing Document Output
9.1
Aim
9.2 Steps to do
9.2.1 Creation of an extension field at Billing Document Item
9.2.2 Extend the Form Template with the Extension Field
9.2.3 Creation of an extension logic
23
23
23
23
24
26
26
26
26
26
27
29
29
29
29
29
30
3
1
Provide Purchase Order Date in Billing Document Output
1.1
Aim
Show Purchase order date on Form Template Item of Billing Document.
1.2
1.2.1
Steps to do
Creation of an extension field at Billing Document
Use app Custom Fields and Logic, tab Custom Fields, in the Extensibility business catalog. Create a new
extension field in Business Context Billing Document with an appropriate Type.
This extension field is intended to store the Purchase Order Date with the Billing Document.
Remark: The extension field will only be filled when triggering the output request.
1.2.2
Extend the Form Template with the Extension Field
Within the same App Custom Fields and Logic and tab Custom Field enable the Form Templates for the
Billing Document with the extension field.
4
Save and publish the extension field.
1.2.3
Creation of an extension logic
Use app Custom Fields and Logic, tab Custom Logic, in the Extensibility business catalog. Create a new
Enhancement Implementation in Business Context Sales: Billing Document with Definition
Description Billing Standard Output Header Adaption and an appropriate Implementation
Description. In case the Enhancement Implementation already exist, this step can be skipped.
5
Add the following example code to the Draft:
*
This method can be used to set values for output to billing document header
extension fields.
billingdoc_extension_out = billingdoc_extension_in.
billingdocdescr_extension_out = billingdocdescr_extension_in.
*get SO number
select single salesdocument
from i_billingdocumentitem
into @data(lv_salesdocument)
where billingdocument = @billingdoc-billingdocument.
*get PO date
select single customerpurchaseorderdate
from i_salesdocument
into @billingdoc_extension_out-yy1_purchaseorderdate_bdh
where salesdocument = @lv_salesdocument.
Save and publish the extension Logic.
Remark: To see the new created extension field in the Billing Document Printout, it is necessary to create a new Form
Template.
6
2 Provide Exchange Rate in Billing Document Output
2.1
Aim
Show Exchange Rate on Form Template Item of Billing Document.
2.2
Steps to do
Note: The fields Absolut Accounting Exchange Rate and Accounting Exchange Rate Is Indirect Quotation
already exist in the Standard Form Data Provider in the Billing Document Node. Please verify if the data is
sufficient.
2.2.1
Creation of an extension field at Billing Document
Use app Custom Fields and Logic, tab Custom Fields, in the Extensibility business catalog. Create a new
extension field in Business Context Sales: Billing Document with an appropriate Type.
This extension field is intended to store the Exchange Rate with the Billing Document.
Remark: The extension field will only be filled when triggering the output request.
7
2.2.2
Extend the Form Template with the Extension Field
Within the same App Custom Fields and Logic and tab Custom Field extend the Form Templates for the
Billing Document with the extension field.
Save and publish the extension field.
2.2.3
Creation of an extension logic
Use app Custom Fields and Logic, tab Custom Logic, in the Extensibility business catalog. Create a new
Enhancement Implementation in Business Context Sales Billing Document with Definition Description
Billing Standard Output Header Adaption and an appropriate Implementation Description. In
case the Enhancement Implementation already exist, this step can be skipped.
8
Add the following example code to the Draft:
if billingdoc-transactioncurrency ne 'SGD'.
*get Exchange Rate
select single accountingexchangerate
from i_billingdocumentbasic
into @data(lv_exchangerate)
where billingdocument = @billingdoc-billingdocument.
if sy-subrc is initial.
billingdoc_extension_out-yy1_exchangerate_bdh = 1 / lv_exchangerate.
endif.
endif.
Save and publish the extension Logic.
Remark: To see the new created extension field in the Billing Document Printout, it is necessary to create a new Form
Template.
9
3 Provide Net Amount in Billing Document Output
3.1
Aim
Show Net Amount on Form Template Item of Billing Document.
3.2
3.2.1
Steps to do
Creation of an extension field at Billing Document
Use app Custom Fields and Logic, tab Custom Fields, in the Extensibility business catalog. Create a new
extension field in Business Context Sales: Billing Document with an appropriate Type.
This extension field is intended to store the Net Amount with the Billing Document.
Remark: The extension field will only be filled when triggering the output request.
3.2.2
Extend the Form Template with the Extension Field
Within the same App Custom Fields and Logic and tab Custom Field extend the Form Templates for the
billing document with the extension field.
10
Save and publish the extension field.
3.2.3
Creation of an extension logic
Use app Custom Fields and Logic, tab Custom Logic, in the Extensibility business catalog. Create a new
Enhancement Implementation in Business Context Sales: Billing Document with Definition
Description Billing Standard Output Header Adaption and an appropriate Implementation
Description. In case the Enhancement Implementation already exist, this step can be skipped.
11
Add the following example code to the Draft:
*set Net Amount
billingdoc_extension_out-yy1_netamount_bdh = billingdoc-totalnetamount.
Save and publish the extension Logic.
Remark: To see the new created extension field in the Billing Document Printout, it is necessary to create a new Form
Template.
12
4 Provide Created On Date in Billing Document Output
4.1
Aim
Show Created On Date on Form Template Item of Billing Document.
4.2
4.2.1
Steps to do
Creation of an extension field at Billing Document
Use app Custom Fields and Logic, tab Custom Fields, in the Extensibility business catalog. Create a new
extension field in Business Context Sales: Billing Document with an appropriate Type.
This extension field is intended to store the Created On Date with the billing document.
Remark: The extension field will only be filled when triggering the output request.
4.2.2
Extend the Form Template with the Extension Field
Within the same App Custom Fields and Logic and tab Custom Field extend the Form Templates for the
billing document with the extension field.
13
Save and publish the extension field.
4.2.3
Creation of an extension logic
Use app Custom Fields and Logic, tab Custom Logic, in the Extensibility business catalog. Create a new
Enhancement Implementation in Business Context Sales: Billing Document with Definition
Description Billing Standard Output Header Adaption and an appropriate Implementation
Description. In case the Enhancement Implementation already exist, this step can be skipped.
14
Add the following example code to the Draft.
*
First of all assign existing extension field values to output parameter:
billingdoc_extension_out = billingdoc_extension_in.
billingdoc_extension_out-yy1_created_on_date_bdh = billingdoc-creationdate.
Save and publish the extension Logic.
Remark: To see the new created extension field in the Billing Document Printout, it is necessary to create a new Form
Template.
15
5 Provide Customer Material in Billing Document Output
5.1
Aim
Show Customer Material on Form Template Item of Billing Document Item.
5.2
5.2.1
Steps to do
Creation of an extension field at Billing Document Item
Use app Custom Fields and Logic, tab Custom Fields, in the Extensibility business catalog. Create a new
extension field in Business Context Sales: Billing Document Item with an appropriate Type.
This extension field is intended to store the Customer Material with the Billing Document.
Remark: The extension field will only be filled when triggering the output request.
5.2.2
Extend the Form Template with the Extension Field
Within the same App Custom Fields and Logic and tab Custom Field extend the Form Templates for the
billing document with the extension field.
16
Save and publish the extension field.
5.2.3
Creation of an extension logic
Use app Custom Fields and Logic, tab Custom Logic, in the Extensibility business catalog. Create a new
Enhancement Implementation in Business Context Sales: Billing Document Item with Definition
Description Billing Standard Output Item Adaption and an appropriate Implementation
Description. In case the Enhancement Implementation already exist, this step can be skipped.
17
Add the following example code to the Draft:
*
This method can be used to set values for output to billing document item
extension fields.
billingdocitem_ext_out = billingdocitem_ext_in.
billingdocitemdescr_ext_out = billingdocitemdescr_ext_in.
*get Salesorganization and Distributionchannel
select single salesorganization, distributionchannel
from i_billingdocumentbasic
into (@data(lv_salesorganization), @data(lv_distributionchannel))
where billingdocument = @billingdocitem-billingdocument.
*get ‘Sold-To’ Customer
select single customer
from i_billingdocumentpartner
into @data(lv_customer)
where billingdocument = @billingdocitem-billingdocument and
partnerfunction = 'AG'.
*get Customer Material
select single materialbycustomer
from i_customermaterial
into @billingdocitem_ext_out-yy1_customermaterial_bdi
where salesorganization = @lv_salesorganization and
distributionchannel = @lv_distributionchannel and
customer = @lv_customer and
material = @billingdocitem-material.
Save and publish the extension Logic.
Remark: To see the new created extension field in the Billing Document Printout, it is necessary to create a new Form
Template.
18
6 Provide Country Of Origin in Billing Document Output
6.1
Aim
Show Country Of Origin on Form Template Item of Billing Document Item.
6.2
6.2.1
Steps to do
Creation of an extension field at Billing Document Item
Use app Custom Fields and Logic, tab Custom Fields, in the Extensibility business catalog. Create a new
extension field in Business Context Sales: Billing Document Item with an appropriate Type.
This extension field is intended to store the Country Of Origin with the Billing Document Item.
Remark: The extension field will only be filled when triggering the output request.
6.2.2
Extend the Form Template with the Extension Field
Within the same App Custom Fields and Logic and tab Custom Field extend the Form Templates for the
billing document with the extension field.
19
Save and publish the extension field.
6.2.3
Creation of an extension logic
Use app Custom Fields and Logic, tab Custom Logic, in the Extensibility business catalog. Create a new
Enhancement Implementation in Business Context Sales: Billing Document Item with Definition
Description Billing Standard Output Item Adaption and an appropriate Implementation
Description. In case the Enhancement Implementation already exist, this step can be skipped.
Add the following example code to the Draft:
20
6.2.3.1
Select Country of Origin from table MARC:
*
First of all assign existing extension field values to output parameter:
billingdocitem_ext_out = billingdocitem_ext_in.
billingdocitemdescr_ext_out = billingdocitemdescr_ext_in.
select single CountryOfOrigin from I_Productplant
WHERE product = @billingdocitem-Material and
plant = @billingdocitem-plant
into @billingdocitem_ext_out-YY1_country_of_origin_bdi.
Save and publish the extension Logic.
6.2.3.2
Select Country of Origin from table MARA:
*
First of all assign existing extension field values to output parameter:
billingdocitem_ext_out = billingdocitem_ext_in.
billingdocitemdescr_ext_out = billingdocitemdescr_ext_in.
select single CountryOfOrigin from I_Product
WHERE product = @billingdocitem-material
into @billingdocitem_ext_out-YY1_country_of_origin_bdi.
Save and publish the extension Logic.
21
Remark: To see the new created extension field in the Billing Document Printout, it is necessary to create a new Form
Template.
22
7 Provide Commodity Code in Billing Document Output
7.1
Aim
Show Commodity Code on Form Template Item of Billing Document Item.
7.2
7.2.1
Steps to do
Creation of an extension field at Billing Document Item
Use app Custom Fields and Logic, tab Custom Fields, in the Extensibility business catalog. Create a new
extension field in Business Context Sales: Billing Document Item with an appropriate Type.
This extension field is intended to store the Commodity Code with the Billing Document Item.
Remark: The extension field will only be filled when triggering the output request.
7.2.2
Extend the Form Template with the Extension Field
Within the same App Custom Fields and Logic and tab Custom Field extend the Form Templates for the
billing document with the extension field.
23
Save and publish the extension field.
7.2.3
Creation of an extension logic
Use app Custom Fields and Logic, tab Custom Logic, in the Extensibility business catalog. Create a new
Enhancement Implementation in Business Context Sales: Billing Document Item with Definition
Description Billing Standard Output Item Adaption and an appropriate Implementation
Description. In case the Enhancement Implementation already exist, this step can be skipped.
Add the following example code to the Draft:
24
*
First of all assign existing extension field values to output parameter:
billingdocitem_ext_out = billingdocitem_ext_in.
billingdocitemdescr_ext_out = billingdocitemdescr_ext_in.
*
*
Read commodity code for specific product:
SELECT SINGLE commoditycode
FROM
c_prodcommoditycodeforkeydate( p_keydate = @billingdocbillingdocumentdate )
WHERE product = @billingdocitem-material
AND
country = @billingdocitem-DepartureCountry
INTO @billingdocitem_ext_out-YY1_CommodityCode_BDI.
Save and publish the extension Logic.
Remark: To see the new created extension field in the Billing Document Printout, it is necessary to create a new Form
Template.
25
8 Provide Tax Code in Billing Document Output
8.1
Aim
Show Tax Code on Form Template Item of Billing Document Item.
8.2
8.2.1
Steps to do
Creation of an extension field at Billing Document Item
Use app Custom Fields and Logic, tab Custom Fields, in the Extensibility business catalog. Create a new
extension field in Business Context Sales: Billing Document Item with an appropriate Type.
This extension field is intended to store the Tax Code with the Billing Document Item.
Remark: The extension field will only be filled when triggering the output request.
8.2.2
Extend the Form Template with the Extension Field
Within the same App Custom Fields and Logic and tab Custom Field extend the Form Templates for the
billing document with the extension field.
26
Save and publish the extension field.
8.2.3
Creation of an extension logic
Use app Custom Fields and Logic, tab Custom Logic, in the Extensibility business catalog. Create a new
Enhancement Implementation in Business Context Sales: Billing Document Item with Definition
Description Billing Standard Output Item Adaption and an appropriate Implementation
Description. In case the Enhancement Implementation already exist, this step can be skipped.
Add the following example code to the Draft:
*
*
*
First of all assign existing extension field values to output parameter:
billingdocitem_ext_out = billingdocitem_ext_in.
billingdocitemdescr_ext_out = billingdocitemdescr_ext_in.
Read tax code for specific billing document item:
SELECT SINGLE taxcode
FROM
i_billingdocitemprcgelmntbasic
WHERE billingdocument = @billingdocitem-billingdocument
27
AND
billingdocumentitem = @billingdocitem-billingdocumentitem
AND
pricingprocedurestep = '850'
INTO @billingdocitem_ext_out-yy1_taxcode_bdi.
Save and publish the extension Logic.
Remark 1: The pricing procedure step depends on the pricing scheme and in case of customer pricing scheme the value
could differ.
Remark 2: To see the new created extension field in the Billing Document Printout, it is necessary to create a new Form
Template.
28
9
Provide ATF License in Billing Document Output
9.1
Aim
Show ATF License on Form Template Item of Billing Document.
9.2
9.2.1
Steps to do
Creation of an extension field at Billing Document Item
Use app Custom Fields and Logic, tab Custom Fields, in the Extensibility business catalog. Create a new
extension field in Business Context Sales: Billing Document Item with an appropriate Type.
This extension field is intended to store the ATF License with the Billing Document Item.
Remark: The extension field will only be filled when triggering the output request.
9.2.2
Extend the Form Template with the Extension Field
Within the same App Custom Fields and Logic and tab Custom Field enable the Form Templates for the
Billing Document with the extension field.
29
Save and publish the extension field.
9.2.3
Creation of an extension logic
Use app Custom Fields and Logic, tab Custom Logic, in the Extensibility business catalog. Create a new
Enhancement Implementation in Business Context Sales: Billing Document Item with BAdI
Description Billing Standard Output Item Adaption and an appropriate Implementation
Description. This step can be skipped in case the Enhancement Implementation already exist.
Add the following example code to the Draft:
*
First of all assign existing extension field values to output parameter:
billingdocitem_ext_out = billingdocitem_ext_in.
billingdocitemdescr_ext_out = billingdocitemdescr_ext_in.
* select the ATF License
30
select single ExtTrdCmplncLicense
from C_TrdCmplncDocItmLicAssgmt
where referencedocument = @billingdocitem-referencesddocument
and referencedocumentitem = @billingdocitem-referencesddocumentitem
into @billingdocitem_ext_out-yy1_atf_license_bdi.
Save and publish the extension Logic.
Remark: To see the new created extension field in the Billing Document Printout, it is necessary to create a new Form
Template.
31
Download