cancel
Showing results for 
Search instead for 
Did you mean: 

Enhancement Implementation

Former Member

Dear experts,

have you tried enhancement implementation functionality?

Could you please give me an example of how to use enhancement option BusinessActivityExcludeCodeValues?

/*

  Add your SAP Business ByDesign scripting language implementation for:

  Enhancement Option: BusinessActivityExcludeCodeValues

  Operation: EXCLUDE_CODE_VALUES

  Script file signature

  ----------------------------

  Parameter: InputData of type BadiBusinessActivityExcludeCodeValuesImport

  Returns: BadiBusinessActvitiyExcludeCodeValuesChanging

  Note:

   - To use code completion, press CTRL+J.

*/

import AP.FO.Activity.Global;

var result : BadiBusinessActvitiyExcludeCodeValuesChanging;

return result;

Many thanks

Best regards

Linh

Accepted Solutions (1)

Accepted Solutions (1)

Dedeepya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Linh

The Enhancement Option : BusinessActivityExcludeCodeValues is similar to a BADI (exit) if you are familiar with ABAP.

It will have 2 structures: 1 would be Input ->Data that will be available at runtime for which code can be restricted.

                                        2nd would be Output or Return Structure -> This should contain the filtered list (as per your code logic)

The coding here is similar to any other ABSL script file.

Hope this clarifies.

BR
Dedeepya

Former Member
0 Kudos

Hi Dedeepya,

thank you for your reply. Unfortunately im not familiar with the badi function.

How should the input looks like?

Could you write a sample code to restrict PriodityCode for BO ActivityTask to value Urgen (code 2) and value Normal (code 3) only. Meaning excluding value Immediate (code 1) and Low (code 7).

Looking forward to your reply.

Many thanks
Best

Linh

Dedeepya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Linh, Sorry for the delay in responding, hope its not too late for a code-snippet: Here you go -

var result : BadiOpportunityExcludeCodeValuesChanging;

var input : BadiOpportunityExcludeCodeValuesImport;

var bus_types : BadiOpportunityCodeValue; input = InputData; var Oppt_UUID = input.RootObjectNodeReference.UUID; if (!Oppt_UUID.IsInitial()) { var opp_ctxt = Opportunity.Retrieve(Oppt_UUID);

if ((opp_ctxt.IsSet()) &&

(opp_ctxt.ProcessingTypeCode == "OPPT") && (opp_ctxt.OriginTypeCode.content == "ZUP"))

{ //var ls_btd = opp_ctxt.BusinessTransactionDocumentReference.GetFirst();

var lt_bustype = result.BadiOpportunityCodeValue.Where(n => n.ListID == "BusinessType");

if (lt_bustype.Count() > 0) { result.Clear(); bus_types.Content = "002";

result.BadiOpportunityCodeValue.Add(bus_types);

bus_types.Content = "001";

result.BadiOpportunityCodeValue.Add(bus_types); }

}

} return result;

As you can see from Above the structure "RESULT" contains the filtered list of values. An additional note to this, the RESTRICTCODE Badi works only for STANDARD fields and not for CUSTOM (extended) fields. Hope this clarifies. BR Dedeepya

former_member606838
Participant
0 Kudos

Hi reddy.dedeepya

I need your help in a similar case here: https://answers.sap.com/questions/12711680/enhancement-spots-for-byd.html would you please help me?

Answers (2)

Answers (2)

tushargoel519
Participant
0 Kudos

Hello Dedeepya Reddy,

Can you please also tell how to enhace the BADI :- ServiceRequestInfluenceContractItemDeterminationResult as i have requirement to change the contract field at the line item in ticket work centre view according to the selected contract in header of ticket.

So i want to just the same contract for all line items present in ticket as same of Header Contract in Ticket.

I tried lots of thing but the valuse are not update in the line items of Ticket.

Regards,

Tushar Goel

Kinsbrunner
Active Contributor
0 Kudos

Ngoc,

By this, you can enhance the standard behavior of specific applications of the SAP cloud solution without modifying the standard solution. For example, you can define your own business logicfor determining, validating or mapping data.

There are single/multiple use enhancements; Singles can be implemented only once in a solution. Multiple use can be implemented more than once in a solution.

Hope this helps you.

Regards.

Alejandro.