Saturday, May 30, 2015

Add Day, Month, Year to DATE Variable in ABAP

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
  EXPORTING
    DATE            = SY-DATUM
    DAYS            = 0                  "Give the number of day to add or subtract
    MONTHS          = 1            
"Give the number of months to add or subtract
    SIGNUM          = '-'             " For Addition give (+) and for Subtraction give (-)
    YEARS           = 0               "Give the number of years to add or subtract  
  IMPORTING
    CALC_DATE       = ZFBDT.

Sunday, May 10, 2015

Reverse Noted Item F-57 for Previous Fiscal Year

Problem - You want to reverse the Noted Item that is of previous fiscal year, and you are not allowed to do so as because you had a migration to NEW GL.

Solution - In order to reverse the noted item posted by T-Code F-57, create another debit entry to same vendor with same other account characteristics by using the same transaction F-57.

Step 1 - You performed F-57
It will create a credit entry with a special gl indicator.

Now in order to reverse
Step 2 - Again run F-57
This time create a debit entry with same special gl indicator and also keeping same other account characteristics same it was creating the credit entry.

This will make the vendor account balance "0" for these two items.


Now do F-51 and select these 2 open items and clear them out.

This will have the same result as of doing FB08.

Friday, May 8, 2015

MR8M Reversal Issue - "Balancing field center" in the line item 001 not filled.

If posted MIRO document is having more than one associated FI documents, system is not picking the relevant invoice document while reversing the document, Which leads to error "Balancing field center" in the line item 001 not filled.

Business area has been updated wrongly for vendor line while reversing the invoice document from MR8M transaction.

Kindly apply the code correction mentioned in Note - " 2162403 - Business area updated wrongly in vendor line of MR8M document"

Call Program in Function Module ABAP

I have created a function module by name 'ZQTR_VACCANT'.
Purpose of this function module is to fetch the data from the program.
Result of the function module will be displayed on the ASP NET Portal.
You can call any program by replacing the ZTM_QURTER_STATUS and with parameters required to execute the program.
At the end you will get the result in TEXTLINES.
It will be separated by | 'PIPE' sign.
Split it as per your requirement.

FUNCTION ZQTR_VACCANT.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(TOWNSHIPID) TYPE  ZTM_TOWNSHIPID
*"     VALUE(VACANT) TYPE  SY-UCOMM
*"  TABLES
*"      ITAB STRUCTURE  ZQTR_VACCANT
*"----------------------------------------------------------------------
DATALIST_TAB TYPE TABLE OF ABAPLIST.
DATATEXTLINES(1024TYPE C OCCURS WITH HEADER LINE.
DATAWA_TEXTLINES LIKE LINE OF TEXTLINES.

SUBMIT ZTM_QURTER_STATUS WITH TOWNSHIP TOWNSHIPID
                         WITH VACANT VACANT
                         EXPORTING LIST TO MEMORY
                         AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
    LISTOBJECT LIST_TAB
  EXCEPTIONS
    NOT_FOUND  1
    OTHERS     2.

IF SY-SUBRC 0.
  CALL FUNCTION 'WRITE_LIST'
    TABLES
      LISTOBJECT LIST_TAB.
ENDIF.

CALL FUNCTION 'LIST_TO_ASCI'
  TABLES
    LISTOBJECT LIST_TAB
    LISTASCI TEXTLINES
  EXCEPTIONS
    EMPTY_LIST 1
    LIST_INDEX_INVALID 2
  OTHERS 3.

TYPESBEGIN OF ST,
        SNO1 TYPE BELNR_D,
        SNO TYPE BELNR_D,
        TYPEID TYPE ZTM_TYPEID,
        SUBTYPEID TYPE ZTM_SUBTYPEID,
        BUILDINGID TYPE ZTM_BUILDINGID,
        QUARTERID TYPE ZTM_QUARTERID,
        FLOOR  TYPE ZTM_FLOOR,
        LOCATION TYPE ZTM_LOCATION,
        ENDDATE(10),
       END OF ST.
DATAIT TYPE STANDARD TABLE OF ST.
DATAWA LIKE LINE OF IT.

LOOP AT TEXTLINES INTO WA_TEXTLINES.
  CHECK SY-TABIX GT 9.
  " SPLIT PIPE DELIMITED DATA
  SPLIT WA_TEXTLINES AT '|' INTO WA-SNO1 WA-SNO WA-TYPEID WA-SUBTYPEID WA-BUILDINGID WA-QUARTERID WA-FLOOR WA-LOCATION WA-ENDDATE.
  APPEND WA TO IT.
  CLEAR  WA.
ENDLOOP.

LOOP AT IT INTO WA.
  IF WA-TYPEID IS NOT INITIAL.
    MOVE-CORRESPONDING WA TO ITAB.
    APPEND ITAB.
  ENDIF.
ENDLOOP.

ENDFUNCTION.

Monday, May 4, 2015

Testing a Database Connection Defined in DBCON

Define the external database connection by using the T-Code 'DBCO'.

After defining to test the above connection execute the T-Code SE38
Run Program ADBC_TEST_CONNECTION.