Posts

Showing posts from June, 2025

Select options in AMDP

Image
Scenario - Create a report which will take in Customer ID (select options) as input and give Loan data. Table used for this requirement: ZDLOAN Below is code implemented in the AMDP class: CLASS zcl_demo_amdp_so1 DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES if_amdp_marker_hdb . TYPES: it_loan TYPE TABLE OF zdloan. METHODS: get_loan_data IMPORTING VALUE(im_mandt) TYPE mandt VALUE(im_custid) TYPE string EXPORTING VALUE(ep_LOAN) TYPE it_loan. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_demo_amdp_so1 IMPLEMENTATION. METHOD get_loan_data BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT OPTIONS READ-ONLY USING zdloan. IT_LOAN = select * from ZDLOAN where mandt = IM_MANDT; EP_loan = APPLY_FILTER (:IT_LOAN, :IM_CUSTID); ENDMETHOD. ENDCLASS. Below is the code implemented in the driver program: *&--------------------...

Simple AMDP program for CRUD opertaions

Image
Scenario - Create a report with selection screen to Create, Read, Update and Delete table data using AMDP. I have used a custom table ZDLOAN for this requirement. The below is the information maintained in the table. Below is the code implemented for AMDP class. CLASS zvr30_amdp_crud DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES if_amdp_marker_hdb . TYPES: BEGIN OF ty_read. INCLUDE TYPE zdloan. TYPES: END OF ty_read. TYPES: tt_read TYPE TABLE OF ty_read. METHODS: md_insert IMPORTING VALUE(ip_mandt) TYPE mandt VALUE(ip_custid) TYPE int4 VALUE(ip_loanamt) TYPE int4 VALUE(ip_loandate) TYPE dats VALUE(ip_duedate) TYPE dats VALUE(ip_priority) TYPE char20 VALUE(ip_interest) TYPE int4 RAISING cx_amdp_execution_failed, md...