Wednesday, 4 October 2023

Step by Step creation of Custom Database Table and Updated it with HANA Class using ABAP on HANA Development

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.

I.e.. Dictionary –> New –> Database Table

SAP HANA Career, SAP HANA Skills, SAP HANA Jobs, SAP HANA Prep, SAP HANA Preparation, SAP HANA Tutorial and Materials, SAP HANA Guides, SAP HANA Preparation Exam, SAP HANA Certification

Step3: Give the Name and Description.

SAP HANA Career, SAP HANA Skills, SAP HANA Jobs, SAP HANA Prep, SAP HANA Preparation, SAP HANA Tutorial and Materials, SAP HANA Guides, SAP HANA Preparation Exam, SAP HANA Certification

Step4: Click on Next and Give the fields as below.

Note: Define table table name with keyword with keys as below.

SAP HANA Career, SAP HANA Skills, SAP HANA Jobs, SAP HANA Prep, SAP HANA Preparation, SAP HANA Tutorial and Materials, SAP HANA Guides, SAP HANA Preparation Exam, SAP HANA Certification

Step5: We can check it in ‘SE11’ T-code

Step6: It will be created as Transparent Table as below.

SAP HANA Career, SAP HANA Skills, SAP HANA Jobs, SAP HANA Prep, SAP HANA Preparation, SAP HANA Tutorial and Materials, SAP HANA Guides, SAP HANA Preparation Exam, SAP HANA Certification

Step7: If we are trying to check the Table there are no entries because we have not created any data.

SAP HANA Career, SAP HANA Skills, SAP HANA Jobs, SAP HANA Prep, SAP HANA Preparation, SAP HANA Tutorial and Materials, SAP HANA Guides, SAP HANA Preparation Exam, SAP HANA Certification

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

SAP HANA Career, SAP HANA Skills, SAP HANA Jobs, SAP HANA Prep, SAP HANA Preparation, SAP HANA Tutorial and Materials, SAP HANA Guides, SAP HANA Preparation Exam, SAP HANA Certification

Give the Class name and Description

SAP HANA Career, SAP HANA Skills, SAP HANA Jobs, SAP HANA Prep, SAP HANA Preparation, SAP HANA Tutorial and Materials, SAP HANA Guides, SAP HANA Preparation Exam, SAP HANA Certification

Write the code using class and Interface as below.

SAP HANA Career, SAP HANA Skills, SAP HANA Jobs, SAP HANA Prep, SAP HANA Preparation, SAP HANA Tutorial and Materials, SAP HANA Guides, SAP HANA Preparation Exam, SAP HANA Certification

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.

SAP HANA Career, SAP HANA Skills, SAP HANA Jobs, SAP HANA Prep, SAP HANA Preparation, SAP HANA Tutorial and Materials, SAP HANA Guides, SAP HANA Preparation Exam, SAP HANA Certification

In the Hana studio we can check the entries.

SAP HANA Career, SAP HANA Skills, SAP HANA Jobs, SAP HANA Prep, SAP HANA Preparation, SAP HANA Tutorial and Materials, SAP HANA Guides, SAP HANA Preparation Exam, SAP HANA Certification

No comments:

Post a Comment