Skip to Content
-4

ASSIGN COMPONENT and INCLUDES

Jan 24 at 06:41 PM

82

avatar image

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?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Horst Keller
Jan 25 at 06:59 AM
2

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.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

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.

0

please close the question if it's answered.

1