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: 

Line structure of table s_werks is incorrect




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.
1 ACCEPTED SOLUTION

0 Kudos

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".

8 REPLIES 8

0 Kudos
still showing the same  Line structure of table s_werks[] is incorrect

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)

0 Kudos

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 Kudos

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 Kudos

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 Kudos
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.

0 Kudos

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".

0 Kudos

The line structure s_ebeln is incorrect