Skip to Content
-2

Line structure of table s_werks is incorrect

Dec 10, 2017 at 08:56 AM

447

avatar image


FORM extraction  USING ut_werks1 TYPE tt_werks1

                       ut_werks2 type tt_werks2

                       ut_werks3 type tt_werks3

                       ut_werks4 type tt_werks4

                       ut_werks5 type tt_werks5

                       ut_werks6 type tt_werks6

                        ut_konh type tt_konh

                       ut_konp type tt_konp.





IF pa_A800 IS NOT INITIAL. "A800 table

    SELECT

        A800~mandt,

        A800~kappl,

        A800~kschl,

        A800~werks,

        A800~matnr,

        A800~DATBI,

         A800~DATAB,

        A800~KNUMH

      FROM A800

      left OUTER JOIN KONH

      ON KONH~Knumh = A800~Knumh



      INTO TABLE @DATA(lt_plants)

      FOR ALL ENTRIES IN @ut_werks1

      Where A800~werks in @s_werks.





      GET REFERENCE OF lt_plants INTO lr_data.

       PERFORM download USING lr_data



               ENDIF.

I am taking condition type based on plant from A800 and putting in KONH.
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Jörgen Lindqvist Dec 12, 2017 at 08:18 AM
0

So the next thing you should check is if there really is a WERKS field in your A800 table. There is not in my system.

Secondly, if there is, check wich datatype that is.

The thing is that the data type WERKS is a structure. WERKS_D is the data element for the plant. It is commented out in your example code here, but you have declared lv_werks as WERKS, which will give precisely the error message that "The line structure of ... is incorrect".

Share
10 |10000 characters needed characters left characters exceeded
Jörgen Lindqvist Dec 11, 2017 at 06:36 AM
1

Can you show us the declaration of s_werks? What is the datatype?

Also, you are using FOR ALL ENTRIES IN @ut_werks1, but that one is incomplete without comparing with at least one of the columns in ut_werks1. (also make sure there are entries in that internal table before selecting)

Show 3 Share
10 |10000 characters needed characters left characters exceeded

DATA: a800_werks TYPE a800-werks,
* lv_werks type werks,
lr_data TYPE REF TO data.

*&---------------------------------------------------------------------*
*& Selection Screen fields
*&---------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

*SELECT-OPTIONS :s_werks for lv_werks.
SELECT-OPTIONS s_werks FOR a800_werks.
PARAMETERS : pa_path TYPE string OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.

IF pa_A800 IS NOT INITIAL.
SELECT
KONH~mandt,
KONH~KNUMH,

INTO TABLE @DATA(lt_plants)
FROM A800
left JOIN KONH
ON KONH~Knumh = A800~Knumh
FOR ALL ENTRIES IN @ut_werks1
WHERE a800~werks in @s_werks.

0

Is there a WERKS field in A800?

Please add the where-clause on at least one column in your FOR ALL ENTRIES IN table. That should be a syntax error and maybe you are getting the wrong error message...?

0

Hi Jörgen, I did the changes like below and now it is showing the same line structure of the table s_werks

IF pa_A800 IS NOT INITIAL.
SELECT
KONH~mandt,
KONH~KNUMH

INTO TABLE @DATA(lt_plants)
FROM A800
left JOIN KONH
ON KONH~Knumh = A800~Knumh

FOR ALL ENTRIES IN @ut_werks1
WHERE A800~werks EQ @ut_werks1-werks+0(4)
and a800~werks in @s_werks.

0
Rohan D'Souza Dec 12, 2017 at 06:10 AM
0
I did it as below,
DATA:

*      a800_werks TYPE a800-werks,

      lv_werks type werks,

      lr_data  TYPE REF TO data.

TABLES : A800.

SELECT-OPTIONS :s_werks for a800-werks.


select MANDT, KNUMH
INTO TABLE @DATA(lt_plants)

      FROM A800

   left JOIN KONH

      ON KONH~Knumh = A800~Knumh

FOR ALL ENTRIES IN @ut_werks1

WHERE A800~werks EQ @ut_werks1-werks+0(4)

  and A800~werks in @s_werks.
Share
10 |10000 characters needed characters left characters exceeded