Application Development and Automation 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: 
Read only

Desdribe Table

Former Member
0 Likes
711

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
Read only

Former Member
0 Likes
674

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
Read only

Former Member
0 Likes
674

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

Read only

0 Likes
674

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.

Read only

Former Member
0 Likes
675

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

Read only

0 Likes
674

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

Read only

Former Member
0 Likes
674

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 *

Read only

Former Member
0 Likes
674

data : ctype.

DESCRIBE field wa type ctype components LINE.

line must be int type.

try this

regards

shiba dutta