Application Development and Automation 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: 
Read only

ALV select statement not working

0 Likes
2,143

Hi,

I have written this code and i am written the selection criteria and read statement.

*&---------------------------------------------------------------------*

*&      Form  Read_data

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

form Read_data .

IF t_t685 IS NOT INITIAL .

SELECT a~kvewe

a~kschl

a~kozgf

b~kvewe

b~kschl

INTO CORRESPONDING FIELDS OF TABLE t_final

FROM t685 as a

inner join t685t as b on a~kschl = b~kschl

WHERE a~kschl in s_kschl

AND a~kschl = b~kschl

AND b~kvewe in s_kschl

AND b~kschl in s_kschl.

*-------------------------------------------------

SELECT DATAB

       DATBI

       KBETR

       KONWA

       FROM konx INTO TABLE t_konx   .

IF t_konx IS NOT INITIAL .

  SORT t_konx by KSCHL.

  delete ADJACENT DUPLICATES FROM t_konx COMPARING Kschl  .

    SELECT DATAB

       DATBI

       KBETR

       KONWA from  konx1 into TABLE t_konx1 package size 2000

                                      for all entries in t_konx

                             where Kschl = t_konx-Kschl.

    ENDSELECT.

    endif.

endif.

endform.                    " Read_data

*&---------------------------------------------------------------------*

*&      Form  populate_data

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

form populate_data .

*firsttest

LOOP AT : t_t685 into wa_t685.

       wa_final-kschl = wa_t685-kschl.

       wa_final-kozgf = wa_t685-kozgf.

       APPEND wa_final to t_final.

       CLEAR wa_final.

*       CLEAR wok aa_t685.

     CLEAR  wa_t685t.

   READ TABLE t_t685t INTO wa_t685t with KEY Kschl = wa_t685-Kschl.

   if sy-subrc = 0.

     wa_final = wa_t685t-vtext.

     APPEND wa_final to t_final.

     ENDIF.

*     endloop.

*---------------------------------------------------------

     LOOP AT : t_konx into wa_konx.

       wa_final-kschl = wa_KONX-kschl.

       wa_final-kschl = wa_KONX-DATAB.

       wa_final-kschl = wa_KONX-DATBI.

       wa_final-kschl = wa_KONX-KBETR.

       wa_final-kozgf = wa_konx-KONWA.

       APPEND wa_final to t_final.

       CLEAR wa_final.

*       CLEAR wok aa_t685.

     CLEAR  wa_konx1.

   READ TABLE t_konx1 INTO wa_konx1 with KEY Kschl = wa_konx-Kschl.

       APPEND wa_final to t_final.

   endloop.

     endloop.

endform.                    " populate_data

It is not working.Please suggest what i did wrong.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,088

Hi Kumar,

    

     Kindly remove your endselect from your query in table konx1.

Best Regards,
Charlie

19 REPLIES 19
Read only

shadab_maldar
Active Participant
0 Likes
2,088

Hi Kumar,

Try fetching all the key fields from tables.

Read only

0 Likes
2,088

Hi,

Is this correct what i have written

SELECT SINGLE t685~kvewe t685~kschl t685~meins

    FROM t685 inner join t685t on t685t~kvewe = t685t~kvewe

    into corresponding fields of t_final

         WHERE  t685~kvewe  = t_t685t-kvewe

         AND    t685~kschl  = t_t685t-kschl

         AND    t685~kozgf  = t_t685t-kozgf.

Please check and confirm me

Thanks

Read only

0 Likes
2,088

Neither of these is going to work. What do you want to do?

In the first instance you have:

SELECT a~kvewe
a~kschl
a~kozgf
b~kvewe
b~kschl
INTO CORRESPONDING FIELDS OF TABLE t_final
FROM t685 as a
inner join t685t as b on a~kschl = b~kschl
WHERE a~kschl in s_kschl
AND a~kschl = b~kschl
AND b~kvewe in s_kschl
AND b~kschl in s_kschl.

Therefore s_kschl means you have a select-option somewhere? or not? Also, how can you have:

AND b~kvewe in s_kschl (What has kvewe got to do with kschl)

In your second example you have:

SELECT SINGLE t685~kvewe t685~kschl t685~meins
    FROM t685 inner join t685t on t685t~kvewe = t685t~kvewe
    into corresponding fields of t_final
         WHERE  t685~kvewe  = t_t685t-kvewe
         AND    t685~kschl  = t_t685t-kschl
         AND    t685~kozgf  = t_t685t-kozgf.

In this case you are not using your select-option at all????

Please can you explain what you require then we can probably give you the code.

Read only

0 Likes
2,088

Hi,


Please check with this


SELECT t685~kvewe t685~kappl t685~kschl t685~meins

     FROM t685 INNER JOIN t685t ON t685t~kvewe = t685~kvewe

     INTO CORRESPONDING FIELDS OF TABLE t_final

          FOR ALL ENTRIES IN t_t685t

          WHERE  t685~kvewe  = t_t685t-kvewe

          AND    t685~kschl  = t_t685t-kschl

          AND    t685~kozgf  = t_t685t-kozgf.

Read only

0 Likes
2,088

  SELECT a~kvewe
  a~kschl
  a~kozgf
  b~kvewe
  b~kschl
  INTO CORRESPONDING FIELDS OF TABLE t_final
  FROM t685 AS a
  INNER JOIN t685t AS b
    ON a~kvewe = b~kvewe
    AND a~kappl = b~kappl
    AND a~kschl = b~kschl
    WHERE a~kschl IN s_kschl.

Read only

Former Member
0 Likes
2,088

hi kumar sethi,

why you are assigning to same field here

  LOOP AT : t_konx into wa_konx.

       wa_final-kschl = wa_KONX-kschl.

       wa_final-kschl = wa_KONX-DATAB.

       wa_final-kschl = wa_KONX-DATBI.

       wa_final-kschl = wa_KONX-KBETR.

       wa_final-kozgf = wa_konx-KONWA.

Read only

0 Likes
2,088

sorry by mistake i have forgot to change.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,088

You don't put any code in the last SELECT-ENDSELECT and used an INTO TABLE and not an APPENDING TABLE, so at end of selections, the internal table only contains results of the last package read. There are also some typo in your code (wrong mapping of fields) so read gain carefully your code.

Regards,

Raymond

Read only

0 Likes
2,088

Hi raymond,

Please help me what i have mapped wrongly.so that i will correct it.please provide a sample where i will correct it.

Thanks

Kumar

Read only

Former Member
0 Likes
2,089

Hi Kumar,

    

     Kindly remove your endselect from your query in table konx1.

Best Regards,
Charlie

Read only

0 Likes
2,088

Hi,

i have remove the endselect .but it is giving error.here i am sending the code.

*&---------------------------------------------------------------------*

*&      Form  Read_data

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

form Read_data .

IF t_t685 IS NOT INITIAL .

SELECT SINGLE t685~kvewe t685~kschl t685~kozgf

     FROM t685 inner join t685t on t685~kvewe = t685t~kvewe

     into corresponding fields of wa_final

          WHERE  t685~kvewe  = t685t-kvewe

          AND    t685~kschl  = t685t-kschl.

*         AND    t685~vtxtm  = t685t-vtext.

*endselect.

* SELECT a~kvewe

*a~kschl

*a~kozgf

*b~kvewe

*b~kschl

*INTO CORRESPONDING FIELDS OF TABLE t_final

*FROM t685 as a

*inner join t685t as b on a~kschl = b~kschl

*WHERE a~kschl in s_kschl

* AND a~kschl = b~kschl

* AND b~kvewe in s_kschl

* AND b~kschl in s_kschl.

*-------------------------------------------------

SELECT DATAB

        DATBI

        KBETR

        KONWA

        FROM konx INTO TABLE t_konx   .

*IF t_konx IS NOT INITIAL .

   SORT t_konx by KSCHL.

   delete ADJACENT DUPLICATES FROM t_konx COMPARING Kschl  .

     SELECT DATAB

        DATBI

        KBETR

        KONWA from  konx1 into TABLE t_konx1 package size 2000

                                       for all entries in t_konx

                              where Kschl = t_konx-Kschl.

endselect.

endif.

endform.                    " Read_data

*&---------------------------------------------------------------------*

*&      Form  populate_data

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

form populate_data .

*firsttest

LOOP AT T_FINAL INTO WA_FINAL.

     READ TABLE T_t685

     INTO WA_t685 WITH KEY kschl = WA_final-kschl BINARY SEARCH.

     IF SY-SUBRC = 0.

       WA_t685-kvewe = WA_FINAL-kvewe.

       WA_t685-kschl = WA_FINAL-kschl.

       WA_t685-kozgf = WA_FINAL-kozgf.

       APPEND WA_FINAL TO T_FINAL.

       clear wa_final.

      

ENDIF.

      endloop.

*---------------------------------------------------------

      LOOP AT : t_konx into wa_konx.

        wa_final-kschl = wa_KONX-kschl.

        wa_final-datab = wa_KONX-DATAB.

        wa_final-datbi = wa_KONX-DATBI.

        wa_final-kbetr = wa_KONX-KBETR.

        wa_final-konwa = wa_konx-KONWA.

        APPEND wa_final to t_final.

        CLEAR wa_final.

*       CLEAR wok aa_t685.

      CLEAR  wa_konx1.

    READ TABLE t_konx1 INTO wa_konx1 with KEY Kschl = wa_konx-Kschl.

        APPEND wa_final to t_final.

    endloop.



Please check and suggest me.

Thanks

Read only

0 Likes
2,088

Hi Kumar,

     Try this.

form Read_data .

IF t_t685 IS NOT INITIAL .

SELECT SINGLE t685~kvewe t685~kschl t685~kozgf

     FROM t685 inner join t685t on t685~kvewe = t685t~kvewe

     into corresponding fields of wa_final

          WHERE t685~kvewe  = t685t-kvewe

          AND   t685~kschl  = t685t-kschl.

* AND    t685~vtxtm  = t685t-vtext.

*endselect.

* SELECT a~kvewe

*a~kschl

*a~kozgf

*b~kvewe

*b~kschl

*INTO CORRESPONDING FIELDS OF TABLE t_final

*FROM t685 as a

*inner join t685t as b on a~kschl = b~kschl

*WHERE a~kschl in s_kschl

* AND a~kschl = b~kschl

* AND b~kvewe in s_kschl

* AND b~kschl in s_kschl.

*-------------------------------------------------

SELECT DATAB

        DATBI

        KBETR

        KONWA

        FROM konx INTO TABLE t_konx   .

IF t_konx IS NOT INITIAL .

   SORT t_konx by KSCHL.

   delete ADJACENT DUPLICATES FROM t_konx COMPARING Kschl  .

     SELECT DATAB

        DATBI

        KBETR

        KONWA from konx1 into TABLE t_konx1 package size 2000

                                       for all entries in t_konx

                              where Kschl = t_konx-Kschl.

*endselect.

endif.

endform.

                   " Read_data

*&---------------------------------------------------------------------*

*& Form  populate_data

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

*  --> p1        text

*  <-- p2        text

*----------------------------------------------------------------------*

form populate_data .

*firsttest

LOOP AT T_FINAL INTO WA_FINAL.

     READ TABLE T_t685

     INTO WA_t685 WITH KEY kschl = WA_final-kschl BINARY SEARCH.

     IF SY-SUBRC = 0.

       WA_t685-kvewe = WA_FINAL-kvewe.

       WA_t685-kschl = WA_FINAL-kschl.

       WA_t685-kozgf = WA_FINAL-kozgf.

       APPEND WA_FINAL TO T_FINAL.

       clear wa_final.

     

ENDIF.

      endloop.

*---------------------------------------------------------

      LOOP AT : t_konx into wa_konx.

        wa_final-kschl = wa_KONX-kschl.

        wa_final-datab = wa_KONX-DATAB.

        wa_final-datbi = wa_KONX-DATBI.

        wa_final-kbetr = wa_KONX-KBETR.

        wa_final-konwa = wa_konx-KONWA.

        APPEND wa_final to t_final.

        CLEAR wa_final.

* CLEAR wok aa_t685.

      CLEAR wa_konx1.

    READ TABLE t_konx1 INTO wa_konx1 with KEY Kschl = wa_konx-Kschl.

        APPEND wa_final to t_final.

    endloop.



If there's still an error. can you send me the sample error.

Read only

0 Likes
2,088

Hi Charlie,

still i am getting the same error.here i am attaching the error.in final output,we have to show the data .

Pick Overhead rate (KSCHL), Description(VTEXT), Dependency(KOZGF) from T685  And valid from (KBETR), Valid To(DATBI), Percentage(KBETR), unit (KONWA) pull fromKONX.


Thanks

Santosh

Read only

0 Likes
2,088

Hi Santosh,

     Can you attach here the whole program.



Best Regards,

Charlie

Read only

0 Likes
2,088

Hi charlie.

here is the code that i have attached

*&---------------------------------------------------------------------*

*& Report  ZVIEW_FETCHING_DATA_PS_3

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT  ZVIEW_FETCHING_DATA_PS_3.

TYPE-POOLS: slis.

* TABLE DECLARATION

TABLES : T685,T685T,KONX.

* DATA DECLARATION.

TYPES : BEGIN OF IT_T685,

         KVEWE TYPE T685-KVEWE,

         KSCHL TYPE T685-KSCHL,

         KOZGF TYPE T685-KOZGF,

         END OF IT_T685.

TYPES : BEGIN OF IT_T685T,

         KSCHL TYPE T685t-KSCHL,

         VTEXT TYPE T685T-VTEXT,

         END OF IT_T685T.

TYPES : BEGIN OF IT_KONX,

         KSCHL type konx-kschl,

         DATAB TYPE KONX-DATAB,

         DATBI TYPE KONX-DATBI,

         KBETR TYPE KONX-KBETR,

         KONWA TYPE KONX-KONWA,

         END OF IT_KONX.

TYPES : BEGIN OF IT_KONX1,

         KSCHL type konx1-kschl,

         DATAB TYPE KONX1-DATAB,

         DATBI TYPE KONX1-DATBI,

         KBETR TYPE KONX1-KBETR,

         KONWA TYPE KONX1-KONWA,

         END OF IT_KONX1.

TYPES : BEGIN OF IT_FINAL,

         KVEWE TYPE T685-KVEWE,

         KSCHL TYPE T685-KSCHL,

         KOZGF TYPE T685-KOZGF,

         VTEXT TYPE T685T-VTEXT,

*        KSCHL type konx-kschl,

         DATAB TYPE KONX-DATAB,

         DATBI TYPE KONX-DATBI,

         KBETR TYPE KONX-KBETR,

         KONWA TYPE KONX-KONWA,

         END OF IT_FINAL.

*INTERNAL TABLE DECLARATION*

DATA: T_fieldcat  TYPE slis_t_fieldcat_alv,

       T_T685 TYPE STANDARD TABLE OF IT_T685," with header line ,

       T_T685T TYPE STANDARD TABLE OF IT_T685T," with header line,

       T_KONX TYPE STANDARD TABLE OF IT_KONX ,"with header line ,

       T_KONX1 TYPE STANDARD TABLE OF IT_KONX1 ,

       T_FINAL TYPE STANDARD TABLE OF IT_FINAL ,

       wa_fieldcat  TYPE slis_fieldcat_alv,

       wa_layout TYPE slis_layout_alv,

* WORK-AREA DECLARATION

WA_T685 TYPE IT_T685,

WA_T685T TYPE IT_T685T,

WA_KONX TYPE IT_KONX,

WA_KONX1 TYPE IT_KONX1,

WA_FINAL TYPE IT_FINAL.

* CLEAR WORK-AREA *

CLEAR : WA_T685,WA_KONX,WA_T685T,WA_FINAL.

* REFRESH WORK-AREA *

REFRESH : T_T685,T_KONX,T_T685T,T_FINAL.

*-----------------------------------------

*--Selection Screen

SELECT-OPTIONS: s_KSCHL FOR T685-KSCHL.

START-OF-SELECTION.

PERFORM Read_data.

PERFORM populate_data.

PERFORM build_fcat.

PERFORM build_layout.

PERFORM display_data.

*&---------------------------------------------------------------------*

*&      Form  Read_data

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

form Read_data .

IF t_t685 IS NOT INITIAL .

SELECT SINGLE t685~kvewe t685~kschl t685~kozgf

      FROM t685 inner join t685t on t685~kvewe = t685t~kvewe

      into corresponding fields of wa_final

           WHERE t685~kvewe  = t685t-kvewe

           AND   t685~kschl  = t685t-kschl.

* AND    t685~vtxtm  = t685t-vtext.

*endselect.

* SELECT a~kvewe

*a~kschl

*a~kozgf

*b~kvewe

*b~kschl

*INTO CORRESPONDING FIELDS OF TABLE t_final

*FROM t685 as a

*inner join t685t as b on a~kschl = b~kschl

*WHERE a~kschl in s_kschl

* AND a~kschl = b~kschl

* AND b~kvewe in s_kschl

* AND b~kschl in s_kschl.

*-------------------------------------------------

SELECT DATAB

         DATBI

         KBETR

         KONWA

         FROM konx INTO TABLE t_konx   .

IF t_konx IS NOT INITIAL .

    SORT t_konx by KSCHL.

    delete ADJACENT DUPLICATES FROM t_konx COMPARING Kschl  .

      SELECT DATAB

         DATBI

         KBETR

         KONWA from konx1 into TABLE t_konx1 package size 2000

                                        for all entries in t_konx

                               where Kschl = t_konx-Kschl.

*endselect.

*endif.

endselect.

endif.

endif.

endform.

                    " Read_data

*&---------------------------------------------------------------------*

*& Form  populate_data

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

*  --> p1        text

*  <-- p2        text

*----------------------------------------------------------------------*

form populate_data .

*firsttest

LOOP AT T_FINAL INTO WA_FINAL.

      READ TABLE T_t685

      INTO WA_t685 WITH KEY kschl = WA_final-kschl BINARY SEARCH.

      IF SY-SUBRC = 0.

        WA_t685-kvewe = WA_FINAL-kvewe.

        WA_t685-kschl = WA_FINAL-kschl.

        WA_t685-kozgf = WA_FINAL-kozgf.

        APPEND WA_FINAL TO T_FINAL.

        clear wa_final.

ENDIF.

       endloop.

*---------------------------------------------------------

       LOOP AT : t_konx into wa_konx.

         wa_final-kschl = wa_KONX-kschl.

         wa_final-datab = wa_KONX-DATAB.

         wa_final-datbi = wa_KONX-DATBI.

         wa_final-kbetr = wa_KONX-KBETR.

         wa_final-konwa = wa_konx-KONWA.

         APPEND wa_final to t_final.

         CLEAR wa_final.

* CLEAR wok aa_t685.

       CLEAR wa_konx1.

     READ TABLE t_konx1 INTO wa_konx1 with KEY Kschl = wa_konx-Kschl.

         APPEND wa_final to t_final.

     endloop.

     endform.

*&---------------------------------------------------------------------*

*&      Form  build_fcat

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

form build_fcat .

*Build field catalog

        wa_fieldcat-coL_pos = 1.

      wa_fieldcat-fieldname  = 'KSCHL'.    " Fieldname in the data table

      wa_fieldcat-tabname  = 'T_FINAL'.

      wa_fieldcat-seltext_m  = 'Overhead Rate'.   " Column description in the output

   APPEND wa_fieldcat TO t_fieldcat.

              CLEAR  wa_fieldcat.

       wa_fieldcat-coL_pos = 2.

    wa_fieldcat-fieldname  = 'VTEXT'.    " Fieldname in the data table

   wa_fieldcat-tabname  = 'T_FINAL'.

      wa_fieldcat-seltext_m  = 'Description'.   " Column description in the output

   APPEND wa_fieldcat TO t_fieldcat.

             CLEAR wa_fieldcat .

       wa_fieldcat-coL_pos = 3.

    wa_fieldcat-fieldname  = 'KOZGF'.    " Fieldname in the data table

    wa_fieldcat-tabname  = 'T_FINAL'.

      wa_fieldcat-seltext_m  = 'Dependency'.   " Column description in the output

   APPEND wa_fieldcat TO t_fieldcat.

            CLEAR  wa_fieldcat .

         wa_fieldcat-coL_pos = 4.

    wa_fieldcat-fieldname  = 'KBETR'.    " Fieldname in the data table

    wa_fieldcat-tabname  = 'T_FINAL'.

      wa_fieldcat-seltext_m  = 'Valid from'.   " Column description in the output

   APPEND wa_fieldcat TO t_fieldcat.

             CLEAR  wa_fieldcat .

          wa_fieldcat-coL_pos = 5.

    wa_fieldcat-fieldname  = 'DATBI'.    " Fieldname in the data table

    wa_fieldcat-tabname  = 'T_FINAL'.

      wa_fieldcat-seltext_m  = 'Valid to'.   " Column description in the output

   APPEND wa_fieldcat TO t_fieldcat.

              CLEAR  wa_fieldcat .

        wa_fieldcat-coL_pos = 6.

    wa_fieldcat-fieldname  = 'KBETR'.    " Fieldname in the data table

    wa_fieldcat-tabname  = 'T_FINAL'.

      wa_fieldcat-seltext_m  = 'Percentage'.   " Column description in the output

   APPEND wa_fieldcat TO t_fieldcat.

           CLEAR  wa_fieldcat .

         wa_fieldcat-coL_pos = 7.

   wa_fieldcat-fieldname  = 'KONWA'.    " Fieldname in the data table

   wa_fieldcat-tabname  = 'T_FINAL'.

      wa_fieldcat-seltext_m  = 'Unit'.   " Column description in the output

   APPEND wa_fieldcat TO t_fieldcat.

             CLEAR  wa_fieldcat .

endform.                    " build_fcat

*&---------------------------------------------------------------------*

*&      Form  display_data

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

form display_data .

*  *Pass data and field catalog to ALV function module to display ALV list

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

  EXPORTING

    IT_FIELDCAT                       T_fieldcat

   TABLES

     t_outtab                          = T_FINAL

  EXCEPTIONS

    PROGRAM_ERROR                     = 1

    OTHERS                            = 2

           .

IF sy-subrc <> 0.

  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endform.                    " display_data

*&---------------------------------------------------------------------*

*&      Form  build_layout

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

form build_layout .

wa_layout-colwidth_optimize = 'X'.

CLEAR wa_layout.

endform.

Read only

0 Likes
2,088

Hi Santosh,

     Reading your code initially under form read_data, it seems that it wont return anything since, you are setting a condition on an internal table having no data which will definitely skip on the select statement you have created.

form Read_data .

IF t_t685 IS NOT INITIAL . (No data under internal table t_t685, create query first and put it in this internal table (t_t685)

SELECT SINGLE t685~kvewe t685~kschl t685~kozgf

      FROM t685 inner join t685t on t685~kvewe = t685t~kvewe

      into corresponding fields of wa_final

           WHERE t685~kvewe  = t685t-kvewe

           AND   t685~kschl  = t685t-kschl. (Put the result under an internal table)

* AND    t685~vtxtm  = t685t-vtext.

*endselect.

* SELECT a~kvewe

*a~kschl

*a~kozgf

*b~kvewe

*b~kschl

*INTO CORRESPONDING FIELDS OF TABLE t_final

*FROM t685 as a

*inner join t685t as b on a~kschl = b~kschl

*WHERE a~kschl in s_kschl

* AND a~kschl = b~kschl

* AND b~kvewe in s_kschl

* AND b~kschl in s_kschl.

*-------------------------------------------------

SELECT DATAB

         DATBI

         KBETR

         KONWA

         FROM konx INTO TABLE t_konx   .

IF t_konx IS NOT INITIAL .

    SORT t_konx by KSCHL.

    delete ADJACENT DUPLICATES FROM t_konx COMPARING Kschl  .

      SELECT DATAB

         DATBI

         KBETR

         KONWA from konx1 into TABLE t_konx1 package size 2000

                                        for all entries in t_konx

                               where Kschl = t_konx-Kschl.

*endselect.

*endif.

endselect.

endif.

endif.

endform.

----------------------------------------------------

Best Regards,

Charlie

Read only

0 Likes
2,088

Follow your logic:

You have

START-OF-SELECTION

then your first subroutine:

PERFORM read_data

then your very very first statement:

IF t_t685 IS NOT INITIAL

This will always be initial as you have not populated it! Can you not see this program will not even pass GO?

Read only

0 Likes
2,088

Hi,

I have corrected in the program.

SELECT a~kvewe a~kschl a~kozgf

          b~vtext b~spras

          c~datab c~datbi c~kbetr c~konwa

             FROM t685 AS a

             left JOIN t685t AS b ON a~kschl EQ b~kschl

             left JOIN konx AS c ON a~kschl EQ c~kschl

          INTO TABLE t_final

          WHERE a~kschl IN s_kschl.


Now data is getting displayed.Thanks for help in solving this issue

Read only

0 Likes
2,088

You mark your own Answer as correct!?