Skip to Content
Author's profile photo Sankaran A

Attachment Folder in Custom Business Object

Attachment Folder

An object that is used to store attachments that are related to a business document.

For example, a freight order or a forwarding order.

You use Dependent Object to store attachments that are related to a business document.

You can store the following attachment types:

  1. Files
    You can upload any kind of files that contain binary content.
  2. Links
    You can store links to external content that is accessible via a uniform resource locator (URL). For example, links to content on the World Wide Web or links to files stored on a server. Here we are going to Implement Attachment Folder in root level and node level for custom Business Object.

So, I would like to document it here and let you know the same so that it will stay as a reference for everyone.


Tenant: SAP Business ByDesign.

Scenario: Implement Attachment Folder in root level and node level for custom Business Object.


Workflow

  1. Create Custom Business Object
  2. Generating Screen
  3. Design Screen
  4. Testing
  5. Troubleshooting

Create Custom Business Object

  1. Create a custom Business Object AttachmentFolder.
  2. Define elements/node as shown in the below screenshot.
  3. Save and Activate.
    For more information about the Custom Business Object creation, see http://blog.sankaranss.com/2016/03/29/sap-byd-business-object/.


Save this article as PDF?


Generating Screen

  1. Right click on BO name -> Create Screens.
  2. Generate all screens.
    For more information about the screen generation,
    see http://blog.sankaranss.com/2016/04/28/sap-byd-screen-types/.Your solution should look something like in the below screenshot.


Design Screen

  1. Double-click the new OIF screen.
  2. The OIF screen opens in the user interface designer.
    For more information about the screen designing,
    see http://blog.sankaranss.com/2016/08/29/quick-activity-floorplan-sapby/..
Configure the data model view of the OIF Screen

Bind each of the fields to the required business object element as shown in the below screenshot.

 

Configure Attachment Folder in Root Level
  1. Drag and drop ‘Documentlist’ as follows
    1.1  Go to configuration window
    1.2 Open ‘SAP_BYD_Application_UI’
    1.3 Go to ‘Reuse’ folder
    1.4 Attachment folder
    1.5 Drag and drop ‘Documentlist’ on to the screen
  2. Click Bind button.
    A binding dialogue box will open.
    Configure binding with Root Level element as shown in below screenshot.

Configure Attachment Folder in Node Level
  1. Drag and drop ‘Documentlist’ as follows
    1.1 Go to configuration window
    1.2 Open ‘SAP_BYD_Application_UI’
    1.3 Go to ‘Reuse’ folder
    1.4 Attachment folder
    1.5 Drag and drop ‘Documentlist’ on to the screen
  2. Click Bind button.
    A binding dialogue box will open.
    Configure binding with Node Level element as shown in below screenshot.
  3. Save and Active Screen.

Save this article as PDF?


Testing

  1. Login into SAP Business ByDesign as a Business User.
  2. Navigate to Attachment Folder work center. (Custom Development which we developed)
  3. Click New -> View All (Navigate from QA Screen to OIF Screen)
Root Level Attachments
  1. Click Add -> File from Attachments.
    Add File window will open.
  2. Browse file.
  3. Choose Document Type.
  4. Click Add button.

 

Node Level Attachments
  1. Navigate to Line Items -> Add Files in attachments.
    Add File window will open.
  2. Browse file.
  3. Choose Document Type.
  4. Click Add button.


Troubleshooting
  1. Disabled Add Button:
Solution:
  1. Don’t run OIF screen directly from UI Designer. First run QA Screen, then navigate to OIF screen from QA Screen.
  2. Check Binding properties.

Next Article

In future articles, we will learn how to display only selected Document Types in Add File Window.



If you like to add some points to this article, kindly leave your points in the comment box.

Don’t forget to subscribe it my blog. http://blog.sankaranss.com

For more information about this article read http://blog.sankaranss.com/2016/12/19/attachment-folder-in-custom-bo/

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo K Reddy
      K Reddy

      Hiii Sankaran,

      This article was very good.
      But, How to get image from attachment folder through absl code.

      Thanks,
      Kreddy.

      Author's profile photo Sankaran A
      Sankaran A
      Blog Post Author

      Hi Koteshwara,

      You could not save your file directly. First convert the image file into Binary object. Then use bellow code to save your image file into attachment.

      var PDF : basisGlobal:BinaryObject;
      PDF.content = <Binary image file>;
      Useraccountid.content = "PRT_001";
      PDF.fileName = "FileName.pdf";
      var doctype : DocumentTypeCode;
      doctype.content = "10001";
      var desc : Description;
      desc.content = "Description";
      desc.languageCode = Library::LanguageCode.ParseFromString("EN");
      this.AttachmentFolder.CreateFile(doctype, PDF.fileName, PDF.fileName, desc, PDF);

      Regards
      Sankaran A

      Author's profile photo Former Member
      Former Member

      Great job Sankaran ! Thanks for sharing.

      I have a question please, what if I want to insert the attachment into a standard BO Attachment Folder  ?

      For example through the custom OIF, I want to add an attachment to the Employee Attachment Folder using the Employee UUID or Internal ID.

      Any idea how to proceed ?

      Thanks again.
      BR.

      Author's profile photo Neenu Abraham
      Neenu Abraham

      Hi Sankaran,

       

      I tried to add attachment at node level as given her and then the add button is disabled and not able to add attachments. What could be the issue here?

       

      Thanks,

      Neenu

      Author's profile photo Amrit Bansal
      Amrit Bansal

      Hi Sankaran,

       

      I have added same functionality but the attachment at node level disappears once i close and open the object. They are there available in backend but not displayed on UI. Also once i change the node test element id and save, it comes again.

       

      any idea?

       

      Regards,