Tuesday, March 2, 2010

five months of busy work

For the past 5 moths I have been really busy that I didn't have anytime to blog or contribute to SCN on SAP. During these 5 months I was working for 1 main client on one main area it was all about Vendor confirmations. I have been so much into it that now I know a lot about the confirmation process. There were two main developments where one was on SAP user level and other was on customer level which was a web Dynpro development. During this period I gained lots of functional Exp but on technical side it was noting much same old ABAP.

but there were few limitations which I came a cross when I developed tab striped selection screen which I am hoping to blog sometime in the future.

till then enjoy reading my old post's on SAP but still there is nothing much since from the time I joined my work place I hardly had any free time.

Wednesday, September 16, 2009

when and where we can use parallel cursor


Loop AT i_primary into wa_primary.
Loop AT i_secondary into wa_secondary from lv_index.
If ( wa_primary-field1 NE wa_secondary-field1 ) or
( wa_primary-field2 NE wa_secondary-field2 ).
Lv_index = sy-tabix.
Endif.
“ your code comes here “
Endloop.
Endloop.
To use this following should be true
1)      Both tables should be sorted with the same key ( in the above case field1 and field2 )
2)      The mapping between primary to secondary tables should be
a.       one to many ( for one record in primary there are multiple records in secondary )
b.      one to one (for one record in primary there is only one in secondary )
Please note that other than the above 2 other 2 scenarios (many to many & many to one) will not work with the above logic and make sure you don’t use in such case.
3)      The secondary table should not contain a record which does not map to the primary table ( this will not happen if the secondary is fetched using for all entries from primary )
4)      Please make sure you do not delete any record from primary before using the logic which will make the point 3 false  
5)      If you were to use a 'AND' in where statement of the inner loop you should use or in the inner loop if condition in the above logic. 
 

Friday, September 11, 2009

Copy to Clipborad SAP

copy to clipborad

Bellow code is how to copy data to clipboard. This feature helps you when there is a BDC recording and you want to add selection extended options

    DATA: v_rc TYPE I,
       it_data TYPE STANDARD TABLE OF CHAR128,
       wa_data TYPE char128.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_EXPORT
    IMPORTING DATA = it_data
    CHANGING RC = v_rc      .

Monday, August 31, 2009

How to add a button on selection screen


one small thing I came across on a customer development was to add a button on the selection screen. I have not done such a requirement before for any customer so i didn't any idea on how to do it.

After doing some searching this is what I found out was :).

For a selection screen you can put up to 5 buttons this is a default feature which is available to use if you want.
For that these are the steps you have to do

I have added the button in two ways one is just the button with the text next one button with a icon.

The data declarations for these are.
TABLES: sscrfields.
DATA: functxt TYPE smp_dyntxt.
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME
TITLE TEXT-001.
SELECT-OPTIONS: p_ktopl FOR t030-ktopl.

SELECTION-SCREEN END OF BLOCK block1.


SELECTION-SCREEN FUNCTION KEY 1.
SELECTION-SCREEN FUNCTION KEY 2.


functxt-icon_id = ICON_HISTORY.
functxt-quickinfo = 'log'(001).
sscrfields-functxt_01 = functxt.

MOVE 'Maintain Item Cat.' TO sscrfields-functxt_02.






Thursday, July 16, 2009

how to add tooltip to icon


its very easy to add tooltip to icon's

1) have a icon field in output table ( this can be a char field with 25 characters)

2) in case if you cant to add the lock icon for that icon field put
-icon = '@06\QIn process@'.

in this @06@ is the icon when you give the tooltip with '\QXXXtooltipXXX'
insert this part beore last @.

Note: if you want to find the icons check icon table :)

3) field catalog make the icon field 'X'.


there is a SAP example on program: BCALV_DEMO_TOOLTIP



Tuesday, June 23, 2009

How to Debug any screen on SAP

its very simple just put this code on a text file and save it with what even name you want e.g debug

[FUNCTION]
Command=/H
Title=Debugger
Type=SystemCommand



when ever you want to debug you dont have to use /h but just drag and drop this on the SAP screen this enables you to debug on popup screens

Hope this will be useful

nafran

Wednesday, June 10, 2009

how to get the first day and last day SAP

Most of the time when we need the first day and the last day of a given month we always run to get a function. why use a function when its so easy to code it

*get first and last date of month and year
CONCATENATE s_bdatj-low s_mnr-low '01' INTO gv_date1.

gv_month = s_mnr-low .
gv_month = gv_month + 01.

CONCATENATE s_bdatj-low gv_month '01' INTO gv_date2.

gv_date2 = gv_date2 - 1.
Google