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: 

REPORT

Former Member
0 Kudos

Hi

In the below prg the fields matnr,belnr,menge of bsim table is not executed

TYPES : BEGIN OF TY_BSIS,

BUKRS TYPE BSIS-BUKRS, "COMPANY CODE

HKONT TYPE BSIS-HKONT, "GENERAL LEDGER ACCOUNT

GJAHR TYPE BSIS-GJAHR, "FISCAL YEAR

BELNR TYPE BSIS-BELNR, "ACCOUNTING DOCUMENT NO

BUDAT TYPE BSIS-BUDAT, "POSTING DATE IN THEDOCUMENT

BLART TYPE BSIS-BLART, "DOCUMENT TYPE

SHKZG TYPE BSIS-SHKZG, "DEBIT/CREDIT INDICATOR

DMBTR TYPE BSIS-DMBTR, "AMOUNT IN LOCAL CURRENCY

KOSTL TYPE BSIS-KOSTL, "COST CENTER

END OF TY_BSIS,

BEGIN OF TY_BSIM,

MATNR TYPE BSIM-MATNR,

BELNR TYPE BSIM-BELNR,

GJAHR TYPE BSIM-GJAHR,

MENGE TYPE BSIM-MENGE,

END OF TY_BSIM,

BEGIN OF TY_FINAL,

BUKRS TYPE BSIS-BUKRS,

HKONT TYPE BSIS-HKONT,

GJAHR TYPE BSIS-GJAHR,

dmbtr type bsis-dmbtr,

BELNR TYPE BSIM-BELNR,

shkzg type bsis-shkzg,

KOSTL TYPE BSIS-KOSTL,

MATNR TYPE BSIM-MATNR,

MENGE TYPE BSIM-MENGE,

budat type bsim-budat,

blart type bsim-blart,

END OF TY_FINAL.

*DATA: W_BSIS TYPE TY_BSIS,

  • W_BSIM TYPE TY_BSIM,

  • W_FINAL TYPE TY_FINAL,

**********SELECT OPTIONS**********

data: it_BSIm type standard table of TY_BSIm with header line.

DATA: it_bsis TYPE STANDARD TABLE OF ty_bsis WITH HEADER LINE ,

it_final TYPE STANDARD TABLE OF ty_final WITH HEADER LINE,

w_bsis type ty_bsis,

w_bsim type ty_bsim,

w_final type ty_final.

**********SELECT OPTIONS**********

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS: S_ACCNT FOR w_bsis-hkont,

S_CODE FOR W_BSIS-BUKRS,

S_FYEAR FOR W_

S_DCTYPE FOR W_BSIS-BLART,

S_PSDT FOR W_BSIS-BUDAT.

SELECTION-SCREEN END OF BLOCK B1 .

**********SELECT OPTIONS**********

select * from bsis into corresponding fields of table it_bsis where

hkont in s_accnt and

bukrs in s_code .

if it_bsis[] is not initial .

select * from bsim into corresponding fields of table it_bsim

where belnr = W_bsis-belnr .

endif.

LOOP AT IT_BSIS INTO W_BSIS.

READ TABLE IT_BSIS INTO W_BSIS WITH KEY BELNR = W_BSIS-BELNR.

W_FINAL-BUKRS = W_BSIS-BUKRS.

W_FINAL-HKONT = W_BSIS-HKONT.

W_FINAL-GJAHR = W_BSIS-GJAHR.

W_FINAL-BELNR = W_BSIS-BELNR.

W_FINAL-SHKZG = W_BSIS-SHKZG.

W_FINAL-DMBTR = W_BSIS-DMBTR.

READ TABLE IT_BSIM INTO W_BSIM WITH KEY BELNR = W_BSIS-BELNR .

W_FINAL-MATNR = W_BSIM-MATNR.

W_FINAL-BELNR = W_BSIM-BELNR.

W_FINAL-GJAHR = W_BSIM-GJAHR.

W_FINAL-MENGE = W_BSIM-MENGE.

APPEND W_FINAL TO IT_FINAL.

ENDLOOP.

loop at it_final INTO W_FINAL.

write : /

W_final-hkont,

W_final-gjahr,

W_final-dmbtr,

W_final-belnr,

W_final-shkzg,

W_final-KOSTL,

W_final-matnr,

W_final-menge,

W_final-budat.

ENDLOOP.

please solve the problem .

with regards

lalitha .

2 REPLIES 2

Former Member
0 Kudos

The problem is here;

if it_bsis[] is not initial .

select * from bsim into corresponding fields of table it_bsim

where belnr = W_bsis-belnr .

endif.

w_bsis at this point is stilll initial

You would be better to use

if it_bsis[] is not initial .

select * from bsim into corresponding fields of table it_bsim

for all entries in table it_bsis

where bsim-belnr = it_bsis-belnr .

endif.

(this is psudo-code, you'll need to check the syntax before you use it).

Regards,

Nick

Former Member
0 Kudos

you write types statment before it.