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: 

unicode problem dd03l-intlen

Former Member
0 Kudos
313

i've got the follwing code:

&----


*& Report Z_ARTIKEL_OUTPUT *

*& *

&----


*& *

*& *

&----


REPORT z_artikel_output LINE-SIZE 190.

TABLES: bdcpv,

mara,

mvke.

TYPES: BEGIN OF ty_matnr,

matnr TYPE matnr,

END OF ty_matnr.

TYPES: BEGIN OF ty_output,

vkorg TYPE vkorg,

matnr TYPE matnr,

maktx TYPE makt-maktx,

meins TYPE meins,

spart TYPE spart,

kondm TYPE mvke-kondm,

pr00 TYPE kbetr,

datar TYPE datab,

pn00 TYPE kbetr,

datan TYPE datab,

colli TYPE char10,

mstav TYPE mstav,

mstdv TYPE mstdv,

END OF ty_output.

DATA: ta_bdcpv TYPE STANDARD TABLE OF bdcpv,

sa_bdcpv LIKE LINE OF ta_bdcpv.

DATA: ta_output TYPE STANDARD TABLE OF ty_output,

sa_output LIKE LINE OF ta_output.

DATA: ta_matnr TYPE STANDARD TABLE OF ty_matnr,

sa_matnr LIKE LINE OF ta_matnr.

DATA: sa_konh TYPE konh.

DATA: va_tab TYPE dd03l-tabname,

va_offset TYPE numc4.

DATA: ta_dd03l TYPE STANDARD TABLE OF dd03l,

sa_dd03l LIKE LINE OF ta_Dd03l.

DATA: ta_where TYPE STANDARD TABLE OF line,

sa_where LIKE LINE OF ta_where.

FIELD-SYMBOLS: <fs> LIKE sa_dd03l.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.

SELECT-OPTIONS : s_vkorg FOR mvke-vkorg.

SELECT-OPTIONS : s_matnr FOR mara-matnr.

SELECT-OPTIONS : s_date FOR bdcpv-cretime.

SELECTION-SCREEN: END OF BLOCK b1.

INITIALIZATION.

CONCATENATE sy-datum '000000' INTO s_date-low.

CONCATENATE sy-datum '235959' INTO s_date-high.

APPEND s_date.

START-OF-SELECTION.

PERFORM get_change_pointers.

PERFORM get_changed_matnrs.

PERFORM get_info.

END-OF-SELECTION.

PERFORM output.

TOP-OF-PAGE.

PERFORM top_of_page.

&----


*& Form GET_CHANGED_MATNRS

&----


  • text

----


FORM get_changed_matnrs .

DATA: lv_field TYPE dd03l-fieldname.

DATA: lv_error TYPE xfeld.

LOOP AT ta_bdcpv INTO sa_bdcpv.

IF sa_bdcpv-tabname = 'KONDAT' OR

sa_bdcpv-tabname = 'KONPAE'.

SELECT SINGLE * FROM konh

INTO CORRESPONDING FIELDS OF sa_konh

WHERE knumh = sa_bdcpv-cdobjid.

IF sy-subrc EQ 0.

CONCATENATE sa_konh-kvewe sa_konh-kotabnr INTO va_tab.

  • Check article number is present in table

SELECT fieldname INTO lv_field

FROM dd03l

WHERE tabname = va_tab

AND fieldname = 'MATNR'.

EXIT.

ENDSELECT.

IF sy-subrc NE 0.

CONTINUE.

ENDIF.

  • Create dynamic selection on table

SELECT * INTO CORRESPONDING FIELDS OF TABLE ta_dd03l

FROM dd03l

WHERE tabname = va_tab

AND keyflag = 'X'

AND NOT ( fieldname EQ 'MANDT' OR

fieldname EQ 'KAPPL' OR

fieldname EQ 'KSCHL' OR

fieldname EQ 'DATBI' )

ORDER BY position.

CLEAR: ta_where[].

CLEAR: lv_error.

CONCATENATE 'KAPPL EQ_' '''' sa_konh-kappl '''' '_AND' INTO sa_where.

TRANSLATE sa_where USING '_ '.

INSERT sa_where INTO TABLE ta_where.

CONCATENATE 'KSCHL EQ_' '''' sa_konh-kschl '''' '_AND' INTO sa_where.

TRANSLATE sa_where USING '_ '.

INSERT sa_where INTO TABLE ta_where.

CLEAR va_offset

.

LOOP AT ta_dd03l ASSIGNING <fs>.

  • Selection check material / sales org

IF ( <fs>-fieldname EQ 'VKORG' AND

( NOT sa_konh-vakey+va_offset(<fS>-intlen) IN s_vkorg ) ) OR

( <fs>-fieldname EQ 'MATNR' AND

( NOT sa_konh-vakey+va_offset(<fs>-intlen) IN s_matnr ) ).

lv_error = 'X'.

EXIT.

ENDIF.

AT LAST.

CONCATENATE <fs>-fieldname '_EQ_' '''' sa_konh-vakey+va_offset(<fs>-intlen)

'''' '.' INTO sa_where.

TRANSLATE sa_where USING '_ '.

INSERT sa_where INTO TABLE ta_where.

EXIT.

ENDAT.

CONCATENATE <fs>-fieldname '_EQ_' '''' sa_konh-vakey+va_offset(<fs>-intlen)

'''' '_AND' INTO sa_where.

TRANSLATE sa_where USING '_ '.

INSERT sa_where INTO TABLE ta_where.

ADD <fs>-intlen TO va_offset.

ENDLOOP.

  • Material or sales organization not in selected range - continue to next change pointer

IF lv_error = 'X'.

CONTINUE.

ENDIF.

  • Get changed article

SELECT SINGLE matnr INTO sa_matnr-matnr

FROM (va_tab)

WHERE (ta_where).

IF sy-subrc EQ 0.

INSERT sa_matnr INTO TABLE ta_matnr.

ENDIF.

ENDIF.

ELSE.

sa_matnr-matnr = sa_bdcpv-cdobjid.

IF sa_matnr-matnr IN s_matnr.

INSERT sa_matnr INTO TABLE ta_matnr.

ENDIF.

ENDIF.

ENDLOOP.

SORT ta_matnr.

DELETE ADJACENT DUPLICATES FROM ta_matnr COMPARING matnr.

ENDFORM. " GET_CHANGED_MATNRS

ENDFORM. " select_units

it dumps at the select statement of MATNR into sa_matnr-matnr

possible there is a unicode problem but i don't know for sure.

the program had worked always but after uploading a note not anymore.

could anybody help me.

7 REPLIES 7

Sm1tje
Active Contributor
0 Kudos
172

Post the info on the short dump, might give us some additional info that could be useful in solving the error.

0 Kudos
172

Hi,

Please paste the code in a way that it is more readable.

KR Jaideep,

Former Member
0 Kudos
172

the problem was after a migration to Unicode and/or Upgrade

eine dynamisch angegebene bedinung hat ein unwartetes Format. thats the error

<p>TABLES: bdcpv

<br> mara,

<br> mvke.

<br>

<br> TYPES: BEGIN OF ty_matnr,

<br> matnr TYPE matnr,

<br> END OF ty_matnr.

<br>

<br> TYPES: BEGIN OF ty_output,

<br> vkorg TYPE vkorg,

<br> matnr TYPE matnr,

<br> maktx TYPE makt-maktx,

<br> meins TYPE meins,

<br> spart TYPE spart,

<br> kondm TYPE mvke-kondm,

<br> pr00 TYPE kbetr,

<br> datar TYPE datab,

<br> pn00 TYPE kbetr,

<br> datan TYPE datab,

<br> colli TYPE char10,

<br> mstav TYPE mstav,

<br> mstdv TYPE mstdv,

<br> END OF ty_output.

<br>

<br> DATA: ta_bdcpv TYPE STANDARD TABLE OF bdcpv,

<br> sa_bdcpv LIKE LINE OF ta_bdcpv.

<br>

<br> DATA: ta_output TYPE STANDARD TABLE OF ty_output,

<br> sa_output LIKE LINE OF ta_output.

<br>

<br> DATA: ta_matnr TYPE STANDARD TABLE OF ty_matnr,

<br> sa_matnr LIKE LINE OF ta_matnr.

<br>

<br> DATA: sa_konh TYPE konh.

<br>

<br> DATA: va_tab TYPE dd03l-tabname,

<br> va_offset TYPE numc4.

<br>

<br> DATA: ta_dd03l TYPE STANDARD TABLE OF dd03l,

<br> sa_dd03l LIKE LINE OF ta_Dd03l.

<br>

<br> DATA: ta_where TYPE STANDARD TABLE OF line,

<br> sa_where LIKE LINE OF ta_where.

<br>

<br> FIELD-SYMBOLS: <fs> LIKE sa_dd03l.

<br>

<br> SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.

<br> SELECT-OPTIONS : s_vkorg FOR mvke-vkorg.

<br> SELECT-OPTIONS : s_matnr FOR mara-matnr.

<br> SELECT-OPTIONS : s_date FOR bdcpv-cretime.

<br> SELECTION-SCREEN: END OF BLOCK b1.

<br>

<br> INITIALIZATION.

<br>

<br> CONCATENATE sy-datum '000000' INTO s_date-low.

<br> CONCATENATE sy-datum '235959' INTO s_date-high.

<br> APPEND s_date.

<br>

<br> START-OF-SELECTION.

<br> PERFORM get_change_pointers.

<br> PERFORM get_changed_matnrs.

<br> PERFORM get_info.

<br>

<br> END-OF-SELECTION.

<br> PERFORM output.

<br>

<br> TOP-OF-PAGE.

<br> PERFORM top_of_page.

<br>

<br> &----


<br> *& Form GET_CHANGED_MATNRS

<br> &----


<br> * text

<br> ----


<br> FORM get_changed_matnrs .

<br>

<br> DATA: lv_field TYPE dd03l-fieldname.

<br> DATA: lv_error TYPE xfeld.

<br>

<br>

<br> LOOP AT ta_bdcpv INTO sa_bdcpv.

<br> IF sa_bdcpv-tabname = 'KONDAT' OR

<br> sa_bdcpv-tabname = 'KONPAE'.

<br> SELECT SINGLE * FROM konh

<br> INTO CORRESPONDING FIELDS OF sa_konh

<br> WHERE knumh = sa_bdcpv-cdobjid.

<br> IF sy-subrc EQ 0.

<br> CONCATENATE sa_konh-kvewe sa_konh-kotabnr INTO va_tab.

<br>

<br> * Check article number is present in table

<br> SELECT fieldname INTO lv_field

<br> FROM dd03l

<br> WHERE tabname = va_tab

<br> AND fieldname = 'MATNR'.

<br> EXIT.

<br> ENDSELECT.

<br> IF sy-subrc NE 0.

<br> CONTINUE.

<br> ENDIF.

<br>

<br> * Create dynamic selection on table

<br> SELECT * INTO CORRESPONDING FIELDS OF TABLE ta_dd03l

<br> FROM dd03l

<br> WHERE tabname = va_tab

<br> AND keyflag = 'X'

<br> AND NOT ( fieldname EQ 'MANDT' OR

<br> fieldname EQ 'KAPPL' OR

<br> fieldname EQ 'KSCHL' OR

<br> fieldname EQ 'DATBI' )

<br> ORDER BY position.

<br>

<br> CLEAR: ta_where[].

<br> CLEAR: lv_error.

<br>

<br> CONCATENATE 'KAPPL EQ_' '''' sa_konh-kappl '''' '_AND' INTO sa_where.

<br> TRANSLATE sa_where USING '_ '.

<br> INSERT sa_where INTO TABLE ta_where.

<br>

<br> CONCATENATE 'KSCHL EQ_' '''' sa_konh-kschl '''' '_AND' INTO sa_where.

<br> TRANSLATE sa_where USING '_ '.

<br> INSERT sa_where INTO TABLE ta_where.

<br> CLEAR va_offset

<br> .

<br>

<br> LOOP AT ta_dd03l ASSIGNING <fs>.

<br> * Selection check material / sales org

<br> IF ( <fs>-fieldname EQ 'VKORG' AND

<br> ( NOT sa_konh-vakey+va_offset(<fS>-intlen) IN s_vkorg ) ) OR

<br> ( <fs>-fieldname EQ 'MATNR' AND

<br> ( NOT sa_konh-vakey+va_offset(<fs>-intlen) IN s_matnr ) ).

<br> lv_error = 'X'.

<br> EXIT.

<br> ENDIF.

<br>

<br> AT LAST.

<br> CONCATENATE <fs>-fieldname '_EQ_' '''' sa_konh-vakey+va_offset(<fs>-intlen)

<br> '''' '.' INTO sa_where.

<br> TRANSLATE sa_where USING '_ '.

<br> INSERT sa_where INTO TABLE ta_where.

<br> EXIT.

<br> ENDAT.

<br>

<br> CONCATENATE <fs>-fieldname '_EQ_' '''' sa_konh-vakey+va_offset(<fs>-intlen)

<br> '''' '_AND' INTO sa_where.

<br> TRANSLATE sa_where USING '_ '.

<br> INSERT sa_where INTO TABLE ta_where.

<br> ADD <fs>-intlen TO va_offset.

<br> ENDLOOP.

<br>

<br> * Material or sales organization not in selected range - continue to next change pointer

<br> IF lv_error = 'X'.

<br> CONTINUE.

<br> ENDIF.

<br>

<br> * Get changed article

<br> SELECT SINGLE matnr INTO sa_matnr-matnr

<br> FROM (va_tab)

<br> WHERE (ta_where).

<br> IF sy-subrc EQ 0.

<br> INSERT sa_matnr INTO TABLE ta_matnr.

<br> ENDIF.

<br>

<br> ENDIF.

<br>

<br> ELSE.

<br> sa_matnr-matnr = sa_bdcpv-cdobjid.

<br> IF sa_matnr-matnr IN s_matnr.

<br> INSERT sa_matnr INTO TABLE ta_matnr.

<br> ENDIF.

<br> ENDIF.

<br> ENDLOOP.

<br>

<br> SORT ta_matnr.

<br> DELETE ADJACENT DUPLICATES FROM ta_matnr COMPARING matnr.

<br>

<br> ENDFORM. " GET_CHANGED_MATNRS

Edited by: H. Gommans on Sep 9, 2009 1:37 PM

Sm1tje
Active Contributor
0 Kudos
172

So what is the exact content of the dynamic where condition TA_WHERE? It's a bit hard to determine this from your code.

Former Member
0 Kudos
172

hey Micky, fijn dat je me probeert te helpen.

KAPPL EQ 'V' AND

KSCHL EQ 'PR00' AND

VKORG EQ '1000' AND

VTWEG EQ '10' AND

KUNNR EQ '0000214451' AND

MATNR EQ '000000000000100400'.

Sm1tje
Active Contributor
0 Kudos
172

Graag gedaan, maar vooralsnog zie ik niks vreemds hierin. Heb je al eens geprobeerd om deze 'WHERE' clause in een test programma te gebruiken. Maar dan dus niet dynamisch maar gewoon 'as usual'.

I'll have a closer look at the Where clause and I'll let you know if I find anything.

P.S. Could you catch this dynamic sql selection in a CX-exception class and retrieve the text. Might give you some additional information on the exact error.

Which table is used to select the MATNR from. In other words, which table is 'stored' in VA_TAB?

Edited by: Micky Oestreich on Sep 9, 2009 2:27 PM

Sm1tje
Active Contributor
0 Kudos
172

Henk,

the dynamic where clause

KAPPL EQ 'V' AND

KSCHL EQ 'PR00' AND

VKORG EQ '1000' AND

VTWEG EQ '10' AND

KUNNR EQ '0000214451' AND

MATNR EQ '000000000000100400'.

ends with a '.'.

Delete this from the ta_where and try again and let's see what happens.