‎2008 Dec 12 11:04 AM
Hi everyone
is it possible to read a table structure of a intern Table to check whether in this table some specific data field exists or not. for example ,to check table1 if matnr is a data field in it.
the best will be using a loop to check all data fields name and type.
anyone can solve this problem???
thanks !!!
‎2008 Dec 12 11:07 AM
Hi yunfan Wang
WELCOME to SDN
Structure dont have data .So u can fetch the data from structure in into internal table.
Regards
‎2008 Dec 12 11:11 AM
first thanks for replying
but my question is,
i have an intern table
but i want to check whether matnr is a data field in this table or not, how to do that?
has nothing to do with structure.
‎2008 Dec 12 11:13 AM
Hi
Debug ur program and find tht matnr has data or not.
you can ask ur team mates for debugging if u a fresher
Regards
‎2008 Dec 12 11:14 AM
Hi Yuwang,
Please take the help of key word *DESCRIBE FIELD INTO *
there is an example tooo
using this example i can check the fields of structure in debug mode
Best Regards
Ramchander Rao.k
Edited by: ramchander krishnamraju on Dec 12, 2008 12:41 PM
‎2009 Jan 05 10:00 PM
Here is how you can do this.
Sample code.
DATA: BEGIN OF it OCCURS 0,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
END OF it.
FIELD-SYMBOLS: <field>.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE it TO <field>.
sy-subrc = 0 --> Means there is Matnr in the structure
sy-subrc = 4 --> Means there is NO Matnr in the structure
In the above case return code should be 4.
MK.
‎2008 Dec 12 11:40 AM
Hi Wang..
once you get the into your internal table..
just loop the table for searching..
and regarding the performance
you can follow the follow this steps:
1) first short the table with MATNR
2) pass all the varible to some another table.
or
just first pass the table to another table.
and delete all the records where matnr NE your MATNR.
it is all just for performance.. only
Thanks and Regards,
GSANA