Saturday, December 17, 2011

TAW review season 1

Hello Guys, hope you are doing well this coming holiday season.

I would like to let you know that I will be posting some topic with regards to TAW reviewer in this coming days. TAW reviewer helped me a lot in passing my ABAP certification as well as helps me in my day to day ABAP job.

If you have any suggestions or topic that want to discuss I would be happy to cover them up!

Until next time. Please don't forget to check out my posts soon.

Happy Holidays everyone!

(For a complete copy of TAW reviewers, please email me at awesome_nope@yahoo.com)

Monday, November 28, 2011

Adding standard ALV toolbar button in OOP

Below are the simple steps in adding a standard ALV button using OOP.

1. Create a class that will handle the TOOLBAR event and insert the code for the particular button













2. Include the event in your main program:

 SET HANDLER obj_EH_ALV_FORECAST->HANDLE_TOOLBAR FOR grid1.

Monday, September 26, 2011

Translating your SAP text

Have you ever encountered language translation problem or any SAP related problem with regards to language? In this topic, we are going to address that issue of yours. Just follow the below simple steps:

1. In your ABAP editor or any editor that you are currently on as long as it has a toolbar above and you can find this path:

 GOTO-> TRANSLATION.

then put the corresponding language you may want to translate. On the example below we are going to translate german to english:



then locate the program by double clicking it then you will see the text that you might need to translate in order to show in your SAP application when you run:



In our case, we will double click FBAS row then just change the text that you may want to translate then SAVE!



And that's it!

Wednesday, September 14, 2011

Converting a SAPSCRIPT to PDF

Below are some of the things that you need to do in order for the sapscript to be converted into a pdf file. (We need to convert the spool instead of otf)

1. Make sure to move values to the ff. fields of OPTIONS parameter of FM OPEN_FORM:

Tuesday, September 13, 2011

Cost Center and HR master exits and BADIs


FOR COST CENTER master

1. Determine the receiving Partner Profile to receive.
2. Put COSMAS as message type on the receiving partner (only specified partner will have the  extended sgment)
3. include YCOSMA01 as the extended idoc for COSMAS mess type basic idoc COSMAS01
4. add additional code in badi :
   implementation name: ZCOOM_CI_CSKS_IDOC
   definition name: COOM_CI_CSKS_IDOC
   interface name: IF_EX_COOM_CI_CSKS_IDOC
   implementing class: ZCL_IM_COOM_CI_CSKS_IDOC

       CODE: upload data to segment as long as cost center date is valid.

FM: MASTERIDOC_CREATE_SMD_COSMAS <--- exits can be found here

Configuration for message type HRMD_A change pointer

1. Use message type hrmd_a (Your custom IDoc should have a Message Type and the Change Pointer should be activated for this Message Type. You can activate this via transaction SALE)
2. Use bd59 to define ALE obj
3. Activate change pointer globally in bd61

Just a checklist for ALE change pointer configuration

I want to share the steps in ALE/IDOC/EDI configuration. 

Below are the steps to look at in creating change pointer. The ff. steps are standard all across SAP IDOC/EDI/ALE related projects. No matter what you are aiming for as long as change pointer or IDOC is concerned, you are required to consider the steps below:

1. SM59(Create RFC destination)
2. WE21(Create TRFC-PORT)

Thursday, July 07, 2011

Change pointer in IDOC (when data was changed)

Change pointer is the process in SAP IDOC triggered every time there are changes on master tables for both fields and records. Thus, for example you add or edit any information with your customer information and once change pointer program has been triggered, then that is also the time it will be populated and will create an IDOC. Change pointer can also be setup in a customized IDOC or message type.

Tuesday, June 28, 2011

Tricky steploop in screen painter (SE51)

Recently, we have a problem in our standard transaction regarding the pop up dialog being shown. The dialog is originally created by SAP called POPUP_TO_DECIDE_LIST. The dialog shows only 25 radio buttons that when displayed, it is exactly as tall as the monitor screen.

One of the business requirements is to enhance the dialog to be able to show at least 200 rows or all the records in the master table of credit cards as this is related to a credit card transactions. We have contacted SAP and they tell us that this was already addressed by OSS note 1108382. Meaning, there is no need for us to do coding anymore as we just only need to apply the OSS note. But, there is a problem as we've

Maintaining a table hastle free

Maintaining your customized table with your own tcode and program did ever cross your mind?

There's a very easy way to address your problem by creating a TCODE in se93 and choosing the parameter type tcode. By calling SM30, skipping initial screen then at the bottom part, you may include the table name (add VIEWNAME under name of screen field) and assign whether it can be updated (X) or not (blank) (add UPDATE under name of screen field).

To start with, in SE11 after creating your table, tech settings, etc. go to  Utilities->table maintenance generator. Save your changes.

Prerequisite: Make sure that the below where assigned to table:



If you want to add new fields, you may go to se11--> change--> utilities--> table maintenance generator-->generated objects--change-->new fields table and press enter and generate (click key or normal fields as well as click the screens to regenerate new)

Note: Put &NC& in Authorization Group and the table name in function group field if you don't assign any authorization..

Don't forget to adjust and activate your db in se14. then generate again.You may want also to modify your generated function group codes i.e changing screen layout, column names, etc.

Hope you find this useful. If you have questions or comments, please don't forget to put. Thanks!

Thursday, June 23, 2011

Transferring/receiving data from SAP r/3 to other box or third party software

Many existing organizations run their business from a different systems or platforms. This may include SAP R/3, JAVA J2EE, .NET or legacy systems such as Mainframe/COBOL.

In legacy systems, transferring data is usually done through a dump file or a txt file which has been formatted according to agreed format with the handler system.

In SAP, transferring data is done through IDOC using ALE and EDI technology.

IDOC stands for intermediate document comprises of a segment and fields that forms a certain file layout. In non-SAP system, their IDOC is commonly referred as the input and output dump file or simply text file. In SAP, it is quite more sophisticated and intact. IDOC in SAP world is used as a medium of transferring data to one box or to a third party software.


IDOC will work only by configuring it with ALE and EDI technologies. ALE stands for Application Link Enabling or a technology incorporated by SAP to synchronize and to manage the changes done between data of separate  boxes within SAP only.


EDI stands for Electronic Data Interchange. This serves as the medium to transfer or to communicates the IDOC to other system outside SAP in order for them to be transferred and delivered successfully.

Tuesday, June 21, 2011

How to apply OSS NOTES

OSS NOTES are sap fixes or patches programs or configurations to your SAP system in order to fix or to update something relevant to your specific problem or application functions.

Today we will walk through you to tcode snote to apply the oss note.  SNOTE tcode is used to apply oss notes as well as viewing the status of the OSS notes if has already been applied or not or any status determination.

Tuesday, June 14, 2011

BINARY SEARCH with disadvantage!

In whatever means possible, always use binary search in your ABAP program as what SAP AG suggests. But, there is one thing that you need to look at.

Function Exit in SAP DMEE

Introduction:


Data Medium Exchange Engine (DMEE) is where you define the fields of your FTE or IDOC.


It is defined also by SAP AG as:
    The Data Medium Exchange Engine (DMEE) enables you to define file formats that meet the requirements   of your financial institution. This is particularly important as there is no worldwide or regional standard. In some cases, no country standard exists and the file must comply with bank-specific standards. With no ABAP programming knowledge required, this tool enables you to flexibly define new formats and to efficiently modify existing ones. In addition, DMEE can be used by calling applications to generate a DME file.

Objective:


In this topic, I will show you how to use the function exit in DMEE of a certain bank of a country.

Tuesday, May 31, 2011

The secret of SAP AG in reading COVP


In tcode CJIC, SAP used this method in reading clustered table COVP (COBK and COEP) urgg this is a uge file of data to read on.
I noticed that this style is suitable only for reading one objnr record, else you will get stuck.

SELECT alebn alebz aworg aworg_rev awref_rev awsys awtyp beknz belnr beltp blart bldat
bltxt btrkl budat bukrs buzei bwstrat bw_refbz cpudt cputm ctyp1 ctyp2 ctyp3
ctyp4 dabrz delbz ebeln ebelp erlkz fkber geber gjahr gkoar gkont grant_nbr gsber
hrkft kokrs kstar kurst kwaer k_gjahr k_timestmp k_versn k_vrgng lednr logsyso
logsysp logsystem mandt matnr mbfbtr mbgbtr mefbtr megbtr meinb meinh mvflg objnr
objnr_hk objnr_n1 objnr_n2 objnr_n3 orgvg owaer pafbtr pagbtr paobjnr pargb parob
parob1 pbukrs perab perbi perio pernr pfkber pgeber pgrant_nbr pkstar pscope psegment
qmnum rbest refbk refbn refbt refbz refbz_fi refgj scope segment sgtxt stflg stokz
sumbz timestmp twaer usnam uspob varnr vbund versn vrgng werks wkfbtr wkgbtr wogbtr
wrttp wsdat wtgbtr zekkn zlenr zprofit_center zzcommcode zzfuncaccnt zztxtid
zzwriteofcat zz_ext_locno zz_matnr zz_pernr zz_xref3
INTO CORRESPONDING FIELDS OF wa_covp FROM covp
WHERE lednr = c_lednr_00 AND
objnr IN r_bsis_objnr AND
GJAHR IN GR_GJAHR AND
versn IN GR_VERSN AND
wrttp IN r_wrttp AND
KSTAR IN LR_KSTAR AND
PERIO IN GR_PERIO AND
BUDAT IN GR_BUDAT AND
PAROB IN GR_PAROB AND
(VT_VAR_COND).

IF sy-subrc = 0.
CHECK wa_covp-kokrs = c_ko01 AND
wa_covp-belnr IN r_belnr AND
wa_covp-bukrs IN r_bukrs.
CHECK wa_covp-beknz <> c_debit_a.
CHECK wa_covp-wrttp = c_vtype_04 OR wa_covp-wrttp = c_vtype_12.
INSERT wa_covp INTO TABLE tb_covp.
ENDIF.
ENDSELECT.

The best way to read covp or any table with a large volume of data is by utilizing its secondary keys instead of primary keys when not available or you can experiment among the two types of keys. Always use FOR ALL ENTRIES and avoid INTO CORRESPONDING FIELDS OF and SELECT .. ENDSELECT. I can guarantee you to have an optimized way of reading such tables.

*please check tcode cjic ;)

Saturday, May 07, 2011

Rewriting a select statement with into corresponding fields

One of my task in my recent work was to optimize a select statement. As a best practice, using asterisk (*) and into corresponding is greatly discouraged in a select statement. One of our tasks today, is to optimize the code below and I will show you how.

Saturday, April 30, 2011

Downloading and uploading SAP objects

A very helpful table that stores the Object Type of Saplink short text is EUOBJEDIT. Look for TADIR field to see the list of Obj. Types.

Tuesday, April 19, 2011

Getting down with ABAP memory analysis and management

Mostly, ABAP programmers doesn't care too much on the memory being consumed by the application or reports they are creating during runtime. Though, yes sometimes, memory consumption is not the main issue when comes to abap programming. But, for me, having an efficient memory allocation and management of your application is one way of showing how keen you are and not only that, it shows also how much you care to the overall performance of your SAP system where your apps resides. It starts from 1 to reach 1000 and so on. Meaning, if you don't know how to manage or to free-up even 1bit of your memory garbage, it will lead to be a problem/disaster later on. So why wait for your apps/system to crush when you can manage it right now? In this topic, I will show you the different tools available from SAP that could help us in managing memory issues and if how can we minimize and clean up some of those.

Saturday, April 09, 2011

Dynamic selection screen

Sometime ago, I started doing research in creating a dynamic selection screen similar to se16n initial screen. Today, I found a forum in sap sdn about creating this type of selection screens. I have to paste this code before someone will delete the page  or I will not be able to locate this again (funny though). This code was contributed by Sumant Sura to give credit to his work. I can't guarantee yet if how this code works. I will try to code this when I get by the office again then I will let you know. For more info about dynamic selection screen, you may visit this forum.

FUNCTION y_ss_test_dynamic_selection.
*"----------------------------------------------------------------------
""Local interface:

Monday, April 04, 2011

Printing Header in OOP ALV

In using ALV OOP and you want to print the header i.e. using spliter screen. Don't forget to include this event:

Monday, March 28, 2011

By reference or by value?

Probably, you have already used an ABAP method parameters. In OOP world, a method is a behavior wherein all parameters/variables accompanying it should have there own memory allocation or should be initialized. In ABAP method, you have an option in terms of parameters. It is either passing it by value or by reference. Ok, let's take a closer look of the difference between the two.

Searching ABAP codes for this word

There are some cases wherein we forgot to remember the name of our program that uses a certain line of codes. As a programmer, I used to work in a platform i.e unix that has a capability to search words or phrases in the entire directory of the program repository (COBOL in my case).

Sunday, March 27, 2011

Creating a Non class-based exception

Non class-based exception can be used in functions and methods. Below I will show you how.

Thursday, March 24, 2011

Blueprinting - Gathering requirements in SAP

Gathering requirements depends on the project and the size of the organization you are working with. There is no hard and fast rule as long as you finished your job on time and meets the user requirements.

Wednesday, March 23, 2011

Headache gone with SAP ICM (Incentives and Commission Management)

Many corporations today rely on spreadsheet or home grown applications which is very tedious to maintain esp. for the programmers due for example to ever changing alignment of marketing strategies which affect the setup for incentives and commissions of business partners/sellers/vendors/agents etc.

Monday, March 21, 2011

ABAP Exceptions

Knowing the types of exception handling in ABAP could be helpful in your application.


Trade-off in SE30 Runtime Analysis Evaluation Result

They say that programmers when developing apps/reports should see to it that the ABAP resources are utilized the most compared to DATABASE and SYSTEM resources. But, all throughout my

Sunday, March 20, 2011

OOP ALV toolbar button exclusion

A while ago after reading some stuff in SAP SDN site, I stumbled over this exclusion of alv toolbar buttons and found this pdf guide very useful, courtesy of http://www.volker-wegert.de/en/alv-function-codes

Thursday, March 17, 2011

Cluster Table reading

Points to Ponder:

1. It's better to read cluster table like BSEG without FOR ALL ENTRIES addition for better performance.
2. Put necessary static filters
3. As much as possible, compare all primary key or at least include the foreign keys

Wednesday, March 16, 2011

Optimization - Avoid DB access inside LOOP

Rule of thumb:

When dealing with large volume of records or involving several db tables, the best practice is to free your loop statement with db access. As much as possible, work with your internal tables or abap read table statement.

Watch out for my next blog.

Tuesday, March 15, 2011

ABAP FOR ALL Entries much better!

This morning, I have stumbled over this FOR ALL ENTRIES as I got missing entries on my result set.
I noticed that including FOR ALL ENTRIES statement resulted in a deletion of a duplicate records. Also, take note that if the internal table is blank, all entries will be considered in your table being selected.

RECOMMENDATIONs:

1. The primary key fields of the driver table should all be included to avoid duplicate of records.

2.  Use all keys of driver table against the db table.

2. Sort the driver table by its keys.

EX. If you want to get the hkont field in EKKN table, always include the ebeln and ebelp key fields.

SORT at_it_ekpo by ebeln. "

SELECT
   ebeln
   ebelp
   hkont
INTO at_it_ekkn FROM ekkn
FOR ALL ENTRIES OF at_it_ekpo
WHERE ebeln = at_it_ekpo-ebeln.

FOR ALL ENTRIES is like a join statement in open sql. This is a good alternative to minimize DB resources in your program.

Sunday, March 13, 2011

Internal Table control level processing

PREREQUISITE: Sort your internal table by the fields used in the control command

This is very useful when dealing reports!

ALV Splitter Screen Create Header

Steps in creating a header in a splitter screen:

DYNAMIC Open SQL statement

Just this morning I have created a dynamic sql. I have a sample code below:

Saturday, March 12, 2011

ABAP Parameters

I recommend for ABAPers to as much as possible create your data types as global by creating it in se11 to avoid constraint later on esp. if you are doing applications that involve SF and ALV.

Friday, March 11, 2011

OOP ALV splitter screen

Custom container can be divided into parts by a splitter screen class. Usually, developers can create different panel within a custom container to separate its selection screen header or the ALV data itself.

ABAP creating audit trail by change document table CDPOS CDHDR

There are some cases wherein you may want to create an audit trail or a history/log for your application. One way of doing this is by utilizing the CDPOS and CDHDR table by generating a program by it.

My banner

Thursday, March 10, 2011

OOP ALV events

Lately, I always practice to develop my applications in OOP ALV. By using cl_gui_alv_grid class compared to the FM reuse_alv_grid*, I noticed that the former uses EVENTS for the buttons or the mouse clicks to capture user actions over the alv.

To learn more about this events, please download the guide here from SAP AG itself. To give you an idea about this reference, it contains and lists the basic guidelines in using cl_gui_alv_grid. Some of the codes that for example to capture event DATA_CHANGED is not being explained here.

To trigger the data changed event, you may insert the code below and you can set the action you may want your event be triggered:


"activate data_changed 
  CALL METHOD g_alv_grid_ref->register_edit_event
    EXPORTING
      i_event_id = cl_gui_alv_grid=>mc_evt_enter  
"trigger event after ENTER is pressed
*    i_event_id = cl_gui_alv_grid=>MC_EVT_MODIFIED  
"or trigger once you go to next cell after modification 
(without pressing ENTER)
    EXCEPTIONS
      error      = 1
      OTHERS     = 2.



Thank you!

ALV Object Model (OM)

Hi Guys, so far at least there are different types of approach in developing or creating an ALV depending on your needs and objective. One of them is called ALV Object Model which has been around for some time. This type of ALV can be created using a cl_salv_table class - a wrapper class of the previous ALV classes.

Wednesday, March 09, 2011

Internal Table Facts

Internal table with header line
   - With header line, the internal table has a header structure that works as a work area and a body that contains the details or the data itself.

Tuesday, March 08, 2011

Connecting MM, PS, & FI/CO modules

Table association between 3 modules modules:

Finding SAP tables

There are some cases wherein you have difficulties in looking for a table where the field belongs that appears in any SAP screen. One way of finding it is through ST05.

Debugging a dialog in SAP

There are some ways in debugging SAP when a dialog pop-up appears. Usually "/h" doesn't have an effect in the case when you transact via a pop-up, dialog, etc.

Adding an Image in a dialog

There are some cases wherein you may want to display an image in a sap dialog. In this topic I will show you how this can be done.

Reporting using ALV in OOP

In this topic I will show you how to generate a report using ALV in OOP. 

OOP ABAP

Hi,

I will give you some basic idea regarding creating programs/applications in ABAP using OOP.

Friday, March 04, 2011

Debugging - sapscript

I will show you how to debug a transaction to be able to trace if what sapscript is being used.

Field symbols - the advantage

Hi,

Good day to all, this is my first blog ever. Hope you will find this useful as I will start from this topic -> abap field-symbols.