Tuesday, February 28, 2012

View Cluster

SE11
Create table
Create view
Generate maintenance view for view

SE54
Create view cluster
Enter view name under enter object structure


Thursday, January 26, 2012

Modify COOIS

Notes on how to add custom ALV fields to COOIS and handle custom double click event.

Objects to modify:
BAdI:

  • WORKORDER_INFOSYSTEM

Tables:

  • CT_IOHEADER-CI_IOHEADER
  • T354T
  • T354S
Program:
  • RCOTX000



Steps:

  1. Add custom fields to appropriate structure (i.e. CI_IOHEADER)
  2. Create BAdI implementation for WORKORDER_INFOSYSTEM (i.e. ZCL_IM_PP_HEADER)
  3. Edit appropriate method w/in the implementation (i.e. modify_table_layout)
  4. Handle Events
    1. Modify table T354T and T354S
  5. Modify field catalog
    1. execute RCOTX000 for appropriate structure (i.e. IOHEADER or IOOPER)

Friday, November 11, 2011

ALV OM Header / Footer alignment

The class for controlling alignment in the header/footer is cl_salv_form_layout_data_grid.

Example:
data: lr_grid type ref to cl_salv_form_layout_grid,
lr_layout_grid type ref to cl_salv_form_layout_data_grid,
lr_label type ref to cl_salv_form_label.

lr_label = lr_grid->create_label(
row = 1
column = 1
colspan = 4
text = 'Net Profit Report'(h01)
tooltip = text-h01 ).

lr_layout_grid ?= lr_label->get_layout_data( ).
lr_layout_grid->set_h_align( if_salv_form_c_h_align=>center ).

PFSTATUS SE41

SAPLKKBL is a good program to copy pf status from.

Tuesday, October 25, 2011

Select data from a SET

DATA: p_range LIKE TABLE OF range_c24 WITH HEADER LINE.
DATA: set_values LIKE rgsb4 OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'G_SET_GET_ALL_VALUES'
EXPORTING
setnr = 'Z-BUKRS'
class = '0000'
TABLES
set_values = set_values.

LOOP AT set_values.
CLEAR p_range.
p_range-sign = 'I'.
IF set_values-from = set_values-to.
p_range-option = 'EQ'.
ELSE.
p_range-option = 'BT'.
p_range-high = set_values-to.
ENDIF.
p_range-low = set_values-from.
APPEND p_range.
ENDLOOP.

Wednesday, September 28, 2011

Refresh Select Options

  "refresh select option for ME22.
  DATA: l_rspar_tab  TYPE STANDARD TABLE OF rsparams. 
  CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
  EXPORTING
    curr_report     = 'SAPMM06E'
  TABLES
    selection_table = l_rspar_tab.

Tuesday, August 02, 2011

Break down a file to deal with excel upload function row limitation

report ZZFLOTH_TEMP.

DATA: BEGIN OF file_chunks OCCURS 0,
        file LIKE rlgrap-filename,
        rowb TYPE i,
        rowe TYPE i,
      END OF file_chunks.

SELECTION-SCREEN BEGIN OF BLOCK block1
           WITH FRAME TITLE text-001.
PARAMETERS: p_bdc   LIKE apqi-groupid OBLIGATORY
                    DEFAULT 'ZB01yyyymmdd',
            p_file  LIKE rlgrap-filename OBLIGATORY
                    DEFAULT 'c:\exclusions.xls',
            p_row_bg  TYPE i OBLIGATORY,
            p_recs TYPE i DEFAULT 20000 OBLIGATORY.
SELECTION-SCREEN END OF BLOCK block1.

START-OF-SELECTION.
** Import XLS
  perform read_xls.
  end-of-SELECTION.

*&---------------------------------------------------------------------*
*&      Form  read_xls
*&---------------------------------------------------------------------*
*       read xls file
*----------------------------------------------------------------------*
FORM read_xls .
  DATA:  xls LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.

* Break input files into chunks of 9000 rows.  The function can
* only handle 9999 rows.
  REFRESH file_chunks.
  PERFORM create_file_chunks USING p_file p_row_bg p_recs.

  LOOP AT file_chunks.
    REFRESH xls.
    IF NOT file_chunks-file IS INITIAL.

      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename    = file_chunks-file
          i_begin_col = 1
          i_begin_row = file_chunks-rowb
          i_end_col   = 2
          i_end_row   = file_chunks-rowe
        TABLES
          intern      = xls
        EXCEPTIONS
          OTHERS      = 3.
      IF sy-subrc <> 0.
        MESSAGE e212(zz) WITH p_file.
      ENDIF.
    ENDIF.

    SORT xls BY row col.

    LOOP AT xls.

      CASE xls-col.
        WHEN 1.
          "record-kunnr  = xls-value.
        WHEN 2.
          "record-ktokd  = xls-value.
        WHEN OTHERS.
      ENDCASE.

      AT END OF row.
        "APPEND record.
        "CLEAR record.
      ENDAT.

    ENDLOOP.
  ENDLOOP.

ENDFORM.                    " read_xls

*&---------------------------------------------------------------------*
*&      Form  create_file_chunks
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*       Determine the file chunks that will be read.  No more than
*       9000 records at a time.
*----------------------------------------------------------------------*
FORM create_file_chunks USING file
                              rowb
                              rowe.
  DATA: chunks TYPE i,
        last TYPE i,
        rowbegin TYPE i.

  CLEAR file_chunks.

  CHECK NOT file IS INITIAL.

  file_chunks-file = file.
  rowbegin = rowb.

* Culculate the full chunks of 9000.
  chunks = rowe DIV 9000.
* Calculate the size of the last chunk.
  last = rowe MOD 9000.

* Add the full 9000 chunks
  DO chunks TIMES.
    file_chunks-rowb = rowbegin.
    ADD 9000 TO rowbegin.
* Adjust to account for the  first row.
    file_chunks-rowe = rowbegin - 1.
    APPEND file_chunks.
  ENDDO.

* Add the pertial chunk.
  IF NOT last IS INITIAL.
    file_chunks-rowb = rowbegin.
    ADD last TO rowbegin.
* Adjust to account for the  first row.
    file_chunks-rowe = rowbegin - 1.
    APPEND file_chunks.
  ENDIF.
ENDFORM.                    " create_file_chunks

PDF Forms Notes

Config:
/nOPK8 - config for PDF forms
/spro -> Quality Management -> Quality Notifications -> Notification Processing -> print control -> define shop papers, forms, print programs

/nCO02

/nSFP

refresh form:
FP_GENERATE_FUNCTION_MODULE

Thursday, April 28, 2011

Set Color to System

  1. Customize Local Layout (ALT+F12)
  2. Design Settings
    1. Set Active Theme to "Enjoy", Apply
  3. Logout and restrat SAPGUI
  4. Customize Local Layout (ALT+F12)
  5. Set Color to System

Friday, April 01, 2011

GUI_UPLOAD ASCII special chars causing problems

If you use GUI_UPLOAD to import an ASCII file and the data has embedded CR or other chars.  Try this using filetype = BIN.


    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename                = g_pc_file
        filetype                = 'BIN'
      IMPORTING
        filelength              = filelength
      CHANGING
        data_tab                = lt_bin
      EXCEPTIONS
        OTHERS                  = 19.
    IF sy-subrc <> 0 OR lt_bin[] IS INITIAL.
      RAISE EXCEPTION TYPE lcl_my_exception.
    ENDIF.


    CALL FUNCTION 'SCMS_BINARY_TO_STRING'
      EXPORTING
        input_length = filelength
      IMPORTING
        text_buffer  = ls_string
      TABLES
        binary_tab   = lt_bin
      EXCEPTIONS
        OTHERS       = 2.
    IF sy-subrc <> 0 .
      RAISE EXCEPTION TYPE lcl_my_exception.
    ENDIF.

    SPLIT ls_string AT cl_abap_char_utilities=>cr_lf INTO TABLE ex_raw_tab.

Wednesday, December 15, 2010

How to create a WSDL / webservice:

How to create a WSDL / webservice:

1. Create RFC enabled function.

2. Create webservice:
a. SE37 -> Utilities -> more Utilities -> create webservice -> from function module
b. Follow the on-screen prompts (give the service a name, usually the same name as FM; X-Mapping der Namen; SOAP Application: soap:runtime:rfc:710; Profie: PRF_DT_IF_SEC_NO; X-Deploy Service)

3. Create WSDL:
a. /nSOAMANAGER -> Application and Scenario Communication
b. -> Single Service Administration
c. -> Search for your service -> Select it and click apply
d. -> Open WSDL document for selected binding
e. Save XML locally (this is the WSDL)

4. Maintain service:
a. /nSICF -> enter “service name” -> execute
b. Double click on lowest node and setup “logon data”

5. Test using SOAPUI
a. Download SOAPUI freeware and install
b. File -> New soapUI Project
c. Enter “Project Name” and location your WSDL saved in step 3.e -> ok
d. Open up request -> update XML with input -> click green arrow to run

Change function module / webservice:

6. If you have made changes to the interface of your FM:
a. SE80 -> Edit Object -> Enterprise Services
b. -> enter service name in Service Definition
c. -> change -> activate

7. Repeat steps 3-5.

Wednesday, November 10, 2010

debug batch

How do I debug completed background process?
You can do this only after the job has finished execution. This will simulate the exact background scenario with the same selection screen values as used in the job and sy-batch set to 'X'.
  • Use SM37 to get list of jobs, put the cursor on the job, type JDBG in the command line ( no '/' ), and press ENTER
  • You are in debug mode now. Step through SAP program (press F7 couple of times) until you get to code you need.
  • Note: though running interactively, you can see that sy-batch = 'X'.

More ABAP debugger options - http://wiki.sdn.sap.com/wiki/display/ABAP/ABAP+Debugger

Thursday, October 28, 2010

Forms print in color and ALV does not.

Set your device type to "color".  Otherwise, Smartform and SAPscript creates what is called an OTFPOST data type.  This datatype contains the color inside the file sent to the printer.  That is why we can print the color statement and not ALV in color.

Wednesday, October 06, 2010

Add selection box to ALV OM

*--- Selection box
data: lr_selections type ref to cl_salv_selections
lr_selections = gr_table->get_selections( ).
lr_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
 
See report:
SALV_DEMO_TABLE_SELECTIONS

Thursday, September 09, 2010

Friday, August 20, 2010

OO ALV OM and other sample programs

Check out the new ALV OM:  cl_salv_table=>factory

Sample programs in SAP:
SALV_DEMO_TABLE_REAL_SIMPLE
SALV*  "New OM stuff
BALV*  "old school

 /nABAPDOCU  "abap documentation and examples

SE80->Package = SABAPDEMOS

ALV Object Model - Simple 2D Table - The Basics
ALV Object Model - Simple 2D Table - Event Handling
ALV Object Model - Hierarchical Sequential List - The Basics
SAP Help

Friday, July 09, 2010

Friday, May 28, 2010

Dialog Programming Samples /nBIBS

See transaction: BIBS

Basic Table Control example:
http://www.sapdev.co.uk/dialog/tabcontrol/tc_basic.htm


SAP Help:
http://help.sap.com/saphelp_sm32/helpdata/en/45/adee2396f711d1b46b0000e8a52bed/frameset.htm

Monday, February 22, 2010

FI - Terms

Balance Sheet (OB58, S_ALR_87012279) - summary of a company's balances. Snap shot of a company's financial condition. Assets, Liabilities, Equity (Equity = Assets - Liabilities or Assets = Liabilities + Equity).
Assets: Cash, AR, property, equipment...
Liabilities: AP, provisions, bonds/notes, tax...
Equity: capital stock, retained earnings...

GL - record of business transactions.
Special Purpose Ledger - Used for reporting. User defined.
Reconciliation Account - type of GL account that summarizes sub-ledger accounts.
Subledger - provides the details behind the reconciliation account

Chart of Accoutns - list of GL accounts
1000 Assests
2000 Liabilities
3000 Equity
4000 Revenue
5000 Cost of goods sold
6000 Expense
7000 Other revenue (interest income)
8000 Other expense (income tax) 

Document type - identifies business transactions.  General Ledger Accounting Document, Customer Invoice, Customer Payment, Credit Memo, Vendor Invoice, Vendor Payment, Billing document...


Wednesday, December 09, 2009

Translate SFP - Adobe Form

To successfully perform translation, change SAPGUI Language to Japanese and use Goto…Translation and update appropriate tags.

Wednesday, July 01, 2009

Order to Cash

  1. Quotation
  2. Sales Order
    1. Credit check, availability check
  3. Delivery
    1. Picking
    2. Packing
    3. Ship
    4. Post goods Issue
  4. Billing
  5. Payment
  1. VA01 - Order
  2. VKM3 - release hold
  3. VL01N - Pick/Pack/Ship/PGI
  4. VF01 - Billing
  5. FCC1 - Settlement

Friday, October 31, 2008

Print Selection Screen Criteria

DATA: BEGIN OF mtab_sel_options OCCURS 0,
flag(1) TYPE c,
olength TYPE x,
line LIKE rsvar-infoline,
END OF mtab_sel_options.

CALL FUNCTION 'RS_COVERPAGE_SELECTIONS'
EXPORTING
report = sy-repid
variant = ''
no_import = ''
TABLES
infotab = mtab_sel_options
EXCEPTIONS
error_message = 1
variant_not_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

loop at mtab_sel_options.
write: / mtab_sel_options-line.
endloop.

Tuesday, July 08, 2008

Serial controlled products - config lookup

ranges: r_sernp for t377p-serail.

* build selection option values macro
define m_sel_opt.
&5-sign = &1.
&5-option = &2.
&5-low = &3.
&5-high = &4.
append &5.
end-of-definition.

select serail into r_sernp-low
from t377p
where eqtyp = 'S'.
** append value to range
m_sel_opt: 'I' 'EQ' r_sernp-low '' r_sernp.
endselect.

***NOW THIS RANGE IS READY TO USE FOR YOUR MARC LOOKUP
SELECT *FROM MARCWHERE SERNP IN R_SERNP.

Thursday, July 03, 2008

Convert Hexadecimal to Binary to Decimal, Bin to Hex, Hex to Dec

*--- hex to binary
data: b(1) type n,
l_hex type xstring,
l_bin type string.

DO.
GET BIT sy-index OF l_hex INTO b.
IF sy-subrc <> 0. EXIT. ENDIF.
CONCATENATE l_bin b INTO l_bin.
CONDENSE l_bin NO-GAPS.
ENDDO.
write: / l_bin.

*--- Binary to Dec
DATA : dig_c(1) TYPE c,
dig_i TYPE i,
s_bin TYPE string,
l TYPE i,
l_exp TYPE p,
l_dec TYPE p,
c TYPE i.

clear: dig_c, dig_i, s_bin, l, l_exp, l_dec, c.

s_bin = l_bin.
l = strlen( s_bin ).
c = l - 1.
do l times.
dig_c = s_bin.
dig_i = dig_c.
l_exp = 2 ** c .
l_dec = l_dec + dig_i * l_exp.
shift s_bin.
c = c - 1.
enddo.
write: / l_dec.

*--- Bin to Hex test
DATA hex(3) TYPE x.
SET BIT: 09 OF hex TO 1,
10 OF hex TO 0,
11 OF hex TO 1,
12 OF hex TO 1,
13 OF hex TO 0,
14 OF hex TO 1,
15 OF hex TO 0,
16 OF hex TO 1.
WRITE hex.

*--- Hex to Dec test
DATA: l_hex TYPE xstring.
DATA l_int TYPE i.
l_hex = '123BCA'.
l_int = l_hex.
WRITE: / 'Hex:', l_hex.
WRITE: / 'Dec:', l_int.

Additional info:
http://help.sap.com/saphelp_nw04/helpdata/en/b6/e7d716f46711d195200000e8353423/frameset.htm

Thursday, June 05, 2008

Finding BADI's & Exits

There are multiple ways of searching for BADI.

  • Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE
  • Finding BADI Using SQL Trace (TCODE-ST05).
  • Finding BADI Using Repository Information System (TCODE- SE84).
  1. Go to the Transaction, for which we want to find the BADI, take the example of Transaction VD02. Click on System->Status. Double click on the program name. Once inside the program search for ‘CL_EXITHANDLER=>GET_INSTANCE’.
    Make sure the radio button “In main program” is checked. A list of all the programs with call to the BADI's will be listed.
    The export parameter ‘EXIT_NAME’ for the method GET_INSTANCE of class CL_EXITHANDLER will have the user exit assigned to it. The changing parameter ‘INSTANCE’ will have the interface assigned to it. Double click on the method to enter the source code.Definition of Instance would give you the Interface name.
  2. Start transaction ST05 (Performance Analysis).
    Set flag field "Buffer trace"
    Remark: We need to trace also the buffer calls, because BADI database tables are buffered. (Especially view V_EXT_IMP and V_EXT_ACT)
    Push the button "Activate Trace". Start transaction VA02 in a new GUI session. Go back to the Performance trace session.
    Push the button "Deactivate Trace".
    Push the button "Display Trace".
    The popup screen "Set Restrictions for Displaying Trace" appears.
    Now, filter the trace on Objects:
    V_EXT_IMP
    V_EXT_ACT

    Push button "Multiple selections" button behind field Objects
    Fill: V_EXT_IMP and V_EXT_ACT

    All the interface class names of view V_EXT_IMP start with IF_EX_. This is the standard SAP prefix for BADI class interfaces. The BADI name is after the IF_EX_.
    So the BADI name of IF_EX_CUSTOMER_ADD_DATA is CUSTOMER_ADD_DATA
  3. Go to “Maintain Transaction” (TCODE- SE93).
    Enter the Transaction VD02 for which you want to find BADI.
    Click on the Display push buttons.
    Get the Package Name. (Package VS in this case)
    Go to TCode: SE84->Enhancements->Business Add-inns->DefinitionEnter the Package Name and Execute.


    Here you get a list of all the Enhancement BADI's for the given package MB.

    Also have a look at below report which will list BADIs.

see SDN - https://www.sdn.sap.com/irj/sdn/thread?threadID=268271

Thursday, May 15, 2008

Tuesday, February 19, 2008

Move nodata character '/' to every field of a structure (sample code).

FIELD-SYMBOLS: fs TYPE ANY.

DEFINE nodata.
do.
assign component sy-index of structure &1 to fs.
if sy-subrc <> 0. exit. endif.
fs = '/'.
enddo.
END-OF-DEFINITION.

nodata: bbkpf, bbseg, bbtax, bwith, bselk, bselp.

**Another use for this type of loop:
FIELD-SYMBOLS: TYPE ANY.

DO.
ASSIGN COMPONENT sy-index OF STRUCTURE o_return TO .
IF sy-subrc <> 0. EXIT. ENDIF.
IF NOT IS INITIAL.
WRITE: / .
ENDIF.
ENDDO.

Thursday, January 03, 2008

Transport Translations

Translate report texts

SE38->goto->translation

How to transport translations:
1) Create CTS#
2) run RS_LXE_RECORD_TORDER to capture translations

See:
http://help.sap.com/saphelp_47x200/helpdata/en/3e/c06e08fe4f11d3b2a3005004ed1ff7/frameset.htm

Tuesday, December 11, 2007

Transport ABAP Query, Infoset, User Group

1. Perform these steps in the Development Client
1.1. Make a record of the User Group and Query name

1.2. Go to SAP transaction SQ02. Follow the path Environment > Transports to start the request.
1.2.1. Transport action = Export
1.2.2. Make sure to turn off the defaulted selection “Test Run”.
1.2.3. Select Transport queries
1.2.4. Import option = Replace
1.2.5. User groups = See above, normally SN-Finance
1.2.6. Queries = List the name above or a range of names if you desire to transport more than one query
1.2.7. Click the “Execute” icon to create the transport. This will give you a display of the “Export log: List of Exported objects”. Print this log as you will need the dataset name in a later step.

2. Transport new configuration to the Production Client as usual using the SE10 and STMS transactions
3. Perform these steps in the Production Client
3.1. Import the ABAP/4 Query into Production.
3.1.1. Go to SAP transaction SQ02 in production – Path = environment > transports.
3.1.2. Transport action = Import
3.1.3. Remove the default of “Test Run”
3.1.4. Allow overwriting
3.1.5. Chose Transport queries
3.1.6. Import option = Replace
3.1.7. User group = enter the name of the user group
3.1.8. Queries = enter the name of the query
3.1.9. Dataset with imports = This is the name of the “transport dataset” shown on the export log that you just printed out a few steps back.
3.1.10. Click the “execute” icon to import the query

Friday, August 03, 2007

EXEC SQL

Select data from non-SAP system DB.

1) Create connection entry in table DBCON, you will need to have a DB userid and password and the connection string.
con_name = descriptive name
dbms = mss
user_name = sql_userid
password = ****
con_env = MSSQL_SERVER=mather-mri-002 MSSQL_DBNAME=MRIAccess

ABAP:
2) Establish connection:
data: con_name like dbcon-con_name value 'MRI'.
* Connect to external DB
EXEC SQL.
CONNECT TO :con_name
ENDEXEC.
EXEC SQL.
SET CONNECTION :con_name
ENDEXEC.
IF sy-subrc <> 0.
MESSAGE e009 WITH 'Unable to connect to' con_name.
ENDIF.

3) Sample Code to Select Data:

* Drop subquery tables
EXEC SQL.
IF EXISTS(SELECT TABLE_NAME FROM MRIACCESS.INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'ZSAP_ACCTN')
DROP TABLE MRIACCESS..ZSAP_ACCTN
IF EXISTS(SELECT TABLE_NAME FROM MRIACCESS.INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'ZSAP_SAPCO')
DROP TABLE MRIACCESS..ZSAP_SAPCO
IF EXISTS(SELECT TABLE_NAME FROM MRIACCESS.INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'ZSAP_ENTIT')
DROP TABLE MRIACCESS..ZSAP_ENTIT
ENDEXEC.

* Create subquery tables
EXEC SQL.
CREATE TABLE MRIAccess..ZSAP_ACCTN ( acctn VARCHAR(9))
CREATE TABLE MRIAccess..ZSAP_SAPCO ( sapco VARCHAR(4))
CREATE TABLE MRIAccess..ZSAP_ENTIT ( entit VARCHAR(6))
ENDEXEC.
IF sy-subrc <> 0.
MESSAGE e009 WITH 'Failed to create subquery tables'.
ENDIF.
* Populate subquery tables
LOOP AT s_acctn.
EXEC SQL.
insert into MRIAccess..ZSAP_ACCTN values (:s_acctn-low)
ENDEXEC.
IF sy-subrc <> 0.
MESSAGE e009 WITH 'Failed to populate subquery tables'.
ENDIF.
ENDLOOP.
LOOP AT s_sapco.
EXEC SQL.
insert into MRIAccess..ZSAP_SAPCO values (:s_sapco-low)
ENDEXEC.
IF sy-subrc <> 0.
MESSAGE e009 WITH 'Failed to populate subquery tables'.
ENDIF.
ENDLOOP.
LOOP AT s_entit.
EXEC SQL.
insert into MRIAccess..ZSAP_ENTIT values (:s_entit-low)
ENDEXEC.
IF sy-subrc <> 0.
MESSAGE e009 WITH 'Failed to populate subquery tables'.
ENDIF.
ENDLOOP.

* Now select data from extrnal DB
* All records not extracted
EXEC SQL PERFORMING append_itab.
SELECT g.acctnum, e.saporder, e.sapco, e.EntityID, j.entrdate,
j.amt, j.descrpn, j.ref, j.Item into :itab
FROM
MRIPROD..ENTITY e
INNER JOIN MRIPROD..JOURNAL j ON j.ENTITYID = e.ENTITYID
INNER JOIN MRIPROD..GACC g ON j.ACCTNUM = g.ACCTNUM
WHERE
j.source = :p_sourc AND
g.acctnum NOT IN (select acctn from MRIAccess..zsap_acctn) AND
e.sapco NOT IN (select sapco from MRIAccess..zsap_sapco) AND
e.entityid NOT IN (select entit from MRIAccess..zsap_entit) AND
j.basis = :p_basis AND
j.dtsapul IS NULL
ENDEXEC.
IF p_update = 'X'. "Update
EXEC SQL.
UPDATE MRIPROD..JOURNAL
set dtSAPUL = :v_now
FROM
MRIPROD..ENTITY e
INNER JOIN MRIPROD..JOURNAL j ON j.ENTITYID = e.ENTITYID
INNER JOIN MRIPROD..GACC g ON j.ACCTNUM = g.ACCTNUM
WHERE
j.source = :p_sourc AND
g.acctnum NOT IN (select ACCTN from MRIACCESS..ZSAP_ACCTN) AND
e.sapco NOT IN (select sapco from MRIAccess..zsap_sapco) AND
e.entityid NOT IN (select entit from MRIAccess..zsap_entit) AND
j.basis = :p_basis AND
j.dtsapul IS NULL
ENDEXEC.
ENDIF.
*&---------------------------------------------------------------------*
*& Form append_itab
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM append_itab.
APPEND itab.
ENDFORM. " append_itab

4) Close or reset connection
** Reset to "default connection"
EXEC SQL.
SET CONNECTION DEFAULT
ENDEXEC.

Wednesday, June 27, 2007

Output update nast_protocol_update

To update the output processing log from a form processing program call function
nast_protocol_update.

Tuesday, June 19, 2007

Thursday, May 03, 2007

Email Payment Advice

Configuration:

  1. (FK02); Set Standard Comm Type = INT (SMTP), and maintain email address for Vendor
  2. (BERP); Find event 00002040, copy fm SAMPLE_PROCESS_00002040 to Z_SAMPLE_PROCESS_00002040
  3. (FIBF -> settings -> Product ->a Customer); Enter product name and description of your choice (i.e. ZMAIL) and make it active.
  4. (FIBIF -> setting ->Process fm -> ...of a Customer); Enter Process = 00002040, FM = Z_SAMPLE_PROCESS_00002040, Product = ZMAIL (name of product define by you in step 3).
  5. *This config will automatically send email to vendor provided SCOT, payment method, and payment run program variant are configured.

*SCOT: Email attachment should be in PDF but it is in OTF - remove OTF from SCOT->node EXCH->supported address type, internet->set->supported formats. Validate conversion rule config (SCOT->settings->conversion rules).

*PM should have "Always Payment Advice Notes" selected.

*F110 program variant has print Payment Advice checked.

Additional information:

Forum Email Remittance Advice
https://www.sdn.sap.com/irj/sdn/message?messageID=3056623

SAP Help:
http://help.sap.com/saphelp_47x200/helpdata/en/e7/653749d2d211d29e430000e839cd96/frameset.htm

Additional:

http://www.le.ac.uk/cc/cchelp/sap/UG3-5%20Rem%20Advice.doc

Tuesday, May 01, 2007

Internal table in ABAP memory

Remote access to internal table of other program


field-symbols: type table.
data: wa type string.
data: pointer_tab(20) type c.

pointer_tab = '(ZRICH_0001)ITAB[]'.
assign (pointer_tab) to .
loop at into wa.
write:/ wa. endloop.

Monday, April 23, 2007

Trigger inbound BAPI IDOC for message type ACC_GL_POSTING

Refer to function group EDIN.

- Use EDI_DATA_INCOMING if you want to pass a IDOC file.
- Use IDOC_INBOUND_SINGLE or IDOC_INBOUND_ASYNCHRONOUS if you want to pass IDOCs in memory.

Additional information can be found in the book "ALE, EDI, & IDoc Technologies for SAP" pages: 99, 207, 262, 498.

Wednesday, April 04, 2007

ABAP ALV Robot

This site is intended to help ABAP programmers on the creation of ALV reports by automatically generating source code using a specially designed template.
This way ALV reports get done easier and faster. Also, as they are all made from the same template, standards get honored. The generated source is not messy nor complicated. Is as readable, simple and straight-forward as any other program created by yourself!
http://www.alvrobot.com.ar/home.php

ALV Generator

Thursday, December 07, 2006

Tuesday, December 05, 2006

ALV Colors

*&---------------------------------------------------------------------*
*& Report ZDEMO_ALVGRID *
*& *
*&---------------------------------------------------------------------*
*& *
*& Example of a simple ALV Grid Report *
*& ................................... *
*& *
*& The basic ALV grid, Enhanced to display each row in a different *
*& colour *
*&---------------------------------------------------------------------*

REPORT zdemo_alvgrid .

TABLES: ekko.

type-pools: slis. "ALV Declarations
*Data Declaration
*----------------
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
line_color(4) type c, "Used to store row color attributes
END OF t_ekko.

DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.

*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.


************************************************************************
*Start-of-selection.
START-OF-SELECTION.

perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.


*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
* Build Fieldcatalog for ALV Report
*----------------------------------------------------------------------*
form build_fieldcatalog.

* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you more control of the final product.

* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
* I.e. Field type may be required in-order for
* the 'TOTAL' function to work.

fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.

fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.

fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.

fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.

fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.

fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.

fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.

fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.

fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG

Tuesday, November 14, 2006

Sapgui progress indicator

PERFORM progress_bar USING 'Retrieving data...'(001)
sy-tabix
total_lines.


*&---------------------------------------------------------------------*
*& Form PROGRESS_BAR
*&---------------------------------------------------------------------*
FORM progress_bar USING p_value
p_tabix
p_nlines.
DATA: w_text(40),
w_percentage TYPE p,
w_percent_char(3).
w_percentage = ( p_tabix / p_nlines ) * 100.
w_percent_char = w_percentage.
SHIFT w_percent_char LEFT DELETING LEADING ' '.
CONCATENATE p_value w_percent_char '% Complete'(002) INTO w_text.
* This check needs to be in otherwise when looping around big tables
* SAP will re-display indicator too many times causing report to run
* very slow. (No need to re-display same percentage anyway)
if w_percentage gt gd_percent or p_tabix eq 1.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = w_percentage
text = w_text.
gd_percent = w_percentage.
endif.
endform. " PROGRESS_BAR

Friday, September 29, 2006

ST05 - SP vs SQL explain

Note 155413 says the following ...The output of the ST05 trace contains the runtime of theindividual SQL statements in microseconds (1.0E-6 sec). SQLstatements with longer runtimes are displayed red.- Select the slowest SQL statement and press the "Explain SQL"pushbutton.The execution plan for this SQL statement appears. The executionplan shows the indices, which the SQL Server would use at thepresent time to execute the SQL statement. This execution planmay change as soon as the contents of the database changes or anautomatic statistics update is executed.Therefore it shows the exact execution plan that is used at the time ofthe statment being run.Next onto the part about stored proceedures it states ....SAP R/3 uses Stored Procedures (SP's) for accessing the SQLServer. The SQL Server generates the execution plan during thefirst call of the SP. All additional calls use the same executionplan until the SP is re-compiled (caused, for example, by anautomatic statistics update). This improves the overallperformance of the R/3 System. However, in rare cases this canresult in very long-running SQL statements.- See Note 159171According to this part of the note the execution plan for a SQL commandis stored in cache and used again on the next time a similar commandis executed and so on.Refreshing the statistics forces the Stored Procedures to be recompiledagain and the execution plans to be updated. The following commandshould have the same effectexec sp_recompile

Thursday, August 31, 2006

Upload and Dowload to app server

Copy file between server (unix) and client (windows)

CG3Y and CG3Z for upload and download the file

Friday, July 21, 2006

Zebra - BarOne Printing ITF files

Here is some notes regarding printing labels with Zebra:This topic tells you how to use the method described under Printing Labels to create and print labels with Zebra .Procedure

1. Create the label: To design the label layout, use the design program BAR-ONE Tool for SAP R/3 label printing of the manufacturer Zebra. For more information see http://www.zebra.com. As printer, select the printer Zebra Z4000 in BAR-ONE.

2. Define the R/3 form fields: In BAR-ONE define all those fields as variable fields of type SAP variable field that will later be filled with variable data from the R/3 system. In the input field Identifier of the field attributes enter the R/3 field name to be used in SAPscript, enclosed in ampersands ("&"), for example &VBAK-KUNNR& .

3. Select fonts for the text fields: For variable and constant text fields you can use printer-internal fonts as well as TrueType fonts. For Zebra label printing, SAP has defined two different device types (see 8.). The difference lies in the character set coding for special characters (for example, German umlauts):o The device type LB_ZEB supports the character set IBM 850 of the printer-internal font "CG Triumvirate Bold Condensed". Use this device type if you want to print special characters in variable text fields in this printer-internal font. o The device type LB_ZEB2 supports the character set "Latin-1" of the TrueType fonts. Use this device type if you want to print special characters in variable text fields using TrueType fonts.

4. Insert bitmap graphics: You can include bitmap graphics (for example, company logo as *.BMP file) into the label definition. The system passes them to the print file during the download.

5. Download label definition into print file: Choose File ® Create Format for SAP R/3 to convert the printer commands into an ITF file that is suited for import into SAPscript. The Download Stored Format Wizard appears and allows you to choose between two procedures: o Download the label definition into the Zebra printer (RAM or nonvolatile memory) and create a merge file for SAPscript.o Create a file for SAPscript that contains label definition plus variable data. For performance reasons you should prefer the first method, since that print files created in R/3 to be sent to the printer have only minimal size. With the second method, even though you avoid keeping the label definition in the printer, you must pass the entire label definition to the printer for each label you print from R/3 (including graphics, fonts, and so on), which is considerably slower. BAR-ONE in both cases creates a file with the extension ".ITF".

6. Upload the print file to SAPscript: Start the SAPscript standard text editor (transaction SO10). Create a new standard text. Use Text ® Upload to load the label file; choose ITF as format. Save the file.

7. Adapt the SAPscript form: To print the label, adapt the SAPscript form you want to use for printing. Choose Utilities ® SAPscript ® Form: o The MAIN window must be as wide as possible to avoid printer commands being split up by line feeds. If the width of the main window is less than 15 cm (6 inches), enlarge it to at least this value. o You can keep all other windows unless they overlap with the MAIN window. The Zebra printer ignores any texts you may output in these windows. o Delete all windows except MAIN. If you keep any windows, they must not contain any data you want to print (you may mark texts as comments). o The MAIN window should contain only one text element which contains the newly created label file. The name of the text element depends on the R/3 application program you use. Insert the label file into this text element by copying the entire text from SO10 into the form window. o If there are any other text elements defined in MAIN that are called from within the print program, you can leave them unchanged since the printer ignores unknown commands. However, for better readability you should mark their contents as comments.o The first page of the form should point to itself as next page, since the label file in the MAIN window may be very large, especially if it includes graphics.

8. Create an output device: Define the Zebra printer as Output Device in the SAP System. The easiest way is to connect the printer to a Windows PC, install any Windows printer driver there, and start the output program SAPlpd. Then define the printer in the spool administration (transaction SPAD) using coupling type "S" or "U". As device type select LB_ZEB or LB_ZEB2 .

Wednesday, July 05, 2006

Switch from ALV Grid to ALV List at runtime

REPORT Y_RAVI_REUSE_ALV.



TYPE-POOLS : SLIS.



DATA : T_DATA TYPE TABLE OF ALV_T_T2,

T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.



START-OF-SELECTION.



SELECT * FROM ALV_T_T2 INTO TABLE T_DATA UP TO 30 ROWS.



END-OF-SELECTION.



CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

* I_PROGRAM_NAME =

* I_INTERNAL_TABNAME =

I_STRUCTURE_NAME = 'ALV_T_T2'

* I_CLIENT_NEVER_DISPLAY = 'X'

* I_INCLNAME =

* I_BYPASSING_BUFFER =

* I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = T_FIELDCAT

* EXCEPTIONS

* INCONSISTENT_INTERFACE = 1

* PROGRAM_ERROR = 2

* OTHERS = 3

.

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.



FIELD-SYMBOLS : LIKE LINE OF T_FIELDCAT.

READ TABLE T_FIELDCAT ASSIGNING with key FIELDNAME = 'PRICE'.

IF SY-SUBRC = 0.

-DO_SUM = 'C'.

ENDIF.



DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

WA_LAYOUT-allow_switch_to_list = 'X'.



DATA : WA_VARIANT TYPE DISVARIANT.

WA_VARIANT-USERNAME = SY-UNAME.

WA_VARIANT-REPORT = SY-REPID.



CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

* I_INTERFACE_CHECK = ' '

* I_BYPASSING_BUFFER = ' '

* I_BUFFER_ACTIVE = ' '

* I_CALLBACK_PROGRAM = ' '

* I_CALLBACK_PF_STATUS_SET = ' '

* I_CALLBACK_USER_COMMAND = ' '

* I_CALLBACK_TOP_OF_PAGE = ' '

* I_CALLBACK_HTML_TOP_OF_PAGE = ' '

* I_CALLBACK_HTML_END_OF_LIST = ' '

* I_STRUCTURE_NAME =

* I_BACKGROUND_ID = ' '

* I_GRID_TITLE =

* I_GRID_SETTINGS =

IS_LAYOUT = WA_LAYOUT

IT_FIELDCAT = T_FIELDCAT

* IT_EXCLUDING =

* IT_SPECIAL_GROUPS =

* IT_SORT =

* IT_FILTER =

* IS_SEL_HIDE =

* I_DEFAULT = 'X'

* I_SAVE = ' '

IS_VARIANT = WA_VARIANT

* IT_EVENTS =

* IT_EVENT_EXIT =

* IS_PRINT =

* IS_REPREP_ID =

* I_SCREEN_START_COLUMN = 0

* I_SCREEN_START_LINE = 0

* I_SCREEN_END_COLUMN = 0

* I_SCREEN_END_LINE = 0

* I_HTML_HEIGHT_TOP = 0

* I_HTML_HEIGHT_END = 0

* IT_ALV_GRAPHICS =

* IT_HYPERLINK =

* IT_ADD_FIELDCAT =

* IT_EXCEPT_QINFO =

* IR_SALV_FULLSCREEN_ADAPTER =

* IMPORTING

* E_EXIT_CAUSED_BY_CALLER =

* ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = T_DATA

* EXCEPTIONS

* PROGRAM_ERROR = 1

* OTHERS = 2

.

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Wednesday, April 05, 2006

Interview Questions

Real time questions

Which client number you use for the current project?
You are running a report. It is taking long time for execution. What steps will you do to reduce the execution time.
After running a BDC program in background, next day morning when you see the results, few records are not updated(error records). What will you do then?
You are given functional specs for a BDC program and you need to decide whether to write a method call transaction or a session. How u will decide?
What is the difference between report and script?
what are the differences between scripts & smart forms?
what are enhancements?
what are user-exits?
what is badi?
what is the difference between user-exit & BADIs?
what is the difference between user-exit & customer-exit?
how do you get functional specs when you are assigned some object? (specs through email..??)
How do you write technical specs?
How do you write UTP?(unit test plan)


ABAP FAQ (Technical)
DATA DICTIONARY
What is data Dictionary ?
What is the difference between open sql & native sql ?
Difference between Pooled, cluster & transparent tables?
What is Primary key, foreign key ? what is primary index? secondary index?
how many indexes can be created for a table?
what is a value table?
what are the components of a table?
what is a domain?
what is a data element?
what is data class?
can you create a table with out a data element?
can you create a field with out a data element?
What approach you prefer for creating a table?
Give few names of cluster tables in sap?
Give few names of pooled tables in sap?
give few names of transparent tables?
what is a buffer and how many types?
what is table maintenance generator and how to create that? What is the transaction code?
How to add new fields to a standard sap table ?
How many types of table joins are there?
difference between inner join & outer join?
Difference between "select * from mara" and "select single * from mara"?
what is a match code ? Lock objects ?
what are views?
what are logical tables/database?
what is the difference bet'n table and a structure?

REPORTS
what is a report?
what are types of reports?
difference bet'n simple and interactive reports?
what are the events in interactive reports?
what is the first event that will be triggered in a report?
what is the use of Initialization event? give one example.
what is the use of start-of-selection event?
what is the difference betn end-of-page and end-of-selection?
if you write a write statement after end-of-selection, will that be triggered?
how to create a button in selection screen?
how to add a gui status in a selection screen?
what is at-line-selection event?
How many secondary lists can be created in an interactive report?
how to create a check box/option button in a list?
can you call a bdc program from a report? how?
can you call a transaction from a report? how?
what are ALV reports? how they are different from normal reports?
what are the main events that are used in an ALV report?
what is the use of SLIS type pool in alv reports?
difference betn top-of-page and top-of-page during at-line-selection?
in an interactive report, after going to 5th list, can you come back to 2nd list? how?

Internal Tables
what is an internal table?
how many type of internal tables are there?
what is the difference between hashed & sorted internal tables?
what is the difference between standard and sorted internal tables? (in performance wise)
Difference between internal table and a dictionary table?
can you create an internal table dynamically?(at run time)
what is the use of select for all entries in an internal table?
when you are using 2 internal table in program, you have decided to use for all entries statement to retrieve data but unfortunately there are no records in the first internal table. What will be the result? (2nd internal table contains records).
in a loop of an internal table, what is the use of at first & at last statements?
What is the use of at new statement?
what is the difference between at first & at new statements?
what is a binary search ? and how it is useful in a sorted internal table?
when do you need to create an internal table with header line ?and with out a header line?
what does it mean occurs 0 while creating an internal table?
what will happen if you don't give occurs clause while creating an internal table?
what is the difference between clear, delete & refresh with respect to an internal table?

BDC & LSMW
What is BDC ?
What is call transaction method ? what is the syntax/procedure?
What is session method and what is the syntax/procedure?
Difference between call transaction & session method?
which of these methods can be best used in background process?
What is direct input method?
How LSMW is advantageous than normal BDC?
what are the steps in lsmw?
IN LSMW can you use BAPI, ?
Can you call a bdc from a report program?
what is the difference between synchronus & asynchronus methods?
call transaction uses synchronus or synchronus method?
session method uses synchronus or synchronus method?
What is bapi?
how bapi is different from call transaction/session?
what r the advantages of bapi?
for uploading master data(ex:customer data) into sap, which methods you prefer? call transaction/session/lsmw/bapi? why?
tell any 2 standard bapi function modules used for uploading sales order data?

Performance Tuning
What is performance tuning?
What are steps you follow to improve the performance of a report ?
what is the role of secondary index in performance?
what is the role of ST05 in performance tuning?
what is the role of extended syntax check in performance tuning?
will join conditions in sql queries affect perfomance? how?
will sorted internal tables help in performance?
will where conditions in a sql query help improve performance?
does select single *.. / select * .. affect performance ? how?

Sap Scripts & Smart forms
What is the difference between a script & a report ?
What are the components/elements in sap script ?
Can you create a script with out a main window ?
How many main windows can be created for a script ?
How can we use tables in sap scripts?
How to print a logo in a sap script?
When we need to modify standard scripts(eg:medruck) given by sap?
What is the use of transaction code NACE in sap scripts?
what is the table name that will contain all the script form names and print program names?
Can you assign your own form to a standard print program? how?
What is the use of PROTECT & ENDPROTECT?
How to add extra functionality to a standard print program with out touching the print program?
what is sub routine pool in sap script? when it is used?
How to read text in sapscripts?
What is the transaction code for logo uploading?
what is the difference between paragraph & character format?
How to use a sapscript for multiple languages ? (english,germany etc)
How to download/upload sapscripts from & to your PC ?
What is the difference between scripts & smart forms?
What is the standard program used for uploading the logo to script?
How can you send forms from one client to other?
what does open_form, write_form, close_form do?
How to convert a sapscript to smart form?
How to send a smartform result through mail?
how to select desired paper size in sapscript?
tableWorkaround(3)
Updating more faq every day...plz revisit..

Thursday, March 16, 2006

ESRDIRE - Lock Object for ABAP/4 programs

*Lock the program
CALL FUNCTION 'ENQUEUE_ESRDIRE'
EXPORTING
name = 'PT_AR_Interface'
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE e009 WITH 'Failed to lock program.'.
ENDIF.

Tuesday, December 20, 2005

ALV Refresh screen

If you modify fields on your ALV screen using the user_command exit and want the changes to be displayed. Set the user command r_ucomm to '&REFRESH' before leaving the form.

For example:
*---------------------------------------------------------------------*
* FORM USER_COMMAND *
*---------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&DATA_SAVE'. "menubutton
PERFORM post_transactions.
r_ucomm = '&REFRESH'.
WHEN '&IC1'. "doubleclick
PERFORM handle_drilldown USING rs_selfield post_flag.
CLEAR r_ucomm.
WHEN OTHERS.
MESSAGE w061.
CLEAR r_ucomm.
ENDCASE.
ENDFORM.

Wednesday, December 07, 2005

Portugal Config Notes

*Start off
IMG->
General Settings...
Enterprise Structure...
Cross-Application Components...
Financial Accounting...

*Vendor Config
IMG->
Define Vendor Account GroupsPT01 - portugalI001 - Intercompany Create number range for Account groupIX - Innnn (nnnn - company code) x-companyP1 - 10000000000 -10000099999) Portugal AssignNumber range to account group Define screen layoutTurn on international fields Created x-company vendor:I3000 and I0005

*Portugal Bank
The bank key has 8 characters (4 positions stand for the bank number + 4 positions for the branch), is numerical, and without gaps.
The bank account number has up to 11 digits, is numerical, and without gaps.
The control key has 2 digits and is numerical.
The bank key, the bank account number and the control key are checked simultaneously.
Bank account number checks in general ...

*Payment Program DME
FBZP - set up payment method and banks
FK01 - set up vendor with bank account
F110 - run payment run
FDTA - download DME/PS2 file for transmission

*Various Topics
Standardize ACH processing
Clean up payment methods for country and company (FBZP)
Payment program run design (for US and PT)
S_ALR_87012260 - BS for Portugal P&L
OBD4 - Turn on Alt. Acct No. in FS00/FSP0/etc.
IMG -> Transport Group Chart of Accounts

*COA / GLs
1) Load new COA into system (FSP0): Z_COA_LOAD (possible replace with RFBISA00)
2) Creating and changing G/L account master data (FS01...):
a. ZRFBISA00_FORMAT - Format file for RFBISA00
b. RFBISA00 - Creating and changing G/L account master data
3) Automate: OBA1 -> Exchange rate difference in open items:ZKDF_V_T030H

*Config Exchange Rate difference key (FSS0, OBA1)
IMG->
Accounts Receivable and Accounts Payable -> Prepare Automatic Posting for Foreign Currency Valuation
Consolidation -> Transport Group Chart of Accounts
General Ledger Accounting -> Delete Chart of Accounts
General Ledger Accounting -> Transport Chart of Accounts
General Ledger Accounting -> Prepare Automatic Postings for Foreign Currency Valuation
General Ledger Accounting -> Copy Chart of Accounts
*OBA1
1) Config Unrealized gain/loss for B/S accounts - Exch.rate diff. in forgn.curr.balances (KDB)
2) Config realized gain/loass for P/L accounts- Exchange rate difference in open items (KDF)

*Foreign Exchange Rate config
SPRO->
Define Additional Local Currencies
Validate/update group currency fields K* in table GLT0 using H* fields and any special purpose GL tables

*Load Exchange Rates:
RFTBFF00

Thursday, November 03, 2005

Database-Hints in Open SQL for MS SQL Server

Example ABAP hint to use BSAS index ZSN:

SELECT * FROM bsas BYPASSING BUFFER
APPENDING CORRESPONDING FIELDS OF TABLE i_zkloan
WHERE aufnr = p_aufnr
%_HINTS MSSQLNT 'TABLE &TABLE& ABINDEX(ZSN), FASTFIRSTROW'.

additional information in oss notes: 133381, 129385, 159171

Problems with indexes, try the following:

Force an "update statistics" (this should happend automatically in MSSQL 7 and up).
Update Stats on one table:
USE DEV
UPDATE STATISTICS bsas

Update Stats on all tables:
USE DEV
EXEC sp_updatestats

Refreshing the statistics force the Stored Procedures to be recompiled again and the execution plans to be updated. The following command should have similar effect:
EXEC sp_recompile bsas

Monday, October 31, 2005

C call to retrieve transaction variant name at runtime

report zzdifran_variant .
data: tcode_variant like shdfv-tcvariant,
tcode_variant_cliidep.
parameters: test.
*New field: transaction variant
call 'DY_GET_TX_VARIANT'
id 'VARIANT' field tcode_variant
id 'CLIENT_INDEPENDENT' field tcode_variant_cliidep.

write: / 'I found txn variant:', tcode_variant.

Thursday, September 15, 2005

BADI - Business Add-in Builder

Transaction SE19

FB1S Missing clearing information in table BSEG

IF you need to have the field AUFNR in the clearing line item, you have the option to work with a clearing rule.
1) Go to transaction OBIA and define a clearing rule.
2) Assign the field AUFNR to the clearing rule.
3) Save the definitions.
4) Go to transaction OBIB and assign the clearingrule to the concerned account type.
5) Save the changes.

Please see note 543898.

Monday, August 29, 2005

Find programs that use sapscript form

Find Programs That Use a Layout Set
In 4.6, you can find the programs that use a layout set by going to transactoin SE71, and entering your layout set name. Go to the text elements (F9) of the main window and from there choose Insert-Symbols-Program Symbols. A list of the print programs that use the layout set will be generated.
Use one of the ABAP scan programs that SAP delivers. ie RSRSCAN

Tuesday, August 09, 2005

Select count(*) is faster then Select single

SE30 analysis:

SELECT count(*) FROM bkpf WHERE bukrs = s_trans-bukrs AND
belnr = s_trans-belnr AND
gjahr = s_trans-gjahr AND
stblg = space.

vs

SELECT single * FROM bkpf WHERE bukrs = s_trans-bukrs AND
belnr = s_trans-belnr AND
gjahr = s_trans-gjahr AND
stblg = space.

Wednesday, June 08, 2005

Message type to Function Module table TBDBE

Table TBDDE shows what function module, object type, or method is related to the message type for IDOC processing.

Monday, April 25, 2005

Sample Code - Control Break Processing Option

Loop Control Break Processing if you can’t use AT NEW or ON CHANGE stuff

LOOP AT itab.

IF sy-tabix = 1.
MOVE-CORRESPONDING itab TO sav_itab.
ENDIF.

IF sav_itab-key <> itab-key OR
sav_itab-key2 <> itab-key2.

PERFORM append_itab USING sav_itab sum_wrbtr.
CLEAR: sav_itab, sum_wrbtr.
MOVE-CORRESPONDING itab TO sav_itab.
sum_wrbtr = sum_wrbtr + itab-wrbtr.
ELSE.
sum_wrbtr = sum_wrbtr + itab-wrbtr.
CLEAR sav_itab.
MOVE-CORRESPONDING itab TO sav_itab.

AT LAST.
PERFORM append_itab USING sav_itab sum_wrbtr.
ENDAT.

ENDIF.

ENDLOOP.

Tuesday, April 12, 2005

SGEN - SAP Load Generator

You can use transaction SGEN to generate the ABAP loads of a number of programs, function groups, classes, and so on.

Tuesday, March 29, 2005

IDOC/ALE/XML/Change Pointers overview

Config:
•SPRO -> Search for “Change Pointer”
•Define/Assign Logical System (SALE)
•Define Port (WE21)
•Maintain Distribution Model and Distribute Views (BD64)
•Activate Change Pointers – Generally (BD61)
•Activate Change Pointers for Message Types (SPRO)
•Creating IDocs from Change Pointers ->Define Variant (BD21)
•Maintain Partner Profile Manually (WE20)

Customization:
•Additional data for message type (BD60)

Process:
•View Change Pointers (table BDCP)
•Create IDoc from Change Pointers (BD21)
•OR: Create IDoc for a range (DB14)
•View IDocs (WE05)
•Process all selected IDocs (WE14)

Other stuff:
•DTD (WE60/WE63)
•Delete Change Pointers (BD22)
•Archive IDocs (WE47, SARA)

Monday, March 28, 2005

Print Selection Parameters (RS_COVERPAGE_SELECTIONS)

DATA: BEGIN OF it_param_values OCCURS 0,
z(2) TYPE c,
line LIKE raldb-infoline,
END OF it_param_values.

*Output selection Parameters
CALL FUNCTION 'RS_COVERPAGE_SELECTIONS'
EXPORTING
report = sy-cprog
variant = space
* NO_IMPORT = ' '
TABLES
infotab = it_param_values
EXCEPTIONS
error_message = 1
variant_not_found = 2
others = 3.

IF sy-subrc = 0.
LOOP AT it_param_values.
WRITE: / it_param_values-line.
TRANSFER it_param_values-line TO p_file.
ENDLOOP.
ENDIF.

Wednesday, March 23, 2005

For all entries

When using for all entries in a select statement with an empty internal table, not only does it get all entries for the selected where clause for the desired field in the for all entries table, it IGNORES the rest of the WHERE clause, meaning it will retrieve every single entry in the SELECT FROM table. Usually, this is not encountered because you should always check for an empty table prior to doing a FOR ALL ENTRIES select, but if you wanted to use the other conditions in the where clause you will not be able to. Pretty stupid on SAP's part.

Wednesday, March 02, 2005

List of User Exits

User Exit List
CMOD -> Utilities -> SAP Enhancements -> F8 Execute

Tuesday, March 01, 2005

Transaction Variant (SHD0)

Use tranid SHD0 to create a transaction variant and screen variants for a standard transaction.
Create a transaction code with SE93 - type "transaction with variant" specify transaction and variant.

Friday, February 25, 2005

Methods Being Displayed through .Net Connector

I marked several BAPI methods as Modeled and Implemented throughtransaction SWO1. This removes the method from the BAPI Explorer, butthey are still being displayed through .Net Connector. Is there anywayto hide Methods from the .Net Connector until they are Released?
There might be small differences in the view of BAPI explorer in SAPGUI and Visual Studio. If you need another view, you cantry to select the "Hierarchical" node and change the "X"sesin the property window before you expand the node.Which methods appear inside of a BOR class is mainly controlledif there is an implementation specified(property Abapname is not empty). If you see more methods thanyou want to have in your proxy, the easiest is either droping theBOR object and deleting the methods you don't like from the designer,or drag the methods you need individually. Note that draggingindividual method would not do some auto-customizing (e.g.use of Key-fields and so on).

Thursday, February 24, 2005

Generate Fast Entry Screen Templates

RFFAKP01
Short text
Generate Fast Entry Screen Templates
Description
This program is used to completely generate the variants of the fast entry, which exist for different applications (for example, post document).
The parameters Program and Application can be recognized in the respective configuration menu (example: Bus.transactions -> Base parameters -> Display format and then Object -> Fast entry) in the upper part of the screen where the variants are listed.

In the configuration menu, a regeneration is only carried out when the variant is changed; this restriction does not apply to this program, the variants are generated without having been changed.

Friday, February 18, 2005

Sapgui sapdp00 error

This occurs when something is awry and your services file is not being read properly.

The workaround is to start sapgui from command line:

Run the following command from the dos:
sapgui /H/server IP here/S/3200

Payment Methods How it works

Payment Method (PM)
Vendor Master (VM)

+PM in the VM - are the allowable PMs if the invoice PM is left blank.
+PM in the Invoice - overrides what is in the VM.
+PM in the payment program(F110) looks for invoices with a matching PM.

For example:
Vendor 1 PM = C
Invoice a PM = blank
Invoice b PM = M
Invoice c PM = C
Invoice d PM = D

F110 PM = CM will create a payment for:
Invoice a PM => C (PM came from the VM, if the VM PM was blank, this invoice would not have been created)
Invoice b PM => M (invoice overrode VM PM)
Invoice c PM => C (invoice overrode VM PM)
Invoice d PM => not selected by F110

Tuesday, January 18, 2005

trigger an event from an external program

Here's how you can trigger an event from an external program.

Create the event in SM62 (i.e. DTEST_EVENT)
Create a job to run after event SM36(i.e. DTEST_JOB)
Create a program on SAP server (i.e. d:\Raise_DTEST.cmd)
Run the program.

The magic command in the program is:

sapevt -t name= nr=
(i.e. sapevt DTEST_EVENT -t name=DEV nr=00 )

EVENTID is the name of the SAP defined event to raise
-t will create a trace file

the program must have access to \\\sapmnt\\SYS\exe\run

Friday, January 14, 2005

Field Validation config for Tranid

(OB28) IMG -> search for validation
1) Assign validation to company code
2) create validation (i.e. dat_chk)
3) create step, check, message

(GCX2) Maintain Client-Dependent User Exits activity in the Implementation Guide (IMG) for Special Purpose Ledger
1) enter the appropriate user exit program
2) maintain user exit program (ZGGBS000 and ZGGBR000 -- copied from -- RGGBS000 and RGGBR000)

Additional:
IMG -> search for Validation (OB28 for accounting docs)
IMG -> search for Substitution (OBBH for accounting docs)

Wednesday, January 05, 2005

Check Processing

FB10 Invoice Fast Entry
F-58 - Payment w/ print
FBZ5 - Print
FCH4 - Renumber
FCH7 - Reprint
FCH8 - Cancel
FCH9 - Void
FCHT - Change Assignments

Tuesday, January 04, 2005

Configure FB10 - Invoice Fast Entry

Q: How can I add House Bank to FB10 (Invoice/Credit Memo Fast Entryscreen)?I was able to activate the field for FB60 by using "Maintain FieldStatus Variants" in the IMG, but this does not seem to change the FB10screen. O7E5 doesn't seem to have house bank as a possible entry.Thanks for your assistance.

A: Which screen are you referring to? Please confirm is it for programSAPMF05A and screen 127. These details you can get it from menu patchSystem --> Status. You can enable or disable list of possible fieldsif they are available in the corresponding screen layout editor viaSE51. I checked in our test system for tcode FB10 and noticed that inthe screen 127 there is no possibility of having 'House Bank' fieldsince the availability of field on this screen doesn't exist. Hope thisinformation clarifies your query. Should the problem is resolved pleaseclose the message. Please do not hesitate to revert me in case you haveany queries with necessary info like, program name and screen number tocheck the possibility of having 'House Bank' field.

R: I was able to active house bank for transaction FB10, however, it was not on the initial screen and was difficult to get to. Based on this and SAP's response, I've decided to modify SAPMF05A screen 8001 (FB10, entry template Z003) to include house bank. A modified version of this screen is already in production and it has a repair open in DEV that I'll have to clean up and/or close as not to migrate it to PRD. Otherwise, this looks like it will be a good solution for the users to choose/override the bank determination logic.

Friday, December 17, 2004

Wednesday, December 15, 2004

OK_CODE to '=/BDA' when you want to give a user control at a specific screen during a call transaction

Set OK_CODE to '=/BDA' when you want to give a user control at a specific screen during a call transaction.

So instead of run mode A where you see all the screens or run mode E where you only see the errors, you can use run mode N and then stop the program on a specific screen and give the control to the user. When the user finishes the transaction the control goes back to the program, I think.



SAPconnect Internet Email

SAP Library - BC SAPconnect