Wednesday, December 26, 2012

Clear or Delete SPOOL Request


Below is the program to clear the spool request.

1. Run SE38 - RSPO1041





OR

1. Run tcode SPAD
2. Click 'Admin' Tab
3. Choose 'Delete Old Spool Requests'
4. Delete




Friday, December 21, 2012

Edit Message Document


This document can be called also Help Document or Performance Assistant Message, its act as long text for the message class.

1) We use transaction SE61 to edit the long text for each message.
2) Or we can go to SE80 and Browse the right package to edit the Short Text and Long Text.

Below is the screen capture :

Browse throught SE80

SE61 Screen

Edit Document using SAPScript Format.









Thursday, December 13, 2012

Enhancemen Point How To


Enhancement Point How To:

1. Go to SE38 , Select Enhancement point (Shift+F4) and select 'Show Implicit Enhancement'



2. On the code select any area that contain double quote symbol  """"""""" , and right click choose 'Enhancement' -- Create.


3. Choose type of Enhancement either 'Declaration' or 'Code'. Normally choose Code.


4. Insert the Enhancement Implementation Name and Short Text .



5. Save and Assign the implementation to the right package and transport number. Done!

Tips:

To find created Enhancement used SE84 Object Navigator tcode.










Sunday, December 2, 2012

Find BADI in Every Tcode

Below is the tips to find BADI in every tcode or transaction code.

1. Go to SE37 and enter this Function Module (FM) : SXV_GET_CLIF_BY_NAME
2. Put Breakpoint to trigger ABAP Debugger.
3. Run your tcode.
4. You can see the BADI names under this variable "Name".

Below is the screen shot :



Friday, October 12, 2012

Large data on query selection



Sometimes when we perform lot of data selection, usually time out error or ABAP Dump will be happened, there some techniques in Selection process to select large amount of data and prevent time out, below is the code snippet.



  data : ta_vbakuk    like vbakuk occurs with header line,
         ta_vbakuk_2  like vbakuk occurs with header line,
         l_max_fetch(4type p,
         l_cursor       type cursor.
  if so_vbeln[] is initial.
    so_vbeln-sign 'I'.
    so_vbeln-option 'BT'.
    so_vbeln-low '0000000001'.
    so_vbeln-high '9999999999'.
    append so_vbeln.
    clear so_vbeln.
  endif.
  l_max_fetch  '1000'.
  open cursor with hold l_cursor for
  select from vbakuk
         where vbeln in so_vbeln
         and   erdat in so_date
         and auart eq cn_auart_zor or auart eq cn_auart_zfc )
         and   kunnr in so_camp
         and   vbtyp eq cn_vbtyp_c
         and   lfstk eq cn_lfstk_a.                "delivery status "Not processed"
  do.
    fetch next cursor l_cursor into table ta_vbakuk
    package size l_max_fetch.
    if sy-subrc <> 0.
      close cursor l_cursor.
      exit.
    endif.
    if not ta_vbakuk[] is initial.
      select vbeln werks from vbap
             appending corresponding fields of table ta_vbap_t2
             for all entries in ta_vbakuk
             where vbeln ta_vbakuk-vbeln and
             werks pa_plant .
      select from vbfa appending table ta_vbfa_2
        for all entries in ta_vbakuk
        where vbelv   ta_vbakuk-vbeln
        and   vbtyp_n cn_vbtyp_n_h.       "Returns
      select from vbpa appending table ta_vbpa_2
        for all entries in ta_vbakuk
        where vbeln   ta_vbakuk-vbeln
        and   parvw   cn_parvw_we.               "Ship-to-party
    endif.
    if ta_vbakuk_2[] is initial.
      ta_vbakuk_2[] ta_vbakuk[].
    else.
      loop at ta_vbakuk into ta_vbakuk_2.
        append ta_vbakuk_2.
      endloop.
    endif.
    free: ta_vbakuk.
  enddo.

Concatenate with Blank Space


There is few ways to concatenate with blank space if we google it out.

Below is the classic example.

Rules:
  1. Make sure the variable field is in the correct length.

Below is the code snippet.

CONCATENATE sy-mandt wa_po-ebeln wa_po-ebelp INTO tp_tabkey RESPECTING BLANKS


Others way is using  class CL_ABAP_CONTAINER_UTILITIES.  If you want to set the space based on others data type. Below is the code snippet.


FORM insert_space  USING    p_ebeln TYPE ekko-ebeln
                   CHANGING tp_ebeln.

  CALL METHOD CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_C
    EXPORTING
      IM_VALUE               p_ebeln
    IMPORTING
      EX_CONTAINER           tp_ebeln.
*    EXCEPTIONS
*      ILLEGAL_PARAMETER_TYPE = 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.


ENDFORM. 

Monday, October 8, 2012

Add new Printer in SAP




.





1. Run tcode SPAD
2. Go to Utilities -- Device Type -- Import
3. Fill the data according ly


p/s if the import generate  "Object can only be created in SAP Package" error , please use SAP Package SPOO.