Skip to Content
0
Former Member
Dec 15, 2006 at 05:06 AM

report

22 Views

why this code is not wotking properly.

SORT it_mara BY matnr. sy-subrc =4

SORT it_makt BY matnr. sy-subrc =4

SORT it_mseg BY matnr. sy-subrc =4

LOOP AT it_mara INTO wa_mara. sy-subrc =4

READ TABLE it_makt INTO wa_makt WITH KEY matnr = wa_mara-matnr

BINARY SEARCH.

IF sy-subrc = 0.

MOVE wa_mara-matnr TO wa_final-matnr.

MOVE wa_mara-matkl TO wa_final-matkl.

MOVE wa_makt-maktx TO wa_final-maktx.

APPEND wa_final TO it_final.

ENDIF.

  • ENDLOOP.

  • LOOP AT it_mara INTO wa_mara.

READ TABLE it_mseg INTO wa_mseg WITH KEY matnr = wa_mara-matnr

BINARY SEARCH.sy-subrc =8

IF sy-subrc = 0.

MOVE wa_mseg-bwart TO wa_final-bwart.sy-subrc =8

APPEND wa_final TO it_final.

ENDIF.

ENDLOOP.

SORT it_final BY matnr bwart.

LOOP AT it_final INTO wa_final.

IF wa_final-bwart = '101' OR

wa_final-bwart = '103' OR

wa_final-bwart = '105'.

count_gr = count_gr + 1.

ENDIF.

IF wa_final-bwart = '201' OR

wa_final-bwart = '261' OR

wa_final-bwart = '281' OR

wa_final-bwart = '291' OR

wa_final-bwart = '301' OR

wa_final-bwart = '311' OR

wa_final-bwart = '541'.

count_gi = count_gi + 1.

ENDIF.

ENDLOOP.