Thursday, November 24, 2016

Batch Data Communication(BDC)

Batch input is typically used to transfer data from non-R/3 systems to R/3 systems or to transfer data between R/3 systems. It is a data transfer technique that allows you to transfer datasets automatically to screens belonging to transactions, and thus to an SAP system. Batch input is controlled by a batch input session.

Monday, September 5, 2016

Steps to create Package

1. Go to T-code SE21
2. Write Package name and click create
3. Write following details

    Description: Give description 
     Software Component: HOME
     Transport Layer: Select Transport layer
     Package TYPE: Development package

4.Then execute and then continue.
5.By this procedure successfully package will be created .


Thanks

Saturday, September 3, 2016

Steps to create domain

1. Go to t-code SE11.
2. Select the Domain radio button, enter the name of the domain that you want to create
3. Press create.
4. Enter the short description.
5. Place the cursor in the data type and press F4 to get the list of SAP data types.
6. In the popup window select the correct data type.
7. Enter the number of characters.
8. Enter the decimal places if it applicable to data type that you have selected.
9. Save and activate the domain.


Thanks

Tuesday, October 8, 2013

Add Vendor Code and name in FBL3N report


To add Vendor Code and name in FBL3N report use BTE concept. 
  • Append structure in RFPOS & RFPOSX. 
  • In SE38 to regenerate the program RFPOSXEXTEN. 
  • Create a new function module ZXXXX and assign it to BTE 00001650.
  • In the FM select the vendor code from BSIK or BSAK by Document no. 

Monday, June 3, 2013

Authorization check for selection option

I want to share AUTHORITY-CHECK OBJECT for selection opting.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
PARAMETERS:p_bukrs type bkpf-bukrs OBLIGATORY.
SELECT-OPTIONS :  so_audat FOR vbak-audat OBLIGATORY,
      so_auart FOR vbak-auart OBLIGATORY,
      so_kunnr FOR vbak-kunnr,
      so_matnr FOR vbap-matnr,
      so_vrkme FOR vbap-vrkme OBLIGATORY,
      so_lgort FOR vbap-lgort,
      so_werks FOR vbap-werks,
      so_vkorg FOR vbak-vkorg,
      so_vtweg FOR vbak-vtweg,
      so_spart FOR vbak-spart.
SELECTION-SCREEN END OF BLOCK b1.

Want to check Authorization for so_vkorg, so_vtweg, so_spart.

Go to AT SELECTION-SCREEN OUTPUT.
Now AT SELECTION-SCREEN.
Call  V_VBAK_VKO.

Check the code.

SELECT *
FROM  vbak
          INTO TABLE tmp_vbak
         WHERE audat IN so_audat
      AND auart IN so_auart
      AND vkorg IN so_vkorg
      AND vtweg IN so_vtweg
      AND spart IN so_spart
      AND bukrs_vf = p_bukrs.

   LOOP AT tmp_vbak INTO  wa_tmp_vbak.
     AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'
        ID 'VKORG' FIELD  wa_tmp_vbak-vkorg
        ID 'VTWEG' FIELD  wa_tmp_vbak-vtweg
        ID 'SPART' FIELD  wa_tmp_vbak-spart
        ID 'ACTVT' FIELD '03'.
   ENDLOOP.
   IF sy-subrc <> 0.
     MESSAGE 'No authorization' TYPE 'E'.
   ENDIF.

Hope it will work
Rizvi

Tuesday, May 21, 2013

Display employee picture in an adobe form report



Hi,

I want to show the process to display employee picture in an adobe form report which upload from t-code OAAD.

Step 1: Call FM 'BAPI_EMPLOYEE_GETDATA' to get Archive Link ID and Archive Link Document ID.

 CALL FUNCTION 'BAPI_EMPLOYEE_GETDATA'
 EXPORTING
   employee_id            = p_pernr

   date                   = sy-datum
*   EXTENSION              =
*   READDB                 = FALSE
*   ORGTXT_LG              =
*   JOBTXT_LG              =
*   POSTXT_LG              =
*   AUTHORITY_CHECK        = 'X'
* IMPORTING
*   RETURN                 =
 TABLES
   org_assignment         = org_assignment
   personal_data          = personal_data
   internal_control       = internal_control
   communication          = communication
   archivelink            = archivelink.

Step 2: User can upload more than one picture so I took the latest one.


SORT archivelink BY ar_date DESCENDING.
READ TABLE archivelink INTO wa_archivelink INDEX 1



Step 3: Call FM 'SCMS_R3DB_IMPORT' and pass Archive Link ID and Archive Link Document ID to get binary document contents.

CALL FUNCTION 'SCMS_R3DB_IMPORT'
  EXPORTING
    mandt        = sy-mandt
    crep_id      = wa_archivelink-archiv_id
    doc_id       = wa_archivelink-arc_doc_id
  TABLES
    content_info = lt_content_info
    content_txt  = lt_content_txt
    content_bin  = lt_content_bin
  EXCEPTIONS
    error_import = 1
    error_config = 2
    OTHERS       = 3.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.



Step 4: Now call FM 'SCMS_BINARY_TO_XSTRING' the XSTRING value.



READ TABLE lt_content_info INTO lw_file_info INDEX 1.

IF sy-subrc IS INITIAL.
  l_fl = lw_file_info-first_line.
  l_ll = lw_file_info-last_line.
  l_fs = lw_file_info-comp_size.

  CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
    EXPORTING
      input_length = l_fs
      first_line   = l_fl
      last_line    = l_ll
    IMPORTING
      buffer       = l_url
    TABLES
      binary_tab   = lt_content_bin
    EXCEPTIONS
      failed       = 1
      OTHERS       = 2.

ENDIF.

Step 5: Append your value to the internal table.

Now go to your Adobe forms.

    Add Graphic in the table.
    Change the property Graphic Type as Graphic Content.
    In Field use your XSTRING field.
    Set MIME Type as 'JPG/BMP'.

Monday, May 20, 2013

BAPI for HCM Employee age calculation


CALL FUNCTION 'HR_AUPBS_AGE'
  EXPORTING
    pernr                  = p_pernr
    bsdte                  = sy-datum
*   REACTION               = ' '
 IMPORTING
   value                  = value
* EXCEPTIONS
*   RECORD_NOT_FOUND       = 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.

Saturday, May 18, 2013

BAPI for HCM Employee information

DATA: org_assignment TYPE STANDARD TABLE OF  bapip0001b,
      personal_data TYPE STANDARD TABLE OF  bapip0002b,
      internal_control  TYPE STANDARD TABLE OF  bapip0032b,
      communication TYPE STANDARD TABLE OF  bapip0105b,
      archivelink TYPE STANDARD TABLE OF  bapitoav0,
      wa_org_assignment  LIKE  bapip0001b,
      wa_personal_data TYPE  bapip0002b,
      wa_internal_control  LIKE  bapip0032b,
      wa_communication LIKE  bapip0105b,
      wa_archivelink LIKE  bapitoav0.

CALL FUNCTION 'BAPI_EMPLOYEE_GETDATA'
 EXPORTING
   employee_id            = p_pernr    "Personnel No
*   LASTNAME_M             =
*   FSTNAME_M              =
*   FST_NAME_K             =
*   LST_NAME_K             =
*   FST_NAME_R             =
*   LST_NAME_R             =
*   ORGTXT                 =
*   JOBTXT                 =
*   POSTXT                 =
*   COSTCENTER             =
*   BLDING_NO              =
*   ROOM_NO                =
*   PHONE_NO               =
*   LIPLATE_NO             =
*   USERID                 =
   date                   = sy-datum
*   EXTENSION              =
*   READDB                 = FALSE
*   ORGTXT_LG              =
*   JOBTXT_LG              =
*   POSTXT_LG              =
*   AUTHORITY_CHECK        = 'X'
* IMPORTING
*   RETURN                 =
 TABLES
   org_assignment         =  org_assignment
   personal_data          =   personal_data
   internal_control       =   internal_control
   communication          = communication
   archivelink            =  archivelink.

Sunday, May 12, 2013

How to insert background image in Smartforms?

To insert background image in Smartforms please follow the below steps:

1. Double click on your Page under 'Pages and Windows'
2. Click on the 3rd tab 'Background Picture'
3. Mention all the details of image which you want to insert in Smartforms background.


Saturday, May 4, 2013

BAPI for Vendor Account Statement for a given Period

To get any vendor line items at a given period use BAPI 'BAPI_AP_ACC_GETSTATEMENT'. 
 
CALL FUNCTION 'BAPI_AP_ACC_GETSTATEMENT'
    EXPORTING
      companycode       = p_bukrs
      vendor            = p_lifnr            "Vendor
      date_from         = so_budat-low       "Date from
      date_to           = so_budat-high      "Date to
*   NOTEDITEMS        = ' '
* IMPORTING
*   RETURN            =
    TABLES
      lineitems         = i_bapi3008_2 .

BAPI for Vendor account balance at a key date

Use 'BAPI_AP_ACC_GETKEYDATEBALANCE' to get closing balance of a keydate.
 CALL FUNCTION 'BAPI_AP_ACC_GETKEYDATEBALANCE'
    EXPORTING
      companycode      = p_bukrs 
      vendor           = p_lifnr
      keydate          = v_date
*   BALANCESPGLI       = ' '
*   NOTEDITEMS         = ' '
* IMPORTING
*   RETURN             =
    TABLES
      keybalance         = i_bapi3008_3 .

BAPI for Customer account statement for a given period

To get any customer line items at a given period use the BAPI. 
 CALL FUNCTION 'BAPI_AR_ACC_GETSTATEMENT'
    EXPORTING
      companycode       = p_bukrs
      customer          = p_kunnr
      date_from         = so_budat-low       "from_date
      date_to           = so_budat-high      "to_date
*   NOTEDITEMS        = ' '
* IMPORTING
*   RETURN            =
    TABLES
      lineitems         = i_bapi3007_2 .


How to disable print option in smartforms?

To disable print option change parameter ssfcompop-tdnoprint. User will only able to view the samrtforms.

 DATA: t_ssfcompop TYPE ssfcompop.

       t_ssfcompop-tdnoprint = 'X'.
       t_ssfcompop-tdnoarch  = ' '.
       t_ssfcompop-tdnoprev = ' ' .

  CALL FUNCTION fm_name
    EXPORTING
      output_options     = t_ssfcompop
      p_bukrs            = p_bukrs
      p_kunnr            = p_kunnr
    TABLES
      it_final           = it_final
      so_budat           = so_budat
    EXCEPTIONS
      formatting_error   = 1
      internal_error     = 2
      send_error         = 3
      user_canceled      = 4
      OTHERS             = 5.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

Thursday, May 2, 2013

BAPI for Customer account balance at a key date


To get any customer account balance at any date use the BAPI. You can get opening or closing balance of any customer using this.


CALL FUNCTION 'BAPI_AR_ACC_GETKEYDATEBALANCE'
    EXPORTING
      companycode        = p_bukrs      "Company Code
      customer           = p_kunnr      "Customer Code
      keydate            = v_date       "Date
*   BALANCESPGLI       = ' '
*   NOTEDITEMS         = ' '
* IMPORTING
*   RETURN             =
    TABLES
      keybalance         = i_bapi3007_3 .

 

Sunday, April 28, 2013

BAPI for Vendor address

To get company details address call function BAPI_VENDOR_GETDETAIL.

Data:
  vendor TYPE   bapivendor_04,
  companydetail  TYPE  bapivendor_05,
  return1  TYPE  bapiret1,
  v_return LIKE TABLE OF bapiret2.

 CALL FUNCTION 'BAPI_VENDOR_GETDETAIL'
      EXPORTING
        vendorno      = wa_final_temp-lifnr
        companycode   = p_bukrs
      IMPORTING
        generaldetail = generaldetail
        companydetail = companydetail
        return        = return1
      TABLES
        bankdetail    = v_return.

Thanks

Sunday, April 21, 2013

BAPI for Company address

To get company details address call function BAPI_COMPANYCODE_GETDETAIL. It will return company  address including Telephone, Fax no.

CALL FUNCTION 'BAPI_COMPANYCODE_GETDETAIL'
  EXPORTING
    companycodeid             = p_bukrs
 IMPORTING
   COMPANYCODE_DETAIL        = wa_DETAIL
   COMPANYCODE_ADDRESS       = wa_ADDRESS
   RETURN                    = RETURN.

Thanks
Rizvi

Tuesday, April 16, 2013

Control the default Reverse Date at VL09

I want Reversal Date and Actual GI Date will be same Reverse Goods Movement (VL09). So I am going to set a popup message and checking for the date when user will click on Reverse button. 

Copy the standard program RVV50L09 to ZRVV50L09.
Go to line WHEN 'WAST' . (for Reverse button)
Add this code.

      IF xlikpukwa-wadat_ist NE  xlikpukwa-stdat.
        MESSAGE i000(fb) WITH 'Reversal Date & Actual GI Date should be the same.' .
        CLEAR sy-ucomm.
        sy-ucomm = 'MABL'.
        is_selfield-exit = gc_noout.

        PERFORM check_list_selection.

      ENDIF.

Thursday, April 11, 2013

How to create PDF from Smartforms?

Many times end users  come to me and ask to create PDF from Smartforms. So I am going to share a small tips to create PDF from smartforms.

  • Go to your smartforms tcode.
  • Run the report and click print preview.
  • Now write tcode PDF!







  • A popup window will come.
  • Just save it to your local disk.

Thanks
Rizvi

Tuesday, April 9, 2013

How to upload new pictures and logos?

Do the following steps:

Go to TCODE: SE78.













Expand Graphics (for BMP)

















Double click on Bitmap








Enter name of the picture








Select Graphic -->  import
Mention file location



















Go to Print preview (to check logo is aploaded or not)

Enjoy :)

Thanks
Rizvi

Monday, April 8, 2013

How to disable print option in smartforms?


To disable print option change parameter ssfcompop-tdnoprint. User will only able to view the samrtforms.
DATA: t_ssfcompop TYPE ssfcompop.

       t_ssfcompop-tdnoprint = 'X'.
       t_ssfcompop-tdnoarch  = ' '.
       t_ssfcompop-tdnoprev = ' ' .

  CALL FUNCTION fm_name
    EXPORTING
      output_options     = t_ssfcompop
      p_bukrs            = p_bukrs
      p_kunnr            = p_kunnr
    TABLES
      it_final           = it_final
      so_budat           = so_budat
    EXCEPTIONS
      formatting_error   = 1
      internal_error     = 2
      send_error         = 3
      user_canceled      = 4
      OTHERS             = 5.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
Thanks
Rizvi :)
UA-40152711-1