03-12-2014 5:34 PM
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.
03-12-2014 6: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
03-12-2014 6: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
03-13-2014 3:35 AM
Thanks Sameer for the detailed analysis and prompt reply, i managed to include a type vbak inside a type just as you mentioned, but it still doesnt seem to work .. ...
03-13-2014 3:52 PM
Hello,
What kind of error it is giving?
Alternatively, try to declare structure in data dictionary(T-code: SE11) used in your program & class, so that definition will be same at both places.
Regards,
Sameer
03-13-2014 4:01 PM
Hello,
I tried to declare type in dummy class ZZTEST & call same structure mention above.
It is working at my end, see below screen-shot.
Regards,
Sameer
03-12-2014 7: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.
03-14-2014 9: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