Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to make two tables mutually convertiable

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Sm1tje
Active Contributor
0 Kudos

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.

2 REPLIES 2

Sm1tje
Active Contributor
0 Kudos

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.

former_member585060
Active Contributor
0 Kudos

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