Archive

Archive for the ‘ABAP’ Category

SAP ALE/IDoc Tutorial 2 – First ALE Example a

February 20th, 2012 No comments

This is the second post of this ALE tutorial series. In order to make some progress, I will give an example to guide you how to configure, test your first ALE example. Please consider below example. There are two systems: system A and system B. We would like send material master in system A to system B using ALE/IDoc. Below is the system diagram.

Read more…

SAP ALE/IDoc Tutorial 1 – Basic Concept

February 20th, 2012 No comments

In this series of posts, I try to provide a step by step tutorial on SAP ALE/IDoc. SAP provides a comprehensive documents in the help portal but I think it good for reference but not for beginners. It will be easier to have a step by step tutorial with screenshot. In the first post, I will give some explanation some abbreviations related to ALE/IDoc. Most of them come from SAP help portal. Please find the link in the reference section of this post.

ALE

Application Link Enabling (ALE) is a technology to create and run distributed applications. It comprises the controlled exchange of business messages and consistent data management in loosely-linked SAP application systems.

Application Link Enabling has three layers:

· Application services

· Distribution services

· Communication services

EDI

You use EDI if you want to exchange business application documents with an (external) partner system (for example, a customer or vendor). The SAP system sends EDI messages in IDoc format to an EDI subsystem, where they are converted to a universal EDI standard (UN/EDIFACT or ANSI/X12). This enables communication with non-SAP systems.

Read more…

SAP Terms of Payment Configuration

February 16th, 2012 No comments

Terms of payment is the key for defining payment term composed of cash discount percentages and payment period. It is maintained in the customer and vendor master record. The system will automatically defaults this key whenever you enter an item for this customer or vendor.

The payment term determines the valid cash discount rate for an individual payment with a maximum of 3 payment terms (first cash discount period, second cash discount period and due date for net payment) and also a baseline date for the payment. Below is the terms of payment configuration path.

Path

Financial Accounting – Accounts Receivable and Accounts Payable – Business Transactions – Outgoing Invoices/Credit Memos – Maintain Terms of Payment

T-code

OBB8

Choose standard terms of payment AD10 for an example.

Read more…

SAP Smartforms – Date and Decimal Format

February 14th, 2012 No comments

In the output of SAP smartforms, the format of date and decimal point is determined by the country and user setting according to how print program and smartform developed. Below explains how SAP standard configuration to handle this format issue.

1. Country Format Setting

Go to tcode – OY01 and select country ‘US’ for example.

image

2. Standard print program for billing document – RLB_INVOICE

routine entry is the first routine called. In this routine, routine processing will be called. In routine processing, billing destination country will be retrieved in subroutine get_data. I didn’t check more detail logic but I think database field VBRK-LAND1 contains this information.

Once this value is retrieved, it will call subroutine set_print_param and passed in this parameter. In this routine. function module WFMC_PREPARE_SMART_FORM will be called.

In this function module, below statement will be executed.

  SET COUNTRY pi_country.

Below is the explanation from SAP help.

SET COUNTRY cntry.

 

This statement sets the formatting settings of the langauge environment for all subsequent statements of the current internal session.

For cntry you must specify a character-like data object that either contains a value from the LAND column of the database table T005X or is initial.

  • When cntry contains a value from the table T005X, number format, date format, and time format are set according to the entries in the XDEZP, DATFM, and TIMEFM columns to a country-specific format.
  • When cntry is initial (contains a blank space in the first position), the formatting is set according to the fixed values in the user master record.

If the content of cntry is neither found in the database table T005X nor contains a blank space in the first position, then sy-subrc is set to 4 and the following settings are made:

  • Decimal separator is a period, thousand separator is a comma.
  • Date in the form "mm/dd/yyyy"
  • Time in 24-hour format

As long as the SET COUNTRY statement has not been carried out in an internal session, the formatting corresponds to the fixed values in the user master record.

FM – DATE_TO_PERIOD_CONVERT

February 7th, 2012 1 comment
REPORT ZPERIOD.
 
DATA: X_PERIOD LIKE T009B-POPER,
      X_YEAR   LIKE CSSL-GJAHR.
 
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
     EXPORTING
          I_DATE         = SY-DATUM
*         I_MONMIT       = 00
          I_PERIV        = 'K4'
     IMPORTING
          E_BUPER        = X_PERIOD
          E_GJAHR        = X_YEAR
     EXCEPTIONS
          INPUT_FALSE    = 1
          T009_NOTFOUND  = 2
          T009B_NOTFOUND = 3
          OTHERS         = 4.
 
WRITE: / 'Your Company Current Period', X_PERIOD, X_YEAR.
 
*-- End of Program

Read more…

SAP FI – Deductible and Non-deductible Tax

February 6th, 2012 No comments

Non-deductible taxes are taxes that are not allowable when calculating a taxable income. They are taxes that have been paid in the process of generating income or purchasing items, but they are not subtracted from the final taxable income. For example,

VAT 14% non-deductible 50%

100 EUR invoice (account 5080) 
7 EUR VAT goes to the VAT account 
7 EUR VAT goes back to the Expense account (5080)
Total invoice 107.00
Total VAT 7.00

How to configuration this scenario in SAP?

In Tax code A2, Enter 7% in condition type MWAS and 7% in condition type MWVZ.

Read more…

SAP FI – Coding Block

February 2nd, 2012 No comments

In the coding block of the system you can create your own fields. The new coding fields can then be used in FI General Ledger accounts, MM Inventory Management and MM Purchasing, and are also updated in the line items created in the Controlling applications.

If you have created customer fields, they are updated by the system during automatic postings. To enable you to post these fields in the Enjoy transactions manually, you must assign the fields to the entry variants in the Enjoy posting transactions. To do this, choose Include Customer Fields in Enjoy Transactions.

Requirements

You require a test system in order to include coding fields.

The changes are recorded in the test system in a transport request and can thus be transported into other systems. To include coding fields, you require the following authorizations:

  • New field inclusion in coding block X_COBLMOD
  • Maintenance of cross-client tables S_TABU_CLI
  • Dictionary authorization S_DEVELOP
  • Transport authorization S_TRANSPRT

Read more…

How to hide SAP standard button in standard transaction

February 2nd, 2012 No comments

Business user might need to hide some buttons in SAP standard transaction code because they don’t want there functions to be abused. We assume there function couldn’t be controlled by authorization objects. SAP provides transaction variant to change SAP standard UI.

Transaction variants can simplify transaction runs as they allow you to:

  • Preassign values to fields
  • Hide and change the ‘ready for input’ status of fields
  • Hide and change table control column attributes
  • Hide menu functions
  • Hide entire screens
    In particular, hiding fields in connection with screen compression, and hiding screens, can result in greater clarity and simplicity.

Transaction variants are made up of a sequence of screen variants. The field values and field attributes for the individual screens found in transaction variants are stored in screen variants. Each of these variants is assigned to a specific transaction, can, however, also contain values for screens in other transactions if this is required by transaction flow. The transaction that the variant is assigned to serves as initial transaction when the variant is called.

For example, if we need to hide button ‘Reject document’ in tcode VA02. Below are the detail steps.

Read more…

SAP ABAP – Convert number to chinese character function module

January 9th, 2012 No comments

Only Chinese Project will use this funtion module.Usually in account document print.

To english character,we can use function module spell_amout.

The sample code use the function module spell_amount is RF_SPELL.

Below is the function module convert number to chinese character

FUNCTION z_convert_numeric_to_chinese.
*";----------------------------------------------------------------------
*";*";Local interface:
*";  IMPORTING
*";     REFERENCE(PI_MONEY) LIKE  BSEG-DMBTR
*";  EXPORTING
*";     REFERENCE(PO_CHINESE)
*";  EXCEPTIONS
*";      WRONG_MONEY
*";----------------------------------------------------------------------
  IF pi_money = 0.
    po_chinese = '零'.
    EXIT.
  ENDIF.
  DATA:money_str(13).
  money_str = pi_money.
  IF money_str CN '0123456789. '.
    RAISE wrong_money.
  ENDIF.
  DATA:i TYPE i.
  IF money_str CS '.'.
    i = sy-fdpos + 1.
 
    money_str+sy-fdpos = money_str+i.
  ENDIF.
  CONDENSE money_str NO-GAPS.
  DATA:units_off TYPE i,
         curnt_off TYPE i.
  DATA:lastd TYPE n,curntd TYPE n.
  DATA:cword(2),weight(2).
  DATA:units(30) VALUE ' 分 角 元 拾 佰 仟 万 拾 佰 仟 亿 拾 佰 仟 万',
         digts(20) VALUE ' 零 壹 贰 叁 肆 伍 陆 柒 捌 玖'.
  CLEAR:po_chinese,units_off.
  lastd = 0.
  units_off = 0.
  curnt_off = STRLEN( money_str ) - 1.
  WHILE curnt_off >;= 0.
    curntd = money_str+curnt_off(1).
    i = curntd * 2.
    cword = digts+i(2).
 
    weight = units+units_off(2).
 
    i = units_off / 2.
    IF curntd = 0.             ";Current digit is 0
      IF i = 2 OR i = 6 OR i = 10.
        CLEAR:cword.
        IF curnt_off = 0.
          CLEAR:weight.
        ENDIF.
      ELSEIF lastd = 0.
        CLEAR:cword,weight.
      ELSE.
        CLEAR:weight.
      ENDIF.
    ENDIF.
    CONCATENATE cword weight po_chinese INTO po_chinese.
    lastd = curntd.
    SUBTRACT 1 FROM curnt_off.
    ADD 2 TO units_off.
  ENDWHILE.
  IF po_chinese NS '分'.
    CONCATENATE po_chinese '整' INTO po_chinese.
  ELSE.
    cword = po_chinese.
    IF cword = '零'.
      SHIFT po_chinese BY 2 PLACES.
    ENDIF.
  ENDIF.
*-----------------BEGIN----------------------------
*&; 当数值为100,000,000.01 时,调用该函数
*&; ,显示出来为壹亿万元零壹分,加上该段
*&; ,则读为壹亿元零壹分。
  SEARCH po_chinese FOR '亿 万'.
  IF sy-subrc = 0.
    REPLACE '亿 万' WITH '亿' INTO po_chinese.
  ENDIF.
*-----------------END------------------------------
  CONDENSE po_chinese NO-GAPS.
 
 
 
ENDFUNCTION.

ABAP Programming – ABAP General

January 4th, 2012 No comments

The following diagram shows the components of SAP ABAP. Generally speaking, it contains the ABAP language, development environment, runtime environment, technologies that based on ABAP and other tools & services. All these components forms the ABAP (Advanced Business Application Programming).

In order to be a senior ABAP consultant, you should have a good command of all these components. I wants to share my personal experience on all these topics.

ABAP Overview

Read more…