Sunday, May 16, 2010

ALV Export Bizarre

Posted by Aries Wandari

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
image
Export result on field type MSEG-AUFNR.
image
Export result on field type char 12.
image

Wednesday, April 14, 2010

How to Find Weekdays on a Date in Excell

Posted by Aries Wandari

Helpdesk question of the day:
=CHOOSE(WEEKDAY(A1),"Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu")

Thursday, April 1, 2010

SAP > BDC Transfer Template

Posted by Aries Wandari

   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

Wednesday, March 31, 2010

SAP > Direct Edit on PO Price

Posted by Aries Wandari

     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.
clip_image002
Go to SE16N, type &sap_edit to activate direct edit mode on table. Key in parameter, and input desired value.
SE16N
clip_image004
&SAP_EDIT
clip_image006
Do direct edit
clip_image008

SAP > Freeze Full Release PO

Posted by Aries Wandari

     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
clip_image002
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.
clip_image004

SAP > Non Valuated Material Stock

Posted by Aries Wandari

     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
clip_image002
MB52
clip_image004
MM03 > Accounting1, field Total Stock (MBEW-LBKUM)
clip_image006
MM03 > Plant stock, field Unsres.use stock (MARD-LABST)
clip_image008

Monday, March 29, 2010

SAP > New Material Type

Posted by Aries Wandari

One of store audit finding result that we need to maintain ex-project material which has no value. This will be ‘non valuated material’. We need to define non valuated material type, material group, and valuation class.
1. Define material type OMS2
clip_image002
Create NVAL  material type reference to UNBW Nonvaluated materials
clip_image004
Select View. Set Internal/External Purchase Order to 0 since it will not go to procurement process. Set quantity updating in all valuation areas, and value updating in no val areas.
clip_image006
2. Define Number Range MMNR
Create new number range group and interval. Then assign the interval to the groups.
clip_image008
clip_image010
clip_image012
Experiment shows that on number range transport, current number is also transported to target system. We’ll set the number range for this non valuated material type manually.
clip_image002[4]
3. Set valuation class OMSK
Create NVAL Account Category ref
clip_image014
clip_image016
Create NonValuated valuation class
clip_image018
Assign val class to Account Category Ref
clip_image020