Requirements
Transaction Code | XD01 |
BADI Definition | CUSTOMER_ADD_DATA |
Method 1 to be Implemented | CHECK_ALL_DATA |
Functionality to be Implemented | Download the Customer data |
Method 2 to be Implemented | PRESET_VALUES_CCODE |
Functionality to be Implemented | Set default values for Company code |
To find out the package.
- Go to transaction code XD02.
To find out BADI defination
- Go to Transaction Code SE18.
- Initial screen looks like,
- Select BAdi name radio button.
- Click on F4 help.
- Pop-up will appear .
- Click on Information System.
- Pop-up will appear.
- Enter the package name and click on execute.
- In pop-up BADI definition will appear.
- Double click on BADI definition.
- Click on Display.
- Screen look like this,
- Click on interface tab , to find out the methods.
- Copy the BADI Definition name.
Implementation of BADI
- Go to Transaction Code SE19.
- Automatically BADI definition will pull's up.
- Click on Create Impl. Button.
- Pop-up will appear.
- Enter the Implementation name start's with Y or Z< implementation BADI name> and click on continue button.
- Screen looks like,
- Enter the Implementation short text.
- Click on Interface Tab.
- Automatically , Class will be created.
- Double click on Class name.
- Pop-up will appear.
- Click on Yes.
- One more pop-up will Appear.
- Click on continue.
- One more pop-up will appear.
- Either Select the existing Enhancement Implementation or Create the new Enhancement Implementation .
- To Create the new Enhancement Implementation , Click on Create new Enhancement Implementation Button .
- Pop-up will appear.
- Enter the Enhancement Implementation name start's with Y or Z.
- Enter the short description.
- Select the Enhancement Implementation name and click on continue.
method IF_EX_CUSTOMER_ADD_DATA~CHECK_ALL_DATA.
TYPES : BEGIN OF TY_KNA1,
KUNNR TYPE KNA1-KUNNR,
KTOKD TYPE KNA1-KTOKD,
NAME1 TYPE KNA1-NAME1,
ORT01 TYPE KNA1-ORT01,
LAND1 TYPE KNA1-LAND1,
END OF TY_KNA1.
DATA : WA_KNA1 TYPE TY_KNA1,
IT_KNA1 TYPE TABLE OF TY_KNA1.
DATA : FILENAME TYPE STRING.
CLEAR WA_KNA1.
WA_KNA1-KUNNR = S_KNA1-KUNNR.
WA_KNA1-KTOKD = S_KNA1-KTOKD.
WA_KNA1-NAME1 = S_KNA1-NAME1.
WA_KNA1-ORT01 = S_KNA1-ORT01.
WA_KNA1-LAND1 = S_KNA1-LAND1.
APPEND WA_KNA1 TO IT_KNA1.
CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
EXPORTING
WINDOW_TITLE = 'Select the file save location'
DEFAULT_EXTENSION = 'DOC'
* DEFAULT_FILE_NAME =
* WITH_ENCODING =
* FILE_FILTER =
* INITIAL_DIRECTORY =
IMPORTING
FILENAME = FILENAME
* PATH =
* FULLPATH =
* USER_ACTION =
* FILE_ENCODING =
.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = FILENAME
FILETYPE = 'ASC'
* APPEND = ' '
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = IT_KNA1
* FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endmethod.
- Save ->Check ->Activate.
- Click on Back button.
- To implement the second method.
- Select the method.
- Click on back button.
- Go to transaction code : XD01.
- Screen looks like,
- Select Account Group as : Bill-to-party.
- Customer number.
- Company code and press Enter.
- Select the Title.
- Name and search term and press ENTER,
- Click on Company Code data.
No comments:
Post a Comment