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

Refer to a type include.

ramiwal_dsilva
Participant
0 Likes
1,421

Hi Everyone:

I have a situation like this.

eg:

types: begin of y_test,

               include type vbak,

              a          type c,

               b          type c,

          end of y_test.

data:  wa_test      type      y_test.

now assuming wa_test is already populated  i need to pass 2 parameters from wa_test to a Class method  , lets say wa_test-vkorg and wa_test-vtweg .

How can i refer to the nested include inside y_test?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,371

study this source in your own abap, hopefully, it will make you understand it better.

  types: begin of y_test,
                include type vbak,
                a          type c,
                b          type c,
         end of y_test.

  data: wa_test type y_test.
  break-point. "check the value
  wa_test-include-vbeln = '000000001'.

  types: begin of y_test2.
          include structure vbak.
  types: a          type c,
            b          type c,
     end of y_test2.

  data: wa_test2 type y_test2.
  break-point."check the value
  wa_test2-vbeln = '000000001'.


I personally prefer typing with structures/table types as of y_test2.It is syntactically easier and makes more sense as you work with the data and so on.

Cheers

Hi, Manish,

I probably do not understand the meaning of the points here. What can I buy for them? Or what advantage do I have once I earned enough?

9 REPLIES 9
Read only

Former Member
0 Likes
1,372

study this source in your own abap, hopefully, it will make you understand it better.

  types: begin of y_test,
                include type vbak,
                a          type c,
                b          type c,
         end of y_test.

  data: wa_test type y_test.
  break-point. "check the value
  wa_test-include-vbeln = '000000001'.

  types: begin of y_test2.
          include structure vbak.
  types: a          type c,
            b          type c,
     end of y_test2.

  data: wa_test2 type y_test2.
  break-point."check the value
  wa_test2-vbeln = '000000001'.


I personally prefer typing with structures/table types as of y_test2.It is syntactically easier and makes more sense as you work with the data and so on.

Cheers

Read only

0 Likes
1,371

Thanks steve, you're right, and it works..it does make more sense as you're addressing the field just like you would do it in a regular type.

thanks... cheers

Read only

0 Likes
1,371

thanks - would of been nice of you to mark my answer as correct - as I spent the time to help!

Cheers & good luck with your solution!

Read only

0 Likes
1,371

It appears the thread is a discussion, not a question. Reply can't be marked correct.

Read only

0 Likes
1,371

Hi, Manish,

I probably do not understand the meaning of the points here. What can I buy for them? Or what advantage do I have once I earned enough?

Read only

0 Likes
1,371

Most forums have points/reps/karma system.

A feel-good factor. Something you can brag about. Nothing more than that.

Read only

0 Likes
1,371

How about putting them on your resume? That ought to count for something right?

It shows you been answering people's doubt and been really active in the SAP world.

Read only

0 Likes
1,371

You could just write that you contribute on SCN. Being a mentor/moderator counts. Points do not.

Read only

Former Member
0 Likes
1,371

Hi Ramiwal,

You can do like this.

Since you have populated the WA_TEST and you need to pass wa_test-vkorg and wa_test-vtweg to the class method ok.

so the class method should have the importing parameters as VKORG and VTWEG.

For Instance :

ZCL_SALES_OPERATION->GET_DATA(

    IMPORTING

IM_VKORG = WA_TEST-INCLUDE-VKORG

IM_CTWEG = WA_TEST-INCLUDE-VTWEG

) .

The above senaio will be used for your codee Since in the type declaration you are including the structure so now it is Nested Structure.

As Steve mentioned above if you include the fields in your structure you can use them directly.

For Instance :

ZCL_SALES_OPERATION->GET_DATA(

    IMPORTING

IM_VKORG = WA_TEST-VKORG

IM_CTWEG = WA_TEST-VTWEG

) .

Regards,

Waliullah Mohd