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: 

Physical Inventory Detail

Former Member
0 Kudos

Hi Forum,

From where to get detail of Physical Inventory ??

i have to make a program In SAP, that gives detail of Inventory stock available on basis of Plant , storage location and material?

i.e. in Plant XYZ and Storage location 01 for material 1212 how much stock is available for current date?

what are the tables i have to consider to fetch these details?

or if there is any BAPI to get inventory detail as of now?

then after i get the inventory detail i have to reconcile it from external system file whether this SAP inventory matches with the inventory in external system?

I have to make program for Inventory reconciliation for which i need inventory detail in SAP.

Can anybody help me figure out any such program in SAP that gives inventory detail..?? and tables to refere relations?? or any function by using which i can get my querry solved??

3 REPLIES 3

Former Member
0 Kudos

just check the table MARD.

Reward if useful

Regards

ANUPAM

Former Member
0 Kudos

Hi Anumpam,

Can you tell me which field in MARD gives the Physical Inventory Quantity,

i.e. which field has the physical quanitity of material for the particular store

i want the field name which indicates it is Physical Inventory Present in store for the XYZ material???

0 Kudos

HI

CHEK THIS REPORT

REPORT ZPHYSICAL_INVENTORY.

TABLES: ISEG,MARA.

TYPE-POOLS : SLIS.

DATA : DATE1(15) TYPE C,

DATE2(15) TYPE C,

TITLE(65) TYPE C,

DT(25) TYPE C.

DATA : ITEVENT TYPE SLIS_T_EVENT.

                      • INTERNAL TABLE FOR INVENTORY STOCK *****************

DATA: BEGIN OF ITS1 OCCURS 0,

MATNR LIKE ISEG-MATNR,

ITEMID(6) TYPE C,

MEINS LIKE ISEG-MEINS,

MENGE LIKE ISEG-MENGE,

WRTZL LIKE ISEG-WRTZL,

BUCHM LIKE ISEG-BUCHM,

WRTBM LIKE ISEG-WRTBM,

WERKS LIKE ISEG-WERKS,

BUDAT LIKE ISEG-BUDAT,

ZLDAT LIKE ISEG-ZLDAT,

MTART LIKE MARA-MTART,

ITEMDESC LIKE MAKT-MAKTX,

DIFFQTY LIKE ISEG-BUCHM,

DIFFVALUE LIKE ISEG-WRTBM,

GRUND LIKE ISEG-GRUND,

GRTXT LIKE T157E-GRTXT,

BWART LIKE T157E-BWART,

REAS TYPE C LENGTH 15,

END OF ITS1.

data: t_heading type slis_t_listheader.

SELECTION-SCREEN BEGIN OF BLOCK PAR1 WITH FRAME TITLE TEXT-001.

*********PARAMETERS*********

PARAMETERS : PLANT LIKE ISEG-WERKS OBLIGATORY.

*********SELECTION SCREEN OPTIONS*********

SELECT-OPTIONS : R_DATE FOR ISEG-BUDAT OBLIGATORY NO-EXTENSION,

M_TYPE FOR MARA-MTART,

IT_M FOR MARA-MATNR.

*********DEFINING VARIABLES*********

SELECTION-SCREEN END OF BLOCK par1.

CONCATENATE R_DATE-LOW6(2) '.' R_DATE-LOW4(2) '.' R_DATE-LOW+0(4) INTO DATE1.

CONCATENATE R_DATE-HIGH6(2) '.' R_DATE-HIGH4(2) '.' R_DATE-HIGH+0(4) INTO DATE2.

TOP-OF-PAGE.

PERFORM PG_HEADER.

START-OF-SELECTION.

SELECT AMATNR AMEINS AMENGE AWRTZL ABUCHM AWRTBM AWERKS ABUDAT AZLDAT BMTART AGRUND CBWART

FROM ISEG AS A INNER JOIN MARA AS B ON BMATNR = AMATNR

INNER JOIN MSEG AS C ON AMBLNR = CMBLNR

INTO CORRESPONDING FIELDS OF TABLE ITS1 WHERE BMATNR = AMATNR AND BMEINS = AMEINS AND AWERKS = PLANT AND ABUDAT IN R_DATE AND BMTART IN M_TYPE AND BMATNR IN IT_M.

LOOP AT ITS1.

ITS1-ITEMID = ITS1-MATNR+12(6).

ITS1-DIFFQTY = ITS1-MENGE - ITS1-BUCHM.

ITS1-DIFFVALUE = ITS1-WRTZL - ITS1-WRTBM.

SELECT SINGLE MAKTX FROM MAKT INTO ITS1-ITEMDESC WHERE MATNR = ITS1-MATNR.

SELECT SINGLE GRTXT INTO ITS1-GRTXT FROM T157E WHERE GRUND = ITS1-GRUND AND SPRAS = 'E' AND BWART = ITS1-BWART.

MODIFY ITS1.

ENDLOOP.

PERFORM PRN_SMSTOCK_ALV.

                    • WRITING DATA FROM D TABLES**********

FORM PG_HEADER.

WRITE : 'PHYSICAL INVENTORY AUDIT REPORT PLANT : ', PLANT.

ENDFORM.

&----


*& Form PRN_SMSTOCK_ALV

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form PRN_SMSTOCK_ALV .

data: w_title type lvc_title,

w_repid type syrepid,

w_comm type slis_formname,

w_status type slis_formname,

x_layout type slis_layout_alv,

t_event type slis_t_event,

t_fieldcat type slis_t_fieldcat_alv,

t_sort type slis_t_sortinfo_alv.

refresh t_fieldcat.

refresh t_event.

refresh t_sort.

clear x_layout.

clear w_title.

perform set_fieldcat2 using:

1 'MTART' 'MTART' 'MARA' '15' space 'MATERIAL TYPE' space space space space space space space space SPACE t_fieldcat 'L' 'L',

2 'ITEMID' 'ITEMID' 'MARA' '7' space 'ITEM ID' space space space space space space space space SPACE t_fieldcat 'R' 'C',

3 'ITEMDESC' 'MAKTX' 'MAKT' '25' space 'MATERIAL DESCRIPTION' space space space space space space space space SPACE t_fieldcat 'L' 'C',

4 'MEINS' 'MEINS' 'MARA' '5' space 'UOM' space space space space space space space space SPACE t_fieldcat 'C' 'C',

5 'MENGE' 'MENGE' 'ISEG' '13' space 'ORG.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',

6 'WRTZL' 'WRTZL' 'ISEG' '13' space 'ORG.INV.VALUE' space space space space space space space space SPACE t_fieldcat 'R' 'C',

7 'BUCHM' 'BUCHM' 'ISEG' '13' space 'PHY.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',

8 'WRTBM' 'WRTBM' 'ISEG' '13' space 'PHY.INV.VALUE' space space space space space space space space SPACE t_fieldcat 'R' 'C',

9 'DIFFQTY' 'MENGE' 'ISEG' '13' space 'DIFF.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',

10 'DIFFVALUE' 'WRTZL' 'ISEG' '13' space 'DIFF.INV.VALUE' space space space space space space space space SPACE t_fieldcat SPACE 'P',

11 'BUDAT' 'BUDAT' 'ISEG' '18' space 'CORRECTED DATE' space space space space space space space space SPACE t_fieldcat 'C' 'C',

12 'GRTXT' 'GRTXT' 'ISEG' '18' space 'REASON' space space space space space space space space SPACE t_fieldcat 'L' 'L',

13 'REAS' 'REAS' 'ISEG' '18' space 'AUTH.BY' space space space space space space space space SPACE t_fieldcat 'C' 'C'

.

x_layout-zebra = 'X'.

perform set_top_page_heading using t_heading t_event.

perform set_events using t_event.

w_status = ''.

w_repid = sy-repid.

  • w_comm = 'USER_COMMAND'.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = w_repid

it_fieldcat = t_fieldcat

i_Callback_top_of_page = 'Top-of-page'

is_layout = x_layout

it_sort = t_sort

i_callback_pf_status_set = w_status

i_callback_user_command = w_comm

i_save = 'X'

it_events = t_event

i_grid_title = w_title

tables

t_outtab = ITS1

exceptions

program_error = 1

others = 2.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

ENDFORM.

FORM set_fieldcat2 USING

p_colpos p_fieldname p_ref_fieldname p_ref_tabname

p_outputlen p_noout

p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt

p_hotspot p_showasicon p_checkbox p_edit

p_dosum

t_fieldcat TYPE slis_t_fieldcat_alv

P_JUST

P_FTYPE.

DATA: wa_fieldcat TYPE slis_fieldcat_alv.

CLEAR wa_fieldcat.

  • General settings

wa_fieldcat-fieldname = p_fieldname.

  • wa_fieldcat-no_zero = 'X'.

wa_fieldcat-col_pos = p_colpos.

wa_fieldcat-no_out = p_noout.

wa_fieldcat-hotspot = p_hotspot.

wa_fieldcat-checkbox = p_checkbox.

wa_fieldcat-icon = p_showasicon.

wa_fieldcat-do_sum = p_dosum.

  • Set output length.

IF NOT p_outputlen IS INITIAL.

wa_fieldcat-outputlen = p_outputlen.

ENDIF.

  • Set text headers.

  • IF NOT p_seltext_m IS INITIAL.

wa_fieldcat-seltext_m = p_seltext_m.

  • ENDIF.

  • IF NOT p_seltext_l IS INITIAL.

wa_fieldcat-seltext_l = p_seltext_l.

  • ENDIF.

  • IF NOT p_seltext_s IS INITIAL.

wa_fieldcat-seltext_s = p_seltext_s.

  • ENDIF.

IF NOT p_reptext_ddic IS INITIAL.

wa_fieldcat-reptext_ddic = p_reptext_ddic.

ENDIF.

  • IF NOT p_ddictxt IS INITIAL.

wa_fieldcat-ddictxt = p_ddictxt.

  • ENDIF.

IF NOT P_JUST IS INITIAL.

WA_FIELDCAT-JUST = P_JUST.

ENDIF.

  • IF NOT P_JUST IS INITIAL.

  • wa_fieldcat-no_zero = 'X'.

  • endif.

  • Set as editable or not.

IF NOT p_edit IS INITIAL.

wa_fieldcat-Input = 'X'.

wa_fieldcat-edit = 'X'.

ENDIF.

APPEND wa_fieldcat TO t_fieldcat.

ENDFORM. "set_fieldcat2

======================== Subroutines called by ALV ================

&----


*& Form top_of_page

&----


  • Called on top_of_page ALV event.

  • Prints the heading.

----


form top_of_page.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = t_heading.

ENDFORM.

form set_top_page_heading using t_heading type slis_t_listheader

t_events type slis_t_event.

data: x_heading type slis_listheader,

x_event type line of slis_t_event.

  • Report title

clear t_heading[].

clear x_heading.

x_heading-typ = 'H'.

x_heading-info = 'PHYSICAL INVENTORY AUDIT REPORT'.

append x_heading to t_heading.

  • Plant Name

clear x_heading.

x_heading-typ = 'S'.

x_heading-key = 'PLANT : '.

x_heading-info = PLANT.

append x_heading to t_heading.

IF DATE2 = '00.00.0000'.

CONCATENATE DATE1 'to' DATE1 INTO DT SEPARATED BY SPACE.

ELSE.

CONCATENATE DATE1 'to' DATE2 INTO DT SEPARATED BY SPACE.

ENDIF.

X_heading-TYP = 'S'.

X_heading-key = 'PERIOD :'.

X_heading-INFO = DT.

APPEND x_heading TO t_heading.

*data : v_txt type c length 50.

*v_txt = 'ASDFASDFASDF DATE : 11.04.2007'.

  • Control Date

clear x_heading.

x_heading-typ = 'S'.

x_heading-key = 'CONTROL NO. :'.

x_heading-info = ' ASDFADDFAAS DATE : 11.04.2007'.

append x_heading to t_heading.

    • Control date

  • clear x_heading.

  • x_heading-typ = 'S'.

  • x_heading-key = 'CONTROL DATE : '.

  • x_heading-info = ''.

  • append x_heading to t_heading.

    • Time of execution

  • clear x_heading.

  • x_heading-typ = 'S'.

  • x_heading-key = 'DATE : '.

  • write sy-DATUM to x_heading-info.

  • append x_heading to t_heading.

*

  • Top of page event

x_event-name = slis_ev_top_of_page.

x_event-form = 'TOP_OF_PAGE'.

append x_event to t_events.

endform.

form set_events using t_events type slis_t_event.

data: x_event type line of slis_t_event.

endform.