- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Fetch fields from table or structure in ABAP SAP
If you need to identify the fields and number of fields in a structure, then you should use runtime type services. Using runtime type services makes more sense in this case as if we have some data in our environment, then it’s not ideal to call database for fetching the same.
DATA(structure) = VALUE <your structure>( ) DATA(Descriptor) = CAST cl_abap_structdescr( cl_abap_datadescr=>describe_by_data (structure) ) DATA(Fields = LINES(Descriptor ->components )
This will give you the count of the components of the table or structure.
You can also try another option if you do not want to use runtime type services. Below query can get you’re the count
SELECT COUNT(*) INTO @data(count) FROM DD03l (// this table stores the fields information of SAP tables) WHERE tabname = <Structure name> AND AS4LOCAL = 'A'
- Fetch unique records from table in SAP ABAP
- In SAP ABAP, mapping two database table fields
- Determining table or structure of an ABAP code
- Retrieving data from a table in SAP ABAP
- Moving TABKEY from CDPOS table into field structure in ABAP
- Difference between Work area, global structure and internal table in SAP ABAP
- Combining fields in CDS view in SAP ABAP
- Getting a syntax error unknown fields in SAP ABAP
- Hiding SAP ABAP table control column
- Fetch max date and other field from the same row of a table grouped by other fields in SAP HANA
- How to have a structure with a table in ABAP?
- Retrieving ABAP BAdi from SAP BW
- Fetch the modified date of table in SAP HANA
- Modification not working for both internal table and control table in SAP ABAP
- Difference between using - "standard table of", "Hashed table of", or simply "table of" in SAP ABAP