Creating report ZMMF003 using ALV and export it to excell file. One of the data field is MSEG-AUFNR. Result in ALV layout is ok. But once I export it (to txt or excell) it truncated. Export giving correct result once MSEG-AUFNR changed to type char 12 (AUFNR is char 12).
ALV Result
![]()
Export result on field type MSEG-AUFNR.
Export result on field type char 12.
Helpdesk question of the day:
=CHOOSE(WEEKDAY(A1),"Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu")
After create recording on SHDB and transfer it to a program, steps below will do data transfer from txt data source to SAP:
1. itab data definition.
2. Define filename as data source.
3. Loop at itab
4. Transfer itab data
Line in purple are inserted based from pure SHDB recording.
----------------------------
report ZBDC_ZZZ
no standard page heading line-size 255.
include bdcrecx1.
* 1. itab data definition
data: begin of itab occurs 0,
vbeln(10),
end of itab.
start-of-selection.
* 2. Define filename as data source
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = 'C:\ZZZ.txt'
FILETYPE = 'ASC'
TABLES
DATA_TAB = ITAB
* EXCEPTIONS
* CONVERSION_ERROR = 1
* FILE_OPEN_ERROR = 2
* FILE_READ_ERROR = 3
* INVALID_TABLE_WIDTH = 4
* INVALID_TYPE = 5
* NO_BATCH = 6
* UNKNOWN_ERROR = 7
* GUI_REFUSE_FILETRANSFER = 8
* OTHERS = 9
.
* 3. Loop internal table
LOOP AT ITAB.
perform open_group.
* 4. transfer itab data
perform bdc_field using 'LIKP-VBELN'
ITAB-VBELN.
perform bdc_dynpro …
perform bdc_field …
perform bdc_transaction using '…'.
* End Loop
ENDLOOP.
perform close_group.
--------------
Note that we must create txt data source based on data type length. Example: I do upload material stock with parameter material number (length 18), stock quantity (length 6), and store location (length 16). Below are the format:
2000000309 2 S600
2000000340 2 S100
2000000388 2 S600
2000000437 2 S202
2000000459 3 S100
Freeze PO on Fully Release state do trouble. Urgent PO need to be revised and time to make direct edit to table. To edit PO net price, we need to edit Net price (and total price) (EKPO) and edit Condition (KONV). Link between EKKO and KONV is field KNUMV.
![]()
Go to SE16N, type &sap_edit to activate direct edit mode on table. Key in parameter, and input desired value.
SE16N
![]()
&SAP_EDIT
![]()
Do direct edit
One of procurement audit finding is, PO release has to be reset whether PO value increase or decrease. Old fashion way, PO release only reset if total value is increase only. Testing and googling shows that there is no way PO release reset if total value is decrease. So we choose freeze PO on its fully release state.
SPRO > IMG > Materials Mangement > Purchasing > Purchase Order > Release Procedure for Purchase Orders > Define Release Procedure for Purchase Orders > Release Indicator
![]()
But then problem occur. If user want to edit the PO, it has to be un-released first. And still PO cant be un-released if PO has been issued (error is ‘Document has already been outputted… ’). We still waiting the solution from SAP. Or we need to create new different procurement procedure for this. Or, another solution is using user-exit.
Something interesting found in this non valuated material. I’ve GR non val material 1700000015 for 15 EA. But in my customized report ZMMF001, the total stock is not updated. But in SAP standard report MB52, the quantity is updated. In report ZMMF001 I use account MBEW-LBKUM as a reference. While on MB52 it use MARD-LABST as reference.
ZMMF001
![]()
MB52
![]()
MM03 > Accounting1, field Total Stock (MBEW-LBKUM)
![]()
MM03 > Plant stock, field Unsres.use stock (MARD-LABST)