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