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: 

ASSIGN COMPONENT and INCLUDES

dean_hinson2
Active Contributor
0 Kudos

Hello,

I have a function module with a structure like this....

DATA: BEGIN OF ls_CORCTS_PRO_ENH.
DATA: INCLUDE TYPE /SAPSLL/CORCTS.
DATA: CCNGN TYPE /SAPSLL/CCNGN.
DATA: END OF ls_CORCTS_PRO_ENH.

The data is filled and passed to another function module with a type ANY....

USING uv_ROLLNAME TYPE ROLLNAME
us_PROVISION TYPE ANY

When this statement is executed, nothing is in <field>...

ASSIGN COMPONENT us_DFIES-FIELDNAME OF STRUCTURE us_PROVISION TO <field>.

I am wandering if the INCLUDE is the issue. Because, when I debug, the INCLUDE is shown as a direct component of the structure, not the fields of the INCLUDE....

STRUCTURE

+INCLUDE

CCNGN

Is this the issue?

3 REPLIES 3

horst_keller
Product and Topic Expert
Product and Topic Expert

No.

You could easily answer this question yourself by reading the documentation for INCLUDE TYPE or writing a little test as

CLASS demo DEFINITION.
  PUBLIC SECTION.
  CLASS-METHODS main IMPORTING p TYPE any.
ENDCLASS.
CLASS demo IMPLEMENTATION.
  METHOD main.
  ASSIGN COMPONENT 'CARRID' OF STRUCTURE p TO FIELD-SYMBOL(<fs>).
  IF sy-subrc = 0.
  cl_demo_output=>display( <fs> ).
  ENDIF.
  ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
  DATA BEGIN OF struct.
  INCLUDE TYPE scarr.
  DATA END OF struct.
  struct = VALUE #( carrid = 'XX' ).
  demo=>main( struct ).		

I'd rather say, that your /SAPSLL/CORCTS has a substructure.

0 Kudos

Table /SAPSLL/CORCTS is made up of INCLUDES, yes. However, that should not affect the ASSIGN COMPONENT. So, I re-developed the solution. But I did use your code to test the theory...

CLASS demo DEFINITION.
PUBLIC SECTION.
CLASS-METHODS main IMPORTING p TYPE any.
ENDCLASS.
CLASS demo IMPLEMENTATION.
METHOD main.
ASSIGN COMPONENT 'ALUOM' OF STRUCTURE p TO FIELD-SYMBOL(<fs>).
IF sy-subrc = 0.
cl_demo_output=>display( <fs> ).
ENDIF.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA BEGIN OF CORCTS_ENH.
INCLUDE TYPE /SAPSLL/CORCTS.
DATA CCNGN TYPE /SAPSLL/CCNGN.
DATA END OF CORCTS_ENH.
CORCTS_ENH = VALUE #( ALUOM = 'XX' ).
demo=>main( CORCTS_ENH ).

XX was displayed.

please close the question if it's answered.