Tuesday, April 19, 2011

General

Dynamic SQL

DATA: BEGIN OF w_m,
               matnr like mara-matnr,
               mtart LIKE mara-mtart,
            END OF w_m.

DATA: i_m LIKE STANDARD TABLE OF w_m WITH HEADER LINE.

DATA: column_syntax TYPE string,
      cond_syntax TYPE string.

CONCATENATE 'MATNR' 'MTART' INTO column_syntax SEPARATED BY space.

CONCATENATE 'MTART' 'IN S_MTART' INTO cond_syntax SEPARATED BY space.


select  (column_syntax) into corresponding fields of table i_m
  From mara
  UP TO 10 ROWS
  Where (cond_syntax).

Difference between “ ‘ ” and “ ` ” in ABAP

A basic difference: still I find that most of the programmer hardly uses string literal. String literal is generally a forgotten case.
A character sequence within single quote characters (’) is a char literal, while within (`) is a string literal. That is especially important for trailing spaces: a string literal preserves the trailing space while a char literal ignores them.
This can be best understood by the following example:

DATA v_char TYPE c LENGTH 32.
v_char = 'This is a'.
CONCATENATE v_char 'text   ' INTO v_char SEPARATED BY space.
*" v_char would be "This is a text"
CONCATENATE v_char `text   ` INTO v_char SEPARATED BY space.
*" v_char would be "This is a text   "

Field Symbol

CONSTANTS: c_ydrseg(18) TYPE c VALUE '(SAPLMR1M)YDRSEG[]'.

DATA: wa_drseg TYPE mmcr_drseg.
CLEAR wa_drseg.

FIELD-SYMBOLS: <fs_ydrseg> TYPE table.

ASSIGN (c_ydrseg) TO <fs_ydrseg>.

CLEAR lt_drseg.REFRESH lt_drseg.
lt_drseg[] = <fs_ydrseg>.

IF NOT <fs_ydrseg>[] IS INITIAL.

  LOOP AT lt_drseg INTO wa_drseg.
    * do something with EREKZ
  ENDLOOP.
ENDIF.

____________________________________________
DATA  : l_stack(50)  TYPE c.

FIELD-SYMBOLS : <fs1> TYPE ANY TABLE.

MOVE '(SAPLV09A)GVT_LOCAL_MEMORY-XVBPA[]' TO l_stack.

ASSIGN (l_stack) TO <fs1>.
IF sy-subrc = 0.
   ..................................
ENDIF.

SAP Tables

Relationship between MM & FI

This field contains RBKP-BELNR + RBKP-GJAHR = BKPF-AWKEY.

e.g. BKPF-AWKEY = 51056059232009
                  5105605923         - RBKP-BELNR
                            2009  - RBKP-GJAHR


Edit SAP Tables


  1. Go to SE16N.
  2. Give the table name
  3. Enter “&SAP_EDIT” in the command line.
  4. See the message
  5. Then execute (F8).
  6. You can edit table entries now!!!
    or Go to UASE16N
Relationship between VBRP & KONV
    You will get konv document number from vbrk-knumv.
     KONV-POSNR = VBRP-POSNR
     The ref schedule lines in vbrp you will get from :
     VBRP-J_3AETENR
     VBRP-J_3AUSIZE
     VBRP-J_3AVGETE
     KONV-J_3AETENR = VBRP-J_3AETENR
     The higher level item of the split item will be described in the field
vbrp -j_3ausize
Faster method to access MSEG    
When we have to access MSEG it will be a more inefficient search because most of the time we have to access
the table by MATNR, BWART, WERKS which are not key fields of the table.

Here is a faster method to get movement info from MSEG :
Use table S033 by giving MATNR or any other key out of 11 key fields and get material document number (MBLNR)
This MBLNR is the key field in MSEG, so you can do a direct access instead of a sequential search.
Hope this will help you to improve the efficiency of your search.



Implement BADI - SE18 & SE19

Go to SE18



Enhancement points

01.   Find Explicit or Implicit Enhancement Points
Implicit



                       
Explicit

02. Create or Change Enhancement Point