Using ABAP fuction “Z_GET_EOH_VALUE”, we can get Begining Stock, Begining AMT, Ending Stock, Ending AMT.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 *Ending Stock & AMT DATA: WA_EOH LIKE MBEWH. *If ther is no To(From~To) IF P_MONAT-HIGH = '00'. P_MONAT-HIGH = P_MONAT-LOW. ENDIF. LOOP AT IT_MAIN. CALL FUNCTION 'Z_GET_EOH_VALUE' EXPORTING matnr = it_main-matnr bwkey = it_main-werks lfgja = p_gjahr lfmon = p_monat-high IMPORTING eoh = wa_eoh. IF sy-subrc = 0. it_main-LLBKUM = wa_eoh-lbkum. it_main-LSALK3 = wa_eoh-SALK3. ENDIF. *Beginning Stock and AMT CLEAR WA_EOH. DATA: TEMP_MONAT LIKE IT_MAIN-MONAT. DATA: TEMP_GJAHR LIKE P_GJAHR. IF P_MONAT-LOW = '01'. TEMP_MONAT = '12'. TEMP_GJAHR = P_GJAHR - 1. ELSE. TEMP_MONAT = P_MONAT-LOW - 1. TEMP_GJAHR = P_GJAHR. ENDIF. CALL FUNCTION 'Z_GET_EOH_VALUE' EXPORTING matnr = it_main-matnr bwkey = it_main-werks lfgja = TEMP_GJAHR lfmon = TEMP_MONAT IMPORTING eoh = wa_eoh. IF sy-subrc = 0. it_main-LBKUM = wa_eoh-lbkum. it_main-SALK3 = wa_eoh-SALK3. ENDIF. MODIFY IT_MAIN. ENDLOOP.
2 Responses
Vinicius

July 10th, 2009 at 6:47 am
1Where is the function ‘Z_GET_EOH_VALUE’ ?
Tks
admin

August 13th, 2009 at 8:26 pm
2Sorry for late reply.
It’s my mistake that the function is only used in my project.
RSS feed for comments on this post · TrackBack URI
Leave a reply
Categories
Recent Posts
Recent Comments
Meta
Archives
Blogroll