Category Archives: Uncategorized

Asset report

Here the need for total asset value and attribute in one report , some keys value :

Asset Number: ANLA-ANLN1
Asset Sub-Number:ANLA-ANLN2
Description:ANLA-TXT50
Asset Class:ANLA-ANLKL
Asset Class Name:ANKT-TXK50
Cost Center:ANLZ-KOSTL
Cost Center Name:CSKT-KLTXT
Room:ANLZ-RAUMN
Capitalized Date:ANLA-AKTIV
Cumulate Acquisition Value:ANLC-KANSW
Ordinary Depreciation Start Date:ANLB-AFABG
Rate:1/ANLB-NDJAR
Monthly Depreciation: ANLC-KANSW * (1/ANLB-NDJAR)
Useful Life (Year): ANLB-NDJAR
Useful Life (Period) : ANLB-NDPER
Expired Useful Life (Year) : ANLC-NDABJ
Expired Useful Life (Period): ANLC-NDABP
Accumulate Ordinary Depreciation: ANLC-KNAFA + ANLC-NAFAG
Remain Value : ANLC-KANSW – (ANLC-KNAFA + ANLC-NAFAG)

http://www.consulting.mungapen.com/?p=318
http://www.erpgreat.com/abap/step-for-using-query-sq01-sq02-sq03.htm
http://www.erpgreat.com/abap/step-for-using-query-sq01-sq02-sq03-2.htm

Essential Sap Reports for Managers

Advertisements

SAP create bank key tcode

FI12 – Change House banks/bank Accounts FI – Master Data
FI01 – create bank Cross Application – Bank
FI02 – Change bank Cross Application – Bank
OY17 – Countries – field checks Cross Application – Bank
FBKP – Maintain Accounting Configuration FI – Basic Functions
FI06 – Set Flag to Delete bank Cross Application – Bank
FI03 – Display bank Cross Application – Bank
BAUP – bank Data Transfer Cross Application – Bank
BA01 – Table T005BU Cross Application – Bank
OY01 – Customize: set up countries Cross Application – Global Organization Customizing
OBD3 – C FI Maintain Table T077K FI – Basic Functions
SPACKAGE – Package Builder Basis – Package Tools
OB23 – C FI Maintain Table T078K FI – Basic Functions
OBR4 – Delete banks FI – Basic Functions
OX15 – Define internal trading partner FI – Basic Functions

 

Read more: http://www.sapland.com

ABAP crimes

In this blog postGungor Ozcelebi selects his top ten ABAP code crimes. .He invites you to join and discuss your examples and share cases you’ve experienced in the comments section.

ABAP crimes list:

1. Complete program with no modularization blocks

2. Modification/repairs

3- Not considering performance

4- Development in productive and quality assurance systems

5- No success and failure checks

6- Not using exceptions

7- Copying big templates to every program

8- Too many global definitions

9- Lack of comments

10-  Too many errors and warnings after SLIN and SCI checks in a recently developed program.

11- Copying standard programs

12- Writing code like 1999

13-  Badly formatted source code.

14- Avoid ‘Hard codings’

15- Using exit and commit work statements in enhancements 

BDC Program to Upload GL Transaction

Using this program to upload data from Excel file to FB01 via BDC Recording.

Download program ZK_FI_BDC_GL_V2  : http://binbox.io/OiCXA#Iw5c2X67

( Type pass : Iw5c2X67 )

This program read Excel file ( or save as tab text file ) to internal table , check and process using BDC method.

Download sample file ( TXT format ) to run with this program .

http://binbox.io/oXa7X#3J0TvtF7

Coder : Khoa Huynh

SAP ABAP – Uploading Excel Sheet Data & Saving It To FB01 Transaction Using BDC Session Or Call Transaction Method.

This is a sample program on uploading FI documents into SAP system

. Also this program shows how to upload multiple line items through BDC sessions

.
Upload the financial documents from a legacy system (excel file) into SAP using transaction code FB01. The file to be uploaded is specified on the selection screen by the user. The same file is displayed on the output screen in ALV Format (grid display) along with status details (success/failure).Also, the successful transaction is uploaded into the SAP system.
ALSO this program download all the error message and success messages in excel sheets.
SAMPLE PROGRAM:
REPORT ztest_fi_bdc_fb01_upload MESSAGE-ID zfimessages.
TYPE-POOLS: truxs,slis.
* STRUCTURE FOR INTERNAL TABLE
TYPES:BEGIN OF x_file,
documentreferencenumber TYPE augbl, “Variable name for document reference number.

documentdate(10) TYPE c, “Variable name for document date.

documenttype TYPE blart, “Variable name for document type.

companycode TYPE bukrs, “Variable name for company code.
postingdate(10) TYPE c, “Variable name for posting date.

period TYPE monat, “Variable name for fiscal period.
currency TYPE waers, “Variable name for currency code.

reference TYPE xblnr1, “Variable name for reference.
postingkey TYPE newbs, “Variable name for posting key.
account TYPE newko, “Variable name for account number.
amount(16) TYPE c, “Variable name for amount.
taxcode TYPE mwskx, “Variable name for taxcode.
businessarea TYPE gsber, “Variable name for business area.
profitcenter TYPE prctr, “Variable name for profit center.

valuedate(10) TYPE c, “Variable name for value date.

status(1) TYPE c, “Variable name for status.
description TYPE string, “Variable name for description.
END OF x_file.
* STRUCTURE FOR MESSAGE STATUS
TYPES: BEGIN OF x_mess,
documentreferencenumber TYPE augbl, “Variable name for document reference number.

status(1) TYPE c, “Variable name for status of the message.

description TYPE string, “Variable name for description of the message.
END OF x_mess.
TYPES: BEGIN OF x_header,
field1(20) TYPE c,
END OF x_header.
TYPES: BEGIN OF x_down,
documentreferencenumber TYPE n,
END OF x_down.
DATA: v_statusd TYPE n,
it_check TYPE STANDARD TABLE OF x_file,
wa_check TYPE x_file.
DATA: it_header TYPE STANDARD TABLE OF x_header,
wa_header TYPE x_header,
p_filee TYPE string,
p_files TYPE string.
* DATA DECLARATION FOR INTERNAL TABLES, WORKAREAS, VARIABLES
DATA: it_upload TYPE STANDARD TABLE OF x_file,” IT To Store Data From Excel Sheet

wa_upload TYPE x_file,
wa_upload1 TYPE x_file,
it_type TYPE truxs_t_text_data,
it_successmess TYPE STANDARD TABLE OF x_file,
wa_successmess TYPE x_file,
it_errormess TYPE STANDARD TABLE OF x_file,
wa_errormess TYPE x_file,
it_bdcdata TYPE STANDARD TABLE OF bdcdata, :” IT To Store Data Field Names & Values Of Each Screen.
wa_bdcdata TYPE bdcdata,
it_messagelog TYPE STANDARD TABLE OF bdcmsgcoll, ” IT To Store Messages

wa_messagelog TYPE bdcmsgcoll,
v_itirate TYPE c,
v_msg TYPE string VALUE ‘ is missing.’,
v_finalmsg TYPE string VALUE ”,
it_success TYPE STANDARD TABLE OF x_mess,
wa_success TYPE x_mess,
v_validate_fg TYPE c,
v_temp TYPE c.
* DATA DECLARATION FOR ALV GRID DISPLAY
DATA: it_alv_fieldcat TYPE slis_t_fieldcat_alv,
wa_alv_fieldcat TYPE slis_fieldcat_alv,
it_alv_layout TYPE slis_layout_alv.
* DATA DECLARATION FOR VALIDATION OF BDC SESSION METHOD
CONSTANTS: c_documentdate TYPE c LENGTH 20 VALUE ‘Document date’,
c_documenttype TYPE c LENGTH 20 VALUE ‘Document type’,
c_companycode TYPE c LENGTH 20 VALUE ‘Company code’,
c_postingdate TYPE c LENGTH 20 VALUE ‘Posting date’,
c_period TYPE c LENGTH 20 VALUE ‘Fiscal period’,
c_currency TYPE c LENGTH 20 VALUE ‘Currency code’,
c_postingkey TYPE c LENGTH 20 VALUE ‘Posting key’,
c_account TYPE c LENGTH 20 VALUE ‘Account’,
c_amount TYPE c LENGTH 20 VALUE ‘Amount’,
c_documentreferenceno TYPE c LENGTH 20 VALUE ‘Document reference #’,
c_x TYPE c VALUE ‘X’,
c_comma TYPE c VALUE ‘,’,
c_session(12) TYPE c VALUE ‘FB01_SESSION’,
c_transaction TYPE tstc-tcode VALUE ‘FB01’,
c_mode TYPE c VALUE ‘N’,
c_update TYPE c VALUE ‘S’,
c_y TYPE c VALUE ‘Y’.
* BLOCK 1 FOR FILE NAME & BLOCK 2 FOR TYPE OF PROCESS.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME
TITLE text-001.
PARAMETERS: p_fname TYPE rlgrap-filename OBLIGATORY,
p_error TYPE rlgrap-filename,
p_succes TYPE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME
TITLE text-002.
PARAMETERS: rb_sessi RADIOBUTTON GROUP grp1 USER-COMMAND flag,
rb_trans RADIOBUTTON GROUP grp1 DEFAULT ‘X’.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME.
PARAMETERS: p_sname TYPE apqi-groupid obligatory.
SELECTION-SCREEN END OF BLOCK b3.
p_files = p_succes.
p_filee = p_error.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
PERFORM get1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_succes.
PERFORM get2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_error.
PERFORM get3.
AT SELECTION-SCREEN OUTPUT.
PERFORM modify_screen.
START-OF-SELECTION.
PERFORM alv_setup.
* TRANSFER DATA FROM EXCEL SHEET TO INTERNAL TABLE


CALL FUNCTION ‘TEXT_CONVERT_XLS_TO_SAP’
EXPORTING
i_line_header = c_x
i_tab_raw_data = it_type
i_filename = p_fname
TABLES
i_tab_converted_data = it_upload[]
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
* IF FILE OTHER THAN EXCEL, THROW ERROR “Excel File Conversion Failed”.
IF sy-subrc <> 0.
v_validate_fg = c_x.
MESSAGE i003.
STOP.
ENDIF.
* IF FILE IS EMPTY, THROW ERROR “Excel File Is Empty”.
IF it_upload IS INITIAL.
v_validate_fg = c_x.
MESSAGE i004.
STOP.
ENDIF.
* SELECT A PROCESS : SESSION OR CALL TRANSACTION
CHECK v_validate_fg <> c_x.
IF rb_sessi = c_x.
PERFORM session.
ELSE.
PERFORM transaction.
ENDIF.
*&———————————————————————*
*& Form session
*&———————————————————————*
* Using Session method
*———————————————————————-*
FORM session.
*VALIDATION FOR SESSION METHOD
LOOP AT it_upload INTO wa_upload.
wa_upload1 = wa_upload.
AT NEW documentreferencenumber.
IF wa_upload1-documentreferencenumber IS INITIAL.
wa_upload1-status = text-003.
CONCATENATE c_documentreferenceno v_msg INTO v_msg.
wa_upload1-description = v_msg.
ENDIF.
IF wa_upload1-documentdate IS INITIAL.
wa_upload1-status = text-003.
CONCATENATE c_documentdate v_msg INTO v_msg.
wa_upload1-description = v_msg.
ENDIF.
IF wa_upload1-documenttype IS INITIAL.
wa_upload1-status = text-003.
CONCATENATE c_documenttype v_msg INTO v_msg SEPARATED BY c_comma.
wa_upload1-description = v_msg.
ENDIF.
IF wa_upload1-companycode IS INITIAL.
wa_upload1-status = text-003.
CONCATENATE c_companycode v_msg INTO v_msg SEPARATED BY c_comma.
wa_upload1-description = v_msg.
ENDIF.
IF wa_upload1-postingdate IS INITIAL.
wa_upload1-status = text-003.
CONCATENATE c_postingdate v_msg INTO v_msg SEPARATED BY c_comma.
wa_upload1-description = v_msg.
ENDIF.
IF wa_upload1-period IS INITIAL.
wa_upload1-status = text-003.
CONCATENATE c_period v_msg INTO v_msg SEPARATED BY c_comma.
wa_upload1-description = v_msg.
ENDIF.
IF wa_upload1-currency IS INITIAL.
wa_upload1-status = text-003.
CONCATENATE c_currency v_msg INTO v_msg SEPARATED BY c_comma.
wa_upload1-description = v_msg.
ENDIF.
ENDAT.
IF wa_upload1-postingkey IS INITIAL.
wa_upload1-status = text-003.
CONCATENATE c_postingkey v_msg INTO v_msg SEPARATED BY c_comma.
wa_upload1-description = v_msg.
ENDIF.
IF wa_upload1-account IS INITIAL.
wa_upload1-status = text-003.
CONCATENATE c_account v_msg INTO v_msg SEPARATED BY c_comma.
wa_upload1-description = v_msg.
ENDIF.
IF wa_upload1-amount IS INITIAL.
wa_upload1-status = text-003.
CONCATENATE c_amount v_msg INTO v_msg SEPARATED BY c_comma.
wa_upload1-description = v_msg.
ENDIF.
IF v_msg CO ‘ is missing.’.
wa_upload1-status = text-004.
wa_upload1-description = ”.
ENDIF.
MODIFY it_upload FROM wa_upload1.
CLEAR wa_upload1.
v_msg = text-005.
ENDLOOP.
* OPEN BDC GROUP
PERFORM bdc_open_grp.
LOOP AT it_upload INTO wa_upload.
v_itirate = c_x.
wa_upload1 = wa_upload.
AT NEW documentreferencenumber.
v_itirate = c_y.
PERFORM bdc_dynpro USING ‘SAPMF05A’ ‘0100’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘RF05A-NEWKO’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘/00’.
PERFORM bdc_field USING ‘BKPF-BLDAT’
wa_upload1-documentdate.
PERFORM bdc_field USING ‘BKPF-BLART’
wa_upload1-documenttype.
PERFORM bdc_field USING ‘BKPF-BUKRS’
wa_upload1-companycode.
PERFORM bdc_field USING ‘BKPF-BUDAT’
wa_upload1-postingdate.
PERFORM bdc_field USING ‘BKPF-MONAT’
wa_upload1-period.
PERFORM bdc_field USING ‘BKPF-WAERS’
wa_upload1-currency.
PERFORM bdc_field USING ‘FS006-DOCID’
‘*’.
PERFORM bdc_field USING ‘RF05A-NEWBS’
wa_upload1-postingkey.
PERFORM bdc_field USING ‘RF05A-NEWKO’
wa_upload1-account.
PERFORM bdc_dynpro USING ‘SAPMF05A’ ‘0300’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘BSEG-VALUT’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘/00’.
PERFORM bdc_field USING ‘BSEG-WRBTR’
wa_upload1-amount.
PERFORM bdc_field USING ‘BSEG-VALUT’
wa_upload1-valuedate.
PERFORM bdc_field USING ‘DKACB-FMORE’
‘X’.
PERFORM bdc_dynpro USING ‘SAPLKACB’ ‘0002’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘COBL-PRCTR’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘=ENTE’.
PERFORM bdc_field USING ‘COBL-GSBER’
wa_upload1-businessarea.
PERFORM bdc_field USING ‘COBL-PRCTR’
wa_upload1-profitcenter.
ENDAT.
CHECK v_itirate = c_x.
IF sy-tabix <> 1.
PERFORM bdc_dynpro USING ‘SAPMF05A’ ‘0300’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘RF05A-NEWKO’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘/00’.
PERFORM bdc_field USING ‘RF05A-NEWBS’
wa_upload1-postingkey.
PERFORM bdc_field USING ‘RF05A-NEWKO’
wa_upload1-account.
PERFORM bdc_field USING ‘DKACB-FMORE’
‘X’.
PERFORM bdc_dynpro USING ‘SAPLKACB’ ‘0002’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘COBL-GSBER’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘=ENTE’.
PERFORM bdc_field USING ‘COBL-GSBER’
wa_upload1-businessarea.
PERFORM bdc_field USING ‘COBL-PRCTR’
wa_upload1-profitcenter.
PERFORM bdc_dynpro USING ‘SAPMF05A’ ‘0300’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘RF05A-NEWKO’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘/00’.
PERFORM bdc_field USING ‘BSEG-WRBTR’
wa_upload1-amount.
PERFORM bdc_field USING ‘BSEG-VALUT’
wa_upload1-valuedate.
PERFORM bdc_dynpro USING ‘SAPLKACB’ ‘0002’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘COBL-GSBER’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘=ENTE’.
ENDIF.
AT END OF documentreferencenumber.
PERFORM bdc_dynpro USING ‘SAPMF05A’ ‘0300’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘BSEG-WRBTR’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘=BU’.
PERFORM bdc_field USING ‘BSEG-WRBTR’
wa_upload1-amount.
PERFORM bdc_field USING ‘BSEG-VALUT’
wa_upload1-valuedate.
PERFORM bdc_field USING ‘DKACB-FMORE’
‘X’.
PERFORM bdc_dynpro USING ‘SAPLKACB’ ‘0002’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘COBL-PRCTR’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘=ENTE’.
PERFORM bdc_field USING ‘COBL-GSBER’
wa_upload1-businessarea.
PERFORM bdc_field USING ‘COBL-PRCTR’
wa_upload1-profitcenter.
* CREATE BDC SESSION
PERFORM bdc.
REFRESH it_bdcdata.
ENDAT.
ENDLOOP.
* CLOSE BDC GROUP
PERFORM bdc_close_grp.
ENDFORM. “End of form Session
*&———————————————————————*
*& Form transaction
*&———————————————————————*
* Using CALL TRANSACTION method
*———————————————————————-*
FORM transaction.
LOOP AT it_upload INTO wa_upload.
v_itirate = c_x.
wa_upload1 = wa_upload.
AT NEW documentreferencenumber.
v_itirate = c_y.
PERFORM bdc_dynpro USING ‘SAPMF05A’ ‘0100’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘RF05A-NEWKO’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘/00’.
PERFORM bdc_field USING ‘BKPF-BLDAT’
wa_upload1-documentdate.
PERFORM bdc_field USING ‘BKPF-BLART’
wa_upload1-documenttype.
PERFORM bdc_field USING ‘BKPF-BUKRS’
wa_upload1-companycode.
PERFORM bdc_field USING ‘BKPF-BUDAT’
wa_upload1-postingdate.
PERFORM bdc_field USING ‘BKPF-MONAT’
wa_upload1-period.
PERFORM bdc_field USING ‘BKPF-WAERS’
wa_upload1-currency.
PERFORM bdc_field USING ‘FS006-DOCID’
‘*’.
PERFORM bdc_field USING ‘RF05A-NEWBS’
wa_upload1-postingkey.
PERFORM bdc_field USING ‘RF05A-NEWKO’
wa_upload1-account.
PERFORM bdc_dynpro USING ‘SAPMF05A’ ‘0300’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘BSEG-VALUT’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘/00’.
PERFORM bdc_field USING ‘BSEG-WRBTR’
wa_upload1-amount.
PERFORM bdc_field USING ‘BSEG-VALUT’
wa_upload1-valuedate.
PERFORM bdc_field USING ‘DKACB-FMORE’
‘X’.
PERFORM bdc_dynpro USING ‘SAPLKACB’ ‘0002’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘COBL-PRCTR’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘=ENTE’.
PERFORM bdc_field USING ‘COBL-GSBER’
wa_upload1-businessarea.
PERFORM bdc_field USING ‘COBL-PRCTR’
wa_upload1-profitcenter.
ENDAT.
CHECK v_itirate = c_x.
IF sy-tabix <> 1.
PERFORM bdc_dynpro USING ‘SAPMF05A’ ‘0300’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘RF05A-NEWKO’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘/00’.
PERFORM bdc_field USING ‘RF05A-NEWBS’
wa_upload1-postingkey.
PERFORM bdc_field USING ‘RF05A-NEWKO’
wa_upload1-account.
PERFORM bdc_field USING ‘DKACB-FMORE’
‘X’.
PERFORM bdc_dynpro USING ‘SAPLKACB’ ‘0002’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘COBL-GSBER’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘=ENTE’.
PERFORM bdc_field USING ‘COBL-GSBER’
wa_upload1-businessarea.
PERFORM bdc_field USING ‘COBL-PRCTR’
wa_upload1-profitcenter.
PERFORM bdc_dynpro USING ‘SAPMF05A’ ‘0300’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘RF05A-NEWKO’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘/00’.
PERFORM bdc_field USING ‘BSEG-WRBTR’
wa_upload1-amount.
PERFORM bdc_field USING ‘BSEG-VALUT’
wa_upload1-valuedate.
PERFORM bdc_dynpro USING ‘SAPLKACB’ ‘0002’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘COBL-GSBER’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘=ENTE’.
ENDIF.
AT END OF documentreferencenumber.
PERFORM bdc_dynpro USING ‘SAPMF05A’ ‘0300’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘BSEG-WRBTR’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘=BU’.
PERFORM bdc_field USING ‘BSEG-WRBTR’
wa_upload1-amount.
PERFORM bdc_field USING ‘BSEG-VALUT’
wa_upload1-valuedate.
PERFORM bdc_field USING ‘DKACB-FMORE’
‘X’.
PERFORM bdc_dynpro USING ‘SAPLKACB’ ‘0002’.
PERFORM bdc_field USING ‘BDC_CURSOR’
‘COBL-PRCTR’.
PERFORM bdc_field USING ‘BDC_OKCODE’
‘=ENTE’.
PERFORM bdc_field USING ‘COBL-GSBER’
wa_upload1-businessarea.
PERFORM bdc_field USING ‘COBL-PRCTR’
wa_upload1-profitcenter.
* CALL TRANSACTION
CALL TRANSACTION c_transaction USING it_bdcdata MODE c_mode UPDATE c_update MESSAGES INTO it_messagelog.
IF sy-subrc <> 0.
v_temp = text-003.
ENDIF.
LOOP AT it_messagelog INTO wa_messagelog.
CALL FUNCTION ‘FORMAT_MESSAGE’
EXPORTING
id = wa_messagelog-msgid
lang = wa_messagelog-msgspra
no = wa_messagelog-msgnr
v1 = wa_messagelog-msgv1
v2 = wa_messagelog-msgv2
v3 = wa_messagelog-msgv3
v4 = wa_messagelog-msgv4
IMPORTING
msg = v_msg.
IF v_temp IS NOT INITIAL.
wa_messagelog-msgtyp = v_temp.
ENDIF.
IF v_finalmsg = ”.
v_finalmsg = v_msg.
ELSE.
CONCATENATE v_finalmsg v_msg INTO v_finalmsg SEPARATED BY c_comma.
ENDIF.
wa_success-documentreferencenumber = wa_upload1-documentreferencenumber.
wa_success-status = wa_messagelog-msgtyp.
wa_success-description = v_finalmsg.
APPEND wa_success TO it_success.
IF wa_success-documentreferencenumber = wa_upload1-documentreferencenumber.
MOVE wa_success-status TO wa_upload1-status.
MOVE wa_success-description TO wa_upload1-description.
MODIFY it_upload FROM wa_upload1.
ENDIF.
ENDLOOP.
CLEAR v_temp.
CLEAR v_finalmsg.
REFRESH it_messagelog.
* LOOP AT IT_SUCCESS INTO WA_SUCCESS
REFRESH it_bdcdata.
ENDAT.
ENDLOOP.
ENDFORM. ” End of Form transaction
END-OF-SELECTION.
wa_header-field1 = ‘doc_no’.
APPEND wa_header TO it_header.
CLEAR wa_header..
wa_header-field1 = ‘doc_date’.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-field1 = ‘doc_type’.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-field1 = ‘companycode’.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-field1 = ‘postingdate’.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-field1 = ‘period’.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-field1 = ‘currency’.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-field1 = ‘reference’.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-field1 = ‘postingkey’.
APPEND wa_header TO it_header.
CLEAR wa_header..
wa_header-field1 = ‘account’.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-field1 = ‘amount’.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-field1 = ‘taxcode’.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-field1 = ‘businessarea’.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-field1 = ‘profitcenter’.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-field1 = ‘valuedate’.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-field1 = ‘status’.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-field1 = ‘description’.
APPEND wa_header TO it_header.
CLEAR wa_header.
CHECK v_validate_fg <> c_x.
***********************************
* WRITING TO THE LOG FILES.
***************************************
IF rb_sessi = c_x.
LOOP AT it_upload INTO wa_upload.
wa_upload1 = wa_upload.
IF wa_upload1-status = text-003 OR wa_upload1-documentreferencenumber = v_statusd.
APPEND wa_upload1 TO it_errormess.
v_statusd = wa_upload1-documentreferencenumber.
APPEND wa_upload1 TO it_check.
ELSE.
IF wa_upload1-documentreferencenumber <> v_statusd.
APPEND wa_upload1 TO it_successmess.
ENDIF.
LOOP AT it_check INTO wa_check.
LOOP AT it_successmess INTO wa_successmess.
IF wa_successmess-documentreferencenumber = wa_check-documentreferencenumber.
DELETE it_successmess.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDIF.
AT END OF documentreferencenumber.
CLEAR v_statusd.
ENDAT.
ENDLOOP.
PERFORM file_download.
ELSE.
LOOP AT it_upload INTO wa_upload.
wa_upload1 = wa_upload.
APPEND wa_upload1 TO it_check.
AT END OF documentreferencenumber.
IF wa_upload1-status = text-004.
LOOP AT it_check INTO wa_check.
APPEND wa_check TO it_successmess.
ENDLOOP.
REFRESH it_check.
ELSE.
LOOP AT it_check INTO wa_check.
APPEND wa_check TO it_errormess.
ENDLOOP.
REFRESH it_check.
ENDIF.
ENDAT.
ENDLOOP.
PERFORM file_download.
ENDIF.
PERFORM display_alv.
FREE: it_upload,
it_type,
it_bdcdata,
it_messagelog,
it_success,
it_alv_fieldcat,
it_alv_layout.
CLEAR: wa_upload,
wa_upload1,
wa_bdcdata,
wa_messagelog,
wa_success,
wa_alv_fieldcat.
DATA fcode TYPE TABLE OF sy-ucomm.
*&———————————————————————*
*& Form file_download
*&———————————————————————*
* text
*———————————————————————-*
FORM file_download.
IF p_files IS NOT INITIAL.
CALL FUNCTION ‘GUI_DOWNLOAD’
EXPORTING
filename = p_files
filetype = ‘DAT’
append = ‘X’
TABLES
data_tab = it_successmess
fieldnames = it_header
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.
ENDIF.
IF p_filee IS NOT INITIAL.
CALL FUNCTION ‘GUI_DOWNLOAD’
EXPORTING
filename = p_filee
filetype = ‘DAT’
append = ‘X’
TABLES
data_tab = it_errormess
fieldnames = it_header
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.
ENDIF.
ENDFORM. “file_download
*&———————————————————————*
*& Form set_pf_status
*&———————————————————————*
* text
*———————————————————————-*
* –>RT_EXTAB text
*———————————————————————-*
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
IF rb_sessi = ‘X’.
SET PF-STATUS ‘ZSTATUS’.
ELSE.
APPEND ‘DISP’ TO fcode.
APPEND ‘PROCESS’ TO fcode.
SET PF-STATUS ‘ZSTATUS’ EXCLUDING fcode.
ENDIF.
ENDFORM. “set_pf_status
*&———————————————————————*
*& Form user_command
*&———————————————————————*
* text
*———————————————————————-*
* –>SY-UCOMM text
* –>RS_SELFIELD text
*———————————————————————-*
FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
IF r_ucomm EQ ‘PROCESS’.
SUBMIT rsbdcsub AND RETURN
WITH mappe = p_sname
WITH z_verarb = ‘X’
WITH logall = ‘X’.
ELSEIF r_ucomm EQ ‘DISP’.
CALL TRANSACTION ‘SM35’.
ENDIF.
ENDFORM. “user_command
*&———————————————————————*
*& Form alv_setup
*&———————————————————————*
* Layout for ALV
*———————————————————————-*
FORM alv_setup.
CLEAR wa_alv_fieldcat.
REFRESH it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘DOCUMENTREFERENCENUMBER’.
wa_alv_fieldcat-seltext_l = ‘Document Reference Number’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘DOCUMENTDATE’.
wa_alv_fieldcat-seltext_l = ‘Document Date’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘DOCUMENTTYPE’.
wa_alv_fieldcat-seltext_l = ‘Document Type’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘COMPANYCODE’.
wa_alv_fieldcat-seltext_l = ‘Company Code’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘POSTINGDATE’.
wa_alv_fieldcat-seltext_l = ‘Posting Date’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘PERIOD’.
wa_alv_fieldcat-seltext_l = ‘Period’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘CURRENCY’.
wa_alv_fieldcat-seltext_l = ‘Currency’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘REFERENCE’.
wa_alv_fieldcat-seltext_l = ‘Reference’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘POSTINGKEY’.
wa_alv_fieldcat-seltext_l = ‘Posting Key’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘ACCOUNT’.
wa_alv_fieldcat-seltext_l = ‘Account’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘AMOUNT’.
wa_alv_fieldcat-seltext_l = ‘Amount’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘TAXCODE’.
wa_alv_fieldcat-seltext_l = ‘Tax code’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘BUSINESSAREA’.
wa_alv_fieldcat-seltext_l = ‘Business Area’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘PROFITCENTER’.
wa_alv_fieldcat-seltext_l = ‘Profit Center’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘VALUEDATE’.
wa_alv_fieldcat-seltext_l = ‘Value Date’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘STATUS’.
wa_alv_fieldcat-seltext_l = ‘Status’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
wa_alv_fieldcat-fieldname = ‘DESCRIPTION’.
wa_alv_fieldcat-seltext_l = ‘Description’. “#EC NOTEXT
APPEND wa_alv_fieldcat TO it_alv_fieldcat.
ENDFORM. “alv_setup
*&———————————————————————*
*& Form display_alv
*&———————————————————————*
*
*———————————————————————-*
FORM display_alv.
it_alv_layout-colwidth_optimize = c_x.
it_alv_layout-zebra = c_x.
SET PF-STATUS ‘TEST’.
CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = ‘SET_PF_STATUS’
i_callback_user_command = ‘USER_COMMAND’
is_layout = it_alv_layout
it_fieldcat = it_alv_fieldcat
TABLES
t_outtab = it_upload.
ENDFORM. “display_alv
**&———————————————————————*
**& Form bdc_open_grp
**&———————————————————————*
** –>Group Session name
**———————————————————————-*
FORM bdc_open_grp.
CALL FUNCTION ‘BDC_OPEN_GROUP’
EXPORTING
client = sy-mandt
group = p_sname
keep = c_x
user = sy-uname.
.
ENDFORM. “bdc_open_grp
*&———————————————————————*
*& Form bdc
*&———————————————————————*
* –>TCODE Transaction code for which session to be created
* –>DYNPROTAB Intenal table that is passed
*———————————————————————-*
FORM bdc.
CALL FUNCTION ‘BDC_INSERT’
EXPORTING
tcode = c_transaction
TABLES
dynprotab = it_bdcdata.
ENDFORM. “bdc
*&———————————————————————*
*& Form bdc_close_grp
*&———————————————————————*
* text
*———————————————————————-*
FORM bdc_close_grp.
CALL FUNCTION ‘BDC_CLOSE_GROUP’
EXCEPTIONS
not_open = 1.
.
IF sy-subrc <> 0.
MESSAGE i017.
ELSE.
MESSAGE s016.
ENDIF.
ENDFORM. “bdc_close_grp
*&———————————————————————*
*& Form get1
*&———————————————————————*
* Browse for a file on the presentation server
*———————————————————————-*
FORM get1.
CALL FUNCTION ‘F4_FILENAME’
EXPORTING
field_name = ‘p_fname’
IMPORTING
file_name = p_fname.
ENDFORM. “get1
*&———————————————————————*
*& Form get2
*&———————————————————————*
* text
*———————————————————————-*
FORM get2.
CALL FUNCTION ‘F4_FILENAME’
EXPORTING
field_name = ‘p_succes’
IMPORTING
file_name = p_succes.
ENDFORM. “get2
*&———————————————————————*
*& Form get3
*&———————————————————————*
* text
*———————————————————————-*
FORM get3.
CALL FUNCTION ‘F4_FILENAME’
EXPORTING
program_name = ‘p_error’
IMPORTING
file_name = p_error.
ENDFORM. “get3
*&———————————————————————*
*& Form BDC_DYNPRO
*&———————————————————————*
*
*———————————————————————-*
* –>PROGRAM Program name
* –>DYNPRO Screen #
* –>DYNBEGIN Beginning of new screen
*———————————————————————-*
FORM bdc_dynpro USING program dynpro.
CLEAR wa_bdcdata.
wa_bdcdata-program = program.
wa_bdcdata-dynpro = dynpro.
wa_bdcdata-dynbegin = c_x.
APPEND wa_bdcdata TO it_bdcdata.
ENDFORM. “BDC_DYNPRO
*
**&———————————————————————*
**& Form BDC_FIELD
**&———————————————————————*
**
**———————————————————————-*
** –>FNAM Field name
** –>FVAL Field value
**———————————————————————-*
FORM bdc_field USING fnam fval.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = fnam.
wa_bdcdata-fval = fval.
APPEND wa_bdcdata TO it_bdcdata.
ENDFORM. “BDC_FIELD
*&———————————————————————*
*& Form modify_screen
*&———————————————————————*
* text
*———————————————————————-*
FORM modify_screen.
LOOP AT SCREEN.
IF rb_sessi <> ‘X’.
IF screen-name CS ‘p_sname’.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. “modify_screen

Vendor Confirmation Letter

ABAP Development, Sap Blogs

by VN Consultant

Vendor Confirmation Letter

This code sample ( run on real environment ) print vendor balance confirmation.

Vendor can be filtered by Code or Accounting Clerk.

For support this program, please email info@sapland.com for more detail.

Download Source:

http://sapland.com/downloads

http://sapaccounting.blogspot.com/

How to Disable Word Editor in SAP Smartform Text

Using SAP program rscpseteditor

Microsoft Word can be used as an enhanced text editor for Smartform text objects. But SAP Smart Forms developers who have been dealing with SSF can have some difficulties adopting to MS Word as default text editor in Text component. For example the font style and the paragraph styles are displayed mixed in styles combo in Word editor. So if you want to work with default SAP text editor in Smartform report like me, you can use rscpseteditor tcode  program to turn off Word as text editor.

It is easy to disable or enable Word as text editor using rscpseteditor – Set MS Word as Editor windows shown as below.
Mark or clear the checkbox beside the SAP output development tool SAPscript or SAP Smart Forms text where you want to make modification in default editor.

Set or disable MS Word as default editor for SAP Smartform Text objects

After you change the default editor for SAPScript or SAP Smart Form, then activate changes using the Activate buton. After you activate, developers should exit the application SAP Smartforms in order to reflect the editor change on their development environment.

Process documentation Header and Item Conditions Locate the document in its SAP Library structure

Entering content frame

The standard system includes condition types that you can only apply at the header level, the header conditions. Condition types that you can only use for items are called item conditions. The standard system also includes some condition types that can be used both at header and item level: Percent from gross (RA01) Absolute discount (RB00) Weight discount (RD00).

Header Conditions

Automatic pricing does not take header conditions into account; you can not create condition records for them in the standard system. Header conditions are entered manually in order processing. R/3 includes the following header conditions:

  • Percent discount (HA00)
  • Absolute discount (HB00)
  • Freight (HD00)
  • Order value (HM00)

Item Conditions

In the standard system, most condition types are defined as item conditions. Examples of item conditions are:

  • Material discount (K004)
  • Customer/Material (K005)
  • Customer discount (K007)
  • Material price (PR01)

Displaying Header and Item Conditions

From the header and item pricing screens, you can branch to detailed information about each condition type that appears. From the header pricing screen, place the cursor on the condition for which you require detailed information.

  • In the header price screen, choose Condition detail.
  • The system displays data it uses to calculate the amount of the condition (for example, the kind of pricing scale, quantity conversion, the scale base value, the document currency, and so on). From the details screen, you can choose Goto ® Condition record to see the specific condition record that the system accesses. From the item pricing screen, select the condition for which you require detailed information.

  • Accordingly choose Condition detail in the item price screen. To see the specific condition record that the system accesses, choose Goto
  • ® Condition record.

 

Leaving content frame

Managing Unstructured Data

Managing Unstructured Data: 10 Key Requirements

Dramatically Accelerate Oracle Database Performance

Your ECM Scorecard

Laptop Backup for a Remote Workforce

 

STO returned with Billing

How to return in STO