Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Desdribe Table

Former Member
0 Kudos

Hi Everybody,

using Describe statement i can easily find No.of.line's of the internal table. But using Describe how to find out the No.of.colomns in the Internal Table.

thanks in advance..

1 ACCEPTED SOLUTION

Former Member
0 Kudos

TRY TO USE FM

DATA : BEGIN OF ITAB OCCURS 0,

CHK(1),

AUFNR LIKE AFKO-AUFNR,

END OF ITAB.

DATA ITAB3 LIKE RSTRUCINFO OCCURS 0 WITH HEADER LINE.

DATA : COL TYPE I.

CALL FUNCTION 'GET_COMPONENT_LIST'

EXPORTING

PROGRAM = SY-REPID

FIELDNAME = 'ITAB'

TABLES

COMPONENTS = ITAB3

.

<NOW ITAB3 CONTAINS THE FIELD NAMES>

DESCRIBE TABLE ITAB3 LINES COL.

NOW COL CONTAINS THE NO OF COLUMN.

REGARDS

SHIBA DUTTA

6 REPLIES 6

Former Member
0 Kudos

Hi,

use describe field..

You can use the work area of the internal table to determine the number of columns..

Example

-


DATA: BEGIN OF WA,

MATNR,

WERKS,

KUNNR,

END OF WA.

DATA: V_COLUMNS TYPE INT4.

DESCRIBE FIELD wa COMPONENTS v_columns.

WRITE: / V_COLUMNS.

You can also check this link..

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3145358411d1829f0000e829fbfe/content.htm

Thanks,

Naren

0 Kudos

Thanks Naren, But the code sends the following error.

Between "WA" and "COMPONENTS", "TYPE ..." is missing . (see HELP

COMPUTE). (see HELP COMPUTE). (see HELP COMPUTE). (see HELP COMPUTE).

(see HELP COMPUTE).

thanks in advance.

Former Member
0 Kudos

TRY TO USE FM

DATA : BEGIN OF ITAB OCCURS 0,

CHK(1),

AUFNR LIKE AFKO-AUFNR,

END OF ITAB.

DATA ITAB3 LIKE RSTRUCINFO OCCURS 0 WITH HEADER LINE.

DATA : COL TYPE I.

CALL FUNCTION 'GET_COMPONENT_LIST'

EXPORTING

PROGRAM = SY-REPID

FIELDNAME = 'ITAB'

TABLES

COMPONENTS = ITAB3

.

<NOW ITAB3 CONTAINS THE FIELD NAMES>

DESCRIBE TABLE ITAB3 LINES COL.

NOW COL CONTAINS THE NO OF COLUMN.

REGARDS

SHIBA DUTTA

0 Kudos

Thank you shiba. Your code solve my problem. Thank you.

Former Member
0 Kudos

Dear Vijay,

Please go through the sample code in the following link:

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3798358411d1829f0000e829fbfe/content.htm

Regards,

Abir

************************************

  • Don't forget to award Points *

Former Member
0 Kudos

data : ctype.

DESCRIBE field wa type ctype components LINE.

line must be int type.

try this

regards

shiba dutta