05-21-2013 7:54 AM
Hi,
I need to find out the count of new Materials from an Internal Table based on the old Material no. I am providing a Table Parameter in a Function Module in which old Materials are entered. Based on that I'm selecting new Material and few other fields from a cross reference table. I want to check if there are multiple new materials for an existing old material.How to check this count? I do not want to use two Loops. Code snippet:
05-21-2013 8:41 AM
Hi,
Use Sy-DBCNT for the records successfully processed count.
Thanks,
Kranthi.
05-21-2013 9:14 AM
Hi Saurabh,
Try below code...
DATA: W_OLDMATERIAL TYPE ZMMAT_PLANT_ESUPPLI....,
W_NEWMATERIAL TYPE ZMM_MAT_ELPREX,
L_COUNT TYPE I.
CLEAR L_COUNT.
LOOP AT P_NEWMATERIAL INTO W_NEWMATERIAL.
CLEAR W_OLDMATERIAL.
READ TABLE P_OLDMATERIAL INTO W_OLDMATERIAL
WITH KEY (matrial_no_field) = W_NEWMATERIAL-(matrial_no_field).
IF SY-SUBRC NE 0.
* New Material
ADD 1 TO L_COUNT.
ENDIF.
ENDLOOP.
WRITE:/ 'Total New Materials:', L_COUNT.
Regards,
Mordhwaj
05-21-2013 9:50 AM
Hi Saurabh,
You can check SY-DBCNT at the end of select from internal table.
You can also use :: Describe table it_final index lv_index.
where it_final is ur internal table & lv_index is local variable which contains no of records.
05-21-2013 10:24 AM
05-21-2013 11:24 AM
05-21-2013 11:57 AM