Skip to Content
0
Former Member
Sep 09, 2009 at 11:24 AM

unicode problem dd03l-intlen

69 Views

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.