Tuesday, March 22, 2011

How to identify a BADI for a TCODE

Go to se24 and display class CL_EXITHANDLER - view the code behind method GET_INSTANCE. place a break-point there somewhere in the beginning. 

Now, go to your tcode in another session and execute it. Your breakpoint will be hit every time a BADI is called.

Friday, November 12, 2010

Important Tables

TJ30 -- Table that contains User status table with Profile ID, Status Id and Status Description

Monday, August 23, 2010

Interactive ALV report

Sample code for Interactive ALV reports( Fetch records from VBAK, on clicking any output record, navigate to Sales Doc Tcode)


*&---------------------------------------------------------------------*
*&      Form  ALV_DISPLAY
*&---------------------------------------------------------------------*
FORM alv_display .

  PERFORM build_fieldcatalog.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_bypassing_buffer      = 'X'
      i_callback_program       = sy-repid
      i_callback_user_command = 'USER_COMMAND'
*      i_grid_title            = 'Interactive ALV'
      it_fieldcat             = i_fieldcatalog[]
      is_layout               = w_layout
      it_sort                 = i_sort
      i_default               = 'X'
      i_save                  = 'A'
      is_variant              = w_variant
      it_events               = i_grid_event
    TABLES
      t_outtab                = i_vbak[]
    EXCEPTIONS
      program_error           = 1
      OTHERS                  = 2.
ENDFORM.                    " ALV_DISPLAY
*&---------------------------------------------------------------------*
*&      Form  USER_COMMAND
*&---------------------------------------------------------------------*
FORM user_command USING u_com LIKE sy-ucomm sel_field TYPE slis_selfield.

*  CLEAR fcat1.
  DATA: t_doc TYPE vbeln.
  CLEAR: w_vbak.
  CASE u_com.
    WHEN '&IC1'.
      READ TABLE i_vbak INTO w_vbak INDEX sel_field-tabindex.
      IF sy-subrc = 0.
        t_doc = w_vbak-vbeln.
        SET PARAMETER ID 'AUN' FIELD t_doc.
        CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
      ENDIF.
  ENDCASE.
ENDFORM"user_command

Thursday, August 12, 2010

FM for Downloading data to apps -windows folder

soon after close dataset, embed this code.. pass your file path..thats it

*************
lv_additional_parameters = lv_filename.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZCHMODR'
additional_parameters = lv_additional_parameters. "'/sap_report/ED2/report/finance/productcosting/TEst_UNIX.txt'
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

***************




TRINT_SPLIT_FILE_AND_PATH


SUBST_GET_FILE_LIST file path validation

Basic FMs regularly used in Programs

Simple Pop up message with YES No selection


lv_text = text-116.
    popup_to_confirm text-032 lv_text c_true lv_answer.
    CHECK lv_answer EQ '1'



FM to convert date into User Profile date

CALL FUNCTION '/SAPDII/SPP05_CONVERT_DATE'


EXPORTING
if_date = lv_date
IMPORTING
ef_date = lv_date.




Finding the Last day of a Month: 





    CALL FUNCTION 'LAST_DAY_OF_MONTHS'
      EXPORTING
        day_in            = w_order_ccard-cc_valid_t
      IMPORTING
        last_day_of_month = w_order_ccard-cc_valid_t
      EXCEPTIONS
        day_in_no_date    = 1
        OTHERS            = 2.


  • DATE_COMPUTE_DAY
  • GET_WEEK_INFO_BASED_ON_DATE

Language Key:
CONVERSION_EXIT_ISOLA_INPUT Convert two-digit ISO language -> one-digit SAP language key
 CONVERSION_EXIT_ISOLA_OUTPUTConvert One-digit SAP Lang. Key to Two-digit ISO Lang. Key

Currency Key:
CURRENCY_CODE_ISO_TO_SAP Translates ISO currency key into the SAP internal currency key

CURRENCY_CODE_SAP_TO_ISO Translates an SAP internal currency key into the ISO code

UOM:
UNIT_OF_MEASURE_ISO_TO_SAP     Convert an ISO measurement unit code into the SAP code
UNIT_OF_MEASURE_SAP_TO_ISO     Converts an SAP measurement unit code into ISO code

ISO_TO_SAP_CURRENCY_CODE





Report to check the status of Object : RSDDCHECK

Dynamically Setting up values for a field( not a DDIC data element)

* Set Value in Deal Type list
  
IF li_list IS INITIAL.
    l_id = 
'G_DLTP'.
    w_value-
key = c_a.
    w_value-
text = text-034.
    
APPEND w_value TO li_list.

    w_value-
key = c_b.
    w_value-
text = text-035.
    
APPEND w_value TO li_list.

    w_value-
key = c_c.
    w_value-
text = text-036.
    
APPEND w_value TO li_list.

    
CALL FUNCTION 'VRM_SET_VALUES'
      
EXPORTING
        
id              = l_id
        values          = li_list
      
EXCEPTIONS
        id_illegal_name = 
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.
  
ENDIF.










BAPI_MATERIAL_AVAILABILITY issues

https://forums.sdn.sap.com/message.jspa?messageID=5996074


Hi all,


The reason for returning a commited quantity as 9999999999: So the issue is completely at Master data maintenance level. 

details as follows: 

There are 2 Cases: 1. ATP check for the Req Date & Req Quant.
2. ATP check for entire Material-Plant-Storage Loc

In either of the cases: Initially a checks for the Stock level at plant level takes place, then depending on stock availability the BAPI calculates the ATP quant.

IF the stock at plant level = 0.
• Then first RLT (Replenishment Lead Time) is calculated (as per Material master data) and then it calculates the RLT Date as follows
IF Req Date = Passed.
RLT Date = Req Date + RLT time
ELSE.
RLT Date = Current Date + RLT time
ENDIF.


Finally at the time of ATP calculation for Zero stock another check at this RLT date happens, as follows.

IF RLT Date GT (Req Date-If passed otherwise Rundate).
ATP check gets populated depending on current date’s available stock.
ELSE.
Means The ATP check is irrelevant, as no stock available and no visibility for stock updation. So a hard coded “9999999999.000” value is being populated to output Quantity field.
ENDIF.

Edited by: 19740_SANTHI on Mar 1, 2010 7:33 AM

Edited by: 19740_SANTHI on Mar 1, 2010 7:35 AM