Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 950

TAW12-01, lesson: Dynamic Programming whit Field Symbols and References.

$
0
0

On unit 6: Dynamic programming, use the sample program: SAPBC402_DYND_DATADECL

 

On description about this program, says:

if you Knew the components names, you could display the files directly using WRITE <fs_wa>-…. In most cases, however, you will not normally know the names of the components, or how many of them there are. As result, you have to use the ASSING-COMPONENT variant for output:… ”

However, I try to modify the program and the compiler not permit...

Is an error on the book ?

 

 

24-05-2016 11-15-26 a.m..png

 

The data object "<FS_WA>" has no structure and therefore no component called "MAKTG". called "MAKTG".

But if I debug … its true…

 

24-05-2016 11-19-20 a.m..png

 

Any suggestion?

 

Program CODE

______________________________________________________________________________

*&---------------------------------------------------------------------*

*& Report  SAPBC402_DYND_DATADECL

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT  sapbc402_dynd_datadecl.

 

*----------------------------------------------------------------------*

DATA:

     gr_itab TYPE REF TO data,

     gr_wa   TYPE REF TO data.

 

*----------------------------------------------------------------------*

FIELD-SYMBOLS:

     <fs_itab> TYPE ANY TABLE,

     <fs_wa>   TYPE ANY,

     <fs_comp> TYPE ANY.

 

*----------------------------------------------------------------------*

PARAMETERS

     pa_tab TYPE dd02l-tabname DEFAULT 'SPFLI'.

 

 

*----------------------------------------------------------------------*

START-OF-SELECTION.

 

   CREATE DATA gr_itab TYPE STANDARD TABLE OF (pa_tab)

                        WITH NON-UNIQUE DEFAULT KEY.

 

   ASSIGN gr_itab->* TO <fs_itab>.

 

   SELECT * FROM (pa_tab)

       INTO TABLE <fs_itab>

       UP TO 100 ROWS.

 

   CREATE DATA gr_wa LIKE LINE OF <fs_itab>.         "or: TYPE (pa_tab).

 

   ASSIGN gr_wa->* TO <fs_wa>.

 

   LOOP AT <fs_itab> ASSIGNING <fs_wa>.

     DO.

       ASSIGN COMPONENT sy-index OF STRUCTURE <fs_wa> TO <fs_comp>.

       IF sy-subrc NE 0.

         NEW-LINE.

         EXIT.

       ENDIF.

 

       WRITE <fs_comp>.

     ENDDO.

   ENDLOOP.


Viewing all articles
Browse latest Browse all 950

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>