Dynamic ITAB copy problem with field type P

Hello everyone
I need to copy the structure of an internal table that is pass by reference into a method.
Actually everything is fine else than the field type P with decimal is not created properly in the new itab.
Scenario:
An internal table is pass by reference to a method. We need to trait the data without modifying the original table. The Idea is to copy the structure and the data of the referenced internal table into an internal table created dymanically in the method.
Here is what I did and working fine when there are no field of data type "CURR".
Extract the structure of the reference data.
Create a dynamic internal table.
So far so good. Everything seams to work fine. BUT
when I am trying to copy the data from the reference table to the just created internal table the field with data type "CURR" doesn't work.
Here is my example:
FIELD-SYMBOLS: <FS_TABLE> TYPE STANDARD TABLE,
               <TMP_TABLE> TYPE STANDARD TABLE,
               <LS_TMP_TABLE> TYPE ANY,
               <LS_TABLE>     TYPE ANY,
               <LS_VALUE>     TYPE ANY.
DATA: lt_data      TYPE STANDARD TABLE OF vbak,
      ls_data      LIKE LINE OF lt_sortfield,
      ref_data     TYPE REF TO data,
      l_structure  TYPE REF TO DATA,
      lv_ltname    TYPE string.               
select * from vbak UP TO 10 rows INTO CORRESPONDING FIELDS OF TABLE lt_data.
* --- Assign the reference variable to the table
* ---- Only use to simulate a parameter that is assign to a reference to a internal table
unassign <FS_TABLE>.
lv_ltname = 'lt_data[]'.
ASSIGN (lv_ltname) to <FS_TABLE>.
GET REFERENCE OF <FS_TABLE>[] INTO ref_data.
* --- Assign the reference to the field-symbol
UNASSIGN <FS_TABLE>.
ASSIGN ref_data->* TO <FS_TABLE>.
* --- Create a working area for the reference table to a field-table
CREATE DATA l_structure LIKE LINE OF <FS_TABLE>.
ASSIGN l_structure->* TO <LS_TABLE>.
* --- Retrieve the structure of the field-symbol pointing to the internal table
DATA: lr_tabledescr   TYPE REF TO cl_abap_tabledescr,   " Internal Table description
      _r_structdescr  TYPE REF TO cl_abap_structdescr.
lr_tabledescr ?= cl_abap_tabledescr=>describe_by_data( <fs_table> ).
_r_structdescr ?= lr_tabledescr->get_table_line_type( ).
* --- Read internal table structure to create dynamic internal table
data: ls_struc like LINE OF _r_structdescr->components,
      xfc           type lvc_s_fcat,
      ifc           type lvc_t_fcat.
* --- Why the field (component) NETWR length is now 8 instead of 15?
LOOP AT _r_structdescr->components into ls_struc.
  clear xfc.
  xfc-fieldname = ls_struc-name .
  xfc-datatype  = ls_struc-type_kind.
  xfc-inttype   = ls_struc-type_kind.
  xfc-intlen    = ls_struc-length.
  xfc-decimals  = ls_struc-decimals.
  append xfc to ifc.
ENDLOOP.
DATA:   dy_table      type ref to data,
* --- Create dynamic internal table
call method cl_alv_table_create=>create_dynamic_table
  EXPORTING
    it_fieldcatalog = ifc
  IMPORTING
    ep_table        = dy_table.
* --- assign reference internal table to Field-symbol
assign dy_table->* to <tmp_table>.
unassign <ls_tmp_table>.
DATA: ls_tmp_struc type REF TO DATA.
CREATE DATA ls_tmp_struc like LINE OF <tmp_table>.
ASSIGN ls_tmp_struc->* TO <ls_tmp_table>.
Loop at <fs_table> INTO <LS_TABLE>.
MOVE-CORRESPONDING <ls_table> TO <ls_tmp_table>.
APPEND <ls_tmp_table> TO <tmp_table>.
ENDLOOP.
* <fs_table>-netwr length is 15
* <ls_tmp_table>-netwr length is 8
* ??????????? Why the length is different?
* ??????????? It should a structure copy and have the
* ??????????? same length
I use VBAK as example, and the field NETWR is using data type "NETWR_AK" where it us a data type "CURR" with length 15 and decimal 2.
When reading the structure, the method get_table_line_type of the class cl_abap_tabledescr return a length of 8 instead of 15.
Any idea how to get the exact structure of a variable that is refering to a data type?
Regards
Daniel

Hello Everyone
Thank you for your replies.
I think I didn't explain myself clearly.
My goal is to be able to create an exact  structure copy of a "Type ref to data" into a new internal table that is not defined yet.
Example:
  A method contain a parameter that is a ref to DATA type.
  That parameter is refering to an internal table from the calling program.
  Now I want to create an internal table into the method where this one will be an exact structure copy of the parameter.
  So, lets put some name here.
  parameter: ip_data type ref to data.
  FIELD-SYMBOLS: <FS_REF_DATA> TYPE STANDARD TABLE,
                                <FS_CP_DATA>  TYPE STANDARD TABLE.
ASSIGN ip_data->* TO <FS_REF_DATA>.
" some code to assign the same structure to <FS_CP_DATA> from <FS_REF_DATA>
" than copy the data from <FS_REF_DATA> to <FS_CP_DATA>.
<FS_CP_DATA> [ ] = <FS_REF_DATA> [ ].  " This is working if no type P with decimal exist into the structure
" Than I can play with the data of <FS_CP_DATA> without modifying the data of <FS_REF_DATA>.
My problem would be solved if I can create dynamically an internal table that has an exact structure copy of the passed parameter.
Regards
Daniel

Similar Messages

  • Problem with field type STRING in table

    Hi Experts,
             I am new to ABAP. I have created a new transparent table which hold error info. One of the field has to store data of size about 1500 char.
    Since CHAR type is not acceptable for this field So I gave STRING type. Now when I try to create a TABLE parameter in a RFC enabled functional module using "LIKE YERROR" Then I get a error:
    "YERROR must be a flat structure. You cannot use internal tables, strings, references, or structure as component" 
    Why is this error? How to resolve it? Is it because I have used a field of type STRING in the table? If this is the problem then what other type can I use?
    What are other know problems with using STRING type?
    Please help!
    Thanks
    Gopal

    Hi,
    Try to declare it as type LCHR , it can hold up to 32000 chars.
    Regards
    vijay

  • Problem with field label

    Hello All,
    I am having a strange problem with field label? I have created a table with three fields one is MANDT and and the remaining fields as PATID and PATNA.
    I am maintaining the field label for these fields, but still i am not getting the names of the fields while i am calling the structure in my alv tree.
    I d'nt know what is the problem here?
    can any one tell me how can i solve this issue?
    Regards,
    Lisa

    Hi lisa,
    This is not the problem with Data Dictionary,
    While declaring the fieldcatalogue for thr GRID.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      I_BUFFER_ACTIVE              =
       I_STRUCTURE_NAME             = 'ZTABLE'
      I_CLIENT_NEVER_DISPLAY       = 'X'
      I_BYPASSING_BUFFER           =
      CHANGING
        ct_fieldcat                  = gt_fieldcat
    EXCEPTIONS
      INCONSISTENT_INTERFACE       = 1
      PROGRAM_ERROR                = 2
      OTHERS                       = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    If gt_fieldcat-fieldname = 'PATID'.
    gs_fieldcat-ref_field = 'ZTABLE'.
    modify gt_fieldcat from gs_fieldcat.
    clear gs_fieldcat.
    endif.
    Because while calling the FM it is populatinh the fieldname
    so you need to modify the fieldcatalogue with fieldname then it will pick the field labels from the Dictionary.
    Hope this  will solve your problem.
    Regards,

  • Problems with letter type

    Problems with letter type homepage www.JO-qigong.nl When I want to make another type it changes the whole page? Why?

    Thank you for responding. I am sure that I selected the text. I don't do anything different than I did many times before. But if I change a text know, for exemple in the color Red, than other text, that I didn't selected, get a different text: bigger text or other color. In iWeb everything is OK, but when I publish it, than there are those grazy changes. I use iWeb for 3 years now and had no problems till now.
    Is it because the software is not supported anymore by Apple, because you can not update the software anymore. It is a pitty, because I like iWeb. It is easy to work with.

  • Very urgent : Problem with field attributes in Datasource

    Hi
    I am getting a problem with field attributes in the datasource.
    The issue came up after i modified the extract structure-i modified one field and
    added one field to the structure.Now those two fields are not visible in BW.
    When i checked with transaction rsa2, i could find that for those two fields , the
    field attribute is <b>'A'</b> which is <b>'Field in OLTP and BW Hidden by SAP'</b>.
    I tried to modify the field attribute to make it visible.Now the issue is that it is not getting reflected after transport in the Q system.What can be the issue.In the Q system its still the old value 'A' ,which makes the fields invisible.
    Please let me know what can be the issue.
    Regards
    Leon

    Hi,
    did you change this attribute via RSA2?
    you need to change your datasource via postprocessing (RSA6); then transport your DS to your Q source system.
    Replicate your datasources in your BW.
    Finally modifiy your Transfer Structure by editing your TRules ( tab Datasource/Tran structure), move your new fields from the right frame to the left frame)
    Maintain your TRules
    Activate
    hope this helps...
    Olivier.

  • Problem with field GL Account is that it shows concatenated Chart of Accoun

    Hello . Please help me. We have sap BI olap universe . problem with field GL Account is that it shows concatenated Chart of Accounts. But user want to trim the chart of account and show only account in list of values in webi report.
    So What code I can put in Universe to remove this " 9000/" WHICH IS Chart of acct from GL Account
    example List of values shows
    9000/99030
    9000/99070
    I want to show as below
    99030
    99070
    I tried replace function in universe it does not work. Pls help.
    Thanks
    soniya

    Hi,
    You can do it in Web Intelligence using the function Right().
    Depending on the SAP BW version you have it is possible to build such calculated expression in universe on uniquename or name:
    <EXPRESSION>RIGHT[0CALMONTH].currentmember.uniquename,5)</EXPRESSION>
    OR
    <EXPRESSION>RIGHT([0CALMONTH].currentmember.name,5)</EXPRESSION>
    You have to replace 0CALMONTH by the unique definition of GL Accounts and you also need to use the object referencing GL Accounts in your query in addtion to the calculated expression.
    Regatds
    Didier

  • Problem with field  KONWA-Rate Unit(Currency or Percentage) of table KONP

    Hi Gurus,
    I m facing problem with field 'KONWA -Rate Unit (Currency or Percentage)' of table KONP. This field is showing ‘Currency’ and '%' both in table KONP. For some materials its showing currency value and for some its showing '%'. Due to which its creating load problems. My question is how this '%' is coming (means is there any calculation behind that or something else) in table KONP and how can I identify this.
    I am sure u will have the answer for this question so Thanks in advance.
    Message was edited by:
            Amit Rajput
    Message was edited by:
            Amit Rajput
    null

    Hi,
    take the following example: you sell liquor to customers; in your country, when you sell liquor your company is entitled to pay customs and excise fees to governamental authorities.
    These excises and duties are a percentage of the retail price. You'll then create such a condition record with this rate so that you calculation schema will post the correct value during the processing of billing documents...
    hope this shed light
    Olivier.
    Message was edited by:
            Olivier Cora

  • Problem with mime type in web.xml file

    Hi everybody,
    I actually got a problem with mime types on Weblogic 6.0 under Linux.
    I read the documentation so I added the next lines in the web.xml file in
    the WEB-INF directory of my server :
    <mime-mapping>
    <extension>
    doc
    </extension>
    <mime-type>
    application/msword
    </mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>
    ppt
    </extension>
    <mime-type>
    application/vnd.ms-powerpoint
    </mime-type>
    </mime-mapping>
    Why can't I retrieve a .doc or .ppt files with an internet browser correctly
    ? I get only text/plain ...
    Can someone help me ?
    Regards,
    Alexis Berger

    I am having the same problem with doc and xsl. I have added this
    <mime-mapping>
    <extension>xls</extension>
    <mime-type>application/vnd.ms-excel</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>doc</extension>
    <mime-type>application/msword</mime-type>
    </mime-mapping>
    to my web.xml. I even restarted the server. I still see doc and xsl in binary.
    Is there some other setting that needs to take place?
    I am using WL6.1 with fixpack 1.
    I can see the doc and excel files in the browser if I don't go through the weblogic
    server. That just confirms it's not my browser.
    Kumar Allamraju <[email protected]> wrote:
    <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
    <html>
    It works fine for me in 6.1 SP1.
    <br><br>
    If the following doesn't work , can you
    <br>try application/winword instead of application/msword?
    <p>--
    <br>Kumar
    <p>Siming Mu wrote:
    <blockquote TYPE=CITE>Hi,
    <p>I setup in my web.xml a mime mapping as follows,
    <p><mime-mapping>
    <br><extension>doc</extension><mime-type>application/msword</mime-type>
    <br></mime-mapping>
    <p>When I specify a test.doc url, the doc file appears in my browser
    as
    binary data
    <br>instead of download.
    <p>Please reference change request 055002, which decribes this problem. 
    According
    <br>to edocs, it has been fixed in wls6.1sp1.
    <p>But I am seeing it fixed.  Am I doing anything wrong? Thanks.
    <p>Siming</blockquote>
    </html>

  • How do fix problem with iPages - type does not enter - ?

    How do I fix this problem with Pages - type from keyboard does not enter ?  If I need to re-install, How do I do that?

    Hello DonAndNorma,
    You may need to uninstall, then reinstall the Pages application. Steps for doing so can be found in the article linked below.
    OS X Mavericks: Install, update, and uninstall apps
    http://support.apple.com/kb/PH14299
    Cheers,
    Allen

  • Dynamic table with field type table

    Hi,
    I´m using "cl_alv_table_create=>create_dynamic_table" to create a dynamic table for ALV Grid.
    But...I need to use colors in ALV, then I need to declare a field type LVC_S_SCOL in dynamic table from "cl_alv_table_create=>create_dynamic_table".
    How can I declare this in fieldcat?
    The code:
    Creating dynamic table
    DATA: table_agrup TYPE REF TO data,
            line_agrup  TYPE REF TO data.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = t_fieldcat
        IMPORTING
          ep_table                  = table_agrup
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
        ASSIGN table_agrup->* TO .
    Printing ALV
      CALL METHOD obj_grid->set_table_for_first_display
        EXPORTING
          is_variant                    = w_variant
          i_save                        = 'A'
          is_layout                     = w_layout
        CHANGING
          it_outtab                     =
          it_fieldcatalog               = t_fieldcat
          it_sort                       = t_sort
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
    Thanks.

    It is not possible with the  METHOD cl_alv_table_create=>create_dynamic_table to include another table inside that newly generated table.
    I have tried to do it with the code and I got the dynamic table created after at the end of the program.
    In the code,
    <DYN_TABLE> has same effect as your <table> variable
    <DYN_WA> has same effect as your <HEADER>
    REPORT  ZTEST_NP_DYNAMIC.
    DATA: DY_TABLE TYPE REF TO DATA,
          DY_LINE  TYPE REF TO DATA.
    FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE,
                   <DYN_WA>,
                   <DYN_FIELD>.
    FIELD-SYMBOLS: <FS> TYPE ANY.
    * To generate the Dyanmic table with the COLOR
    DATA: LS_SOURCE TYPE STRING.
    DATA: LT_SOURCE LIKE STANDARD TABLE OF LS_SOURCE WITH HEADER LINE.
    DATA: L_NAME LIKE SY-REPID.
    DATA: L_MESSAGE(240) TYPE C,
          L_LINE TYPE I,
          L_WORD(72) TYPE C.
    DATA: L_FORM(30) TYPE C VALUE 'TABLE_CREATE'.
    LT_SOURCE = 'REPORT ZTEST_SUBROUTINE_POOL.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'FORM  TABLE_CREATE USING I_FS TYPE ANY.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'DATA: BEGIN OF LT_GENTAB OCCURS 0.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'DATA: BUKRS TYPE BUKRS. '.
    APPEND LT_SOURCE.
    LT_SOURCE = 'DATA: BKTXT TYPE BKTXT. '.
    APPEND LT_SOURCE.
    * you can add your fields here.....
    LT_SOURCE = 'DATA: COLOR TYPE lvc_t_scol. '.
    APPEND LT_SOURCE.
    LT_SOURCE = 'DATA: END OF LT_GENTAB.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'DATA: POINTER TYPE REF TO DATA.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'CREATE DATA POINTER LIKE STANDARD TABLE OF LT_GENTAB.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'I_FS = POINTER.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'ENDFORM. '.
    APPEND LT_SOURCE.
    L_NAME = 'ZTEST_SUBROUTINE_POOL'.
    CATCH SYSTEM-EXCEPTIONS GENERATE_SUBPOOL_DIR_FULL = 9.
      GENERATE SUBROUTINE POOL LT_SOURCE NAME L_NAME
               MESSAGE L_MESSAGE LINE L_LINE WORD L_WORD.  "#EC CI_GENERATE
    ENDCATCH.
    IF NOT L_MESSAGE IS INITIAL.
      MESSAGE E000(0K) WITH L_MESSAGE L_LINE L_WORD.
    ENDIF.
    ASSIGN DY_TABLE TO <FS>.
    PERFORM (L_FORM) IN PROGRAM (L_NAME) USING <FS>.
    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>.
    Write: 'bye'.
    Regards,
    Naimesh Patel

  • Dynamically table read / write with field symbols

    Hi,
    I like to read dynamically from a table via field symbols. The reading part is working.
    But now I like to do some changes on the entry and then write it to another table with a similar structure.
    I use SAP 4.6c
    There I have two problems:
    1. At the statement I get a dump:
    <l_sysid> = sy-sysid.
    --> Field symbol has not yet been assigned.
    I think that the problem is somewhere around
    assign <table_to> to <wa_to>.
    2. the data change inside the loop. There I like to add the sysid to the target-wa and then copy the source-wa it to the new target-wa to append it to the target table.
    But this does not work. What kind of code do I need? The "move-correspondig" is not correct.
    --> see code around
    loop at <table_from> assigning <wa_from>.
    Below you can find my code. The problem is within the last loop-statement.
    FUNCTION Z_MIG_COPY_TABLE.
    *"*"Lokale Schnittstelle:
    *"  IMPORTING
    *"     REFERENCE(I_TABNAME_FROM) TYPE  TABNAME
    *"     REFERENCE(I_TABNAME_TO) TYPE  TABNAME
    *"     REFERENCE(I_KOMP_TRANS) LIKE  ZS_KOMP_TRANS STRUCTURE
    *"        ZS_KOMP_TRANS OPTIONAL
    *"  TABLES
    *"      I_SELCON STRUCTURE  ZS_SELCON
    *"  EXCEPTIONS
    *"      NOT_FOUND
    *"      OTHERS
    * zeilenweiser Aufbau Tabelle I_SELCON z.B.:
    * bukrs = 3011
    * AND
    * bstyp = 'F'
    * I_KOMP_TRANS
    * dient zur Uebersetzung von alt/neu, z.B. bei LIFNR
    * der angegebene Funktionsbaustein wird genutzt,
    * um den neuen Wert der übergebenen Komponente zu ermitteln
    * Angabe z.B.:
    * LIFNR
      DATA: dref       TYPE REF TO data,
            dref_to    TYPE REF TO data,
            i_alv_cat  TYPE TABLE OF lvc_s_fcat,
            ls_alv_cat LIKE LINE OF i_alv_cat,
            i_alv_cat_to  TYPE TABLE OF lvc_s_fcat,
            ls_alv_cat_to LIKE LINE OF i_alv_cat.
      DATA: BEGIN OF itab OCCURS 0.
    *        INCLUDE STRUCTURE dntab.
              INCLUDE structure DFIES.
      DATA: END OF itab.
      DATA: BEGIN OF itab_to OCCURS 0.
    *        INCLUDE STRUCTURE dntab.
              INCLUDE structure DFIES.
      DATA: END OF itab_to.
      FIELD-SYMBOLS: <table_from>   TYPE ANY TABLE.
      FIELD-SYMBOLS: <table_to>     TYPE Standard TABLE.
      FIELD-SYMBOLS: <wa_from>      TYPE ANY.
      FIELD-SYMBOLS: <wa_to>        TYPE ANY.
      FIELD-SYMBOLS: <l_komp>       TYPE ANY.
      FIELD-SYMBOLS: <l_sysid>      TYPE ANY.
      Data: l_alt type ELIFN.
      Data: l_neu type ELIFN.
      CALL FUNCTION 'DDIF_NAMETAB_GET'
           EXPORTING
                TABNAME   = i_tabname_from
           TABLES
                DFIES_TAB = itab
           EXCEPTIONS
                NOT_FOUND = 1
                OTHERS    = 2.
      IF SY-SUBRC = 1.
        raise not_found.
      elseif sy-subrc = 2.
        raise others.
      ENDIF.
      LOOP AT itab .
        ls_alv_cat-fieldname = itab-fieldname.
        ls_alv_cat-ref_table = i_tabname_from.
        ls_alv_cat-ref_field = itab-fieldname.
        APPEND ls_alv_cat TO i_alv_cat.
      ENDLOOP.
    * build internal table
      CALL METHOD cl_alv_table_create=>create_dynamic_table
          EXPORTING
            it_fieldcatalog = i_alv_cat
          IMPORTING
            ep_table = dref.
      ASSIGN dref->* TO <table_from>.
      CALL FUNCTION 'DDIF_NAMETAB_GET'
           EXPORTING
                TABNAME   = i_tabname_to
           TABLES
                DFIES_TAB = itab_to
           EXCEPTIONS
                NOT_FOUND = 1
                OTHERS    = 2.
      IF SY-SUBRC = 1.
        raise not_found.
      elseif sy-subrc = 2.
        raise others.
      ENDIF.
      LOOP AT itab_to.
        ls_alv_cat_to-fieldname = itab_to-fieldname.
        ls_alv_cat_to-ref_table = i_tabname_to.
        ls_alv_cat_to-ref_field = itab_to-fieldname.
        APPEND ls_alv_cat_to TO i_alv_cat_to.
      ENDLOOP.
    *  break-point.
    * build internal table
      CALL METHOD cl_alv_table_create=>create_dynamic_table
          EXPORTING
            it_fieldcatalog = i_alv_cat_to
          IMPORTING
            ep_table = dref_to.
      ASSIGN dref_to->* TO <table_to>.
    *Select Ursprungstabelle mit Selektionsbedingungen
      SELECT * FROM (i_tabname_from) up to 5 rows
        INTO CORRESPONDING FIELDS OF TABLE <table_from>
        where (i_selcon).
    *  break-point.
    *Aufbau interne Tabelle mit eventuell geänderten Feldern
      assign <table_to> to <wa_to>.
      if not I_KOMP_TRANS is initial.
        loop at <table_from> assigning <wa_from>.
          assign component I_KOMP_TRANS-KOMP
            of structure <wa_from> to <l_komp>.
          CALL FUNCTION I_KOMP_TRANS-FUBA
               EXPORTING
                    I_KOMP = I_KOMP_TRANS-KOMP
                    I_ALT  = <l_komp>
               IMPORTING
                    E_NEU  = <l_komp>.
          break-point.
          assign component 'SYSID' of structure <wa_to> to <l_sysid>.
          <l_sysid> = sy-sysid.
    *      move-corresponding <wa_from> to <wa_to>.
          append <wa_to> to <table_to>.
        endloop.
    *    break-point.
    *Speichern der ausgelesenen Daten in Zieltabelle
        MODIFY (i_tabname_to) FROM TABLE <table_to>.
        if sy-subrc <> 0.
          MESSAGE E001(ZMESSAGES) WITH i_tabname_to.
    *   Fehler beim Modify von Tabelle '&'.
        endif.
      else.
    *Speichern der ausgelesenen Daten in Zieltabelle
        MODIFY (i_tabname_to) FROM TABLE <table_from>.
        if sy-subrc <> 0.
          MESSAGE E001(ZMESSAGES) WITH i_tabname_to.
    *   Fehler beim Modify von Tabelle '&'.
        endif.
      endif.
      commit work.
      if sy-subrc <> 0.
        MESSAGE E002(ZMESSAGES) WITH i_tabname_to.
    *   Fehler beim Commit von Tabelle '&'.
      endif.
    *  break-point.
    ENDFUNCTION.
    Thanks a lot for any hints.
    Regards
    Tom

    Hi,
    Answers below.
    1) For this...you assigning an internal table to a work area...
    assign <table_to> to <wa_to>.
    This should solve the problem..
    * Create the target work area..
    DATA: new_line  TYPE REF TO data.
    CREATE DATA new_line LIKE LINE OF <table_to>.
    ASSIGN new_line->* TO <wa_to>.
    Now the target work area is created..
    2) For the second one...
    ************New code
       FIELD-SYMBOLS: <FS>,<FS1>.
    ************New code End.
       loop at <table_from> assigning <wa_from>.
          assign component I_KOMP_TRANS-KOMP
            of structure <wa_from> to <l_komp>.
          CALL FUNCTION I_KOMP_TRANS-FUBA
               EXPORTING
                    I_KOMP = I_KOMP_TRANS-KOMP
                    I_ALT  = <l_komp>
               IMPORTING
                    E_NEU  = <l_komp>.
          break-point.
          assign component 'SYSID' of structure <wa_to> to <l_sysid>.
          <l_sysid> = sy-sysid.
    ************New code
          LOOP AT itab .
             ASSIGN COMPONENT itab-fieldname of structure <WA_FROM> TO <FS>.
             CHECK SY-SUBRC = 0.
             ASSIGN COMPONENT itab-fieldname of structure <WA_TO> TO <FS1>.
             CHECK SY-SUBRC = 0.
    * Move from source to target.
             <FS1> = <FS>.
          ENDLOOP.
    ************New code End
          append <wa_to> to <table_to>.
        endloop.
    Thanks
    Naren

  • Problem with field-symbol values not updating

    H i ,
          I have following piece of code :
    Assigning Dynamic Table to Field Symbol
        ASSIGN ist_dyn_table->* TO <gs_dyn_table>.
    *   Creating Structure for dynamic table
        CREATE DATA gs_dyn_line LIKE LINE OF <gs_dyn_table>.
    *   Creating line type for the Dynamic Values
        ASSIGN gs_dyn_line->* TO <gs_line>.
    *   Populating values in the dynamic table
        LOOP AT ist_pwcl_main INTO wa_pwcl_main.
          ASSIGN COMPONENT gc_fld_werks OF STRUCTURE <gs_line> TO <gs_field>.
       1   IF sy-subrc EQ 0.
       2        <gs_field> = wa_pwcl_main-werks.
       3      ENDIF.
       5  IF <gs_field> IS ASSIGNED.
       6     <gs_field> = wa_pwcl_main-vbeln.
          ENDIF.
      7 IF <gs_field> IS ASSIGNED.
      8  <gs_field> =  wa_pwcl_main-posnr.
          ENDIF.
       IF <gs_field> IS ASSIGNED.
            <gs_field> = wa_pwcl_main-quant.
          ENDIF.
    on debugging  at line 2 <gs_filed> contains the value of werks .
    but at line 6 <gs_field> contains value of vbeln as 0 and at 8 of posnr as 0 .
    What can be the problem ? Other values are getting assigned properly .
    Plz help ...
    Regards .

    Hi,
    Assigning Dynamic Table to Field Symbol
        ASSIGN ist_dyn_table->* TO <gs_dyn_table>.
      Creating Structure for dynamic table
        CREATE DATA gs_dyn_line LIKE LINE OF <gs_dyn_table>.
      Creating line type for the Dynamic Values
        ASSIGN gs_dyn_line->* TO <gs_line>.
      Populating values in the dynamic table
        LOOP AT ist_pwcl_main INTO wa_pwcl_main.
          ASSIGN COMPONENT gc_fld_werks OF STRUCTURE <gs_line> TO <gs_field>.
       1   IF sy-subrc EQ 0.
       2        <gs_field> = wa_pwcl_main-werks.
       3      ENDIF.
       5  IF <gs_field> IS ASSIGNED.
       6     <gs_field> = wa_pwcl_main-vbeln.
          ENDIF.
      7 IF <gs_field> IS ASSIGNED.
      8  <gs_field> =  wa_pwcl_main-posnr.
          ENDIF.
       IF <gs_field> IS ASSIGNED.
            <gs_field> = wa_pwcl_main-quant.
          ENDIF.
    Based on your coding above, <gs_field> has been assigned with data type 'WERKS' (i'd assume component gc_fld_werks found from structure <gs_line> is a plant typed), which is a CHAR(4) data type.
    Meaning, if <gs_field> is assigned with Plant type value, e.g. <gs_field> = '1000', field symbol <gs_field> will contain 4 character only.
    At line 6, if wa_pwcl_main-vbeln = '0000201000', <gs_field> is only capturing '0000' only. This is also happened to line 8.
    However, it looks like that <gs_field> is getting over-write if ASSIGNED statement returns SY-SUBRC = 0.
    Hope this helps.
    Regards,
    Patrick

  • Problem with numeric types in Abap Proxy

    Hello,
    We are having problems with some abap proxy calls. When a numeric type is filled with 0 the node it´s automatically removed and no value it's recived in XI. The only way I have found to avoid this problem it's to define the field with type string or change the cardinality to 1..1 instead of 0..1. It's there any way to maintain the type and the cardinality?? Maybe with a pattern??
    Regards,
    Alberto Pla.

    Hi Alberto
    I had this problem, and I decided to use xsd:string instead of xsd:integer. This will solve the issue.
    Anyway.. check this note:
    [Note 1242795 - Mapping of XSD default values by ABAP Proxy Generation|https://service.sap.com/sap/support/notes/1242795]
    Regards
    Francesco

  • Problem with Output type NEU in PO

    hI all,
    I would like to have the possibility to send the PO document via mail.
    Therefor I changed the smartform and the program as I did it for some other. I tested it and it works.
    To do so, I've created a new output type ZNEU by copying the NEU output type.
    I've created a new schema including my ZNEU output type in place of the standard NEU.
    I inculded the schema I've created for output type ZNEU.
    I did all the customizing in the NACE transaction, I've created the condition record for ZNEU in the transaction MN05 on the level 'document type', and also set  the communication strategy.
    But there is somethin missing, because by creating a PO, the system doesn't set the ZNEU message type in the PO automatically. Looking the protocol, it says that a valid output condition has been found but it is still not set in the PO.
    Any idea ? I looking for this problem for hours...
    thank you

    It is a possibility that 'smartform' has formatting error and although it is going to the print program as guided by condition records..
    But not assigning the output type with PO document
    Can you please do two things:
    1. Put a break-point in print program and see if control goes there or not
    2. Test the output after adding it in manually in PO
    Thanks.

  • Problem with field symbols in ecc 6.0

    i have the following  code  written in 4.6 version   now i am executing the old report   in 6.0  but  i am facing with some unicode error.
      FIELD-SYMBOLS:
        <line_of_bs_table> LIKE tbl1024,
       READ TABLE bs_table INDEX row_bst ASSIGNING  <line_of_bs_table> .
        buffer_bsbuffer_ptr(aux) =  <line_of_bs_table> >col_bst.
    tb1024 is standard sap structure  for storing buffer contents
    i have the following error in ecc 6.0
    structure type   '<line_of_bs_table> >+col_bst'  does not start with a charecter type  field in unicode programs in such cases
    offset/ length declarations are not allowed.
    can any one tell how can a field symbol  structure is changed  to charecter  type.

    Hi elinuk,
    you have already posted this thread in the ABAP general forum under problem in field symbols in ecc6.0 and I think that this forum is more related to this issue than the DMS forum. So please close this thread and investigate this issue further in the ABAP general forum.
    Best regards,
    Christoph

Maybe you are looking for