Wednesday, January 11, 2012

Transaction code For SAP Query


Transaction Code for Table Maintenance
1. After creating table maintenance
2. GOTO SE93 -> <tcode>
3.popup appear. Select radio button -5(Transaction with Parameters)

Transaction code For SAP TABLE MAINTENANCE Generator

Transaction Code for Table Maintenance
1. After creating table maintenance
2. GOTO SE93 -> <tcode>
3.popup appear. Select radio button -5(Transaction with Parameters)





Sunday, February 27, 2011

Electronic Invoicing to remove the & and $ symbols in idoc message

 move t100-text to text+len.
   move text to akt_message.
   BUFFER = T100-TEXT.
*if first &1/&2/&3/&4 or. $1/$2/$3/$4 replace
   IF T100-TEXT CA '$1'.
     REPLACE '$1' WITH INT_EDIDS-STAPA1 INTO BUFFER.
   ENDIF.
   IF T100-TEXT CA '$2'.
     REPLACE '$2' WITH INT_EDIDS-STAPA2 INTO BUFFER.
   ENDIF.
   IF T100-TEXT CA '$3'.
     REPLACE '$3' WITH INT_EDIDS-STAPA3 INTO BUFFER.
   ENDIF.
   IF T100-TEXT CA '$4'.
     REPLACE '$4' WITH INT_EDIDS-STAPA4 INTO BUFFER.
   ENDIF.
   IF T100-TEXT CA '&1'.
     REPLACE '&1' WITH INT_EDIDS-STAPA1 INTO BUFFER.
   ENDIF.
   IF T100-TEXT CA '&2'.
     REPLACE '&2' WITH INT_EDIDS-STAPA2 INTO BUFFER.
   ENDIF.
   IF T100-TEXT CA '&3'.
     REPLACE '&3' WITH INT_EDIDS-STAPA3 INTO BUFFER.
   ENDIF.
   IF T100-TEXT CA '&4'.
              REPLACE '&4' WITH INT_EDIDS-STAPA4 INTO BUFFER.
   ENDIF.
   IF T100-TEXT CA '$'.
    REPLACE '$' WITH INT_EDIDS-STAPA1 INTO BUFFER.
    REPLACE '$' WITH INT_EDIDS-STAPA2 INTO BUFFER.
    REPLACE '$' WITH INT_EDIDS-STAPA3 INTO BUFFER.
    REPLACE '$' WITH INT_EDIDS-STAPA4 INTO BUFFER.
   ENDIF.
   IF T100-TEXT CA '&'.
    REPLACE '&' WITH INT_EDIDS-STAPA1 INTO BUFFER.
    REPLACE '&' WITH INT_EDIDS-STAPA2 INTO BUFFER.
    REPLACE '&' WITH INT_EDIDS-STAPA3 INTO BUFFER.
    REPLACE '&' WITH INT_EDIDS-STAPA4 INTO BUFFER.
   ENDIF.
   CONDENSE BUFFER.
  MOVE buffer to akt_message.
   
          exit.
     

To calculate the time difference

FORM calculate_time_diff_in_sec USING before_date LIKE sy-datum
                                      before_time LIKE sy-uzeit
                                      now_date    LIKE sy-datum
                                      now_time    LIKE sy-uzeit
                                      time_diff   TYPE i.
  DATA: delta_date TYPE i,
        delta_time TYPE i.

  delta_date = now_date - before_date.
  delta_time = now_time - before_time.

  IF delta_date < 0.                   " irregular situation
    time_diff = 0.
  ELSEIF delta_date > 2000.            " avoid overflow
    time_diff = 0.
  ELSE.
    time_diff = delta_date * 86400 + delta_time.
    IF time_diff < 0.                  " irregular situation
      time_diff = 0.
    ENDIF.
  ENDIF.
ENDFORM.                               " CALCULATE_TIME_DIFF_IN_SEC

Saturday, February 26, 2011

To restrict the select-options popup message


TYPE-POOLS sscr.

DATA: restrict     TYPE sscr_restrict,
      opt_list     TYPE sscr_opt_list,
      associate    TYPE sscr_ass.

CLEAR :opt_list,associate,restrict.

* Set the complex
  MOVE 'EQ'  TO opt_list-name.
  opt_list-options-eq = 'X'.
  APPEND opt_list TO restrict-opt_list_tab.
  associate-kind    = 'S'.
  associate-name    = '<select-option name>'.
  associate-sg_main = 'I'.
  associate-sg_addy = ' '.
  associate-op_main = 'EQ'.
  associate-op_addy = 'EQ'.
  APPEND associate TO restrict-ass_tab.

  CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
    EXPORTING
      program                      = sy-repid
      restriction                  = restrict
*   DB                           = ' '
   EXCEPTIONS
     too_late                     = 1
     repeated                     = 2
     selopt_without_options       = 3
     selopt_without_signs         = 4
     invalid_sign                 = 5
     empty_option_list            = 6
     invalid_kind                 = 7
     repeated_kind_a              = 8
     OTHERS                       = 9


Note: It should be declared in the PBO in Module pool program.

Wednesday, February 9, 2011

To get selection parameter

use FM: RS_REFRESH_FROM_SELECTOPTIONS

ex:
 CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
   EXPORTING
     curr_report     = 'ZTEST_CS15'
   TABLES
     selection_table = it_seltab
   EXCEPTIONS
     not_found       = 1
     no_report       = 2
     OTHERS          = 3.