Skip to Content
Aug 02, 2018 at 12:33 PM

Change Form Template in the output history

169 Views Last edit Aug 02, 2018 at 12:35 PM 3 rev

Hello SAP Experts,

I want to change the Form Template in the output history.

Eg. When a Indicator field is true, I want to use the Form Template „Lieferavis _original“. If the indicator is false I want to use the Form Template „Lieferavis“.

Therefore I created an Business Extension oft the „DocumentOutputRequest“:

import AP.Common.GDT;

import DocumentServices.Global;

[Extension] businessobject DocumentServices.Global:DocumentOutputRequest {

// You must activate this business object before you can access the extension fields // or messages in script files, forms, and screens.


And created an event:

var Z_ForPickup = false;

var documentOutputRequestItemAvis = documentOutputRequestItems.Where(n=> n.Status.OutputStatusCode != "2").GetFirst();

if (documentOutputRequestItemAvis.IsSet())

{ if(Z_ForPickup) { // Template - Lieferavis _original documentOutputRequestItemAvis.OutputRequestFormTemplateCode.content = "ME_08"; }


{ // Template - Lieferavis documentOutputRequestItemAvis.OutputRequestFormTemplateCode.content = "ZRXPB"; } }

The System took the right Form Template and I can open it in the ouput History:

The Problem is, that this Template is broken when i open it in the mail attachment:

Hope you can give me a hint to fix this.

Thanks a lot and greetings,