Tuesday, August 4, 2026

AI Architcect reference Question Answers

 AI Architect & CTO Interview Guide

25 Essential Questions & Answers


1. Describe your approach to designing a scalable ML system architecture.

A scalable ML system architecture should include: (1) Data ingestion layer with fault tolerance; (2) Feature engineering and processing pipelines; (3) Model training infrastructure with distributed computing; (4) Model versioning and registry; (5) Serving layer with low-latency inference; (6) Monitoring and observability; (7) CI/CD pipelines for model deployment. Key considerations include modularity, reproducibility, data governance, and clear separation of concerns. The architecture should support A/B testing, canary deployments, and quick rollbacks. Use containerization (Docker/Kubernetes) for consistency across environments.

2. How do you approach model selection and evaluation?

Start with the business problem and define clear success metrics tied to business outcomes, not just ML metrics. Consider: (1) Baseline performance; (2) Trade-offs between accuracy, latency, and cost; (3) Model complexity and interpretability requirements; (4) Computational resource constraints; (5) Data requirements and availability. Use cross-validation, hold-out test sets, and stratified sampling. Implement proper evaluation frameworks with statistical significance testing. Consider ensemble methods and domain-specific evaluation (e.g., for recommendations, use NDCG; for classification, use precision-recall curves). Always validate on production-like data distributions.

3. What is your experience with LLMs and transformer architectures?

Transformers use self-attention mechanisms to process sequences in parallel, achieving better performance than RNNs. Key concepts: (1) Multi-head attention allows the model to attend to different representation subspaces; (2) Positional encodings preserve sequence order; (3) Layer normalization and residual connections stabilize training. LLMs like GPT and BERT are foundation models trained on massive corpora. Important considerations: (1) Fine-tuning vs. prompt engineering; (2) Context window limitations; (3) Computational costs for inference; (4) Hallucination and bias issues; (5) Prompt injection vulnerabilities. I'd discuss experiences with retrieval-augmented generation (RAG), parameter-efficient fine-tuning (LoRA), and prompt optimization strategies.

4. How do you handle data quality and data governance in ML systems?

Data quality is foundational. Implement: (1) Data validation pipelines to catch anomalies, missing values, and distributional shifts; (2) Data profiling and cataloging; (3) Version control for datasets (using tools like DVC); (4) Data documentation and lineage tracking; (5) Privacy controls and anonymization where needed; (6) Access controls and audit logs. For governance: establish data ownership, create clear policies for data usage, implement consent management, and ensure regulatory compliance (GDPR, CCPA). Monitor for data drift, label drift, and feature drift in production. Use tools like Great Expectations for automated data validation and implement data quality dashboards.

5. Explain your strategy for managing technical debt in ML/AI projects.

ML systems accumulate technical debt uniquely: (1) Code debt - poor documentation, untested code, lack of version control; (2) Data debt - data quality issues, undocumented data dependencies, unused features; (3) Model debt - models trained on outdated data, poor generalization, unmaintained code. Address it by: (1) Establishing code review processes and testing standards; (2) Documenting data pipelines and model decisions; (3) Regular refactoring sprints; (4) Monitoring model performance drift; (5) Retiring underperforming models; (6) Automating testing and deployment. Balance between shipping features and maintaining code quality. Create a technical debt register and allocate time in each sprint to address it systematically.

6. How do you approach ML model monitoring and observability?

Monitoring should cover three layers: (1) Infrastructure metrics - latency, throughput, CPU/memory usage, error rates; (2) Model metrics - accuracy, precision, recall, F1, calibration on held-out test sets; (3) Data metrics - input distributions, feature statistics, label distributions. Implement: (1) Dashboards tracking key metrics in real-time; (2) Automated alerts for anomalies; (3) Model performance baselines and drift detection; (4) Root cause analysis when performance degrades; (5) A/B testing frameworks to validate changes. Use tools like Prometheus, Grafana, or cloud-native solutions. Track business metrics alongside technical metrics. Implement shadow mode for new models to validate before production rollout.

7. Describe your approach to model deployment and serving at scale.

Deployment strategy depends on requirements. For batch inference: use distributed computing (Spark, Ray) for high-throughput processing. For real-time inference: (1) Containerize models (Docker); (2) Use orchestration (Kubernetes) for scaling; (3) Implement load balancing and auto-scaling; (4) Use model serving frameworks (TensorFlow Serving, TorchServe, Ray Serve); (5) Cache predictions when appropriate; (6) Implement circuit breakers and fallback mechanisms. Key practices: (1) Blue-green deployments for zero-downtime updates; (2) Canary deployments to validate changes on a subset; (3) Feature flags for quick rollbacks; (4) Comprehensive logging and tracing; (5) SLO/SLA monitoring. Consider latency, throughput, cost, and reliability requirements.

8. How do you address bias and fairness in AI systems?

Bias mitigation requires a multi-stage approach: (1) Data collection - ensure representative sampling across demographics; (2) Data preprocessing - audit for historical bias and implement debiasing techniques; (3) Model selection - choose architectures that don't amplify bias; (4) Training - use fairness-aware loss functions or constrained optimization; (5) Evaluation - test across demographic groups, measure disparate impact, use fairness metrics (equalized odds, demographic parity); (6) Monitoring - track fairness metrics in production. Implement human review loops for high-stakes decisions. Use interpretability tools to understand model decisions. Document assumptions and limitations. Consider the full ML pipeline, not just the model. Engage domain experts, ethicists, and affected communities in the process.

9. What's your experience with MLOps and ML platforms?

MLOps applies DevOps principles to ML. Key components: (1) Version control for code, data, and models; (2) Automated testing - unit tests, integration tests, data validation; (3) CI/CD pipelines for training and deployment; (4) Experiment tracking (MLflow, Weights & Biases); (5) Feature stores for consistent feature engineering; (6) Model registries for versioning; (7) Orchestration tools (Airflow, Kubeflow) for complex pipelines; (8) Containerization and reproducible environments. ML platforms consolidate these tools to provide a unified experience. Key benefits: reduced time-to-production, reproducibility, scalability, and lower operational overhead. Governance and compliance are critical - audit trails, access control, and data lineage tracking. Consider both build-vs-buy decisions and open-source vs. proprietary solutions.

10. How do you handle model retraining and continuous improvement?

Establish a retraining strategy based on performance degradation and data drift. Implement: (1) Automated monitoring to detect performance decay; (2) Triggers for retraining (time-based, performance-based, or data-based); (3) Offline evaluation pipeline to validate new models before deployment; (4) A/B testing to compare old vs. new models; (5) Rollback mechanisms if new model underperforms. Use curriculum learning to prioritize recent or important data. Implement incremental learning where feasible. For LLMs, consider fine-tuning on new domains or instruction-tuning for specific use cases. Balance between computational cost and performance improvement. Document all model versions, training data, hyperparameters, and results. Maintain a model registry with clear ownership and SLAs.

11. What security and privacy considerations do you implement in AI systems?

Security and privacy are critical: (1) Data security - encryption at rest and in transit, access controls, anonymization/pseudonymization; (2) Model security - prevent adversarial attacks, model theft, and prompt injection; (3) Infrastructure security - network isolation, secret management, vulnerability scanning; (4) Compliance - GDPR right-to-be-forgotten, audit trails, data residency requirements; (5) Privacy-preserving ML - differential privacy, federated learning, secure multi-party computation. Implement: (1) Regular security audits and penetration testing; (2) Dependency scanning for vulnerabilities; (3) Rate limiting and DDoS protection; (4) Input validation and sanitization; (5) Explainability for transparency. Train teams on security best practices. For LLMs, address prompt injection, model inversion attacks, and unintended information leakage.

12. How do you approach building and scaling data pipelines?

Scalable data pipelines require careful architecture: (1) Source layer - handle various data sources (databases, APIs, logs); (2) Ingestion - use message queues (Kafka) for streaming or batch tools (Spark) for large datasets; (3) Transformation - implement feature engineering, aggregations, and quality checks; (4) Storage - choose appropriate storage based on access patterns (data lakes for raw data, data warehouses for analytics, feature stores for ML); (5) Orchestration - use tools like Airflow or Beam for scheduling and monitoring. Design for: (1) Idempotency - ensure consistent results regardless of retries; (2) Exactly-once semantics in streaming; (3) Error handling and recovery; (4) Data quality validation at each stage; (5) Scalability and cost-efficiency. Monitor latency, throughput, and data freshness. Implement data lineage tracking.

13. Describe your experience with cloud platforms for AI/ML.

Cloud platforms (AWS SageMaker, Google Vertex AI, Azure ML) offer managed services for the ML lifecycle. Key advantages: (1) Scalable compute resources on-demand; (2) Pre-built models and APIs; (3) Managed services reduce operational burden; (4) Global infrastructure for low-latency serving. Important considerations: (1) Cost optimization - use spot instances, auto-scaling, and resource right-sizing; (2) Lock-in concerns - design for portability; (3) Compliance and data residency; (4) Integration with existing infrastructure; (5) Latency requirements. I'd discuss specific services: compute (EC2, GCE), storage (S3, GCS), managed ML services, and data warehouses. Design multi-cloud or hybrid strategies when needed. Monitor cloud costs and implement governance policies.

14. How do you make trade-offs between model accuracy and operational constraints?

This is a critical business decision. Consider: (1) Business impact - what's the business value of incremental accuracy improvements?; (2) Latency requirements - can we tolerate slower inference?; (3) Cost constraints - hardware and compute costs; (4) Interpretability needs - simpler models are more interpretable; (5) Maintenance burden - complex models require more expertise. Use Pareto analysis to identify sweet spots. Implement model compression techniques: (1) Quantization - reduce precision of weights; (2) Pruning - remove less important weights; (3) Distillation - train smaller models to mimic larger ones; (4) Low-rank approximation. Consider ensemble methods that balance accuracy and latency. Always validate trade-offs through A/B testing. Document decisions for future reference and team alignment.

15. What's your strategy for developing and managing AI talent and teams?

Building high-performing AI teams requires: (1) Clear roles and responsibilities - ML engineers, data scientists, ML infrastructure engineers; (2) Hiring for both specialized skills and learning ability; (3) Mentorship and knowledge sharing; (4) Continuous learning programs - internal workshops, conference attendance, certifications; (5) Clear career paths and growth opportunities. Organizational practices: (1) Cross-functional collaboration with product and engineering; (2) Code review culture focused on learning; (3) Psychological safety for experimentation; (4) Diverse perspectives - hire for diversity; (5) Work-life balance to prevent burnout. Technical practices: (1) Pair programming and mob sessions; (2) Shared documentation and decision records; (3) Internal ML platforms reducing friction; (4) Regular architecture reviews and design discussions. Invest in tools and infrastructure that make engineers productive.

16. How do you evaluate new AI/ML technologies and decide on adoption?

Use a structured evaluation framework: (1) Business fit - does it address real problems?; (2) Technical fit - architecture alignment, integration complexity; (3) Maturity - is it production-ready or still experimental?; (4) Community and support - active development, documentation, community size; (5) Cost - licensing, infrastructure, training; (6) Risk assessment - vendor lock-in, maintenance burden. Evaluation process: (1) Research and competitive analysis; (2) Proof-of-concept on a small project; (3) Performance benchmarking; (4) Security review; (5) Team training requirements. Make decisions based on data, not hype. Consider total cost of ownership including hidden costs. For new LLM capabilities, experiment in sandbox environments first. Maintain a technology roadmap communicated to the team.

17. How would you design a recommendation system for an e-commerce platform?

Recommendation systems blend multiple approaches: (1) Collaborative filtering - find similar users or items; (2) Content-based filtering - use item features; (3) Hybrid methods - combine approaches; (4) Context-aware - incorporate session/temporal data. Architecture: (1) Candidate generation - reduce from millions to thousands of relevant items; (2) Ranking - score candidates using more complex models; (3) Re-ranking - apply business rules (diversity, exploration); (4) Real-time serving - low-latency response to user requests. Key considerations: (1) Cold-start problem for new users/items; (2) Exploration vs. exploitation - balance known preferences with discovery; (3) Diversity - avoid filter bubbles; (4) Fairness - ensure all items get exposure; (5) Metrics - use ranking metrics (NDCG, MRR), business metrics (click-through rate, conversion, revenue). Implement feedback loops to collect implicit signals (clicks, purchases, dwell time).

18. Describe your approach to handling imbalanced datasets.

Imbalanced datasets require careful handling: (1) Resampling - oversampling minority class (with SMOTE), undersampling majority class, or hybrid approaches; (2) Class weights - increase weight for minority class in loss function; (3) Threshold adjustment - move decision boundary to favor minority class; (4) Ensemble methods - combine predictions from different sampling strategies. Evaluation metrics matter: (1) Avoid accuracy - use precision, recall, F1-score, or ROC-AUC; (2) Stratified cross-validation - maintain class distribution in folds; (3) Cost-sensitive learning - assign different misclassification costs. Business context: (1) What's the cost of false positives vs. false negatives?; (2) What's the acceptable recall threshold?. Generate synthetic data (SMOTE, VAE) when data collection is expensive. Monitor class distribution in production. Consider whether imbalance reflects real-world distribution or is a data collection issue.

19. How do you approach feature engineering and selection?

Good features drive good models. Feature engineering: (1) Domain knowledge - understand the problem deeply; (2) Statistical analysis - correlations, distributions, interactions; (3) Temporal features - lags, rolling statistics for time series; (4) Cross-features - polynomial, interaction terms; (5) Embedding features - learned representations from NLP or graph embeddings; (6) Aggregation features - group statistics. Feature selection reduces dimensionality and improves interpretability: (1) Univariate methods - filter based on correlation with target; (2) Model-based - use feature importance from tree models; (3) Recursive elimination - iteratively remove features; (4) Regularization - L1/L2 penalize irrelevant features. Best practices: (1) Avoid data leakage - don't use information from test set; (2) Handle missing values thoughtfully; (3) Normalize/scale features appropriately; (4) Document feature definitions; (5) Monitor feature distributions in production. Use feature stores for consistency.

20. What is your experience with reinforcement learning applications?

Reinforcement learning (RL) optimizes decisions through trial-and-error. Key concepts: (1) Agents learn policies by maximizing cumulative reward; (2) Exploration-exploitation trade-off - balance trying new actions with exploiting known good actions; (3) Value functions estimate expected returns; (4) Policy gradients optimize action selection directly. Applications: (1) Robotics - control and navigation; (2) Game playing - AlphaGo, game AI; (3) Resource allocation - ad bidding, job scheduling; (4) Dialogue systems - conversation policy optimization; (5) Recommendation - optimize for long-term engagement. Challenges: (1) Sample efficiency - RL requires many interactions; (2) Exploration risk - wrong actions can cause real-world damage; (3) Non-stationarity - environment changes over time; (4) Simulation reality gap - simulators don't match real world. Use simulators for training. Implement reward shaping carefully. Consider safety constraints. Use offline RL when online interaction is expensive.

21. How do you approach interpretability and explainability in AI models?

Interpretability is increasingly important, especially for high-stakes applications. Approaches: (1) Intrinsic interpretability - use inherently interpretable models (linear models, decision trees); (2) Post-hoc explanations - explain predictions after training. Methods: (1) Feature importance - which features matter?; (2) LIME - local interpretable model-agnostic explanations; (3) SHAP - Shapley values for consistent feature attribution; (4) Attention visualization - for neural networks; (5) Saliency maps - visual importance for image models; (6) Counterfactual explanations - "what if" scenarios. Best practices: (1) Explain to different audiences - technical, business, end-users; (2) Validate explanations are correct; (3) Avoid over-interpreting spurious correlations; (4) Balance accuracy vs. interpretability; (5) Document model limitations. For LLMs, track which documents the model retrieves (in RAG systems). Build interpretability into the ML platform, not as an afterthought.

22. Describe how you'd handle a model performance degradation incident.

Incident response requires a systematic approach: (1) Alert - monitoring detects performance drop; (2) Page-on-call engineer; (3) Assessment - gather metrics, logs, and recent changes; (4) Diagnosis - identify root cause: data drift, model issues, infrastructure problems, or external factors. Common causes: (1) Data drift - input distribution changed; (2) Label drift - target distribution changed; (3) Feature data quality - missing values, outliers; (4) Recent code/config changes; (5) Infrastructure issues - GPU degradation, network problems. Recovery steps: (1) Immediate action - rollback to previous stable version; (2) Implement circuit breaker to fallback to baseline; (3) Route traffic to healthy instances; (4) Gather more data for root cause analysis. Post-incident: (1) Improve monitoring and alerting; (2) Implement automated checks to catch issues earlier; (3) Add test cases for the failure scenario; (4) Update runbooks. Maintain detailed incident documentation.

23. How do you measure and improve ML system ROI and business impact?

Align ML metrics with business outcomes: (1) Define success metrics tied to business goals - revenue, cost savings, user engagement, quality; (2) Establish baselines to measure improvement; (3) Use causal inference - ensure improvements come from the ML system, not other factors. Measurement framework: (1) Holdout groups - A/B testing to measure incremental impact; (2) Synthetic controls - estimate counterfactual outcomes; (3) Difference-in-differences - compare treatment and control group trends. ROI calculation: (1) Quantify benefits - increased revenue, reduced costs, time saved; (2) Calculate costs - engineering time, compute, tools; (3) Consider implementation timeline and ramp-up period. Regular reviews: (1) Monitor metrics over time - benefits may decrease as competition adapts; (2) Adjust investment based on performance; (3) Communicate impact to stakeholders. For cost models, include all expenses - data collection, annotation, infrastructure, engineering time. Avoid vanity metrics - focus on actionable metrics.

24. What's your vision for responsible AI and ethical considerations in system design?

Responsible AI requires holistic thinking: (1) Fairness - treat individuals fairly across demographic groups; (2) Transparency - explain decisions to affected parties; (3) Accountability - take responsibility for outcomes; (4) Privacy - protect personal data; (5) Safety - avoid unintended harms. Implementation: (1) Ethics review board - evaluate high-stakes projects; (2) Impact assessments - identify potential harms before deployment; (3) Diverse perspectives - include non-technical voices in design; (4) Feedback mechanisms - let affected parties raise concerns; (5) Continuous monitoring - assess real-world impacts. Emerging AI risks: (1) AI-generated misinformation; (2) Deepfakes and synthetic media; (3) Autonomous weapons; (4) Environmental impact of training large models; (5) Concentration of power. Leadership responsibility: (1) Set organizational tone and culture; (2) Allocate resources for responsible AI; (3) Train teams on ethics; (4) Communicate values externally; (5) Advocate for regulation where needed. Balance innovation with responsibility.

25. How do you stay current with rapidly evolving AI research and trends?

Continuous learning is essential in a fast-moving field: (1) Research papers - read top venues (NeurIPS, ICML, ICLR, ACL); (2) Blogs and newsletters - stay informed on practical developments; (3) Open-source projects - implement and experiment with new techniques; (4) Conferences - attend or watch talks to understand state-of-art; (5) Community - engage with researchers and practitioners. Structured approach: (1) Allocate time for learning - set aside 10-20% for professional development; (2) Focus areas - specialize in areas aligned with business priorities; (3) Experiment - implement new techniques on side projects or hackathons; (4) Share knowledge - write blog posts, give talks, mentor juniors. Balance between: (1) Depth - become expert in key areas; (2) Breadth - understand multiple domains; (3) Hype vs. substance - evaluate claims critically; (4) Academic vs. practical - apply research insights to real problems. Build a team culture that values learning. Sponsor team members for training and conferences. Create time for experimentation and exploration.


Good luck with your interview preparation!

Monday, August 25, 2025

HR Internship Interview Question Answers

 Here’s a strong list of 20 Interview Questions with Suggested Answers tailored for an HR Intern job. These will help candidates prepare confidently while keeping answers practical and professional.


✅ HR Intern Interview Questions and Answers

1. Tell me about yourself.

Answer:
“I’m currently pursuing/completed my degree in [HR/Business/Management]. I have a strong interest in Human Resource Management, particularly in recruitment, employee engagement, and learning HR processes. I’m looking forward to gaining practical experience as an HR Intern and contributing to the team while building my skills.”


2. Why do you want to pursue a career in HR?

Answer:
“HR plays a key role in shaping the culture and success of any organization. I enjoy working with people, problem-solving, and supporting both employees and management. I believe HR allows me to use these skills to add real value.”


3. What do you understand about the role of an HR Intern?

Answer:
“An HR Intern assists with recruitment, onboarding, maintaining employee records, supporting HR events, and learning company policies. The role is about supporting the HR team and gaining exposure to real-world HR practices.”


4. What HR functions interest you the most?

Answer:
“I’m particularly interested in recruitment and employee engagement. I like the process of finding the right talent for a role and helping them feel motivated and connected to the organization.”


5. How do you handle confidential information?

Answer:
“I understand the importance of confidentiality in HR. I would ensure sensitive employee data is never shared inappropriately and follow all organizational policies regarding data privacy.”


6. What do you know about our company’s culture and values?

Answer:
“I researched your company and found that you emphasize [insert company’s value, e.g., innovation, teamwork, or integrity]. I admire how you invest in employee growth and maintain a positive workplace, which makes me excited to intern here.”


7. How would you handle a conflict between two employees?

Answer:
“As an intern, I would first report it to my supervisor or HR manager. However, I believe conflicts should be handled with active listening, understanding both perspectives, and guiding employees toward a respectful resolution.”


8. How do you prioritize tasks when given multiple responsibilities?

Answer:
“I usually make a to-do list, identify urgent vs. important tasks, and set deadlines. I also make sure to communicate with my supervisor if I need clarity on priorities.”


9. What software or tools are you familiar with?

Answer:
“I have basic knowledge of MS Office (Word, Excel, PowerPoint), Google Workspace, and some exposure to HR tools like [mention any known tools like SAP, Zoho People, Workday, etc. if applicable]. I am eager to learn any new HR software used here.”


10. How would you contribute to the recruitment process?

Answer:
“I can support by screening resumes, scheduling interviews, communicating with candidates, and updating the applicant tracking system. I would also make sure the candidate experience remains professional and positive.”


11. What qualities make a good HR professional?

Answer:
“Strong communication, empathy, confidentiality, organizational skills, and problem-solving abilities. A good HR professional also balances company policies with employee satisfaction.”


12. Can you describe a time when you worked in a team successfully?

Answer:
“In my college project, I coordinated tasks among team members, ensured deadlines were met, and supported where needed. We completed the project ahead of time, which taught me teamwork and collaboration.”


13. How do you stay updated with HR trends?

Answer:
“I follow HR-related blogs, LinkedIn pages, and HR news websites. I also attend webinars and online courses to keep learning about HR practices.”


14. How would you support employee engagement as an intern?

Answer:
“I would help organize events, support surveys, and encourage participation. Even small actions like greeting employees, supporting onboarding, and contributing creative ideas can make employees feel more valued.”


15. What would you do if an employee approached you with a complaint?

Answer:
“I would listen respectfully, take notes, and reassure them that their concern will be handled appropriately. Then I would escalate it to my HR supervisor or manager as per policy.”


16. How do you ensure accuracy when managing HR data?

Answer:
“I double-check my entries, keep organized records, and verify information before submitting. I also ask for clarification if I’m unsure, because accuracy is very important in HR.”


17. Where do you see yourself in 5 years?

Answer:
“I see myself as a trained HR professional working in areas like recruitment, employee development, or HR analytics. This internship will give me the foundation to reach that goal.”


18. What is the difference between Recruitment and Selection?

Answer:
“Recruitment is about attracting candidates for a job, while Selection is the process of choosing the most suitable candidate from those applicants.”


19. What do you think is the biggest challenge HR faces today?

Answer:
“One big challenge is employee retention and engagement in a highly competitive job market. HR must create strategies to keep employees motivated and satisfied.”


20. Why should we hire you as an HR Intern?

Answer:
“I bring enthusiasm, adaptability, and a genuine interest in HR. I’m eager to learn, quick to grasp new tools, and committed to supporting the HR team. I will work hard to add value to your organization.”



Tuesday, July 29, 2025

Generative AI & Prompt Engineering

 https://drive.google.com/file/d/1uoA7SacaUqlyOr0xC8yD4ZRuubLSAPZK/view?usp=sharing

Wednesday, January 1, 2025

SAP ABAP Cloud

 More and more organizations are coming across the term ABAP on Cloud. Whether they are considering Side-by-Side Extension with SAP Business Technology Platform or On-stack Extension in S4 HANA, I'm certain that this is discussed in your strategy meeting at least once.


ABAP on Cloud(aka ABAP for Cloud Development language version) is similar yet different from standard ABAP in many ways. Even if your organization holds in-house ABAP developers, the transition path to ABAP on Cloud may not be easy. This is due to the fact that certain APIs(table, function module, tcode, etc.) exist in your system built with standard ABAP language are not functional in ABAP on Cloud. On the front-end level, the major factor of not being able to use SAP GUI changes certain ABAP based solutions. In addition, there are changes in ABAP syntax as well.

This blogs is a one-stop shop for developers and IT strategist who like to make smooth transition from standard ABAP to ABAP for Cloud Development. It consists of three parts:

  • Cheat sheet on LoB(Line of Business) level

  • Cheat sheet on Solution & Syntax level

  • Solution overview & hint based on ABAP for Cloud Development


You can choose to just refer to the cheat sheet, or you can deep dive into each solution at later half of this blog.









Disclaimer:

  • Availability of ABAP object for cloud development may differ between ABAP Platform for S4 HANA and BTP ABAP Environment

  • ABAP object for cloud development may be renewed and deprecated over time

  • The list covers the most common ABAP topics and Line of Business(from personal perspective) but certain areas of your interest may be missing. You are welcome to comment these areas and I maybe able to add them later on.



LoB(Line of Business)


Standard ABAP object/ based solutionPublic local API to use instead in ABAP for Cloud Development
Business Partner
Table:
KNA1
KNB1
KNVK
KNVP
KNVV
LFA1
LFB1
LFM1
CDS view:
i_customer
i_customercompany
i_contactperson
i_custsalespartnerfunc
i_customersalesarea
i_supplier
i_suppliercompany
i_supplierpurchasingorg
Delivery
Table:
LIKP
LIPS
TVST
CDS view:
i_deliverydocument
i_deliverydocumentitem
i_shippingpoint
Finance
Table:
BKPF
BSEG
ACDOCA
SKA1
SKB1
T001
T003
CEPC
Function Module:
BAPI_ACC_EMPLOYEE_EXP_POST
BAPI_ACC_INVOICE_RECEIPT_CHECK
BAPI_ACC_INVOICE_RECEIPT_POST
BAPI_ACC_DOCUMENT_CHECK
BAPI_ACC_DOCUMENT_POST
BAPI_ACC_ACT_POSTINGS_REVERSE
CDS view:
i_journalentry
i_operationalacctgdocitem
i_journalentryitem
i_glaccountlineitem
i_glaccountlineitemrawdata
i_glaccountinchartofaccounts
i_glaccountincompanycode
i_companycode
i_profitcenter
Behavior Definition:
i_journalentrytp
Finance(Hierarchy)
Table:
SETHEADER
SETHEADERT
SETLEAF
SETNODE
CDS view:
i_costcenterhierarchy
i_costcenterhierarchynode
i_costctractivitytypehiernode
i_functionalareahierarchy
i_functionalareahiernode
i_profitcenterhierarchy
i_profitcenterhierarchynode
Manufacturing
Table:
MARA
MARC
MARD
MARM
AFKO
AFPO
AFRU
AFVC
AFVU
AFVV
MKAL
PLKO
PLPO
Function Module:
BAPI_MATERIAL_MAINTAINDATA_RT
BAPI_MATERIAL_SAVEREPLICA
BAPI_MATERIAL_SAVEDATA
BAPI_PLANNEDORDER_GET_DETAIL
BAPI_PRODORD_CHANGE
BAPI_PRODORD_COMPLETE_TECH
BAPI_PRODORD_CREATE
BAPI_PRODORD_RELEASE
BAPI_MATERIAL_STOCK_REQ_LIST
CDS view:
i_product
i_productqm
i_productsales
i_productprocurement
i_productplantbasic
i_productsupplyplanning
i_productstoragelocationbasic
i_productunitsofmeasure
i_manufacturingorder
i_manufacturingorderitem
i_mfgorderconfirmation
i_manufacturingorderoperation
i_manufacturingorderoperation
i_manufacturingorderoperation
i_productionversion
i_billofoperationsgroup
i_mfgbillofoperationsoperation
Behavior Definition:
i_producttp_2
i_plannedordertp
i_productionordertp
i_productionordconfirmationtp
i_plndindeprqmttp
i_supplydemanditemtp
Payment
Table:
REGUH
REGUP
REGUV
REGUT
CDS view:
i_paymentprogramcontrol
i_paymentproposalpayment
i_paymentproposalitem
i_paymentproposalcontrol
Physical Inventory Management
Table:
IKPF
ISEG
T001L
T001W
MSEG
MKPF
Function Module:
MB_CREATE_GOODS_MOVEMENT
MB_POST_GOODS_MOVEMENT
BAPI_GOODSMVT_CANCEL
BAPI_GOODSMVT_CREATE
BAPI_MATPHYSINV_CHANGECOUNT
BAPI_MATPHYSINV_COUNT
BAPI_MATPHYSINV_CREATE
CDS view:
i_physinvtrydocheader
i_physinvtrydocitem
i_storagelocation
i_plant
i_materialdocumentitem_2
i_materialdocumentheader_2
Behavior Definition:
i_materialdocumenttp
i_physicalinventorydocumenttp
Sales
Table:
VBAK
VBAP
VBEP
VBFA
VBKD
VBRK
VBRP
TVGRT
TVKBT
TVKBZ
TVKGR
TVKO
TVTA
TVTW
Function Module:
BAPISDORDER_GETDETAILEDLIST
BAPI_SALESORDER_CREATEFROMDAT2
CDS view:
i_salesdocument
i_salesdocumentitem
i_salesdocumentscheduleline
i_sddocumentmultilevelprocflow
i_salesdocument
i_billingdocumentbasic
i_billingdocumentitembasic
i_salesgroup
i_salesoffice
i_salesareasalesoffice
i_salesgroup
i_salesorganization
i_salesarea
i_distributionchannel
Behavior Definition:
i_salesordertp
Sales (Pricing)
Table:
KONH
KONM
KONP
KONV
PRCD_ELEMENTS
T685
T685A
CDS view:
i_slsprcgconditionrecord
i_slsprcgcndnrecordscale
i_slsprcgconditionrecord
i_slsprcgconditionrecord
i_slsprcgconditionrecord
i_conditiontype
i_pricingconditiontype
Sourcing and Procurement
Table:
EKKO
EKPO
RBKP
RSEG
MATDOC
EBAN
EBKN
EINA
EINE
MSKA
MSKU
MSLB
MSLBH
Function Module:
BAPI_PO_CHANGE
BAPI_PO_CREATE1
BAPI_PR_CHANGE
BAPI_PR_CREATE
BAPI_REQUISITION_CHANGE
BAPI_REQUISITION_CREATE
BAPI_REQUISITION_GETDETAIL
BAPI_INCOMINGINVOICE_CREATE
BAPI_INCOMINGINVOICE_POST
BAPI_INCOMINGINVOICE_RELEASE
CDS view:
i_purchaseorderapi01
i_purchaseorderitemapi01
i_supplierinvoiceapi01
i_suplrinvcitempurordrefapi01
i_materialdocumentheader_2
i_purchaserequisitionitemapi01
i_purreqnacctassgmtapi01
i_purchasinginforecordapi01
i_purchasinginforecordapi01
i_materialstock
Behavior Definition:
i_purchaseordertp_2
i_purchaserequisitiontp
i_purchasecontracttp
i_supplierinvoicetp


Solution Syntax



























































ge ABAP memory but former is much simpler to use. BUFFER transfers to cluster data the buffer data object which is in xstring format.


The main difference is that passing data using MEMORY ID is not supported anymore. Therefore only these 2 options are available.
    "ABAP memory using buffer
    DATA:buffer       TYPE xstring,
         lt_input_bf  TYPE STANDARD TABLE OF I_UnitOfMeasure,
         lt_output_bf TYPE STANDARD TABLE OF I_UnitOfMeasure.

    SELECT *  FROM I_UnitOfMeasure INTO TABLE @lt_input_bf.
    EXPORT input = lt_input_bf TO DATA BUFFER buffer.
    IMPORT input = lt_output_bf FROM DATA BUFFER buffer.

 

Access management


* Below example demonstrates how to restrict access inside IAM app. In addition, you may choose to implement Access Control on your CDS Data Definition.


Similar to in SAP on-premise access management, Authorization Object and Role are still relevant in ABAP for Cloud development. The big difference is that User Profiles is not used anymore and instead, IAM App and Business Catalog are used to map Authorization Object and Business Role. User Profile is where the fine-grained access control is setup, so that some users have display access to certain table objects, while some users don’t. This is in turn done by IAM App and Access Control Object in the ABAP for Cloud development.

The actual authorization check uses the same ABAP syntax, AUTHORITY-CHECK OBJECT. This checks the authorization object and activity value, which hasn't changed from standard ABAP.

In my below example, I created Authorization Field "ZTABLE", Authorization Object "ZAUTH_OBJ". In the IAM app, set the authorization object and restrict the table name and activity.


In the Behavior Definition , implement global authorization instance.
managed implementation in class ZCL_BLOB_TEST unique;
strict ( 1 );
with draft;

define own authorization context
{
'ZAUTH_OBJ';
}

define behavior for ZI_BLOB_TEST alias BLOB_TEST
persistent table zblob_test
draft table ziblob_test_d
etag master LocalLastChangedAt
lock master total etag LastChangedAt
authorization master ( global )

In the Behavior Handler class, implement the authorization check in method "get_global_authorizations". Set a debug on this logic so that we see what is going on.
IF requested_authorizations-%create EQ if_abap_behv=>mk-on.
  * check create authorization
  AUTHORITY-CHECK OBJECT 'ZAUTH_OBJ' ID 'ACTVT' FIELD '01'.
  result-%create = COND #( WHEN sy-subrc = 0 THEN
  if_abap_behv=>auth-allowed ELSE
  if_abap_behv=>auth-unauthorized ).
ENDIF.

IF requested_authorizations-%update EQ if_abap_behv=>mk-on.
  * check update authorization
  AUTHORITY-CHECK OBJECT 'ZAUTH_OBJ' ID 'ACTVT' FIELD '02'.
  result-%update = COND #( WHEN sy-subrc = 0 THEN
  if_abap_behv=>auth-allowed ELSE
  if_abap_behv=>auth-unauthorized ).
ENDIF.

 

Now go to the Fiori application generated from the Odata service and go to the item to edit the record. The debugger should start and you can see that the result of authorization check for update(sy-subrc = 0) is OK. This is because in IAM app, 02(change) is allowed.


 

Now let's create a new record. This time, the authority check fails because IAM app does not allow 01(create).



Calendar(Factory calendar)


This example shows part of the feature to handle factory calendar from released API cl_fhc_calendar_runtime.
"Add 2 days from a date considering factory calendar
DATA(lo_holidaycalendar) = cl_fhc_calendar_runtime=>create_factorycalendar_runtime( iv_factorycalendar_id 
  = 'SAP_CA' ). "Canada
lo_holidaycalendar->add_workingdays_to_date(
  EXPORTING
    iv_start = '20221230'
    iv_number_of_workingdays = 2
  RECEIVING
    rv_end = DATA(lv_end) "Result is 20230103
  ).

 

Calendar(Public holidays)


This example shows part of the feature to handle holidaycalendar from released API cl_fhc_calendar_runtime.
DATA(lo_holidaycalendar) = cl_fhc_calendar_runtime=>create_holidaycalendar_runtime(
  EXPORTING
    iv_holidaycalendar_id = 'SAP_CA' ). "Canada

"Check if the data is a holiday in Canada
lo_holidaycalendar->is_holiday(
  EXPORTING
    iv_date = '20230101'
  RECEIVING
    rv_holiday = DATA(lv_result)
  ).

"Get holiday information for 20230101
DATA: lv_date TYPE lo_holidaycalendar->ty_fhc_date VALUE '20230101'.
DATA(lo_holidays) = lo_holidaycalendar->get_holiday(
  EXPORTING
    iv_date = lv_date
  ).

lo_holidays->get_text(
  EXPORTING
    iv_language = sy-langu
  RECEIVING
    rs_text = DATA(ls_text)
  ).

 

Change document logging


1. Create a table where you want to log the document change. Create data element for the field and check on Change Document Logging.


2. Create Change Document Object and set your Z table. Check how you want to log your Z table

Log Field values for insert - Create log entry record for each field value that's entered.

Log Initial values for insert - Create log entry record for each field value even if they are empty. This created high volumn of change doucment records. Use with caution.

Log Field values for deletion - When object is deleted, create log entry record for each field value that's entered.

Log Initial values for deletion - When object is deleted, create log entry record for each field value even if they are empty. This created high volumn of change doucment records. Use with caution.


 

3. Creating change document entry. Use the generated class to write change document logging. In the below example, it's logging update of table field
DATA:lt_xzcd_test TYPE zcl_zobj_cd_test_chdo=>tt_zcd_test,
lt_yzcd_test TYPE zcl_zobj_cd_test_chdo=>tt_zcd_test,
lv_username TYPE if_chdo_object_tools_rel=>ty_cdusername.

DATA(lv_sys_datum) = cl_abap_context_info=>get_system_date( ).
DATA(lv_sys_time) = cl_abap_context_info=>get_system_time( ).
DATA(lv_user) = cl_abap_context_info=>get_user_formatted_name( ).
lv_username = lv_user.

APPEND INITIAL LINE TO lt_xzcd_test ASSIGNING FIELD-SYMBOL(<lw_xzcd_test>).
<lw_xzcd_test>-employeeid = '0000000001'.
<lw_xzcd_test>-role = 'Developer'. "New value
APPEND INITIAL LINE TO lt_yzcd_test ASSIGNING FIELD-SYMBOL(<lw_yzcd_test>).
<lw_yzcd_test>-employeeid = '0000000001'.
<lw_yzcd_test>-role = 'Solution designer'. "Old value

zcl_zobj_cd_test_chdo=>write(
  EXPORTING
    objectid = 'ZOBJ_CD_TEST'
    utime = lv_sys_time
    udate = lv_sys_datum
    username = lv_username
* planned_change_number =
    object_change_indicator = 'U'
* planned_or_real_changes =
* no_change_pointers =
    xzcd_test = lt_xzcd_test
    yzcd_test = lt_yzcd_test
    upd_zcd_test = 'U'
  IMPORTING
    changenumber = DATA(lv_changenumbner)
  ).

4. Reading the change document entry. In the generated class, add method implementation "if_chdo_enhancements~authority_check" and put below code inside. This method is for implementing your own autheority check, but in the below example, it is simply returning rv_is_authorized = 'X', meaning the authroity check is succesfull.
METHOD if_chdo_enhancements~authority_check.
  "No Auth check performed. Allow all
  rv_is_authorized = 'X'.
ENDMETHOD.

Now, use class method cl_chdo_read_tools=>changedocument_read to read the change log.
cl_chdo_read_tools=>changedocument_read(
  EXPORTING
    i_objectclass = 'ZOBJ_CD_TEST'
  IMPORTING
    et_cdredadd_tab = DATA(lt_cdredadd_tab)
  ).


 

Excel upload to itab


The upload data


Step1. Upload excel file by RAP Odata service described in "Large object handing(storing as MIME)". This way, the excel data is transformed to XSTRING.

Step2. Read the XSTRING to with xco_cp_xlsx. This class will read worksheet specified. Prepare an internal table that matches the file structure of excel. Use IF_XCO_XLSX_RA_WORKSHEET to select the range of the worksheet. Finally, use write_to method in if_xco_xlsx_ra_rs_operation_fc to write the values in internal table.
TYPES:
BEGIN OF ts_row,
Column1 TYPE string,
Column2 TYPE string,
END OF ts_row,

tt_row TYPE STANDARD TABLE OF ts_row WITH DEFAULT KEY.
DATA:lt_rows TYPE tt_row.

DATA(lo_xlsx) = xco_cp_xlsx=>document->for_file_content( iv_file_content = <Your file that is in XSTRING format> )->read_access( ).
DATA(lo_worksheet) = lo_xlsx->get_workbook( )->worksheet->for_name( iv_name = 'Sheet1' ).

DATA(lo_selection_pattern) = xco_cp_xlsx_selection=>pattern_builder->simple_from_to( )->get_pattern( ).

lo_worksheet->select( lo_selection_pattern
)->row_stream(
)->operation->write_to( REF #( lt_rows )
)->if_xco_xlsx_ra_operation~execute( ).


 

Exchange rate


The released API cl_exchange_rates performs currency conversion and exchange rate update, but it does not have method to read the list of exchange rate. To workaround this, we can use standard app "Upload Business Configuration" from Fiori Launchpad. Role "SAP_CA_BC_IC_LND_PC" is required to access this, or assign role template "SAP_BR_BPC_EXPERT".

This app is meant to maintain your custom Z customizing table but by default, SAP has generously allowed the maintenance of below standard currency tables.


 

Forms and printing


*The below setup is for Business Technology Platform. Connecting Forms Service by Adobe with ABAP Environment in S4 may require different setup.

Preparation


Forms Service by Adobe and Forms Service by Adobe API are required in Business Technology Platform. On the service instance of Forms Service by Adobe API, create a service key. Finally, create destination for Forms Service by Adobe instance.



Build Form template


Since there is no SAP Script or Smartforms, Adobe LiveCycle Designer must be used to create form layout. Follow note 2187332 to install it to your local PC.

Once the template is created, download in Adobe XML Form (*xdp), then upload this to Forms Template Store.



Rendering Forms


Rendering forms requies Forms Service by Adobe. Follow my blog below to set it up and consume from ABAP. https://blogs.sap.com/2022/12/14/get-started-with-forms-service-by-adobe-rest-api-in-btp/

Create client for Forms Service by Adobe template store.
mo_http_destination = cl_http_destination_provider=>create_by_cloud_destination(
  i_service_instance_name = CONV #( iv_service_instance_name )
  i_name = 'ADS_SRV'
  i_authn_mode = if_a4c_cp_service=>service_specific
  ).
mv_client = cl_web_http_client_manager=>create_by_http_destination( mo_http_destination ).

Render PDF by calling Forms Service by Adobe API URI "/v1/adsRender/pdf". You can find the complete list of supported URI of this API here. https://adsrestapi-formsprocessing.cfapps.eu10.hana.ondemand.com/swagger

The rendering will return the PDF content result with base64 encoded string.



Viewing PDF


To view the content, we must first convert base64 encoded content to xstring. Then upload this xstring as mime object in your Ztable. This Z table can be created following "Excel upload to itab" part of this blog.
"Get the base64 encoded PDF content
DATA(lo_json) = /ui2/cl_json=>generate( json = lv_rendered_pdf ).
IF lo_json IS BOUND.
  ASSIGN lo_json->* TO FIELD-SYMBOL(<data>).
  ASSIGN COMPONENT `fileContent` OF STRUCTURE <data> TO FIELD-SYMBOL(<field>).
  ASSIGN <field>->* TO FIELD-SYMBOL(<pdf_base64>).
ENDIF.

"Upload the xstring to z table, so the content can be viewed with RAP generated report
DATA: lt_input TYPE STANDARD TABLE OF zblob_test.
lt_input = VALUE #( ( docnum = '1000000001' filename = 'test.pdf' attachment = lv_pdf_xstring mimetype = 
  'application/pdf' )
  ).
INSERT zblob_test FROM TABLE @lt_input.

Go to the RAP service and the inserted record is disaplayed. Click on the attachment and the generated PDF from Form Service by Adobe will open.

 



Print Queue


Create a print queue by using cl_print_queue_utils. The below examples sends data from table zcd_test and send it to print queue.
DATA: lv_print_data TYPE xstring,
      lv_err_msg TYPE STRING.

SELECT * FROM zcd_test INTO TABLE @DATA(lt_table).
CALL TRANSFORMATION id SOURCE root = lt_table RESULT XML DATA(lv_xstring).
lv_print_data = lv_xstring.
DATA(lv_qitem_id) = cl_print_queue_utils=>create_queue_item_by_data(
  EXPORTING
    iv_qname = 'TEST_QUEUE'
    iv_print_data = lv_print_data
    iv_name_of_main_doc = 'zcd_test'
  IMPORTING
    ev_err_msg = lv_err_msg
  ).
out->write( lv_qitem_id ).

The print queue can be viewed in Fiori app Maintain Print Queue.


If you want to integrate physical printer to ABAP Environment, follow this blog that guides you from setting up communication scnerio and installing Cloud Print Manager. https://blogs.sap.com/2017/08/07/cloud-print-manager-installation-and-configuration/

Job scheduling


Required roles: Application Jobs(SAP_CORE_BC_APJ_JCE), Application Job Templates(SAP_CORE_BC_APJ_TPL), Maintain Job Users(SAP_CORE_BC_APJ_USR_PC)


1. There are predefined job template to schedule your job from. If none of them meet your need, you must create your custom job template.

2. To create your custom template, first define your job entry by creating below class. This defines design time information on your job.
CLASS zcl_job_schedule_apj DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_apj_dt_exec_object.
INTERFACES if_apj_rt_exec_object.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.

CLASS zcl_job_schedule_apj IMPLEMENTATION.
METHOD if_apj_dt_exec_object~get_parameters.

" Return the supported selection parameters here
et_parameter_def = VALUE #(
  ( selname = 'S_ID' kind = if_apj_dt_exec_object=>select_option datatype = 'C' length = 10 param_text 
     = 'ID' changeable_ind = abap_true )
  ( selname = 'P_DESCR' kind = if_apj_dt_exec_object=>parameter datatype = 'C' length = 80 param_text = 'Description' lowercase_ind = abap_true changeable_ind = abap_true )
  ( selname = 'P_SIMUL' kind = if_apj_dt_exec_object=>parameter datatype = 'C' length = 1 param_text = 
    'Simulate Only' checkbox_ind = abap_true changeable_ind = abap_true )
).

" Return the default parameters values here
et_parameter_val = VALUE #(
  ( selname = 'S_ID' kind = if_apj_dt_exec_object=>select_option sign = 'I' option = 'EQ' low = '1001' 
  )
  ( selname = 'P_DESCR' kind = if_apj_dt_exec_object=>parameter sign = 'I' option = 'EQ' low = 'Application Job Description' )
  ( selname = 'P_SIMUL' kind = if_apj_dt_exec_object=>parameter sign = 'I' option = 'EQ' low = 
    abap_true )
  ).

ENDMETHOD.

METHOD if_apj_rt_exec_object~execute.
"Execution logic when the job is started
TYPES ty_id TYPE c LENGTH 10.

DATA s_id TYPE RANGE OF ty_id.
DATA p_descr TYPE c LENGTH 80.
DATA p_count TYPE i.
DATA p_simul TYPE abap_boolean.

" Getting the actual parameter values(Just for show. Not needed for the logic below)
LOOP AT it_parameters INTO DATA(ls_parameter).
  CASE ls_parameter-selname.
    WHEN 'S_ID'.
      APPEND VALUE #( sign = ls_parameter-sign
                      option = ls_parameter-option
                      low = ls_parameter-low
                      high = ls_parameter-high ) TO s_id.
    WHEN 'P_DESCR'.
      p_descr = ls_parameter-low.
    WHEN 'P_SIMUL'.
      p_simul = ls_parameter-low.
  ENDCASE.
ENDLOOP.

"Implement core process you want to execute with this job
".......................
".......................
".......................
ENDMETHOD.
ENDCLASS.

 

3. Then create another class to create the job catalog and job template from the job you defined. Note that you need package and transport request.
CLASS zcl_job_template_apj DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .

PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.

CLASS zcl_job_template_apj IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
DATA(lo_apj_create) = cl_apj_dt_create_content=>get_instance( ).
" Create job catalog
lo_apj_create->create_job_cat_entry(
  iv_catalog_name = 'Z_TESTJOB_CATALOG'
  iv_class_name = 'zcl_job_schedule_apj'
  iv_text = 'Job catalog text'
  iv_catalog_entry_type = cl_apj_dt_create_content=>class_based
  iv_transport_request = 'H01K900008'
  iv_package = 'ZSANDBOX'
  ).
out->write( |Job catalog entry created successfully| ).

" Create job template
DATA lt_parameters TYPE if_apj_dt_exec_object=>tt_templ_val.

NEW zcl_job_schedule_apj( )->if_apj_dt_exec_object~get_parameters(
  IMPORTING
  et_parameter_val = lt_parameters
  ).

lo_apj_create->create_job_template_entry(
  iv_template_name = 'Z_TESTJOB_TEMPLATE'
  iv_catalog_name = 'Z_TESTJOB_CATALOG'
  iv_text = 'Job template text'
  it_parameters = lt_parameters
  iv_transport_request = 'H01K900008'
  iv_package = 'ZSANDBOX'
  ).
out->write( |Job template created successfully| ).

ENDMETHOD.
ENDCLASS.

4. After successful execution, go to Fiori app maintain Application Job Template and the new job template is created.


5. Use Fiori app Application jobs to create a job with the job template.


6. The method if_apj_rt_exec_object~execute in class zcl_job_schedule_apjs is executed. Whatever business logic you implemented there will be processed.

7. If you want to start, change, delete jobs programmatically, use class cl_apj_rt_api.

 

Large object handling


The completely guide to storing large object in database table can be found in Streams in RAP : Uploading PDF , Excel and Other Files in RAP Application | SAP Blogs

Parallel processing


Here is example use case to trigger parallel processing.

Parallel process 1
CLASS zcl_paralell1 DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
TYPES ty_t_time TYPE STANDARD TABLE OF cl_abap_context_info=>ty_system_time WITH DEFAULT KEY.
  INTERFACES if_abap_parallel.
METHODS get_time RETURNING VALUE(rt_time) TYPE ty_t_time.
METHODS get_wp_number RETURNING VALUE(rv_wp_number) TYPE char3.

PROTECTED SECTION.
PRIVATE SECTION.
  DATA gt_time_1 TYPE TABLE OF cl_abap_context_info=>ty_system_time.
  DATA gv_wp_number TYPE char3.
ENDCLASS.

CLASS zcl_paralell1 IMPLEMENTATION.
METHOD if_abap_parallel~do.
  DO 3 TIMES.
    WAIT UP TO 2 SECONDS.
    DATA(lv_system_time) = cl_abap_context_info=>get_system_time( ).
    APPEND lv_system_time TO gt_time_1.
  ENDDO.

  gv_wp_number = '001'.
ENDMETHOD.

METHOD get_time.
  rt_time = gt_time_1.
ENDMETHOD.

METHOD get_wp_number.
  rv_wp_number = gv_wp_number.
ENDMETHOD.
ENDCLASS.

Parallel process 2
CLASS zcl_paralell2 DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
TYPES ty_t_time TYPE STANDARD TABLE OF cl_abap_context_info=>ty_system_time WITH DEFAULT KEY.
  INTERFACES if_abap_parallel.
METHODS get_time RETURNING VALUE(rt_time) TYPE ty_t_time.
METHODS get_wp_number RETURNING VALUE(rv_wp_number) TYPE char3.
PROTECTED SECTION.
PRIVATE SECTION.
  DATA gt_time_2 TYPE TABLE OF cl_abap_context_info=>ty_system_time.
  DATA gv_wp_number TYPE char3.
ENDCLASS.

CLASS zcl_paralell2 IMPLEMENTATION.
METHOD if_abap_parallel~do.
  DO 3 TIMES.
    WAIT UP TO 2 SECONDS.
    DATA(lv_system_time) = cl_abap_context_info=>get_system_time( ).
    APPEND lv_system_time TO gt_time_2.
   ENDDO.
  gv_wp_number = '002'.
ENDMETHOD.
METHOD get_time.
  rt_time = gt_time_2.
ENDMETHOD.
METHOD get_wp_number.
  rv_wp_number = gv_wp_number.
ENDMETHOD.
ENDCLASS.

 

Trigger parallel processing
DATA(lo_parallel) = NEW cl_abap_parallel( ).
DATA(lo_instance_1) = NEW zcl_paralell1( ).
DATA(lo_instance_2) = NEW zcl_paralell2( ).

lo_parallel->run_inst(
  EXPORTING
    p_in_tab = VALUE #( ( lo_instance_1 ) ( lo_instance_2 ) )
  IMPORTING
    p_out_tab = DATA(lt_out_tab)
  ).

LOOP AT lt_out_tab ASSIGNING FIELD-SYMBOL(<ls_out_tab>).
  IF <ls_out_tab>-inst IS INSTANCE OF zcl_paralell1.
    lo_instance_1 = CAST #( <ls_out_tab>-inst ).
    out->write( 'System time for instance 1:' ).
    LOOP AT lo_instance_1->get_time( ) ASSIGNING FIELD-SYMBOL(<lv_instance_1>).
      out->write( <lv_instance_1> ).
    ENDLOOP.
    out->write( |WP number: { lo_instance_1->get_wp_number( ) }| ).
  ENDIF.
  IF <ls_out_tab>-inst IS INSTANCE OF zcl_paralell2.
    lo_instance_2 = CAST #( <ls_out_tab>-inst ).
    out->write( 'System time for instance 2:' ).
    LOOP AT lo_instance_2->get_time( ) ASSIGNING FIELD-SYMBOL(<lv_instance_2>).
      out->write( <lv_instance_2> ).
    ENDLOOP.
    out->write( |WP number: { lo_instance_2->get_wp_number( ) }| ).
  ENDIF.
ENDLOOP.


 

 

Translation


Since there is no GUI, the GUI based translation maintenance is no longer available. For this purpose, Maintain Translations app is used.


List of all objects that are translatable.

  • Application Log Object

  • Business Configuration Object

  • CDS Type Definition

  • Data Definition

  • Data Element

  • Domain

  • IAM Business Catalog

  • Message Class

  • Metadata Extension


Define the source language and target language. Demonstrate translation for metadata extension for RAP based application.


XLF file is downloaded and this is the file that defines the translation. Add target translation of Japanese. Upload the same file back in the Maintain Translation app and don't forget to publish the translation.


Start the application in Japanese and English. The field names are translated based on the uploaded XLF file.



 

UI


ABAP Development Tool output console


Since there is no SAP GUI, write statement or ALV output is not possible. The easiest way in ABAP for Cloud Development is to use output console in ADT. Wrap IF_OO_ADT_CLASSRUN into your class and use it's Write method to output data.

This output is only suited for simple string output. It is not meant only for developer, and not for generating report for business application user.
CLASS ztest_class DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
  INTERFACES: if_oo_adt_classrun.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.

CLASS ztest_class IMPLEMENTATION.
  METHOD if_oo_adt_classrun~main.
    out->write( 'Hello world!' ).
  ENDMETHOD.
ENDCLASS.

 

Fiori app generate by ABAP UI service


This is the primary approach to generate UI for report applications. It is part of ABAP RAP framework and no front end development is needed to generate Fiori application. It is completely different framework from SAP GUI. Instead of creating dynpro and controlling logic in PBO, PAI, ABAP RAP uses CDS view as base and expose Odata service. Fiori launchpad consumes UI service part of Odata and generates a Fiori list report based on the data from CDS view and metadata definition of it.

Supported feature:



  • List page, object page to display data

  • Search, filter, variant

  • CRUD operation for backend database

  • Visualization(graph, chart)

  • Screen logic(Validation, conversion, user event)

  • Draft & Copy capabilitties

  • Inline edit

  • Locking mechanism


Limitation:



  • All limitation with Fiori Element apply(No flexibility in UI, limitation in screen control, etc.)

  • Must be deployed outside of ABAP Environment, using WebEDI such as Business Application Studio or Visual Studio.


ABAP RAP reference - SAP help



Fiori app generate by ABAP2UI5(open source)


This is open source project that allows developer to create Fiori UI5 application with pure ABAP. It is the closest approach to built free-style UI5 application in ABAP Environment. https://github.com/abap2UI5/abap2UI5

Highlights:



  • Avaialble for ABAP releases (from NW 7.02 to ABAP 2305)

  • Avaialble for both ABAP for Cloud and Standard ABAP language version

  • Supports Selection Screens, Tables, Lists, Popups, F4-Helps, MIME Editor, File Upload/download, Chart/Graph, Side Effects, etc..

  • Supports all Fiori Elements floorplan


If you want to create more flexible UI with ABAP, consider using ABAP2UI5 instead of ABAP RAP(below is a sample UI I created with ABAP2UI5).


 

AI Architcect reference Question Answers

  AI Architect & CTO Interview Guide 25 Essential Questions & Answers 1. Describe your approach to designing a scalable ML system ar...