Working in SAP is fundamentally a technical job and while theory and strong concepts are imperative for candidates applying for the position, practical and applied knowledge are much needed as well. Like most interviews, SAP candidates will be especially questioned about their previous experience and roles.
Listed below are 30 frequently asked SAP Interview Questions and Answers Every Candidate needs to take a look at:
1. What do you mean by ERP?
Ans. ERP stands for Enterprise Resource Planning Software and is an integrated computer-based system used to manage a company’s resources effectively. It ensures smooth flow of information amongst various departments in an enterprise or a company and manages the workflows.
2. What do you know about SAP?
Ans. SAP is the abbreviation for Systems Applications and Products in Data Processing. It is a German company founded in 1972 by Wellenreuther, Hopp, Hector, Plattner, and Tschira. Along with the name of the company, SAP is its ERP product as well. Leading the ERP industry, SAP customers include around 92% of the Forbes Global 2000 companies. Alongside SAP is also a market share leader in analytics, supply chain management, human capital management and experience management.
3. List the Different Modules in SAP.
Ans. SAP provides several industry- specific solutions and has various modules such as Financial Accounting, Controlling, Enterprise Controlling, Investment Management, Sales and Distribution, Human Resources, Production Planning, Business Warehousing, Quality Management among many others. As the world expands, the list too is ever-growing.
4. Explain Metadata, Master data and Transaction data.
Ans. According to the commonly agreed categories of data in the data management field:
I. MetaData is data about Data i.e it tells you about the structure of data or MetaObjects.
II. Master Data is the key business information about customers, employees and other business elements that supports transactions.
III. Transactional Data describes business events and is the largest volume of data in the enterprise, for example buying from suppliers or selling to customers.
5. Which are the three stages of data mining?
Ans. Data mining is the process of discovering hidden, valuable knowledge by analyzing a large amount of data. It is a very important process, advantageous for various industries, such as manufacturing, marketing, etc. Three stages of data mining include
Initial Exploration
Model building
Deployment
6. Mention what is the difference between SAP BASIS and SAP ABAP?
Ans. SAP ABAP (Advanced Business Application Programming) is a high level programming language used within SAP to customize, generate forms, generate reports, etc. While SAP BASIS is the administration module of SAP used to control code changes, upgrades, database admin, network setup, etc. It is the technical foundation for SAP and consists of middleware programs and tools that support the interoperability and portability of SAP applications across systems and databases.
7. Explain what is meant by “Business Content” in SAP?
Ans. Business Content in SAP is a pre-configured set of role and task-related information models that are based on consistent metadata stored in the SAP warehouse, which can be used directly or with desired modification in varying industries. It provides selected roles within a company with the information that the roles need to perform their tasks.
8. Mention what are the standard stages of the SAP Payment Run?
Ans. SAP provides Automatic Payment Run which manages payments and carries out tasks like posting accounts payable (payment to a vendor) automatically. It also helps you find out due/overdue invoices, process consumer lists and vendor invoices to make payments seamlessly.
In the SAP Payment Run, the standard stages of SAP includes
Entering parameters includes entering company codes, vendor accounts, payment methods, etc.
Proposal Scheduling includes the system proposes a list of invoices to be paid.
Payment booking is the booking of the actual payments into the ledger.
Printing of Payment forms.
9. What is Bex?
Ans. Bex means Business Explorer. It enables the end-user to locate reports, analyze information, view reports and can execute queries. The queries in the workbook can be saved to their respective roles in the Bex browser. It has components like Bex analyzer, Bex Map, & Bex web.
10. What is NetWeaver?
Ans. NetWeaver is an integrated technology platform for all products in the my SAP suite to run on a single instance of NetWeaver, known as SAP Web Application Server (SAP WEBAs). NetWeaver is beneficial as you can access SAP data using the web (http protocol) or even mobile. All in all, it helps you save on costs involved in training users on SAP Client-side GUI.
11. Mention what is the process to create a table in the data dictionary?
Ans. Data dictionary is viewed as metadata in the SAP database with the metadata stored by the database and is used to create and manage data definitions, create tables, data elements, domains, views and types.
To create a table in the data dictionary, you have to follow these steps:
Creating domains (data type, field length, range)
Creating data elements (properties and type for a table field)
Creating tables (SE 11)
12. Mention what is the importance of ODS in BIW?
Ans. An ODS (Operational Data Store) object serves to store debugged and consolidated transaction data on a document level. It defines a consolidated dataset from one or more sources of information. This dataset can be evaluated with a Bex query or an Infoset query. The data of an ODS object can be updated with a delta update into InfoCubes or other ODS objects in the same system or across systems. Contrary to multi-dimensional data storage with InfoCubes, the data in the ODS object is stored in transparent, flat database tables.
13. Other than SAP, are there any ERP softwares in the market?
Ans: Yes, there are others available in the market such as Microsoft Dynamics, PeopleSoft, Siebel, JD Edwards, Baan, etc. Each of these ERPs has different specialities. Apart from these, there are various other lesser known ERPs and many small enterprises tend to use them because of the cost factor.
14. What drove you to choose a career in SAP?
Ans. Enterprise Resource Planning is the backbone of any large organisation. Without using an ERP, the functioning of these organisations is bound to slow down and be vulnerable to errors. I had always dreamt of working in an MNC and since SAP is at the top of the ERP market, it was the obvious choice. SAP is said to have 140,000+ installations and 25+ specific business solutions. I think working in such an accomplished company with so many intellectuals will push me to the best of my capabilities.
15. In SAP, how many simultaneous sessions can you have?
Ans: In SAP, a user can have 6 simultaneous sessions at one time for one client.
16. What are the different layers in the R/3 system?
Ans: There are three main layers in the SAP R/3 system;
Presentation Layer
Database Layer
Application Layer
17. What are the most common transport errors that you can come across?
Ans: The most common transport errors in occurrence are:
Return Code 4
Return Code 8
Return Code 12
Return Code 18
18.Mention what is the difference between Domain & Data Element?
Ans. The basic difference is that data element is an intermediate object between domain and table type, whereas domain defines attributes such as length, type and possible value range.
19. What does an update type with reference to a match-code ID mean?
Ans: Whenever the data in base tables of a match-code ID changes, it needs updating. In this instance, the update type tells us about the time when the match-code needs updating and also clarifies how to do it. Another significant function of the match-code is that it defines the method which is to be used for building match-codes.
20. What are SET parameters & GET parameters?
Ans. To use parameter IDs, you need to SET values in the global memory area and then GET values from this parameter ID memory area. In the case of the online program, you have to SET values from screen fields, and you will GET these values for screen fields.
21. What do you mean by one-time vendors?
Ans. In certain industries, it is not feasible to create new master records for every vendor trading partner. One-time vendors enable a dummy vendor code to be used for an invoice entry, and the information that is normally stored in the vendor master is keyed on the invoice itself.
22. What is an extended star schema?
Ans: The star schema is an amalgamation of fact tables and dimension tables. Separate tables are used to store master data and these tables have reference to characteristics in dimension tables. These separate tables are called extended star schema.
23. Why do organizations generally choose to implement SAP?
Ans. Organisations choose to implement SAP as it is highly configurable and assures secure data handling. Along with that there is minimum data redundancy and maximum data consistency. Organizations can also take advantage of economies of sales like purchasing apart from tight integration-cross function. SAP makes coordination of resources across the organisation swift and effective.
24. Does SAP have its own database management tool?
Ans. SAP is not a database itself but an application that uses databases provided by other servers like Oracle, or SQL Server.
25. What does ‘transaction’ mean in SAP terminology?
Ans. According to SAP terminology, a transaction is a series of logically connected dialog steps.
26. Explain the application, presentation, & database servers in SAP R/3?
Ans. The application layer of a R/3 system is made up of the application server and the message server. Application programs in an R/3 system run on application servers. Using the message server, the application servers interact with presentation components, the database, and also with each other. All the data are stored in a centralized server, which is the database server.
27. Explain what is a company in SAP?
Ans. In SAP, ‘company’ is the highest organizational unit for which financial statements like profit and loss statements, balance sheets can be drawn according to the requirement of organizations. A single company contains one or many company codes. All the company codes in SAP must use the same COA (chart of accounts) and fiscal year.
28. Mention the two types of services that are used to deal with communication?
Ans. To deal with communication, you can use two types of services:
Message Service is used to exchange short internal messages by the application servers.
Gateway Service allows communication between R/3 and external applications using CPI-C protocol.
29. Name the different types of variables there are?
Ans. The different types of variables are characteristics variable, hierarchies, hierarchy nodes, text, formulae, processing types, replacement path and default type.
30. Mention some shortcomings of SAP
Ans. Despite being a game-changer in the data management field, SAP has a few setbacks. These include the high cost and lengthy implementation time. It demands a highly trained staff as the interface can be a bit complicated. SAP also does not determine where master data resides.
E-Invoicing Under GST India: Where Efficiency Meets Transparency
Over the years, companies all over the world have been replacing paper invoices with electronic versions to improve efficiency of business. Tax authorities and governmental organisations have begun enforcing the use of ‘e-invoicing’ for economical and security reasons.
Commencing from 1st January 2020, the GST council of India has approved the introduction of electronic invoicing for reporting of business to business (B2B) invoices to the Invoice Registration Portal (IRP) System.
SAP proposes to introduce an e-Invoice solution to enable customers to comply with the new e-Invoice mandate.
Presently, businesses use different software’s to generate invoices and manually upload them in the GSTR-1. Further it goes to GSTR-2A. When any transporter needs to generate the e-way bill, they have to import the invoices in Excel.
A common misconception is that the e-invoice will be generated from the government’s tax portal. Rest assured, the invoices will continue to be generated using the business’ existing ERP software keeping in view the varied needs of item master, buyer master, UQC etc. along with sub-second responses from IR Portal (IRP).
So the customer needs to keep their ERP to generate the invoice with additional data as the GSTN portal will not generate the e-Invoices for them. It has just been uploaded with JSON data formats.
Benefits of E-invoicing
The e-invoicing is an initiation from the Goods and Services Tax Network to simplify the GST return process and avoid discrepancies. It has parallel benefits for the business or organization as well.
Advantages to the Goods and Services Tax Network:
It will aid in building a healthy GSTN eco-system where the interoperability and interpretation of invoices are easy. This simply means that an invoice generated by one software could be read by other software easily.
Standardization of invoices would avoid the re-entry of data into the portal and reduce resource usage in the long run.
Inculcate better tax-paying practices by supporting organizations in one-time reporting on B2B invoice data, generating purchase/sale registers, and sort out input credit verification issues.
It will help in the reduction of tax evasion by maintaining a complete trail of B2B invoices and facilitating a system-level matching of input credit and output tax.
The biggest benefits that e-invoicing delivers are transparency and proof as with e-invoicing, the moment an invoice is made, it will be uploaded on the GSTN portal where pre-validation will be done and a unique number called IRN (Invoice Reference Number) will be issued.
All in all, it will improve the efficiency of Tax Administration by the elimination of fake invoices.
Advantages to the Business:
Since e-invoicing is not mandatory as of now, businesses can conveniently decide when and how to deploy the practice.
E-invoicing would save the business of last-minute runs as invoices will already be uploaded and the records are reconciled.
This will also avoid the need to generate e-way bills.
Real-time tracking of invoices will be possible as the supplier generated invoice copy would be sent to the customer by the GSTN portal.
How does SAP assist in E-invoicing?
The new mandate brought in the need to standardize the format in which electronic data of an invoice will be shared with others to ensure the interoperability of the data. E-invoice under GST India covers documents such as invoice by supplier, credit note by suppliers, debit note by supplier and any other document required by law to be reported by the creator of the invoice.
SAP proposes to introduce e-Invoice solutions to assist customers to comply with the new e-Invoice mandate:
Automated Solution: It involves the direct integration to the e-invoicing (IRN) system via GSP. This will enable taxpayers to upload the payload from the backend SAP system to the portal, generate the Invoice Reference Number and link it with the billing document in the backend system. In the automated process, the preparation of standardized format is done by SAP.
Manual Solution: It involves reading the response file and storing the information of the IRN, QR code and digital signature in the standard table and linking the original invoice with IRM along with its current status. The preparation of the standardised format (JSON request file) needs to be generated offline by the customer.
Conclusion
SAP generated solutions will help businesses seamlessly generate e-invoices and meet functionality as per the government mandate. Through automatic real-time online integration by secured communication with the GST portal, businesses can use their existing ERP software to operate e-invoices.
E-invoicing will prove to be a great aid in improving the efficiency of business whilst maintaining transparency with the government.
A typical business enterprise has numerous departments and units which are constantly communicating with each other to carry out the various operations. The success of any enterprise highly depends on effective communication and the exchange of data. But how to navigate through so much chaos and get work done efficiently? That’s where SAP comes into the picture.
SAP stands for Systems Applications and Products in Data Processing. This is an ERP or Enterprise Resource Planning software developed in 1972 in Walldorf, Germany by Wellenreuther, Hopp, Hector, Plattner, and Tschira. The software aids in managing business operations and customer relationships. The SAP system consists of a number of fully integrated modules, which cover virtually every aspect of business management.
Leading the ERP industry, SAP customers include around 92% of the Forbes Global 2000 companies. Alongside SAP is also a market share leader in analytics, supply chain management, human capital management, and experience management.
Why does every business need ERP?
Running a business is tough. Especially following a complicated channel of communication to getting tasks done can slow down the process and productivity. This calls for a centralized system of enterprise resource planning. The benefits of ERP are many, only waiting to be tapped:
Real-Time Information: Having a centralized database conveys all the relevant information to all the internal departments in real-time. For example, the production and sales department can be updated with the current inventory situation as and when they require it. This facilitates fast decision-making and effective execution.
Quality data: ERP software eliminates duplication, discontinuity, and redundancy in data.
Control: ERP supports and integrates almost every functional area of a business process such as procurement of goods and services, sale and distribution, finance, human resource, manufacturing, and logistics under one complex database. This makes it easier to control and regulate the flow of actions taking place.
Strategizing: A centralized ERP improves capital planning and helps in executing organizational plans and strategies.
Expand reach: An ERP is a network for all the networks. It has the potential to extend the business network to wider domains. It promises long term profit by expanding the products and services to reach more customers, suppliers, and partners.
Adaptability: The business environment is a dynamic space and having a centralized ERP makes the organization adaptable to the rapid changes in the business process according to the needs.
Future of ERP
With new businesses being set up every other day, incorporating more employees, and navigating various technical spaces, ERP is bound to become popular among organizations. There are immense opportunities for ERPs to evolve and integrate futuristic technologies such as 5G and AI. There is a scope for innovation to make ERPs mobile, flexible, and more user-friendly.
One thing can be said for sure, Enterprise Resource Planning is the reality and need of every business out there.
Now in this blog we will see one of the features of EBRS i.e.Search String.
Search String is a very useful functionality in EBRS process. with this you can directly change or default the some parameters in combination of Company Code,House Bank & Account ID.
Search strings can also be used to substitute fields based on Profit Center, Cost Center, Offsetting Account, etc.
Here we will see one example of search string use.
E.g. if in the Bank Statement as below you find every time that Bank is mentioning “Consolidated Charges for A/c” while debiting Bank Charges & in this case you want system should pass the entry automatically by debiting GL Account of Bank charges.
For simulation enter the text in entry text filed & click on the Test button.
2.Search String Definition
Now click on Search String use to assign this rule for particular House Bank/Account ID.
Give Co Code/House Bk/Acct ID
Select external transaction as NCHG (which is defined for bank charges)
Select Posting value as negative.
Select Search string name as Consolidated Charges.
Target field will be Posting Rule.
Now save the assignment.
So now when you upload the Bank Statement which have above text for Bank charges e.g. Consolidated Charges for A/c. then system will automatically pass the entry by debiting bank charges account & credit to main bank account.
So Conclusion is by this search string you can easily change the posting rule & other Parameters & assign it for a particular Bank Account or Company Code.
SAP have the features of Electronic Bank Reconciliation Statement (EBRS) process where you can directly upload the Bank Statement in a format called MT940.
In this process SAP will upload statement automatically & at the same time will do sub-ledger posting & clearing.
So here in this blog we can see the basic steps to configure the EBRS for MT940 Format.
Path for configuration EBRS is go to SPRO-IMG
Financial Accounting–Bank Accounting–Business Transactions–Payment Transactions–Electronic Bank Statement–Make Global Settings for Electronic Bank Statement (T Code – OT83)
here specify the nature of Transactions happened in the Bank
Generally you need to create new entries for 4 Common Transactions in the Bank & 1 entry for Main Bank as below,
2) Assign GL Accounts to the Accounts Symbol
Create new entry’s for GL Account assignment to Accounts symbol
For Bank Charges (EBCG) & Interest Account (EBIN) give GL Account Code as mostly it may account in respective GL only.
For Cheque Deposited (EBCD) & Cheque Issued (EBCI) give +++++++++1 for IN Bank Account & +++++++++2 for OUT Bank Account in case of multiple bank accounts.(If you have IN Bank Account GL Code last digit is 1 & OUT Bank Account GL Code last digit is 2)
3) Create Key for Posting Rule
This is required for automatic Posting of entry’s while reconciliation as per the nature of transaction Deposited, Cheque Issued, Bank Charges, Bank Interest.
4) Define Posting Rule for Posting key
Define Posting Rule
Please understand this as per below illustration of accounting entries.
5) Create Transaction type
Required to create Transaction types for EBRS
e.g. here we have created EB1 for the organisation
There are also some Standard Transaction types are available.
6) Assign External Transaction Type to posting Rule
External Transactions Types are those which is mentioned in the bank statement for each & every transaction.
i.e. NCHK, NTRF, NSTO, NCHG, etc. as bank mentioned their MT940 bank statement format as below
This Transaction types require to assign to the posting rule which we have created in point No.3 as below with Debit/Credit indicator & Algorithm
If you are maintaining cheque Number in Assignment than use Algorithm 15 against transaction type of cheque. with this system will clear the entry’s by matching the cheque number from the statement.
Other cases you can give simple logic as No Interpretation.i.e.system will clear based on the amount.
Sign + means incoming entry’s & Sign – means outgoing entry’s
7) Assign Bank Accounts to Transaction Types
Here you require to give Bank Key, Bank Account Number of all the banks where you want to activate this process & give Transaction Type against all the bank (i.e. EB01) which created as per point no.5
So in conclusion basically once you complete the above 7 Steps in SPRO than you can start using the functionality of electronic bank reconciliation in MT940 Format as it saves a lot of time & is error free compare to uploading manual bank statement which is time consuming & prone to clerical errors.
In my next blog i will cover some other features & the transactions related steps.
There are many standard workflow scenarios available but some business requirements can not be satisfied by standard workflows. So it is important to develop something from scratch as per the business requirements. This blog post is mainly focused on the Sales Order Approval Process. In most of the case, there is only one Manager/Approver who is going to approve the SO. This can be managed by the SD Functional by some configuration and with the same configuration, you can also manage multi-level Manager/Approver too. But what if the business requirement is as bellow,
While creating or changing SO, a workflow should be triggered to a Manager/Approver.
There are 4 Level of Manager/Approver who is going to approve SO one by one.
Sales Order is considered to be approved if the Final Approver level has approved it.
Final Approver can be Level 1 , Level 2 , Level 3 or Level 4 based on the SO amount fit to the range provided to each level.
i.e. Level 1 ( 0 to 1,000 )
i.e. Level 2 ( 1,000 to 10,000 )
i.e. Level 3 ( 10,000 to 1,00,000 )
i.e. Level 4 ( 1,00,000 and above )
Now if SO amount is 65,000, Level 3 is the Final Approver.
If Sales Order is in Credit Block, workflow should be triggered to a Manager/Approver to release it from Credit Block.
Before starting step by step implementation, let us see the basic prerequisites.
Custom Table: In SE11 -> ZSO_APPROVAL( Screenshot – 1 )
Table Maintenance : ZSO_APPROVAL. I have changed the screen, Utility->Table Maintenance Generator->Environment->Modification->Maintenance Screen.
( Screenshot – 2 )
Here, it is not necessary to maintain 4 entries. If there is only one entry like MinValue = 1.00 and Max_Value BLANK(Means anything) then Level 1 will be the Final Approver. In case there is no entry found in this custom table for a particular sales order so the sales order will be skipped from this Level-Approval Process and treated as per SAP Standard flow.
There is no Level-Approver to manage Credit Block. Only one approver is going to release sales orders from Credit Block based on the sales order amount.
Class: Create a Class in SE24, ZSO_APPROVAL_EXIT with event ‘TRIGGER‘. This class also has some interfaces, methods, and attributes that will be covered after this workflow creation steps.
( Screenshot – 3 )
Function Module: Create a Function Module in SE37 as below. There is no importing or exporting or changing parameters.
( Screenshot – 4 )
Implementation Steps:
Step 1: Create workflow and register Events + Binding.
Goto SWDD and create a new workflow. After ‘Abbreviations’ and ‘Description’ in the ‘Basic Data’ tab, you can register events in the ‘Start Event’ tab. Here, we have two events of standard BO “BUS2032” and one custom event of class “ZSO_APPROVAL_EXIT“.
( Screenshot – 5 )
Create following workflow container elements before binding them to the events.
Workflow Container.
ITAB stores HTML Content
ISO stores VBELN
IUSER stores userid while workflow triggered for Credit Release.(VKM1)
BUS2032 is BO which will be used for Credit Release.(VKM1)
( Screenshot – 6 )
Binding will be the same for “CREATED” and “CHANGED” events. The required container element will receive some value whenever a sales order is created or changed.
( Screenshot – 7 )
Binding for “TRIGGER” event of class ZSO_APPROVAL_EXIT. This event will be triggered manually if SO is in Credit Block in FORM USEREXIT_SAVE_DOCUMENT ofMV45AFZZ UserExit or from some BADI.
( Screenshot – 8 )
Note : &EVENT_NAME& will be used to identify the triggered workflow, i.g. workflow is triggered by VA01(Created) or VA02(Changed) or VKM1(Trigger).
Step 2: Common task that will generate SO Details with List of Materials in HTML format.
Below is a sample output of this task that generates HTML content filled with required Sales Order details including a list of materials.
( Screenshot – 9 )
Create an activity with a custom task. ( Screenshot – 10 )
Fill the required field and select Object Category “ABAP Class” and in Object Type “ZSO_APPROVAL_EXIT” with Method “MATERIALS”. So each time this method gets called whenever any of the workflows is triggered. Don’t forget to make this task “BACKGROUND PROCESSING”.
( Screenshot – 11 )
In the Container tab declare ITAB with typed ZSOLISTI1_TT( which is Table Type of SOLISTI1 ). So whole HTML content will be stored in this Container Element and this ITAB is going to be placed in UserDecision Task for both workflows.
( Screenshot – 12 )
It is declared with TableType so Multiline is by default checked but in Parameter Settings check the Export checkbox. Because we are receiving HTML in it.
( Screenshot – 13 )
The Binding for this Task is simple. Just you have to pass &ISO& to MATERIALS method and it will return &ITAB&. ( ISO is Sales Order number )
( Screenshot – 14 )
Step 3: Condition to identify workflow. (Condition 000008)
Create a condition step to identify which workflow should trigger. If event_name is “CREATED” or “CHANGED” it will trigger Sales Order Approval workflow and if event_name is “TRIGGER” it will trigger a workflow to release Sales Order from Credit Block.
( Screenshot – 15 )
Step 4: Let us assume EVENT_NAME is ‘CREATED’ or ‘CHANGED’. That means workflow triggered from VA01 or VA02. ( User Decision 000041 )
Create User Decision step with “Approve” and “Reject” buttons. Pass &ISO& in parameter 1 so it can be used in Title ” Approval for Sales Order: &1″ . &1 is our Sales Order Number. Here agent assignment is dynamic. You can skip this part for now.
( Screenshot – 16 )
In the Control tab, create a new task, and do not forget to make “General Task” in Task Properties.
( Screenshot – 17 )
Assign ZSO_APPROVAL_EXIT in the Program Exits tab. So after taking a decision, it will call that class, and here we can perform operations based on the decision.
( Screenshot – 18 )
Double click on Task “TS90000046” in the control tab. Fill all fields as below.
( Screenshot – 19 )
In the container tab, create an element with “MLIST” with the same type as we created “ITAB”. Here the lines of ITAB will be stored in “MLIST”.
( Screenshot – 20 )
Now simply declare “&MLIST[]&” in the Description tab. The whole HTML content will be displayed in User Decision BODY.
( Screenshot – 21 )
Binding for Task “TS90000046”, assign ITAB to MLIST. ( Screenshot – 22)
Goto decision tab, create a new rule and double click it. Fill the required field and in Rule Definition select “Agent Determination: Function to be Executed” and Function Module “ZRULE_FM“. (Need to create ZRULE_FM first before activating this agent assignment). Do not forget to check “Terminate If Rule Resolution Without Result.
So if there is no agent received for a particular SO, it will not trigger/dump workflow.
( Screenshot – 23 )
In the container of this Rule, create an element with the type VBELN and make it Import. ( Screenshot – 24)
Binding is again simple for this, just pass ISO. ( ISO is sales order number ) ( Screenshot – 25 )
As we did binding above for the Rule, there is an element ISO passed to SO_N. This SO_N will be received in ZRULE_FM in wa_container-value. Based on that VBELN we can get agent from our Custom Table. Append that user-id retrieved from ZSO_APPROVAL to actor_tab.
( Code – 1 )
DATA : wa_actor TYPE swhactor,
wa_container TYPE swcont.
DATA : lv_lines TYPE i.
READ TABLE ac_container INTO wa_container.
IF wa_container-value IS NOT INITIAL.
*** Sales Order Number(VBELN) will be received in [wa_container-value]
*** Based on that you can find Sales Order Amount and than pass it to ZSO_APPROVAL table
*** So you will get list of approvers.
wa_actor-otype = 'US'.
wa_actor-objid = wa_soapp-userid.
APPEND wa_actor TO actor_tab.
ENDIF.
DELETE ADJACENT DUPLICATES FROM actor_tab COMPARING objid.
DESCRIBE TABLE actor_tab LINES lv_lines.
IF lv_lines EQ 0.
RAISE nobody_found.
ENDIF.
Step 5: Finally, Sales Order Approval acknowledgment will be sent to the workflow initiator.
This email will be received by a workflow initiator with decisions taken by the approver and sales order details.
( Screenshot – 26 )
Create Send Mail step to send mail to the initiator. Here BUS2032 container element have enough data regarding particular Sales Order. So you can use it as bellow.
( Screenshot – 27 )
Step 6:Let us assume EVENT_NAME is ‘TRIGGER’. This workflow trigger when SO is in Credit Block. So associated approver can release it without going into VKM1.
Create Activity and create a task to Instantiate BUS2032 BO by using the sales order number. This step is necessary because to get the complete details of a particular SO.
( Screenshot – 28 )
Double-click on task. Fill the required field and do not forget to check Background Processing.
( Screenshot – 29 )
When you perform the above step, it will auto-generate Object Key, Object type, and Object instance.
( Screenshot – 30 )
Pass ISO to Objectkey and BUS2032 ( as it is – string) to the Object type. So it will instantiate BO implicitly and return it to &BUS2032& Container Element.
( Screenshot – 31 )
Step 7: User Decision for Credit Release.
Create User Decision with “Release” and “Block” buttons and pass Parameter1 with &ISO&. When we trigger the event manually from UserExit by calling ZSO_APPROVAL_EXIT-SET_PARAM method with &ISO& and &IUSER&.
( Screenshot – 32 )
Create a new task “TS****” and do not forget to make “General Task” in Task Properties.
( Screenshot – 33 )
Assign ZSO_APPROVAL_EXIT in the Program Exits tab. So after taking a decision, it will call that class, and here we can perform operations based on the decision.
( Screenshot – 34 )
Binding is simple, pass &ITAB& to &MLIST& so HTML content can be displayed on Decision Body. Avoid Extended and Decision_note, I forgot to remove these auto-generated entries.
( Screenshot – 35 )
Step 8: Sales Order Credit Block Acknowledgement sent to the workflow initiator.
Create Send Mail step to send mail to the initiator. Here BUS2032 container element have enough data regarding particular Sales Order. So you can use it as bellow.
( Screenshot – 36 )
Reference Code.
Class ZSO_APPROVAL_EXIT – Interfaces, following interfaces must be implemented.
( Screenshot – 37 )
Class ZSO_APPROVAL_EXIT – Methods, there are only 3 methods used in this blog.
IF_SWF_IFS_WORKITEM_EXIT~EVENT_RAISED
This method is used to handle Decision Taken by the Approver.
SET_PARAMS
This method is used to trigger event when so is in Credit Block.
MATERIALS.
This method is used to get Sales Order details and List of materials.
( Screenshot – 38 )
Event_Raised – Method ( Code – 2 )
IF im_event_name EQ 'AFT_EXEC'.
CHECK ls_wihead-wi_stat NE swfco_wi_status_error
AND ls_wihead-wi_stat NE swfco_wi_status_excpcaught
AND ls_wihead-wi_stat NE swfco_wi_status_excphandlr.
l_wf_cont = im_workitem_context->get_wf_container( ).
l_wi_cont = im_workitem_context->get_wi_container( ).
CALL METHOD l_wf_cont->get
EXPORTING
name = 'EVENT_NAME'
IMPORTING
value = _wf.
CALL METHOD l_wi_cont->get
EXPORTING
name = '_WI_RESULT'
IMPORTING
value = _res.
***IF A Persion has clicked on Approve button, _res = 0001. and _wf will be received from Workflow.
IF _res EQ '0001' AND ( _wf EQ 'CREATED' OR _wf EQ 'CHANGED' ).
***Code to change SO status in JEST standard table.
***You can use 'I_CHANGE_STATUS' FM
***After getting approved by the approver, it will trigger workflow to next approver level as maitained in ZSO_APPROVAL Table.
***Manually Trigger workflow to next level approver.
***
***
WAIT UP TO 1 SECONDS.
CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
EXPORTING
object_type = object_type "BUS2032
object_key = object_key "SALES ORDER NUMBER
event = event. "CHANGED
***
***
ELSEIF _res EQ '0001' AND _wf EQ 'TRIGGER'.
CALL METHOD l_wf_cont->get
EXPORTING
name = 'ISO'
IMPORTING
value = so_n.
CALL FUNCTION 'SD_ORDER_CREDIT_RELEASE'
EXPORTING
vbeln = so_n.
***
ENDIF.
Materials – Method – to generate HTML Content. ( Code – 3 )
*** ITAB and ISO are imporing parameters.
*** By using ISO that is SO Number you can get details of Materials
*** Append each HTML Line to ITAB [ ITAB TYPE ZSOLISTI1_TT ] Create TableType of SOLISTI1.
DATA : wa_contents TYPE solisti1.
wa_contents-line = |<html><head><style>|.APPEND wa_contents TO itab.
wa_contents-line = '.t1 {font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;border-collapse: collapse;width: 80%;}'.APPEND wa_contents TO itab.
wa_contents-line = '.t1 td, .t1 th {border: 1px solid #000;padding: 2px;}'.APPEND wa_contents TO itab.
wa_contents-line = '.t2{font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;border-collapse: collapse;width: 100%;}'.APPEND wa_contents TO itab.
wa_contents-line = '.t2 td, .t2 th {border: 1px solid #504F4F;padding: 5px;}'.APPEND wa_contents TO itab.
wa_contents-line = '.t2 tbody tr:nth-child(even){background-color: #f2f2f2;}'.APPEND wa_contents TO itab.
wa_contents-line = '.t2 tbody tr:hover {background-color: #ddd;}'.APPEND wa_contents TO itab.
wa_contents-line = '.t2h1 {padding-top: 12px;padding-bottom: 12px;text-align: left;background-color: #9BC2E6;color: #504F4F;}'.APPEND wa_contents TO itab.
wa_contents-line = '.t2h2 {padding-top: 12px;padding-bottom: 12px;text-align: left;background-color: #A6A6A6;color: #504F4F;text-align:center;}'.APPEND wa_contents TO itab.
wa_contents-line = |</style></head><body>|.APPEND wa_contents TO itab.
wa_contents-line = |<table border="1" class="t1"><tbody>|.APPEND wa_contents TO itab.
wa_contents-line = |<tr><td>Person Responsible</td><td>{ ename }</td></tr>|.APPEND wa_contents TO itab.
wa_contents-line = |<tr><td>Sales Organization</td><td>{ wtab-vkorg }</td></tr>|.APPEND wa_contents TO itab.
wa_contents-line = |<tr><td>Distribution Channel</td><td>{ wtab-vtweg }</td></tr>|.APPEND wa_contents TO itab.
wa_contents-line = |<tr><td>Division</td><td>{ wtab-spart }</td></tr>|.APPEND wa_contents TO itab.
wa_contents-line = |<tr><td>Sold to Party</td><td>{ wtab-name1 }</td></tr>|.APPEND wa_contents TO itab.
wa_contents-line = |<tr><td>Inco-Terms</td><td>{ wtab-inco1 }</td></tr>|.APPEND wa_contents TO itab.
wa_contents-line = |</tbody></table><table border="1" class="t2" style="margin-top:10px;"><tbody>|.APPEND wa_contents TO itab.
wa_contents-line = |<tr><th class="t2h1">List of Material:</th></tr>|.APPEND wa_contents TO itab.
wa_contents-line = |<tr><th class="t2h2">Material No</th><th class="t2h2">Material Description</th>|.APPEND wa_contents TO itab.
wa_contents-line = |<th class="t2h2">Order Quantity</th>|.APPEND wa_contents TO itab.
wa_contents-line = |<th class="t2h2">UOM</th>|.APPEND wa_contents TO itab.
wa_contents-line = |<th class="t2h2">Pending Quantity</th>|.APPEND wa_contents TO itab.
wa_contents-line = |<th class="t2h2">Basic Price</th>|.APPEND wa_contents TO itab.
wa_contents-line = |<th class="t2h2">Amount</th>|.APPEND wa_contents TO itab.
wa_contents-line = |<th class="t2h2">Currency</th></tr>|.APPEND wa_contents TO itab.
LOOP AT imat INTO wmat.
***GET MATERIALS DETAILS***
ENDLOOP.
wa_contents-line = |</tfoot></table></body></html>|.APPEND wa_contents TO itab.
SET_PARAMS – Method. ( Code – 4 )
METHOD set_params.
DATA: lv_objtype TYPE sibftypeid,
lv_event TYPE sibfevent,
lv_objkey TYPE sibfinstid,
lr_event_parameters TYPE REF TO if_swf_ifs_parameter_container,
lv_param_name TYPE swfdname,
lv_id TYPE char10.
DATA : wa TYPE zmatlist.
lv_objtype = 'ZSO_APPROVAL_EXIT'. " your class name
lv_event = 'TRIGGER'. " event name.
CALL METHOD cl_swf_evt_event=>get_event_container
EXPORTING
im_objcateg = cl_swf_evt_event=>mc_objcateg_cl
im_objtype = lv_objtype
im_event = lv_event
RECEIVING
re_reference = lr_event_parameters.
lv_param_name = 'ISO'. " parameter name of the event
lv_id = iso.
TRY.
CALL METHOD lr_event_parameters->set
EXPORTING
name = lv_param_name
value = lv_id.
CATCH cx_swf_cnt_cont_access_denied .
CATCH cx_swf_cnt_elem_access_denied .
CATCH cx_swf_cnt_elem_not_found .
CATCH cx_swf_cnt_elem_type_conflict .
CATCH cx_swf_cnt_unit_type_conflict .
CATCH cx_swf_cnt_elem_def_invalid .
CATCH cx_swf_cnt_container .
ENDTRY.
lv_param_name = 'IUSER'. " parameter name of the event
lv_id = iuser.
TRY.
CALL METHOD lr_event_parameters->set
EXPORTING
name = lv_param_name
value = lv_id.
CATCH cx_swf_cnt_cont_access_denied .
CATCH cx_swf_cnt_elem_access_denied .
CATCH cx_swf_cnt_elem_not_found .
CATCH cx_swf_cnt_elem_type_conflict .
CATCH cx_swf_cnt_unit_type_conflict .
CATCH cx_swf_cnt_elem_def_invalid .
CATCH cx_swf_cnt_container .
ENDTRY.
TRY.
CALL METHOD cl_swf_evt_event=>raise
EXPORTING
im_objcateg = cl_swf_evt_event=>mc_objcateg_cl
im_objtype = lv_objtype
im_event = lv_event
im_objkey = lv_objkey
im_event_container = lr_event_parameters.
CATCH cx_swf_evt_invalid_objtype .
CATCH cx_swf_evt_invalid_event .
ENDTRY.
COMMIT WORK.
ENDMETHOD.
Bellow code can be placed in MV45AFZZ user-exit or you can use BADI to call the SET_PARAM method to trigger the workflow.
( Code – 5 )
*** TRIGGER WORKFLOW FROM MV45AFZZ.
*** LV_USER is an Approver who is going to take decision whether SO should be removed from Credit Block or Not.
*** MANUALLY TRIGGER WORKFLOW FOR VKM1
DATA obj TYPE REF TO zso_approval_exit.
data lv_user_t type uname.
CREATE OBJECT obj.
lv_user_t = |US{ lv_user }|.
obj->set_params( EXPORTING iso = vbak-vbeln iuser = lv_user_t ).
*** MANUALLY TRIGGER WORKFLOW FOR VKM1
*** CODE TO REMOVE OLD/PENDING WORKFLOW TRIGGERD FOR THE SAME SO.
lv_srch = |%{ lv_vbeln }|. "CONCATE % WITH SO NUMBER
SELECT wi_id wi_aagent wi_cd wi_ct FROM swwwihead INTO TABLE wtab
WHERE wi_text LIKE lv_srch AND
( wi_stat EQ 'READY' OR wi_stat EQ 'STARTED' OR wi_stat EQ 'SELECTED' ) AND
top_task EQ 'WS90000016'.
LOOP AT wtab.
IF wtab-wi_cd LT sy-datum.
CALL FUNCTION 'SAP_WAPI_ADM_WORKFLOW_CANCEL'
EXPORTING
workitem_id = wtab-wi_id
actual_agent = wtab-wi_aagent.
ELSEIF wtab-wi_cd EQ sy-datum AND wtab-wi_ct LE time.
CALL FUNCTION 'SAP_WAPI_ADM_WORKFLOW_CANCEL'
EXPORTING
workitem_id = wtab-wi_id
actual_agent = wtab-wi_aagent.
ENDIF.
ENDLOOP.
What did you learn from this blog post?
You can create a workflow with standard BO events and custom class event by following this prototype. It is also possible to merge multiple workitem in a single workflow .
Dynamic agent assignment using Function Module.
You can design your own stylish content in mail body using CSS + HTML.
Further, you can also add validation in Outbound Delivery and Invoice as well to restrict it without final level approvel.
( Screenshot – 39 )
Do connect me if there is any issue or if I missed some points.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkPrivacy policy