abap question (abap objects)

KiranKumar Akula KiranKumar_Akula at aprilasia.com
Thu Jan 28 06:01:34 EST 2010


See if it helps:
 
DATA: dy_table TYPE REF TO data,
      dy_line  TYPE REF TO data.
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
               <dyn_wa>,
               <dyn_field>.

*  ASSIGN dy_table->* TO <dyn_table>.
* Create dynamic work area and assign to FS
*  CREATE DATA dy_line LIKE LINE OF <dyn_table>.
*  ASSIGN dy_line->* TO <dyn_wa>.

  LOOP AT <dyn_table> INTO <dyn_wa>.
    DO.
      ASSIGN COMPONENT  sy-index
         OF STRUCTURE <dyn_wa> TO <dyn_field>. 
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      IF sy-index = 1.
        WRITE:/ <dyn_field>.
      ELSE.
        WRITE: <dyn_field>.
      ENDIF.
    ENDDO.
  ENDLOOP.
 
Regards
Kiran
________________________________

From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
Of Shoaib Mirza
Sent: Thursday, January 28, 2010 4:51 PM
To: sap-wug at mit.edu
Subject: RE: abap question (abap objects)
Importance: High
 
Hi Kiran
 
Thanks, but what I'm doing is the other way around I think.
 
I have some SAP code that has already read a table in to <fs>, <fs> is
an object ref (lh_int_tab->*<fs> , call function using <fs>.. etc)
 
What I want to do is take the contents of <fs> and copy them in to a
normal internal table (standard table), when I try I get a short dump
stating that the conversion is incompatible.
 
How do I read the contents of the data object reference table in <fs> in
to an internal table?
 
 
Kind Regards
Sunni
 
________________________________

Subject: RE: abap question
Date: Thu, 28 Jan 2010 10:00:44 +0800
From: KiranKumar_Akula at aprilasia.com
To: sap-wug at mit.edu
This code snippet helps:
 
DATA: BEGIN OF line,
         col1(1) TYPE c,
         col2(1) TYPE c VALUE 'X',
       END OF line.

FIELD-SYMBOLS <fs> LIKE line.

ASSIGN line TO <fs>.

MOVE <fs>-col2 TO <fs>-col1.
WRITE: <fs>-col1, <fs>-col2.
 
 
By the way, using SE38 we can refer to the following list of demo
reports:
 
DEMO_FIELD_SYMBOLS_ASSIGN_COMP Assigning a Structure Component by
Component to a Field Symbol
DEMO_FIELD_SYMBOLS_ASSIGN_DECI Cast Decimal Places
DEMO_FIELD_SYMBOLS_ASSIGN_ERR  Data Areas for Field Symbols
DEMO_FIELD_SYMBOLS_ASSIGN_TYPE Cast with Predefined Data Types
DEMO_FIELD_SYMBOLS_CASTING     Casting Using Field Symbol Type
DEMO_FIELD_SYMBOLS_CASTING_TYP Casting Using Explicit Type
DEMO_FIELD_SYMBOLS_DYNAMI_AS_1 Dynamic ASSIGN
DEMO_FIELD_SYMBOLS_DYNAMI_AS_2 Dynamic ASSIGN
DEMO_FIELD_SYMBOLS_DYNAMI_AS_3 Assigning Field Symbols
DEMO_FIELD_SYMBOLS_STAT_AS_OF2 Static ASSIGN Using Offset
DEMO_FIELD_SYMBOLS_STAT_AS_OFF Static ASSIGN Using Offset
DEMO_FIELD_SYMBOLS_STAT_ASSIGN Static ASSIGN
DEMO_FIELD_SYMBOLS_STRUCTURE   Forcing a Structure on a Field Symbol
DEMO_FIELD_SYMBOLS_TYPE        Specifying the Full Type of a Field
Symbol
________________________________

From: KiranKumar Akula 
Sent: Thursday, January 28, 2010 9:51 AM
To: 'SAP Workflow Users' Group'
Subject: RE: abap question
 
Here it is:
 
  DATA name(20) TYPE c VALUE 'ITAB-FIELDNAME'.
  FIELD-SYMBOLS <fs> TYPE ANY.
  ASSIGN (name) TO <fs>.
  IF sy-subrc EQ 0.
    WRITE / <fs>.
  ENDIF.
 
Regards
Kiran
________________________________

From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
Of Shoaib Mirza
Sent: Thursday, January 28, 2010 3:49 AM
To: sap-wug at mit.edu
Subject: abap question
 
Hi
 
I'm integrating a workflow analysis report i've written into another
report.  This other report selects data from a database and puts it in
to a data reference object i.e.:
 
* assign data reference to table field symbol
  ASSIGN lh_paa_tab->* TO <fs_paa_tab>.
 
-> then a subroutine pulls back the data in to <fs_paa_tab>.
 
 
Now my traditional abap report starts with an internal table whick
matches <fs_paa_tab> structure.
 
I want to transfer the contents of  <fs_paa_tab> in to my internal table
so I can start my processing, but if I try I get a short dump because of
incompatibility.
 
How do I transfer the data from this data reference to a standard
internal table?
 
Any suggestion would be greatly appreciated.
 
Kind REgards
Sunni
 
________________________________

Do you have a story that started on Hotmail? Tell us now

The above message is for the intended recipient only and may contain
confidential information and/or may be subject to legal privilege. If
you are not the intended recipient, you are hereby notified that any
dissemination, distribution, or copying of this message, or any
attachment, is strictly prohibited. If it has reached you in error
please inform us immediately by reply e-mail or telephone, reversing the
charge if necessary. Please delete the message and the reply (if it
contains the original message) thereafter. Thank you. 
________________________________

Do you want a Hotmail account? Sign-up now - Free
<http://clk.atdmt.com/UKM/go/197222280/direct/01/> 

The above message is for the intended recipient only and may contain confidential information and/or may be subject to legal privilege. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this message, or any attachment, is strictly prohibited. If it has reached you in error please inform us immediately by reply e-mail or telephone, reversing the charge if necessary. Please delete the message and the reply (if it contains the original message) thereafter. Thank you.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20100128/6fce93f4/attachment.htm


More information about the SAP-WUG mailing list