Hallo Ihr SAP Tüftler
Ich hab ein grosses Problem mit einem Query wo viele Zusatzfelder hat. Dieses Query bricht seit kurzem mit ABAP-Laufzeitfehler ab. Ich hab das Coding angeschaut, komme aber auf keinen grünen Zweig. Hier mein Coding:
Coding:
Tables: A004,KONP,STXL,T604T.
Data: wa_tline TYPE standard table of TLINE with header line.
Data: wa_a004 TYPE standard table of a004 with header line.
Data: wa_a006 TYPE standard table of a006 with header line.
Data: WA_t604t TYPE standard table of t604t WITH HEADER LINE.
Data:z_tdnamed LIKE STXL-TDNAME.
Data:z_tdnamef LIKE STXL-TDNAME.
Data:z_tdnamei LIKE STXL-TDNAME.
Data:z_tdnamee LIKE STXL-TDNAME.
Data:z_text(120) type C.
Data:record_matnr(18) Type C.
*Data:value LIKE STXL-TDNAME.
*value = '000000'.
Data:z_value(6) Type C.
Zusatzfelder:
CLEAR maktx_e.
SELECT SINGLE maktx FROM makt INTO maktx_e
WHERE matnr = mara-matnr
AND spras = 'E'.
CLEAR maktx_f.
SELECT SINGLE maktx FROM makt INTO maktx_f
WHERE matnr = mara-matnr
AND spras = 'F'.
CLEAR maktx_i.
SELECT SINGLE maktx FROM makt INTO maktx_i
WHERE matnr = mara-matnr
AND spras = 'I'.
CLEAR maktx_d.
SELECT SINGLE maktx FROM makt INTO maktx_d
WHERE matnr = mara-matnr
AND spras = 'D'.
CLEAR knumh_chf.
SELECT SINGLE knumh FROM a004 INTO knumh_chf
WHERE matnr = mara-matnr
AND kschl = 'PR00'
AND datab <= sy-datum
AND datbi >= sy-datum.
CLEAR knumh_usd.
SELECT SINGLE knumh FROM a006 INTO knumh_usd
WHERE matnr = mara-matnr
AND waerk = 'USD'
AND kschl = 'PR00'
AND datab <= sy-datum
AND datbi >= sy-datum.
CLEAR knumh_eur.
SELECT SINGLE knumh FROM a006 INTO knumh_eur
WHERE matnr = mara-matnr
AND waerk = 'EUR'
AND kschl = 'PR00'
AND datab <= sy-datum
AND datbi >= sy-datum.
CLEAR datab_chf.
SELECT SINGLE datab FROM a004 INTO datab_chf
WHERE knumh = knumh_chf.
CLEAR kbetr_chf.
SELECT SINGLE kbetr FROM konp INTO kbetr_chf
WHERE knumh = knumh_chf
AND konwa = 'CHF'.
CLEAR datab_eur.
SELECT SINGLE datab FROM a006 INTO datab_eur
WHERE knumh = knumh_eur.
CLEAR kbetr_eur.
SELECT SINGLE kbetr FROM konp INTO kbetr_eur
WHERE knumh = knumh_eur.
CLEAR datab_usd.
SELECT SINGLE datab FROM a006 INTO datab_usd
WHERE knumh = knumh_usd.
CLEAR kbetr_usd.
SELECT SINGLE kbetr FROM konp INTO kbetr_usd
WHERE knumh = knumh_usd.
CLEAR knumhlpchf.
select * from a004 into table wa_a004
where matnr = mara-matnr AND
kschl = 'PR00'.
sort wa_a004 by knumh.
loop at wa_a004.
knumhlpchf = wa_a004-knumh.
endloop.
CLEAR knumhlpeur.
select * from a006 into table wa_a006
where matnr = mara-matnr AND
kschl = 'PR00'.
sort wa_a006 by knumh.
loop at wa_a006.
knumhlpeur = wa_a006-knumh.
endloop.
CLEAR knumhlpusd.
select * from a006 into table wa_a006
where matnr = mara-matnr AND
kschl = 'PR00'.
sort wa_a006 by knumh.
loop at wa_a006.
knumhlpusd = wa_a006-knumh.
endloop.
CLEAR kbetrlpchf.
SELECT SINGLE kbetr FROM konp INTO kbetrlpchf
WHERE knumh = knumhlpchf
AND konwa = 'CHF'.
CLEAR kbetrlpeur.
SELECT SINGLE kbetr FROM konp INTO kbetrlpeur
WHERE knumh = knumhlpeur
AND konwa = 'EUR'.
CLEAR kbetrlpusd.
SELECT SINGLE kbetr FROM konp INTO kbetrlpusd
WHERE knumh = knumhlpusd
AND konwa = 'USD'.
clear vertrt_d.
*z_value = '100010'.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = mara-matnr
IMPORTING
OUTPUT = record_matnr.
concatenate record_matnr mvke-vkorg mvke-vtweg into z_tdnamed.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = '0001'
LANGUAGE = 'D'
NAME = z_tdnamed
OBJECT = 'MVKE'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
LINES = WA_TLINE
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
IF SY-SUBRC = 0.
loop at wa_tline.
concatenate vertrt_d wa_tline-tdline into vertrt_d.
endloop.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*vertrt_d = mara-matnr.
clear wa_tline.
refresh wa_tline.
clear vertrt_f.
*z_value = '100010'.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = mara-matnr
IMPORTING
OUTPUT = record_matnr.
concatenate record_matnr mvke-vkorg mvke-vtweg into z_tdnamef.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = '0001'
LANGUAGE = 'F'
NAME = z_tdnamef
OBJECT = 'MVKE'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
LINES = WA_TLINE
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
IF SY-SUBRC = 0.
loop at wa_tline.
concatenate vertrt_f wa_tline-tdline into vertrt_f.
endloop.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*vertrt_d = mara-matnr.
clear wa_tline.
refresh wa_tline.
clear vertrt_i.
*z_value = '100010'.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = mara-matnr
IMPORTING
OUTPUT = record_matnr.
concatenate record_matnr mvke-vkorg mvke-vtweg into z_tdnamei.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = '0001'
LANGUAGE = 'I'
NAME = z_tdnamei
OBJECT = 'MVKE'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
LINES = WA_TLINE
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
IF SY-SUBRC = 0.
loop at wa_tline.
concatenate vertrt_i wa_tline-tdline into vertrt_i.
endloop.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*vertrt_d = mara-matnr.
clear wa_tline.
refresh wa_tline.
clear vertrt_e.
*z_value = '100010'.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = mara-matnr
IMPORTING
OUTPUT = record_matnr.
concatenate record_matnr mvke-vkorg mvke-vtweg into z_tdnamee.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = '0001'
LANGUAGE = 'E'
NAME = z_tdnamee
OBJECT = 'MVKE'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
LINES = WA_TLINE
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
IF SY-SUBRC = 0.
loop at wa_tline.
concatenate vertrt_e wa_tline-tdline into vertrt_e.
endloop.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*vertrt_d = mara-matnr.
clear wa_tline.
refresh wa_tline.
clear smatn.
IF mara-mstav = '91'.
SELECT SINGLE smatn INTO smatn FROM kondd
WHERE kondd~knumh in (
SELECT knumh FROM kotd001
WHERE kotd001~matwa = mara-matnr ).
SHIFT smatn LEFT DELETING LEADING '0'.
ENDIF.
CLEAR stawn.
*clear text.
SELECT SINGLE stawn FROM marc INTO stawn
WHERE matnr = mara-matnr.
select * from t604t into table wa_t604t
where spras = 'DE' AND
land1 = 'CH' AND
stawn = stawn.
If marc-stawn >' '.
LOOP at WA_t604t.
concatenate wa_t604t-text1 wa_t604t-text2 wa_t604t-text3 into z_text.
endloop.
else.
clear z_text.
endif.
clear text.
text = z_text.