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

What's wrong with follow code

0 Likes
434

FUNCTION ZSM_READDSO.

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(I_INFOPROV) TYPE RSINFOPROV

*" REFERENCE(I_KEYDATE) TYPE RRSRDATE OPTIONAL

*" REFERENCE(I_TH_SFC) TYPE RSDRI_TH_SFC

*" REFERENCE(I_TH_SFK) TYPE RSDRI_TH_SFK

*" REFERENCE(I_T_RANGE) TYPE RSDRI_T_RANGE OPTIONAL

*" REFERENCE(I_TX_RANGETAB) TYPE RSDRI_TX_RANGETAB OPTIONAL

*" REFERENCE(I_PACKAGESIZE) TYPE I OPTIONAL

*" REFERENCE(I_FIRST_CALL) TYPE RS_BOOL

*" EXPORTING

*" REFERENCE(E_T_DATA) TYPE STANDARD TABLE

*" REFERENCE(E_END_OF_DATA) TYPE RS_BOOL

*" REFERENCE(E_T_MSG) TYPE RS_T_MSG

*"----


type-pools: rs, rsdrc.

data :

First_call type rs_bool,

r_linetype type ref to cl_abap_structdescr,

r_linetype2 type ref to cl_abap_typedescr,

r_tabletype type ref to cl_abap_tabledescr,

itab_data type ref to data.

r_linetype2 = cl_abap_typedescr=>DESCRIBE_BY_DATA( e_T_data ).

<b>r_linetype ?= r_linetype2.</b> " ERROR THERE

r_tabletype = cl_abap_tabledescr=>create(

p_line_type = r_linetype ).

......................

.......................

2 REPLIES 2
Read only

Former Member
0 Likes
397

Hi Jacky,

r_linetype2 is not required.

<b><u>Try this out..</u></b>

r_linetype type ref to cl_abap_structdescr,

r_linetype?= cl_abap_typedescr=>DESCRIBE_BY_DATA( e_T_data ).

<b><u>Check this code...</u></b>

tables: p0442.

TYPES:

BEGIN OF my_struct,

comp_a type i,

comp_b type f,

END OF my_struct.

DATA:

my_data TYPE my_struct,

descr_ref TYPE ref to cl_abap_structdescr.

FIELD-SYMBOLS:

<comp_wa> TYPE abap_compdescr.

START-OF-SELECTION.

*descr_ref ?= cl_abap_typedescr=>describe_by_data( my_data ).

  • call for all entries

*descr_ref ?= cl_abap_typedescr=>describe_by_data( p0442 ).

descr_ref ?= cl_abap_typedescr=>describe_by_name('MARA').

LOOP AT descr_ref->components ASSIGNING <comp_wa>.

WRITE: / <comp_wa>-name.

ENDLOOP.

Regards,

Younus

<b>Reward Helpful Answers:-)</b>

Read only

0 Likes
397

Thank you for your attention!

yes, I know what do you mean, in fact, my oraginal code exactlly same with your suggestion:

r_linetype?= cl_abap_typedescr=>DESCRIBE_BY_DATA( e_T_data ).

But the error occur,

I really don't know why this happen, because i follow the rule listed in BC400....