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

Do statement problem..its urgent

Former Member
0 Likes
855

HI friends,

Please help me wiht this coding..I am getting the error as p0041-dar01 and mydates are type incompatible. please solve it...i have spend my whole day but i am not getting where i am wrong... The coding is below

REPORT ZDATES1 .
TABLES: PERNR.
 
DATA: BEGIN OF MYDATES,
      DAR  LIKE P0041-DAR01,
      DAT  LIKE P0041-DAT01,
END OF MYDATES.
 
INFOTYPES 0041.
 
GET PERNR.
 
  WRITE: PERNR-PERNR, PERNR-ENAME.  "show employee number and name
 
  RP-PROVIDE-FROM-LAST P0041 SPACE PN-BEGDA PN-ENDDA.
  IF PNP-SW-FOUND = 1.

  

DO 12 TIMES VARYING mydates
FROM p0041-dar01
NEXT p0041-dar02.

     

   IF mydates-dar NE space.

           WRITE: /,MYDATES-DAR, MYDATES-DAT.

        ENDIF.

    ENDDO.

  ENDIF.

1 ACCEPTED SOLUTION
Read only

dani_mn
Active Contributor
0 Likes
806

HI,

you are comparing field with internal table .

try this now.

DO 12 TIMES VARYING <b>mydates-dar01</b>

FROM p0041-dar01

NEXT p0041-dar02.

Regards,

8 REPLIES 8
Read only

dani_mn
Active Contributor
0 Likes
807

HI,

you are comparing field with internal table .

try this now.

DO 12 TIMES VARYING <b>mydates-dar01</b>

FROM p0041-dar01

NEXT p0041-dar02.

Regards,

Read only

Former Member
0 Likes
806

hi Specify the field name instead of internal table

<b>DO 12 TIMES VARYING mydates-dar01
FROM p0041-dar01
NEXT p0041-dar02.</b>

Read only

Former Member
0 Likes
806

I tried that, but I am facing anotehr problem.

When I am comparing field, my 1 field is getting populated bt the 2nd field is left empty.

please can anybody solve it for me.

Read only

dani_mn
Active Contributor
0 Likes
806

HI abhay,

I think you need both fields of internal table to get populated for that try this.

DO 12 TIMES VARYING mydates-dar01

FROM p0041-dar01

NEXT p0041-dar02

<b>VARYING mydates-dat01

FROM p0041-dat01

NEXT p0041-dat02.</b>

Regards,

HRA

Read only

Former Member
0 Likes
806

hi,

I think you are working on Unicode Check Active system. So, you are getting incompatibility error. While working on Non-unicode system, we wont get any error of incompatibility.

So, while doing assignment from one field to other field, comparisions of fields, both the fields should be type compatible.

Regards,

Sailaja.

Read only

0 Likes
806

Wht doesd the unicode active system and non-unicode system mean.

cant I corredt this error anyhow?

Read only

0 Likes
806

Try using the below

DO 12 TIMES VARYING mydates-dar

FROM p0041-dar01 NEXT p0041-dar02

varying my-dates-dat

FROM p0041-dat01 NEXT p0041-dat02.

IF mydates-dar NE space and my-dates-dat ne space.

WRITE: /,MYDATES-DAR, MYDATES-DAT.

ENDIF.

ENDDO.

Read only

Former Member
0 Likes
806

hi,

In Unicode programs , dobj, dobj1 and dobj2 have to be compatible . Moreover, in unicode programs, dobj1 and dobj2 have to be either structure components that belong to the same structure, or, part areas of the same data object specified through offset/length.

Here is the example from help.


DATA: BEGIN OF text, 
        word1(4) TYPE c VALUE 'AAAA', 
        word2(4) TYPE c VALUE 'BBBB', 
        word3(4) TYPE c VALUE 'CCCC', 
        word4(4) TYPE c VALUE 'DDDD', 
      END OF text. 

DATA: word(4)  TYPE c, 
      char1(1) TYPE c, 
      char2(1) TYPE c, 
      leng TYPE i. 

DESCRIBE FIELD text LENGTH leng IN CHARACTER MODE. 
leng = leng / 2. 

<b>DO leng TIMES VARYING char1 FROM text(1) 
                            NEXT text+2(1) RANGE text 
              VARYING char2 FROM text+1(1) 
                            NEXT text+3(1) RANGE text. </b>
  WRITE: char1, char2. 
  char1 = 'x'. 
  char2 = 'y'. 
ENDDO. 

DO 4 TIMES VARYING word FROM text-word1 NEXT text-word2. 
  WRITE / word. 
ENDDO. 

Regards,

Sailaja.