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

Re: Determining the Fields of Data Object

$
0
0

Hi Wendy,

 

I'm not sure to understand the whole question, but maybe this code will help you

 


* Get the fields catalog.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name = w_tabname
    CHANGING
      ct_fieldcat      = it_fcat
    EXCEPTIONS
      OTHERS           = 3.
  IF sy-subrc NE space.
    RAISE not_an_allowed_table.
  ENDIF.

 

* Loop on the table content.

    LOOP AT <dyn_tab>
         INTO <dyn_str>
         FROM w_start TO w_end.

* Max entries.
* IF NOT W_SIZE_PAGE IS INITIAL.
* CHECK sy-tabix LE W_SIZE_PAGE.
* ENDIF.
* Initialize

      CLEAR : w_pos, is_out.

* Loop on fields.

      LOOP AT it_fcat
           INTO is_fcat.

* Check if we would like the colum.

        IF NOT it_column[] IS INITIAL.
          READ TABLE it_column
               INTO is_column
               WITH KEY fieldname = is_fcat-fieldname.
          CHECK sy-subrc EQ space.
        ENDIF.

* Save the colum.

        ASSIGN COMPONENT is_fcat-fieldname
               OF STRUCTURE <dyn_str>
               TO <field>.
        IF is_fcat-datatype NE 'CHAR'.
          WRITE <field> TO w_field.
          CONDENSE w_field NO-GAPS.
        ELSE.
          MOVE <field> TO w_field.
        ENDIF.
        MOVE w_field TO is_out+w_pos(is_fcat-dd_outlen).
        w_pos = w_pos + is_fcat-dd_outlen.
      ENDLOOP.

* If internal table export.

      APPEND is_out TO it_out.
    ENDLOOP.
    IF w_mode_memory EQ 'M' OR w_mode_memory EQ 'N'.
      EXPORT <dyn_tab> TO MEMORY ID w_mem_id.
      w_message = ' et Export dans la mémoire'.
    ENDIF.
  ENDIF.

 

 

 

regards

Fred


Viewing all articles
Browse latest Browse all 10671

Trending Articles



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