11-15-2019 12:30 PM
Hi Guys
Please can you assist me I am getting a error when I run my report.
*&---------------------------------------------------------------------*
*& Report Z_COST_MATERIAL5
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT Z_COST_MATERIAL5 line-size 132.
* TABLE DECLARATION
TYPES: BEGIN OF Z_KEPH,
MATNR TYPE MBEW-MATNR,
PLANT TYPE MBEW-BWKEY,
KALN1 TYPE MBEW-KALNR,
LEVEL TYPE KEPH-KKZST,
YARN TYPE KEPH-KST001,
SIZE TYPE KEPH-KST004,
DHU TYPE KEPH-KST006,
OH TYPE KEPH-KST010,
KALN2 TYPE KEPH-KALNR.
TYPES:END OF Z_KEPH.
DATA: it_KEPH TYPE STANDARD TABLE OF Z_KEPH INITIAL SIZE 0,
wa_KEPH TYPE Z_KEPH, "work area (header line)
wa_KEPH1 LIKE LINE OF IT_KEPH.
********************************************************
* SELECTION SCREEN
SELECT-OPTIONS MATERIAL FOR WA_KEPH-MATNR.
*START OF SELECTION "TO INPUT DATA INTO INTERNAL TABLE IT_KEPH
START-OF-SELECTION.
* QUERY TO INPUT DATA
SELECT A~MATNR
A~BWKEY
A~KALNR
B~KKZST
B~KST001
B~KALNR
FROM MBEW AS A
JOIN KEPH AS B
ON A~KALNR EQ B~KALNR
INTO TABLE IT_KEPH
WHERE MATNR IN MATERIAL.
*PROCESSING DATA IN IT_ZEPH
LOOP AT IT_KEPH INTO WA_KEPH.
WRITE:/ WA_KEPH-KALN1.
ENDLOOP.
11-15-2019 1:05 PM
Hi Zubair
Please use into corresponding fields of table instead of into table in select query.
because you have not included all fields in internal table also fields name are not same.
INTO CORRESPONDING FIELDS OF TABLE IT_KEPH
11-15-2019 1:43 PM
Hi
I have inputed "INTO CORRESPONDING FIELDS OF TABLE IT_KEPH" when I run the report using my criteria for selection screen it looks like its loading but nothing happens.
11-15-2019 1:18 PM
Please post only the minimum code (it currently occupies 3 pages): avoid the blank lines in your code (remove them), and do not include useless lines like the top comments and the commented abap code. It is also not a bad idea to put all columns of the SELECT on one line, and you can use the strict SQL syntax if you use ABAP >= 7.40 so that you don't need to declare the structure of the internal table (and it avoids the bug you currently experiment). Moreover, for simple programs, it's usually not needed to post the code after the line of the syntax error (syntax check is always based on previous lines).
Thank you!
11-15-2019 1:48 PM
SELECT A~MATNR
A~BWKEY
A~KALNR
B~KKZST
B~KST001
B~KALNR <-- are you sure ??
FROM MBEW AS A
JOIN KEPH AS B
ON A~KALNR EQ B~KALNR
INTO TABLE IT_KEPH
WHERE MATNR IN MATERIAL.
11-15-2019 8:34 PM
The short dump text points to the specific line in the program where termination occurs. It also suggests possible causes. Just open it in ST22 transaction and read thoroughly all the information available.
It's a bit confusing that the program name in the screenshot is !0... and not Z... as in your listing. But again, everything should be more clear if you just open the short dump and read it.
11-18-2019 3:13 AM
@zubair sultan Problem is with field b~klanr, it is of NUMC, length 12, but the field which you have declared in TYPES, size is of keph-kst004 is of different data type CURR 13,2
Because of different data type the error occurs.
If you are using INTO CORRESPONDING FIELDS, the field names in types and select has to be same, but in your case it is different, try like below
SELECT a~matnr AS matnr
a~bwkey AS plan
a~kalnr AS kaln1
b~kkzst AS level
b~kst001 AS yarn
b~kalnr AS kaln2
FROM mbew AS a
JOIN keph AS b
ON a~kalnr EQ b~kalnr
INTO CORRESPONDING FIELDS OF TABLE it_keph
WHERE matnr IN material.