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: 

Cannot be converted to the line type

Former Member
0 Kudos

Hi,

I got an error as ' Cannot be coverted to the line type' for the sample code as given below

DATA : BEGIN OF GS_DEMAND_OBJ,

DEMAND_OBJ TYPE REF TO /MRSS/CL_SGD_COMPLEX_DEMAND,

END OF GS_DEMAND_OBJ.

DATA: GT_DEMAND_OBJ LIKE TABLE OF GS_DEMAND_OBJ.

CREATE OBJECT GO_DEMAND

EXPORTING

IREF_WORKLIST = GO_WORKLIST

IV_GUID = GS_DEMAND-GUID

IV_ERR_FLAG = '0'

IV_COMPL_FLAG = 'X' .

APPEND GO_DEMAND TO GT_DEMAND_OBJ.-->error "go_demand cannot be converted to the line type gt_demand_obj

Thanks & Regards,

Mehar.

1 ACCEPTED SOLUTION

settipalli_raj
Explorer
0 Kudos

Hi

I am assuming that you have GO_DEMAND declaration as follows.

Data: GO_DEMAND TYPE REF TO /MRSS/CL_SGD_COMPLEX_DEMAND

Replace the create object call as shown below.

CREATE OBJECT GS_DEMAND_OBJ-DEMAND_OBJ
EXPORTING
IREF_WORKLIST = GO_WORKLIST
IV_GUID = GS_DEMAND-GUID
IV_ERR_FLAG = '0'
IV_COMPL_FLAG = 'X' .

And then you should be able to do the following:

APPEND GS_DEMAND_OBJ TO GT_DEMAND_OBJ

Regards

Raj

7 REPLIES 7

settipalli_raj
Explorer
0 Kudos

Hi

I am assuming that you have GO_DEMAND declaration as follows.

Data: GO_DEMAND TYPE REF TO /MRSS/CL_SGD_COMPLEX_DEMAND

Replace the create object call as shown below.

CREATE OBJECT GS_DEMAND_OBJ-DEMAND_OBJ
EXPORTING
IREF_WORKLIST = GO_WORKLIST
IV_GUID = GS_DEMAND-GUID
IV_ERR_FLAG = '0'
IV_COMPL_FLAG = 'X' .

And then you should be able to do the following:

APPEND GS_DEMAND_OBJ TO GT_DEMAND_OBJ

Regards

Raj

0 Kudos

Hi Raj,

Thank u and I need help regarding MRS I got a reqirement as given below as I am new to MRS and use of oops concepts in abap is very less i am not able to move forward can you please help me in solving this?

Actual requirement is:

The class for Demand /MRSS/CL_SGD_SINGLE_DEMAND. Using the GUID from the table instantiate the class and you can use its methods to get the reference to assign object.The attribute GT_ASSIGNMENT has different reference to the assignments.

Type cast this into /MRSS/CL_SGE_ASSIGNMENT. There is a method SET_STATUS which should do the job.

0 Kudos

Hi

I can't find these classes in our ECC/CRM/SRM systems and therefore I can't make out the makeup of these objects definitions.

If one class is a super class of another then you can assign derived class object to super class reference variables using type cast operator "?=". They may be implementing same interface.

<reference> ?= <other reference>.

Regards

0 Kudos

Hi Raj,

Thanks for ur reply I will try to solve this but there are so many issues where I need help and I will keep posting the issues and possibly if u could help me plz help me.

Thanks & Regards,

Mehar.

0 Kudos

Hi,

Plz help me to solve the error in the follwing code

DATA: BEGIN OF GS_SINGLE,

COMPLEX_DEMANDS TYPE REF TO /MRSS/IF_SGE_COMPLEX_DEMAND,

END OF GS_SINGLE.

DATA: GT_SINGLE LIKE TABLE OF GS_SINGLE,

GO_SINGLE TYPE REF TO /MRSS/IF_SGE_SINGLE_DEMAND.

LOOP AT GT_DEMAND INTO GS_DEMAND.

CALL METHOD GO_WORKLIST->/MRSS/IF_SGE_WORKLIST~DEMAND_OBJ_GET

EXPORTING

IV_GUID = GS_DEMAND-GUID

  • IV_WL_REL =

RECEIVING

RREF_DEMAND = GO_SINGLE

.

APPEND GO_SINGLE TO GT_SINGLE.-->ERROR CANNOT BE CONVERTED TO LINE TYPE

ENDLOOP.

Edited by: MeharTaj on Nov 17, 2011 11:22 AM

0 Kudos

Hi ,

Try this.

DATA: 
GO_SINGLE TYPE REF TO /MRSS/IF_SGE_SINGLE_DEMAND ,
GT_SINGLE LIKE TABLE OF GO_SINGLE.

0 Kudos

Hey thanks