Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
Alexander_Korne
Employee
Employee

Introduction


One of the popular requirements in terms of adjusting output forms is to add contact person to the document header. In Billing Documents, for example, there is no such default field, therefore custom field and logic are necessary. In most cases we can use name of employee, who created the document as contact person name. Let´s have a look, how to implement this requirement in Invoice form.

Create Custom field


First of all we need to use "Custom Fields and Logic" app and add new custom field there:


Enter custom values in Label and Tooltip and select "Sales: Billing Document" as context and "Text" as "Type":

Then click "Create and Edit".


Enable the field for UIs and Reports "Billing Document Object Page" and "Change or Display Billing-Related Documents (Header)":


Make sure the field is enabled for Customer Invoice Standard Forms in the Form Templates tab:


Save and publish the changes:


Wait until the field will be published:



Create custom logic


Go to the main screen of the app and then to Custom Logic:


Click "+" sign, select "Sales: Billing Document" as context:


Select "Billing Standard Output Header Adaption":


Add custom implementation description and click "create".

In the code editor window enter following code, replacing custom field name by your own:
billingdoc_extension_out = billingdoc_extension_in.
billingdocdescr_extension_out = billingdocdescr_extension_in.

DATA: ls_user TYPE I_BusinessUser.

SELECT SINGLE *
FROM I_BusinessUser
INTO @ls_user
WHERE I_BusinessUser~UserID = @billingdoc-createdbyuser.
billingdoc_extension_out-<your custom field name>_bdh = ls_user-PersonFullName.

Click test -> save draft -> publish. Wait until the logic is published.

Implementing the field in Billing Documents form


Now we need to implement our field in Billing Document form. Please, refer to this blog to check, how to find correct standard form, create the custom one, download it and open on your laptop.

Once you opened the custom form in Adobe Livecycle designer go to Data View tab. You will find 2 new fields there:


 

You need the one, which end with "BDH". Drag and drop it to the necessary place in the document. You can adjust placing of the field on Hierarchy tab.

Select the newly added field go to Object -> Binding and check, if the binding remained correct:


Save the changes and upload the new form to SAP S/4HANA Cloud.

Check the result


Please, refer to this blog for the instruction, how to generate Invoice. Once you open your document, you should see implemented changes:

Conclusion


The described mechanism allows to add name of the person, who created document in other form as well.