Create me an app that generates SAP Risk and Control when the user provides a business process name.
To upload files, please first save the app
import streamlit as st
import pandas as pd
# Set page config
st.set_page_config(
page_title="SAP Risk & Control Generator",
page_icon="🔒",
layout="wide"
)
# Title and description
st.title("SAP Risk & Control Generator")
st.markdown("""
This application helps generate common SAP risks and controls based on your business process.
Simply enter your business process name and get relevant risks and controls.
""")
# Dictionary of predefined risks and controls for different business processes
risk_control_matrix = {
"accounts_payable": {
"risks": [
"Unauthorized or fraudulent vendor payments",
"Duplicate payments to vendors",
"Incorrect payment amounts",
"Processing of fictitious invoices",
"Unauthorized changes to vendor master data"
],
"controls": [
"Segregation of duties between vendor master data maintenance and payment processing",
"System configuration for duplicate payment checking",
"Three-way match (PO, GR, Invoice) before payment",
"Regular vendor master data reviews",
"Payment approval workflow based on amount thresholds"
]
},
"accounts_receivable": {
"risks": [
"Unauthorized credit memo processing",
"Delayed customer payments",
"Inaccurate customer balances",
"Unauthorized customer master data changes",
"Revenue recognition errors"
],
"controls": [
"Credit memo approval workflow",
"Automated dunning process",
"Regular account reconciliation",
"Restricted access to customer master data",
"Period-end revenue recognition review"
]
},
"general_ledger": {
"risks": [
"Unauthorized journal entries",
"Incorrect account postings",
"Incomplete audit trail",
"Period-end closing errors",
"Chart of accounts maintenance errors"
],
"controls": [
"Journal entry approval workflow",
"Automated validation rules for postings",
"System logging of all GL transactions",
"Period-end closing checklist",
"Restricted access to COA maintenance"
]
},
"inventory_management": {
"risks": [
"Inventory theft or loss",
"Inaccurate stock counts",
"Obsolete inventory",
"Unauthorized goods movements",
"Incorrect valuation"
],
"controls": [
"Regular cycle counts",
"Restricted access to warehouses",
"Regular obsolescence review",
"Goods movement approval workflow",
"Automated inventory valuation"
]
}
}
# Input for business process
process_input = st.text_input("Enter your business process name:",
placeholder="e.g., accounts_payable, accounts_receivable, general_ledger, inventory_management")
if process_input:
# Convert input to lowercase and replace spaces with underscores
process_key = process_input.lower().replace(" ", "_")
if process_key in risk_control_matrix:
# Create two columns
col1, col2 = st.columns(2)
with col1:
st.subheader("🚨 Risks")
risks_df = pd.DataFrame(risk_control_matrix[process_key]["risks"], columns=["Risks"])
st.table(risks_df)
with col2:
st.subheader("🛡️ Controls")
controls_df = pd.DataFrame(risk_control_matrix[process_key]["controls"], columns=["Controls"])
st.table(controls_df)
# Download buttons
st.markdown("### Download Options")
# Convert to DataFrame for download
download_df = pd.DataFrame({
"Risks": risk_control_matrix[process_key]["risks"],
"Controls": risk_control_matrix[process_key]["controls"]
})
csv = download_df.to_csv(index=False)
st.download_button(
label="Download as CSV",
data=csv,
file_name=f"{process_key}_risks_controls.csv",
mime="text/csv"
)
else:
st.error("""
Process not found in database. Please try one of the following:
- accounts_payable
- accounts_receivable
- general_ledger
- inventory_management
""")
# Footer
st.markdown("---")
st.markdown("*Note: This is a simplified risk and control matrix. For a comprehensive risk assessment, please consult with your internal control team.*")
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?