Tuesday, June 23, 2020

System to system Objects comparioson

Tcode to compare Objects between system -- SREPO

Monday, December 24, 2012

Reading files from Business Object repository

Use the following list of FMs to read the documents from Business Object Repository.



CALL FUNCTION 'BDS_ALL_CONNECTIONS_GET'
  EXPORTING
*    logical_system   = logical_system
    classname        = classname
    classtype        = classtype
    objkey           = objkey
    client           = sy-mandt
    all              = ' '     " <- br="br" get="get" newest="newest" the="the" version="version">    no_gos_docs      = ' '     " <- br="br" docs="docs" get="get" gos="gos" too="too">  IMPORTING
    count            = i_count
  TABLES
    signature        = signature
    all_connections  = i_connections
    framework        = framework
  EXCEPTIONS
    no_objects_found = 1
    error_kpro       = 2
    internal_error   = 3
    not_authorized   = 4
    OTHERS           = 5.
IF SY-SUBRC =  0.
 READ SINGATURE INTO I_SIGNATURE INDEX 1.

REFRESH : signature[ ].
 pass I_SIGNATURE-doc_id to below FM AND and get PHIO data
  CALL FUNCTION 'BDS_PHIO_GET_RIGHT'
       EXPORTING
            client         = client
            doc_id         = doc_id
       TABLES
            infoobjects    = i_infoobjects
            signature      = signature
       EXCEPTIONS
             nothing_found   = 1
             parameter_error = 2
             not_allowed     = 3
             error_kpro      = 4
             internal_error  = 5
             not_authorized  = 6
             OTHERS          = 9.
  IF sy-subrc = 0.
Pass the i_infoobjects to as PH_object for below FM and the file content will be downloaded into ASCII & BINARY data tables.
CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
         EXPORTING
              object_id           = ph_object
              client              = client
              text_as_stream      = 'X'
         TABLES
              file_access_info    = i_file_access_info
              file_content_ascii  = i_file_content_ascii
              file_content_binary = i_file_content_binary
         EXCEPTIONS
              not_existing        = 1
              not_authorized      = 6
              no_content          = 7
              bad_storage_type    = 8
              OTHERS              = 49.
    IF sy-subrc = 0.
    ENDIF.
  ENDIF.
ENDIF.

Monday, August 20, 2012

Dynamic Select & Target to Dynamic structure using field symbols

When we need to get data from a table structure that is derived dynamically and get data from that table structure use the following example....




Wednesday, February 22, 2012

Wildcard Search on any particular field inside a program/FM

 IF pfrom CA '*' OR pto CA '*'.
    wildcard = '1'.
    prange-sign   = 'I'.
    prange-option = 'CP'.
    prange-low    = pfrom.
    APPEND prange.
    EXIT.
  ENDIF.


  IF      NOT pto   IS INITIAL
      AND NOT pfrom IS INITIAL.
    prange-sign   = 'I'.
    prange-option = 'BT'.
    prange-low    = pfrom.
    prange-high   = pto.
    APPEND prange.
  ELSEIF NOT pfrom IS INITIAL.
    prange-sign   = 'I'.
    prange-option = 'EQ'.
    prange-low    = pfrom.
    APPEND prange.
  ELSEIF NOT pto IS INITIAL.
    prange-sign   = 'I'.
    prange-option = 'BT'.
    CLEAR pfrom.
    prange-low    = pfrom.
    prange-high   = pto.
    APPEND prange.
  ENDIF.

Wednesday, October 12, 2011

Search Helps with Search Help Exit

Create a search help either with view or DB table depending on requirement.
then assith the Table/View in search help(my requirement was satisfied by Elementary, same approach )

Delcare Changing & Tables in the Search help exit

Then customize the following code according to the requirements


FUNCTION zirm_prdclass_brand.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  TABLES
*"      SHLP_TAB TYPE  SHLP_DESCT
*"      RECORD_TAB STRUCTURE  SEAHLPRES
*"  CHANGING
*"     REFERENCE(SHLP) TYPE  SHLP_DESCR
*"     REFERENCE(CALLCONTROL) LIKE  DDSHF4CTRL STRUCTURE  DDSHF4CTRL
*"----------------------------------------------------------------------

  TYPESBEGIN OF ty_mara,
          matnr TYPE matnr,
           vkorg TYPE vkorg,
           vtweg  TYPE vtweg,
          prodh TYPE prodh_d,
         END OF ty_mara,

         BEGIN OF ty_final,
           matnr TYPE matnr,
           vkorg TYPE vkorg,
           vtweg  TYPE vtweg,
           zzprodh4  TYPE zzprodh4,
           zzprodh5  TYPE zzprodh5,
           zzprodh6  TYPE zzprodh6,
           END OF ty_final.

  DATA: lt_mara TYPE STANDARD TABLE OF ty_mara,
        lt_final TYPE STANDARD TABLE OF ty_final,
        ls_mara TYPE ty_mara,
        ls_final TYPE ty_final.
  DATA: it_mara TYPE STANDARD TABLE OF mvke,
        w_mara TYPE mvke,
        w_selopt LIKE LINE OF shlp-selopt,
        w_fielddrop LIKE LINE OF shlp-fieldprop.

  DATA: l_vkorg(1).

  IF callcontrol-step = 'SELECT'.
    READ TABLE shlp_tab INDEX 1.
    CLEAR: l_vkorg.
    LOOP AT shlp-selopt INTO w_selopt.
      IF w_selopt-shlpfield = 'MATNR'.
        w_mara-matnr = w_selopt-low.
      ELSEIF w_selopt-shlpfield = 'VKORG'.
        w_mara-vkorg = w_selopt-low.
        l_vkorg = 'X'.
      ELSEIF w_selopt-shlpfield = 'VTWEG'.
        w_mara-vtweg = w_selopt-low.
      ENDIF.
    ENDLOOP.
    IF w_mara IS NOT INITIAL.
      APPEND w_mara  TO it_mara .
    ENDIF.


    LOOP AT shlp-fieldprop INTO w_fielddrop
    WHERE fieldname CS 'ZZPROD'.
      w_fielddrop-shlpoutput = 'X'.
      MODIFY shlp-fieldprop FROM w_fielddrop.
    ENDLOOP.
    CLEAR: w_fielddrop.
    IF NOT it_mara IS INITIAL AND l_vkorg = 'X'.
      SELECT matnr vkorg vtweg prodh FROM mvke
        INTO TABLE lt_mara
        FOR ALL ENTRIES IN it_mara
        WHERE matnr = it_mara-matnr
          AND vkorg = it_mara-vkorg.
    ELSEIF NOT it_mara IS INITIAL .
      SELECT matnr vkorg vtweg prodh FROM mvke
        INTO TABLE lt_mara
        FOR ALL ENTRIES IN it_mara
        WHERE matnr = it_mara-matnr.
    ELSE.
      SELECT matnr vkorg vtweg prodh FROM mvke
        INTO TABLE lt_mara.
    ENDIF.
    IF NOT lt_mara IS INITIAL.
      LOOP AT lt_mara INTO ls_mara.
        ls_final-matnr = ls_mara-matnr.
        ls_final-vkorg = ls_mara-vkorg.
        ls_final-vtweg = ls_mara-vtweg.
        IF shlp_tab-shlpname = 'ZIRM_BRAND'.
          ls_final-zzprodh4 = ls_mara-prodh+6(3).
        ELSEIF shlp_tab-shlpname = 'ZIRM_PRD_CLASS'.
          ls_final-zzprodh5 = ls_mara-prodh+9(3).
        ELSE.
          ls_final-zzprodh6 = ls_mara-prodh+12(3).
        ENDIF.
        APPEND ls_final TO lt_final.
      ENDLOOP.

    ENDIF.


    CALL FUNCTION 'F4UT_RESULTS_MAP'
      TABLES
        shlp_tab          = shlp_tab
        record_tab        = record_tab
        source_tab        = lt_final
      CHANGING
        shlp              = shlp
        callcontrol       = callcontrol
      EXCEPTIONS
        illegal_structure = 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.

    callcontrol-step = 'DISP'.

  ENDIF.

  REFRESH: it_mara,
           lt_mara,
           lt_final.
ENDFUNCTION.

Monday, April 18, 2011

SAP translations and transports for them

To assign a transport request for the translations that were done, execute the program RS_LXE_RECORD_TORDER.





Reference from :
http://www.saptechnical.com/Tutorials/Smartforms/TransportRequest/Assign.htm

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.