SAPLab-SAP Tips! ABAP Tips!

SAP ABAP User!

BSEG will contains all items data.
try to make use of this FM
AC_DOCUMENT_RECORD.
or

1
2
3
4
5
6
7
8
9
10
11
12
call function ‘FI_DOCUMENT_RECORD’
exporting
i_awtyp = ‘RMRP’
i_awref = w_awref1 —>IR number of PO
i_aworg = w_gjahr1—-.year
 
I_AWSYS = ‘ ‘
I_AWTYP_INCL = ‘ ‘
I_AWTYP_EXCL = ‘ ‘
I_BUKRS = ‘ ‘
tables
t_documents = t_doc.

Use below ABAP function, you can calculate days.

1
2
3
4
5
6
7
8
9
10
11
12
CALL FUNCTION ‘FIMA_DAYS_AND_MONTHS_AND_YEARS’
EXPORTING
I_DATE_FROM = ‘19991008′
I_DATE_TO = ‘20000116′
IMPORTING
E_DAYS = T_DAYS
E_MONTHS = T_MONTHS
E_YEARS [...]

ABAP Function-Z_GET_EOH_VALUE

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: [...]

  
<-- Google fenxi --!> <-- google fenxi end --!>