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: 

Only 1 data stored out of 92 shown in T_OUTTAB

former_member844813
Participant
0 Kudos
355

i have this program to display a data according to g/l account and date range and then save it to a ztable. with debugging, 82 data appears but only stored 1 data in my ztable. anyone can help me with that ?

heres the code

REPORT ZGETFBL.

DATA: R_TABLE TYPE REF TO CL_SALV_TABLE,
IN_HKONT TYPE BSAS-HKONT,
T_OUTTAB TYPE STANDARD TABLE OF ZDATAGL.

IN_HKONT = '6105001'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = IN_HKONT
IMPORTING
OUTPUT = IN_HKONT.
.
SELECT MANDT HKONT AUGBL KOSTL DMBTR WRBTR BUDAT FROM BSIS
INTO TABLE T_OUTTAB
WHERE HKONT EQ IN_HKONT AND BUDAT BETWEEN '20220901' AND '20220930'.
SELECT MANDT HKONT AUGBL KOSTL DMBTR WRBTR BUDAT FROM BSAS
APPENDING TABLE T_OUTTAB
WHERE HKONT EQ IN_HKONT AND BUDAT BETWEEN '20220901' AND '20220930'.

BREAK-POINT.
MODIFY ZDATAGL FROM TABLE T_OUTTAB.

TRY .
CL_SALV_TABLE=>FACTORY(
IMPORTING
R_SALV_TABLE = R_TABLE
CHANGING
T_TABLE = T_OUTTAB ).

CATCH CX_SALV_MSG .
ENDTRY.

R_TABLE->GET_FUNCTIONS( )->SET_ALL( ABAP_TRUE ).
R_TABLE->GET_COLUMNS( )->SET_OPTIMIZE( ABAP_TRUE ).
R_TABLE->DISPLAY( ).

START-OF-SELECTION.
1 ACCEPTED SOLUTION

fedaros
Product and Topic Expert
Product and Topic Expert
318

Hi Dema,

Check primary key of table ZDATAGL and compare it with internal table entries.

In case all 92 entries falls in same PK, you are just implicit overwriting data.

Regards, Fernando Da Rós

3 REPLIES 3

raymond_giuseppi
Active Contributor
318

How is defined the table ZDATAGL, what are the primary keys (only MANDT?)

fedaros
Product and Topic Expert
Product and Topic Expert
319

Hi Dema,

Check primary key of table ZDATAGL and compare it with internal table entries.

In case all 92 entries falls in same PK, you are just implicit overwriting data.

Regards, Fernando Da Rós

Sandra_Rossi
Active Contributor
318

I don't know what you're trying to achieve, but I feel you're plain wrong:

  1. If you just want to display data from BSIS, you don't need neither to create the database table ZDATAGL, nor to update the database table (MODIFY).
  2. If you want to fill the database table ZDATAGL for something else, it's bad practice to do everything at the same time and the same place.
  3. You can declare T_OUTTAB as an internal table with lines made of components MANDT, etc., directly in ABAP.

You may even use the Inline Declaration to declare T_OUTTAB:

 SELECT MANDT, HKONT, AUGBL, KOSTL, DMBTR, WRBTR, BUDAT 
      FROM BSIS
      WHERE HKONT = @IN_HKONT
        AND BUDAT BETWEEN '20220901' AND '20220930'
      INTO TABLE @DATA(T_OUTTAB).

NB: selecting MANDT is bad practice (although I can understand it might simplify the code, but of course it depends what you really want to do).