Application Development and Automation 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: 
Read only

Data Type Mismatch | length and conversion problem

Former Member
0 Likes
3,496

There is problem in enhancing standard extractor. The problem is of data type length mismatch. Here the field OBJECTID is of char90 and EBELN is of char 10 and it is required to do "for all entries" and compare these two fields.

Data declaration is as follows:

DATA: BEGIN OF I_CDPOS OCCURS 0,

       OBJECTID LIKE CDPOS-OBJECTID ,

       CHANGENR TYPE CDCHANGENR,

       TABNAME TYPE TABNAME,

       FNAME TYPE FIELDNAME,

       VALUE_NEW TYPE CDFLDVALN,

       END OF I_CDPOS.


DATA : L_S_MC02M_0ITM LIKE MC02M_0ITM,

        C_T_DATA_COP TYPE STANDARD TABLE OF MC02M_0ITM.


Select query is as follows:

SELECT  OBJECTID

               CHANGENR

               TABNAME

               FNAME

               VALUE_NEW

               FROM CDPOS

               INTO CORRESPONDING FIELDS OF TABLE I_CDPOS

               FOR ALL ENTRIES IN C_T_DATA_COP

               WHERE OBJECTID = C_T_DATA_COP-EBELN.

Please tell me how these field length can be converted.

Thanks and regars,

Irish

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,953

Issue Solved.

  DATA: BEGIN OF TY_TEMP OCCURS 0 ,
      EBELN1 TYPE CDPOS-OBJECTID,
      END OF TY_TEMP.
DATA: LY_TEMP LIKE LINE OF TY_TEMP.

      LOOP AT C_T_DATA_COP INTO L_S_MC02M_0ITM.
        LY_TEMP-EBELN1 = L_S_MC02M_0ITM-EBELN.
        APPEND LY_TEMP TO TY_TEMP.
      ENDLOOP.

       SELECT OBJECTID
              TCODE
              CHANGENR
              UDATE
              FROM CDHDR
              INTO CORRESPONDING FIELDS OF TABLE I_CDHDR
         FOR ALL ENTRIES IN TY_TEMP
         WHERE OBJECTID = TY_TEMP-EBELN1.

3 REPLIES 3
Read only

rahul_mb
Active Participant
0 Likes
1,953

Hi Irish,

You need to convert the EBELN to the type of OBJECTID. One way of doing it is declaring another internal table which has only one field, OBJECTID.

DATA: lt_objectid LIKE STANDARD TABLE OF cdpos-objectid.

And then loop through the internal table C_T_DATA_COP and pass the value of EBELN to this field, to populate the new internal table. Now use this internal table LT_OBJECTID in FOR ALL ENTRIES and WHERE condition.

Regards,

Rahul MB

Read only

Former Member
0 Likes
1,953

I tried to create a temporary internal table and append the data.Then use for all entries using the temp internal table, as shown below---

TYPES: BEGIN OF TY_TEMP,

        EBELN TYPE OBJECTID,

        END OF TY_TEMP.

DATA: I_TEMP TYPE TABLE OF TY_TEMP,

       WA_TEMP TYPE TY_TEMP.

        LOOP AT C_T_DATA_COP .

             WA_TEMP-EBELN = C_T_DATA_COP-EBELN.

             APPEND WA_TEMP TO I_TEMP.

        ENDLOOP.

        SELECT OBJECTID

               CHANGENR

               TABNAME

               FNAME

               VALUE_NEW

               FROM CDPOS

               INTO CORRESPONDING FIELDS OF TABLE I_CDPOS

               FOR ALL ENTRIES IN C_T_DATA_COP

               WHERE OBJECTID = I_TEMP-EBELN.

But still it is giving an error--

Internal table "C_T_DATA_COP" has no Header line - specification of one

of the additions "INTO wa", "ASSIGNING", "REFERENCE INTO",
"TRANSPORTING NO FIELDS" is required.
Read only

Former Member
0 Likes
1,954

Issue Solved.

  DATA: BEGIN OF TY_TEMP OCCURS 0 ,
      EBELN1 TYPE CDPOS-OBJECTID,
      END OF TY_TEMP.
DATA: LY_TEMP LIKE LINE OF TY_TEMP.

      LOOP AT C_T_DATA_COP INTO L_S_MC02M_0ITM.
        LY_TEMP-EBELN1 = L_S_MC02M_0ITM-EBELN.
        APPEND LY_TEMP TO TY_TEMP.
      ENDLOOP.

       SELECT OBJECTID
              TCODE
              CHANGENR
              UDATE
              FROM CDHDR
              INTO CORRESPONDING FIELDS OF TABLE I_CDHDR
         FOR ALL ENTRIES IN TY_TEMP
         WHERE OBJECTID = TY_TEMP-EBELN1.