2012 Mar 15 12:54 PM
Hello Experts,
Does anybody know if there's any system data for know the columns of an internal table? The variable sy-TFILL gives us the number of rows but I'm not sure if there's any other variable for find the columns....can anybody help me please?
Thanks in advance,
Regards.
Rebeca
Hi,
For cloumns refer Link removed by moderator
Message was edited by: Vinod Kumar
2012 Mar 15 1:00 PM
Hi,
For cloumns refer Link removed by moderator
Message was edited by: Vinod Kumar
2012 Mar 15 1:16 PM
SY-TLENG woul be the length of the lines. But I doubt for number of fields, if the records are not a flat structure, what would be the number of column of a deep structure ? Would it be a constant or would it depend on the values of each record. Nevertheless you can CL_ABAP_STRUCTDESCR's methods DESCRIB_BY_* which will return a ref to CL_ABAP_TYPEDESCR.
Regards,
Raymond
2012 Mar 16 3:25 AM
Hi,
I also doubt if there is a system field that holds the number of columns in an internal table. But you can get the column count by working around. Take a look at this thread. http://scn.sap.com/thread/135452
Regards,
Jake
2012 Mar 16 4:34 AM
Hi,
assign the structure to a field symbol and use assign-components ... press F1 help on assign components...
if sy-index = 1.
ASSIGN COMPONENT sy-index OF STRUCTURE <fs_record> TO <fs_comp>.
IF sy-subrc <> 0.
count = count + 1.
ENDIF.
endif.
Otherwise use the below code,
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE GWA_ITAB TO <FS>.
IF SY-SUBRC = 0.
CONTINUE.
ELSE.
G_COLNUMBER = SY-INDEX.
EXIT.
ENDIF.
ENDDO.
Now G_COLNUMBER - 1 , will be the no of column.
Regards,
Arun
2012 Mar 16 4:53 AM
Hi,
Using Type polls Slis you can get index of the internal table..
WHEN '&IC1'.
READ TABLE <T_itpac> ASSIGNING <W_itpac> INDEX selfield-tabindex.
2012 Mar 16 5:17 AM
2012 Mar 16 7:04 AM
Hi Anoop,
Helping others for point's doesn't make you a professional
2012 Mar 16 8:52 AM
kesavadas Thekkillath wrote:
Hi Anoop,
Helping others for point's doesn't make you a professional
Anoops answer removed for that reason. Asking for or offering points it NOT permitted in these forums.
2012 Mar 16 6:59 AM
data:lwa_structure type ty,
wa_ltype type c,
itab type table of ty.
DESCRIBE FIELD lwa_structure TYPE wf_ltype COMPONENTS wi_count.
Write wi_count
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |