Saturday, July 16, 2011

POPUP MONTH AND YEAR using ABAP


REPORT  ZPOPUPMONTHNYEAR.

DATA: V_CODE  LIKE  SY-SUBRC.

PARAMETER: V_MONTH LIKE ISELLIST-MONTH.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR V_MONTH.

CALL FUNCTION 'POPUP_TO_SELECT_Calendar'
     
EXPORTING
          ACTUAL_MONTH               = 
'200205'
          
LANGUAGE                   = SY-LANGU
          START_COLUMN               = 
8
          START_ROW                  = 
5
    
IMPORTING

         SELECTED_MONTH             = V_MONTH
         RETURN_CODE                = V_CODE
    
EXCEPTIONS
         FACTORY_CALENDAR_NOT_FOUND = 
1
         HOLIDAY_CALENDAR_NOT_FOUND = 
2
         MONTH_NOT_FOUND            = 
3
         
OTHERS                     = 4.

Sunday, June 26, 2011

Dropdown List Example in ABAP


REPORT  ZDROPDOWNLIST .

types: begin of t_vbap,
  posnr 
type vbap-posnr,
  
end of t_vbap.

data: it_vbap TYPE STANDARD TABLE OF t_vbap,
      wa_vbap 
like line of it_vbap.

TYPE-POOLS: VRM.
DATA: NAME  TYPE VRM_ID,
      LIST  
TYPE VRM_VALUES,
      
VALUE LIKE LINE OF LIST.
""""""""""""
PARAMETERS: SO_NUM like vbap-vbeln.
""""""""""""

PARAMETERS: P_POSNR(10) AS LISTBOX VISIBLE LENGTH 10.

*********************************************************
*AT SELECTION-SCREEN OUTPUT.
AT SELECTION-SCREEN OUTPUT.

clear list.
 
SELECT posnr
   
up to 10 rows
   
into CORRESPONDING FIELDS OF TABLE it_vbap
   
from vbap
   
where
   vbeln = SO_NUM.

  
loop at it_vbap into wa_vbap.
    
VALUE-KEY =  wa_vbap-posnr.
    
VALUE-TEXT = wa_vbap-posnr.
    
APPEND VALUE TO LIST.
  
endloop.

  NAME = 
'P_POSNR'.
  
CALL FUNCTION 'VRM_SET_VALUES'
    
EXPORTING
      
ID     = NAME
      VALUES = LIST.


*clear list.
********************************************************
*START-OF-SELECTION.
START-
OF-SELECTION.
  
WRITE: / 'SELECTED VALUE KEY:', SO_NUM.

Dropdown List Example in ABAP


REPORT  ZDROPDOWNLIST .

types: begin of t_vbap,
  posnr 
type vbap-posnr,
  
end of t_vbap.

data: it_vbap TYPE STANDARD TABLE OF t_vbap,
      wa_vbap 
like line of it_vbap.

TYPE-POOLS: VRM.
DATA: NAME  TYPE VRM_ID,
      LIST  
TYPE VRM_VALUES,
      
VALUE LIKE LINE OF LIST.
""""""""""""
PARAMETERS: SO_NUM like vbap-vbeln.
""""""""""""

PARAMETERS: P_POSNR(10) AS LISTBOX VISIBLE LENGTH 10.

*********************************************************
*AT SELECTION-SCREEN OUTPUT.
AT SELECTION-SCREEN OUTPUT.

clear list.
 
SELECT posnr
   
up to 10 rows
   
into CORRESPONDING FIELDS OF TABLE it_vbap
   
from vbap
   
where
   vbeln = SO_NUM.

  
loop at it_vbap into wa_vbap.
    
VALUE-KEY =  wa_vbap-posnr.
    
VALUE-TEXT = wa_vbap-posnr.
    
APPEND VALUE TO LIST.
  
endloop.

  NAME = 
'P_POSNR'.
  
CALL FUNCTION 'VRM_SET_VALUES'
    
EXPORTING
      
ID     = NAME
      VALUES = LIST.


*clear list.
********************************************************
*START-OF-SELECTION.
START-
OF-SELECTION.
  
WRITE: / 'SELECTED VALUE KEY:', SO_NUM.

Monday, June 20, 2011

Double clicking example in abap


REPORT  ZDOUBLECLICK .

START-
OF-SELECTION.
  
WRITE 'Click me'.
 
AT LINE-SELECTION.
  
WRITE 'Hello'. 

How to Create POP-UP window



REPORT  ZPOPUPWINDOW .

START-
OF-SELECTION.
    
WRITE / 'Click me' HOTSPOT ON.
AT LINE-SELECTION.
  
WINDOW STARTING AT 20 20
          ENDING   
AT 60 30.

  
WRITE / 'hello ' HOTSPOT ON.

Tuesday, June 14, 2011

How to get list of active user logged on to the system with terminal and other details


Use the T-code SE37 and execute the function module TH_DISPLAY_USER_LIST.

Here you wil get the list of active users with information like Client, Terminal, Transaction code the user is working on, number of sessions opened by that user and whether Trace is ON or OFF. 

This information can be used for sort of troubleshooting purpose.
 



Difference between T-Code SE09, SE10 and SE01


SE09 is the transaction code for workbench organizer. Workbench organizer is the set of utilities for development change management. All Development changes are tracked via Workbench organizer.

SE10 is for Customizing organizer. Customizing organizer is the set of tools for customizing change management. All customizing changes are tracked via customizing organizer.

SE01 is the main screen of the Change and transport Organizer. From here the administrator can achieve all tasks related to transport requests - such as create, change, view logs, display client/delivery transports, etc. SE09 and SE10 can also be accessed from here. However, not all developers might be granted access to this transaction.

Tuesday, May 3, 2011

How to convert number to words


*&---------------------------------------------------------------------*
*& Report  ZCONVERTNUMBERTOWORDS
*&
*&---------------------------------------------------------------------*
*& Convert number to words
*&
*&---------------------------------------------------------------------*

REPORT  ZCONVERTNUMBERTOWORDS.


PARAMETERS: num TYPE i.

Data amt_in_num TYPE i.
Data words TYPE String.
Data final TYPE integer.
Data amt_in_words TYPE integer.

amt_in_num = num.

PERFORM convertIntoWords.
write:  words.


Form convertIntoWords.
  data: maxno type p.
  maxno = 10 ** 9.
  if ( amt_in_num >= maxno ).
    raise data_type_mismatch.
  endif.
*data declaration-------------------------------------------------*
  data: ten(10),single(6),final(130),dec(20),res type i,rp(7).
  data: a1 type i,a2 type i,str(20),d type p,m type i,wrdrep(20).
  data: cntr type i,f1 type i,f2 type i,f3 type i,f4 type i,f5 type i.
  data: f6 type i,f7 type i,f8 type i,f9 type i.

  d = ( amt_in_num * 100 ) div 100.
  res = ( amt_in_num * 100 ) mod 100.

  f1 = res div 10.
  f2 = res mod 10.
  perform setnum using f1 f2 changing wrdrep.
  f1 = 0. f2 = 0.
  dec = wrdrep.
  cntr = 1.
*Go in a loop dividing the numbers by 10 and store the
*residues as a digit in f1 .... f9
  while ( d > 0 ).
    m = d mod 10.
    d = d div 10.
    case cntr.
      when 1. f1 = m.
      when 2. f2 = m.
      when 3. f3 = m.
      when 4. f4 = m.
      when 5. f5 = m.
      when 6. f6 = m.
      when 7. f7 = m.
      when 8. f8 = m.
      when 9. f9 = m.
    endcase.
    cntr = cntr + 1.
  endwhile.
  cntr = cntr - 1.
*Going in loop and sending pair of digits to function setnum to get
*the standing value of digits in words
  while ( cntr > 0 ).

    if ( cntr <= 2 ).
      perform setnum using f2 f1 changing wrdrep.
      concatenate final wrdrep into final separated by ' '.
    elseif ( cntr = 3 ).
      if ( f3 <> 0 ).
        perform setnum using 0 f3 changing wrdrep.
        concatenate final wrdrep 'HUNDRED' into final separated by ' '.
      endif.
    elseif ( cntr <= 5 ).
      if ( f5 <> 0 ) or ( f4 <> 0 ).
        perform setnum using f5 f4 changing wrdrep.
        concatenate final wrdrep 'THOUSAND' into final separated by ' '
  .
      endif.
      if ( cntr = 4 ).
        cntr = 5.
      endif.
    elseif ( cntr <= 7 ).
      if ( f7 <> 0 ) or ( f6 <> 0 ).
        perform setnum using f7 f6 changing wrdrep.
        concatenate final wrdrep 'LAKH' into final separated by ' ' .
      endif.
    elseif ( cntr <= 9 ).
      perform setnum using f9 f8 changing wrdrep.
      concatenate final wrdrep 'CRORE' into final separated by ' ' .
    endif.

    cntr = cntr - 2.
  endwhile.
*Output the final
  if ( final = ' ONE' ).rp = 'Taka'(003).else. rp = 'Taka'(001).endif
.
  if ( final = '' ) and ( dec = '' ).
    final = 'NIL'.
  elseif ( final = '' ).
    concatenate dec 'Paise'(002) into final separated by ' ' .
  elseif ( dec = '' ).

    concatenate final rp into final separated by ' ' .
  else.
    concatenate final rp dec 'Paise'(002) into final separated by ' ' .
  endif.

words = final.

endform.



*&---------------------------------------------------------------------*
*&      Form  SETNUM
*&---------------------------------------------------------------------*
*       converts a number into words                                   *
*----------------------------------------------------------------------*
*  -->  a1,a2     two digits for 2nd and 1st place
*  <--  str       outpur in words
*----------------------------------------------------------------------*
data: ten(10),single(6),str(20).
*
form setnum using a1 a2 changing str.
  ten = ''.single = ''.
  if ( a1 = 1 ).

    case a2.
      when 0. ten = 'TEN'.
      when 1. ten = 'ELEVEN'.
      when 2. ten = 'TWELVE'.
      when 3. ten = 'THIRTEEN'.
      when 4. ten = 'FOURTEEN'.
      when 5. ten = 'FIFTEEN'.
      when 6. ten = 'SIXTEEN'.
      when 7. ten = 'SEVENTEEN'.
      when 8. ten = 'EIGHTEEN'.
      when 9. ten = 'NINETEEN'.
    endcase.
  else.

    case a2.
      when 1. single = 'ONE'.
      when 2. single = 'TWO'.
      when 3. single = 'THREE'.
      when 4. single = 'FOUR'.
      when 5. single = 'FIVE'.
      when 6. single = 'SIX'.
      when 7. single = 'SEVEN'.
      when 8. single = 'EIGHT'.
      when 9. single = 'NINE'.
    endcase.
    case a1.
      when 2. ten = 'TWENTY'.
      when 3. ten = 'THIRTY'.
      when 4. ten = 'FORTY'.
      when 5. ten = 'FIFTY'.
      when 6. ten = 'SIXTY'.
      when 7. ten = 'SEVENTY'.
      when 8. ten = 'EIGHTY'.
      when 9. ten = 'NINETY'.
    endcase.

  endif.
  if ( single <> '' ) and ( ten <> '' ).
    concatenate ten single into str separated by ' '.
  elseif single = ''.
    str = ten.
  else.
    str = single.
  endif.

endform.