2023 Mar 16 2:01 AM
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.
2023 Mar 16 1:03 PM
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
2023 Mar 16 1:02 PM
How is defined the table ZDATAGL, what are the primary keys (only MANDT?)
2023 Mar 16 1:03 PM
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
2023 Mar 16 4:47 PM
I don't know what you're trying to achieve, but I feel you're plain wrong:
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).