2018 Jan 24 6:41 PM
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?
2018 Jan 25 6:59 AM
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.
2018 Feb 07 8:48 PM
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.
2018 Feb 08 7:30 AM