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

REG: GETTING ERROR

Former Member
0 Likes
454

Hi All,

In table MKPF there is mblnr and mjahr

In table BKPF there is belnr and gjahr

In BKPF there is referance key field AWKEY

In that field AWKEY i have to enter mblnr and mjahr and

it will give Accounting Document Number

In the code i have retun like this but it is giving error

the code is

IF it_mkpf[] IS NOT INITIAL.

SELECT BUKRS BELNR GJAHR AWTYP AWKEY

INTO CORRESPONDING FIELDS OF TABLE it_bkpf

FROM bkpf

FOR ALL ENTRIES IN it_mkpf

WHERE awtyp = 'MKPF'

AND ( awkey0(10) = it_mkpf-mblnr AND awkey14(4) = it_mkpf-mjahr ).

endif.

WHO TO WRITE THAT LOGIC

PLS CAN U HELP ME

THANKS

MARS

2 REPLIES 2
Read only

former_member125931
Active Participant
0 Likes
432

WHERE awtyp = 'MKPF'

Here u r passing table as reference key instead of FIELD can u check it once..

Edited by: Sree on Oct 25, 2008 7:24 AM

Read only

Former Member
0 Likes
432

check this code.

TYPES: BEGIN OF ty_mkpf,
        mblnr TYPE mkpf-mblnr,
        mjahr TYPE mkpf-mjahr,
        xawkey TYPE bkpf-awkey,
       END OF ty_mkpf.

TYPES: BEGIN OF ty_bkpf,
        bukrs TYPE bkpf-bukrs,
        belnr TYPE bkpf-belnr,
        gjahr TYPE bkpf-gjahr,
       awtyp TYPE bkpf-awtyp,
       awkey TYPE bkpf-awkey,
       END OF ty_bkpf.

DATA: it_mkpf TYPE STANDARD TABLE OF ty_mkpf,
it_bkpf TYPE STANDARD TABLE OF ty_bkpf,
wa_mkpf TYPE ty_mkpf,
wa_bkpf TYPE ty_bkpf.

SELECT mblnr
       mjahr
  FROM mkpf
  INTO TABLE it_mkpf
  where (Ur select options or paramters).

LOOP AT it_mkpf INTO wa_mkpf.
  CONCATENATE wa_mkpf-mblnr wa_mkpf-mjahr INTO wa_mkpf-xawkey.
  MODIFY it_mkpf FROM wa_mkpf TRANSPORTING xawkey.
ENDLOOP.

IF it_mkpf[] IS NOT INITIAL.
  SELECT bukrs belnr gjahr awtyp awkey
  INTO TABLE it_bkpf
  FROM bkpf
  FOR ALL ENTRIES IN it_mkpf
  WHERE awtyp = 'MKPF'
  AND awkey = it_mkpf-xawkey.
ENDIF.

regards,

Padma