Skip to Content
author's profile photo Former Member
Former Member

Minimum and max lot size from Recipe

Hai,

I am trying to generate 1 report to display min amd max lot size from recipe.for a range of materials of a particular plant and also if the materials have bulk mat as comp, i have to display min and max lot size of that also below its header mat.

I have used AFKO table to pick up min and max lot size.

But i am not able to dispaly the lot size for all the range of materials.

May be my logic to read and display is wrong. please help me.

The code to read and display is as below.

i_finaln int tab has al the i/p materials.

i_int int tab has min and max lot size

i_makt has comp description

i_total has al the components of materials

i_mid has lot size data for components

FORM process_data.

DATA:v_tabix TYPE sy-tabix.

CLEAR:w_int,

w_final.

LOOP AT i_final INTO w_final.

v_tabix = sy-tabix.

READ TABLE i_int INTO w_int WITH KEY matnr = w_final-matnr.

IF sy-subrc IS INITIAL.

w_final-plsvn = w_int-plsvn.

w_final-plsvb = w_int-plsvb.

MODIFY i_final FROM w_final INDEX v_tabix.

CLEAR:v_tabix,

w_final,

w_int.

ENDIF.

ENDLOOP.

CLEAR:w_mid,

w_makt,

w_total.

LOOP AT i_total INTO w_total.

v_tabix = sy-tabix.

READ TABLE i_makt INTO w_makt WITH KEY idnrk = w_total-idnrk.

IF sy-subrc IS INITIAL.

READ TABLE i_mid INTO w_mid WITH KEY idnrk = w_makt-idnrk.

IF sy-subrc IS INITIAL.

w_total-plsvn = w_mid-plsvn.

w_total-plsvb = w_mid-plsvb.

w_total-maktx = w_makt-maktx.

MODIFY i_total FROM w_total INDEX v_tabix.

CLEAR:v_tabix,

w_makt,

w_mid,

w_total.

ENDIF.

ENDIF.

ENDLOOP.

CLEAR:w_f,

w_final,

w_total.

MOVE i_final TO i_f.

REFRESH:i_final.

LOOP AT i_f INTO w_f.

v_tabix = sy-tabix.

APPEND w_f TO i_final.

READ TABLE i_mast INTO w_mast WITH KEY matnr = w_f-matnr.

IF sy-subrc IS INITIAL.

READ TABLE i_total INTO w_total WITH KEY idnrk = w_mast-idnrk.

if sy-subrc IS INITIAL.

w_final = w_total.

APPEND w_final TO i_final.

Please help me....

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Feb 25, 2009 at 10:03 AM

    Hi Kavitha,

    I didn't get the full logic but i have changed the code some what please find it below.

    DATA:v_tabix TYPE sy-tabix.

    CLEAR:w_int,

    w_final.

    Clear V_tabix.

    LOOP AT i_final INTO w_final.

    v_tabix = V_tabix + 1.

    READ TABLE i_int INTO w_int WITH KEY matnr = w_final-matnr.

    IF sy-subrc = 0.

    w_final-plsvn = w_int-plsvn.

    w_final-plsvb = w_int-plsvb.

    MODIFY i_final FROM w_final INDEX v_tabix.

    CLEAR:w_final,

    w_int.

    ENDIF.

    ENDLOOP.

    CLEAR:v_tabix.

    CLEAR:w_mid,

    w_makt,

    w_total.

    LOOP AT i_total INTO w_total.

    v_tabix = V_tabix + 1.

    READ TABLE i_makt INTO w_makt WITH KEY idnrk = w_total-idnrk.

    IF sy-subrc = 0.

    w_total-plsvn = w_mid-plsvn.

    w_total-plsvb = w_mid-plsvb.

    MODIFY i_total FROM w_total INDEX v_tabix.

    endif.

    READ TABLE i_mid INTO w_mid WITH KEY idnrk = w_makt-idnrk.

    IF sy-subrc = 0.

    w_total-maktx = w_makt-maktx.

    MODIFY i_total FROM w_total INDEX v_tabix.

    CLEAR:w_makt,

    w_mid,

    w_total.

    ENDIF.

    ENDLOOP.

    CLEAR:v_tabix.

    CLEAR:w_f,

    w_final,

    w_total.

    MOVE i_final TO i_f.

    REFRESH:i_final[].

    LOOP AT i_f INTO w_f.

    v_tabix = sy-tabix.

    APPEND w_f TO i_final.

    READ TABLE i_mast INTO w_mast WITH KEY matnr = w_f-matnr.

    IF sy-subrc = 0.

    READ TABLE i_total INTO w_total WITH KEY idnrk = w_mast-idnrk.

    if sy-subrc = 0.

    w_final = w_total.

    APPEND w_final TO i_final.

    Cheers,

    Naveen.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.