‎2008 Aug 22 9:29 AM
Hi Gurus,
I want to create additional field in the report, where I want to do multiplication with (-1);
how to append a new deffined field ZDMBTR to INT internal table?
Code is displayed below.
Thanks.
data: int like ZFI_GET_COMM_ITE occurs 0 with header line.
SELECT * FROM BSIK WHERE ( BUKRS IN BUKRS ) AND
( LIFNR IN LIFNR ) AND
( BLDAT IN BLDAT ) AND
( BUDAT IN BUDAT ) AND
( CPUDT IN CPUDT ).
SELECT * FROM bseg WHERE ( BELNR = BSIK-BELNR ) AND
( BUKRS = BSIK-BUKRS ) and
( GJAHR = BSIK-GJAHR ) and
( BUZID NE ' ' ).
IF BSIK-SHKZG = 'H'.
ZDMBTR = int-DMBTR * ( -1 ).
ELSE.
ZDMBTR = int-DMBTR.
ENDIF.
IF sy-subrc = 0.
CLEAR int.
MOVE-CORRESPONDING bsik TO int.
MOVE-CORRESPONDING bseg TO int.
APPEND int.
ENDIF.
ENDSELECT.
ENDSELECT.
‎2008 Aug 22 10:06 AM
types: BEGIN OF sat.
include structure mara."ZFI_GET_COMM_ITE.
TYPES: zdmbtr TYPE dmbtr,
end of sat.
DATA: int TYPE TABLE OF sat WITH HEADER LINE.
IF BSIK-SHKZG = 'H'.
INT-ZDMBTR = BSIK-DMBTR * ( -1 ).
ELSE.
INT-ZDMBTR = BSIK-DMBTR.
ENDIF.Regards
Sathar
‎2008 Aug 22 9:35 AM
Just add ZDMBTR to DDIC structure ZFI_GET_COMM_ITE. Then you can fill with your calculated value in internal table INT. Also move the MOVE-CORRESPONDING part before the calculation.
Am I missing something?
Thomas
‎2008 Aug 22 9:37 AM
I thought the same.
Btw - don't use tables with header-lines - it's bad programming practice, which is why SAP banned it in ABAP Objects. Avoid SELECT... ENDSELECT.
‎2008 Aug 22 9:37 AM
Hello
DATA: BEGIN OF INT OCCURS 0.
INCLUDE STRUCTURE ZFI_GET_COMM_ITE.
DATA: ZDMBTR LIKE BSEG-DMBTR.
DATA: END OF INT.
‎2008 Aug 22 9:38 AM
>
> Hello
>
>
> DATA: BEGIN OF INT OCCURS 0.
> INCLUDE STRUCTURE ZFI_GET_COMM_ITE.
> DATA: ZDMBTR LIKE BSEG-DMBTR.
> DATA: END OF INT.
> Note: doesn't work in ABAP Objects context.
‎2008 Aug 22 9:45 AM
Hello
Matthew wrote:
Note: doesn't work in ABAP Objects context.
Agree, but in statement of the problem was not nothing be said about ABAP Objects context. (-:
‎2008 Aug 22 9:39 AM
Hi ,
Create that field in table ZFI_GET_COMM_ITE OR
Declare your int as
Data : begin on int opccurs 0 with header line .
Include structure ZFI_GET_COMM_ITE .
ZDMBTR TYPE DMBTR.
Data : END OF inT .
‎2008 Aug 22 9:40 AM
Hi,
Instead of "data: int like ZFI_GET_COMM_ITE occurs 0 with header line."
use: data: begin of int occurs 0,
include structure ZFI_GET_COMM_ITE ,
<your field> type <type of field>,
end of int.
‎2008 Aug 22 10:06 AM
types: BEGIN OF sat.
include structure mara."ZFI_GET_COMM_ITE.
TYPES: zdmbtr TYPE dmbtr,
end of sat.
DATA: int TYPE TABLE OF sat WITH HEADER LINE.
IF BSIK-SHKZG = 'H'.
INT-ZDMBTR = BSIK-DMBTR * ( -1 ).
ELSE.
INT-ZDMBTR = BSIK-DMBTR.
ENDIF.Regards
Sathar