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: 

Logic for displaying Reservations

Former Member
0 Kudos
238

Hi,

I have a requirement to display reservations along with open PO and consignment stock for materials.

As Per the requirement i am not able to fetch the exact requirements.

I am getting correct reservations for some and wrong for some materials when compared to MD04 Reservations.

I have used the below logic to fetch the reservations.

SELECT *

FROM resb

INTO CORRESPONDING FIELDS OF TABLE i_resb

FOR ALL ENTRIES IN i_mard

WHERE matnr EQ i_mard-matnr

AND werks EQ i_mard-werks

AND xloek EQ ' '

AND kzear EQ ' '.

LOOp At i_mard into mard.

READ TABLE i_resb INTO resb WITH KEY matnr = mard-matnr

werks = mard-werks.

IF sy-subrc EQ '0'.

LOOP AT i_resb FROM sy-tabix.

IF i_resb-matnr NE mard-matnr.

EXIT.

ENDIF.

zmmresv-bdmng = zmmresv-bdmng + ( i_resb-bdmng - i_resb-enmng ).

ENDLOOP.

ENDIF.

Clear mard.

ENDLOOP.

Can any one suggest me the exact logic to fetch the reservations.

Thanks in advance.

Message was edited by:

babulreddy kurapatti

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos
145

Hi,

You can use this FM MD_STOCK_REQUIREMENTS_LIST_API to get the same information as transaction MD04.

Regards,

Ferry Lianto

3 REPLIES 3

Former Member
0 Kudos
145

The logic what you written is wrong.

first get the data from resb table

select * from resb into table resb

where condition.

if sy-subrc eq 0.

SELECT * INTO TABLE i_mard

FROM mard

FOR ALL ENTRIES IN i_resb

WHERE matnr = i_resb-matnr

other where condition.

endif.

loop at i_resb.

here you can use read table with mard and move to final internal table.

endloop.

Thanks

Seshu

ferry_lianto
Active Contributor
0 Kudos
146

Hi,

You can use this FM MD_STOCK_REQUIREMENTS_LIST_API to get the same information as transaction MD04.

Regards,

Ferry Lianto

0 Kudos
145

Hi Ferry,

Thanks a lot for your valuable answer.