Dear CSDN predecessors, one small ABAP want to ask, want to for mseg - menge (to do) accumulative
Want to render into Excel chart types, 321, 122 such changes are deducted, 101 is add
Whether the final answer to become the Excel in this way, please predecessors greatly help thank you...
TABLES: MSEG.
*& -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
*& Selection screen
*& -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
SELECTION - SCREEN the BEGIN OF BLOCK BK1 WITH FRAME TITLE TITLE1.
SELECTION - SCREEN COMMENT/1 (50) REM01.
SELECTION - SCREEN END OF BLOCK BK1.
SELECTION - SCREEN the BEGIN OF BLOCK BK2 WITH FRAME TITLE TITLE2.
SELECT the OPTIONS - DD FOR SY - DATUM NO - EXTENSION.
SELECTION - SCREEN END OF BLOCK BK2.
INITIALIZATION.
REM01='20190620) production.
TITLE1='description area.
TITLE2='selection area.
START - OF - SELECTION.
*& -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
*& Declare the Work area
*& -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
"ALV informs the
DATA IT_ALV TYPE SLIS_FIELDCAT_ALV OCCURS 0 WITH the HEADER LINE.
DATA WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
"The data collect
DATA: the BEGIN OF IT_MSEG OCCURS 0,
SEL TYPE C,
End the type c,
* end of TYPE string,
Insmk type mseg - insmk, "inspection whether
Budat_mkpf like mseg - budat_mkpf,
Cpudt_mkpf like mseg - cpudt_mkpf,
Cputm_mkpf like mseg - cputm_mkpf,
Lifnr like mseg - lifnr,
SHKZG like mseg - SHKZG,
Ebeln like mseg - ebeln,
Ebelp like mseg - ebelp,
Werks like mseg - werks,
MBLNR like mseg - MBLNR,
Mjahr like mseg - mjahr,
Zeile like mseg - zeile,
Bwart like mseg - bwart,
Matnr like mseg - matnr,
Menge like mseg - menge,
The test like mseg - menge,
Itm TYPE I, "NUM
END OF IT_MSEG.
DATA: the BEGIN OF IT_PO OCCURS 0,
Ebeln like mseg - ebeln,
Ebelp like mseg - ebelp,
Menge like mseg - menge,
End of it_PO.
"MSEG move type
"101 stock
"102 RE stock
"122 acceptance turn bad return
"Acceptance of 123 RE turn bad return
"321 qualified turned inventory
"Acceptance of 322 RE turned inventory
Select * into Corresponding Fields Of it_mseg
The from mseg
Where bwart in (' 101 ', '102', '321', '322', '122', '123')
And ebeln & lt;> '
And matnr & lt;> "'" assets not included in the
And xauto & lt;> 'X' "the system automatically generate
='2019' and MJAHR "annual
And EBELN IN (' 4100009321 ', '4100012899'). "purchase order
If it_mseg - bwart='102'
The or it_mseg - bwart='122'
The or it_mseg - bwart='321'.
It_mseg - menge=1 * it_mseg - menge.
Endif.
Append it_mseg.
Endselect.
Loop at it_mseg where bwart='101' and insmk="'.
It_mseg - bwart='321'.
It_mseg - menge=1 * it_mseg - menge.
Append it_mseg.
Endloop.
Loop at it_mseg.
MOVE - CORRESPONDING it_mseg TO it_po.
Collect it_po.
Endloop.
Loop at it_po where menge=0.
The Delete it_po.
Endloop.
Sort it_mseg by
Ebeln Ascending ebelp Ascending
Cpudt_mkpf Ascending cputm_mkpf Ascending.
Loop at it_mseg.
Read the table it_po
With the key ebeln=it_mseg - ebeln ebelp=it_mseg - ebelp.
If sy - subrc=0.
It_mseg - end='Y'.
Endif.
The modify it_mseg Transporting end.
Endloop.
DATA zharry TYPE mseg - ebeln.
LOOP AT it_mseg.
Zharry=it_mseg - ebeln.
It_mseg - itm=0.
READ the TABLE it_mseg INDEX sy - tabix - 1.
IF it_mseg - ebeln=zharry.
It_mseg - itm=it_mseg - itm + 1.
ELSE.
It_mseg - itm=1.
ENDIF.
The MODIFY it_mseg INDEX sy - tabix + 1 TRANSPORTING itm.
The CLEAR it_mseg.
ENDLOOP.
LOOP AT it_mseg.
IF it_mseg - itm=1.
It_mseg - test=it_mseg - menge.
ELSE.
It_mseg - test="'.
ENDIF.
The MODIFY it_mseg TRANSPORTING test.
The CLEAR: it_mseg.
ENDLOOP.
LOOP AT it_mseg.
ENDLOOP.
*
* DATA: LIN, TYPE I, OCC TYPE i.
*
* loop at it_mseg.
*
*
* READ the TABLE it_mseg WITH KEY EBELN=it_mseg - EBELN.
*
*
* it_mseg - test=it_mseg - menge.
*
*
*
*
*
*
*
* MODIFY it_mseg TRANSPORTING test.
* the CLEAR: it_mseg.
*
* Endloop.
*& -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
*& ALV Area
*& -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
CALL the FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME=SY - REPID
I_INTERNAL_TABNAME='IT_MSEG'
I_INCLNAME=SY - REPID
CHANGING
CT_FIELDCAT=IT_ALV [].
IF SY - SUBRC & lt;> 0.
* Implement suitable error handling here
ENDIF.
WA_LAYOUT - ZEBRA='X'.
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull