Skip to Content

Data incompatibility when passing a deep structure

Hello Experts,

I am facing an issue

I'm trying to pass xvbak from a standard program to a class method

the formal parameters are defined as

DATA: BEGIN OF xvbak.
INCLUDE STRUCTURE vbak.
DATA: bstkd LIKE vbkd-bstkd.
DATA: kursk LIKE vbkd-kursk.
DATA: zterm LIKE vbkd-zterm.
DATA: inco1 LIKE vbkd-inco1.

DATA: END OF xvbak.



When i try to pass XVBAK to my class method i get a data incompatibility error between CS_XVBAK and XVBAK. although both are types to the same set of fields.


CALL METHOD Object->DETERMINE_customer

Changing

CS_XVBAK = XVBAK




This is how CS_XVBAK (Actual Parameters) have been typed inside my class as a changing Parameter.


types:

BEGIN OF GTY_XVBAK,
p_vbak type vbak,

bstkd TYPE vbkd-bstkd,
kursk TYPE vbkd-kursk,
zterm TYPE vbkd-zterm, l
inco1 TYPE vbkd-inco1,

END OF GTY_XVBAK .

Changing Parameter:

Data: CS_XVBAK type GTY_XVBAK.


Is there an issue with the above code?... Im just wondering if the include structure in both declarations is the cause of the issue?

Is there a correct way of making 2 deep structures compatible?


Any help will be highly appreciated.


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Mar 12, 2014 at 06:15 PM

    Hello,

    Structure CS_XVBAK is declared as complex structure, so it is Include of VBAK. See below screen-shot.

    While XVBAK structure is simple structure with all fields are at same level. see below screen-shot.

    You need to declare as below.

    types: wa_vbak TYPE vbak.

    types:

    BEGIN OF GTY_XVBAK.

    INCLUDE type wa_vbak.

    types: bstkd TYPE vbkd-bstkd,

    kursk TYPE vbkd-kursk,

    zterm TYPE vbkd-zterm,

    inco1 TYPE vbkd-inco1,

    END OF GTY_XVBAK .




    Regards,

    Sameer


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 12, 2014 at 07:05 PM

    Hi Ramiwal.

    The error ocurred because the declaration of GTY_XVBAK IS WRONG.

    BEGIN OF GTY_XVBAK,
    p_vbak type vbak,


    The correct is :

    BEGIN OF GTY_XVBAK,

    include structure INCLUDE STRUCTURE vbak.



    Hope helped you.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 14, 2014 at 09:02 AM

    Thanks sameer!!!!...it works now... i actually missed one parameter , so it threw up a few errors.... its fine now... thanks so much for your help

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.