Now I am going to explain how do we create Customized Data Dictionary Table in ABAP on HANA environment and updating the created Table
Step1: Open the Hana studio and Go to the project explorer.
Step2: Click on the package and Right click on Dictionary.
Step3: Give the Name and Description.
Step4: Click on Next and Give the fields as below.
Note: Define table table name with keyword with keys as below.
Step5: We can check it in ‘SE11’ T-code
Step6: It will be created as Transparent Table as below.
Step7: If we are trying to check the Table there are no entries because we have not created any data.
Step8: I have created the table entries using the class.
opened the Project explore and right click on Package.
I.e.. Right click on Package ->New -> ABAP Class
Give the Class name and Description
Write the code using class and Interface as below.
CLASS zcl_travel_data8 DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_travel_data8 IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
DATA itab TYPE TABLE OF zdb_table8.
* fill internal travel table (itab)
itab = VALUE #(
(
travel_id = ‘800001’ agency_id = ‘080001’ customer_id = ‘000077’ begin_date = ‘20230924’
end_date = ‘20231028’ currency_code = ‘USD’ created_by = ‘SGOTTAPU’
created_at = ‘20230920133945.5960060’ last_changed_by = ‘GOTTAPS’
last_changed_at = ‘20230922105400.3647680’ )
(
travel_id = ‘800002’ agency_id = ‘080002’ customer_id = ‘000088’
begin_date = ‘20230924’ end_date = ‘20231028’ currency_code = ‘INR’
created_by = ‘SGOTTAPU’ created_at = ‘20230920133945.5960060’
last_changed_by = ‘GOTTAPS’ last_changed_at = ‘20230922105400.3647680′ )
).
* delete existing entries in the database table
* DELETE FROM zdb_table8.
* insert the new table entries
INSERT zdb_table8 FROM TABLE @itab.
* output the result as a console message
out->write( |{ sy-dbcnt } Travel entries inserted successfully!| ).
ENDMETHOD..
ENDCLASS.
Execute the Class.
Then we will get the Table entries as below.
In the Hana studio we can check the entries.
No comments:
Post a Comment