Skip to Content
avatar image
Former Member

How to make two tables mutually convertiable

Hi experts,

I am faceing a problem while doing a program, in which i used CSAP_MAT_BOM_READ FM and getting the values in table i_stp1 having structure STPO_API02 and declared another internal table i_stp

begin of i_stp occurs 0,

stlty like stpo-stlty, "BOM category

stlnr like stpo-stlnr, "BOM internal number

postp like stpo-postp, "item category

dokar like stpo-dokar, "document type

doknr like stpo-doknr, "document number

dokvr like stpo-dokvr, "document version

doktl like stpo-doktl, "document part

potx1 like stpo-potx1, "compenent description 1

potx2 like stpo-potx2, "component description 2

menge like stpo-menge, "quanity

lkenz like stp-lkenz, " Deletion Indicator [2]

end of i_stp.

while appending i_stp1 to i_stp its showing

"I_STP" and "I_STP1" are not mutually convertible. In Unicode programs, "I_STP" must have the same structure layout as "I_STP1",independent of the length of a Unicode character.

one more thing STLTY and MENGE are not present in structure STPO_API02 .

How to solve it if anybody know please let me know with sample codes.

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Sep 01, 2008 at 06:52 PM

    When you want to append a line to an internal table, you'll have to make sure that the line and the line of the internal table are of the same type i.e. having the same structure.

    Structure STPO_API02 and the structure you declared are not the same.

    Easiest way to solve this is to do a MOVE-CORRESPONDING from one structure to the other. This will only work of the fieldnames of both structures are the same.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 01, 2008 at 07:13 PM

    As Micky Oestreich sujjested Use MOVE-CORRESPONDING

    Syntax:-

    MOVE-CORRESPONDING i_stp1 TO i_stp.

    refer this help documentation.

    http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3260358411d1829f0000e829fbfe/content.htm

    Regards

    Bala Krishna

    Add comment
    10|10000 characters needed characters exceeded