How to call Projection View from ABAP Report


Projection View name - ZVP_PRO_VIEW

Fields available in above view -
VBELN
ERDAT
ERZET
ERNAM
VKGRP


Code :
REPORT ZVP_PROJECTION_VIEW_CALL.

DATA: ZVIEW_IT TYPE TABLE OF ZVP_PRO_VIEW,
      ZVIEW_WA TYPE ZVP_PRO_VIEW.

START-OF-SELECTION.
SELECT * FROM ZVP_PRO_VIEW INTO TABLE ZVIEW_IT UP TO 50 ROWS.

LOOP AT ZVIEW_IT INTO ZVIEW_WA.
WRITE:/
ZVIEW_WA-VBELN,
ZVIEW_WA-ERDAT,
ZVIEW_WA-ERZET,
ZVIEW_WA-ERNAM,
ZVIEW_WA-VKGRP.
ENDLOOP.

Output :


IDE Used To Test This Code : ABAP Editor.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

How to call Database View from ABAP Report


Database view name - ZVP_DB_VIEW
Following fields will be available in ZVP_DB_VIEW.
NAME1
KUNNR
NAME1
ORT01
PSTLZ
REGIO
VBELN
ERDAT
ERZET
ANGDT

Code :
REPORT ZVP_DATABASE_VIEW_CALL.

DATA: ZVIEW_IT TYPE TABLE OF ZVP_DB_VIEW,
            ZVIEW_WA TYPE ZVP_DB_VIEW.

START-OF-SELECTION.
SELECT * FROM ZVP_DB_VIEW INTO TABLE ZVIEW_IT UP TO 50 ROWS.

LOOP AT ZVIEW_IT INTO ZVIEW_WA.
WRITE:/ ZVIEW_WA-NAME1,
        ZVIEW_WA-KUNNR,
        ZVIEW_WA-NAME1,
        ZVIEW_WA-ORT01,
        ZVIEW_WA-PSTLZ,
        ZVIEW_WA-REGIO,
        ZVIEW_WA-VBELN,
        ZVIEW_WA-ERDAT,
        ZVIEW_WA-ERZET,
        ZVIEW_WA-ANGDT.
ENDLOOP.

Output :


IDE Used To Test This Code : ABAP Editor.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

How to find BAPI for a particular transaction in SAP ABAP


1. Suppose you want to find out the BAPI for create sales order, so transaction code for create a sales order is VA01, go to VA01 transaction code.

2. After that go to System -->> Status.

3. Double click on Transaction VA01 and you will see the related package which is VA.

4. Just copy the package name and go to transaction code SE80 and then choose package from the drop down menu and put the package name VA and hit enter.

5. All package related data you will see. choose Business Engineering -->> Business Object Types , double click on BUS2032 for sales order.

6. Choose Methods.

7. SaleOrder.CreateFromDat2 click on green portion and you will enter in to BAPI_SALESORDER_CREATEFROMDAT2 function module.

If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Difference between RFC and BAPI in SAP ABAP


RFC
1. Its a Remote Function Call.
2. It not always use Business Object Repository.

BAPI
1. It is known as Business Application Programming Interface.
2. It use the Business Object Repository via methods.

If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Difference between BDC and BAPI in SAP ABAP


BDC
1. Batch Data Communication.
2. It is not stored in Business Object Repository.
3. Here use screen.
4. Exception can handle using BDCMSGCOLL.

BAPI
1. Business Application Programming Interface.
2. BAPI stored in Business Object Repository.
3. Here use interface.
4. We can't handle exception in BAPI generally, but explicitly we can handle the exception using RETURN table or BAPIRET2 structure.

If you have any Question you can contact us or mail us.We will reply you as soon as possible.

List of Work Process in SAP ABAP


1. Dialog Work process.
2. Background work process.
3. Spool Work Process.
4. Update Work process.
5. En queue Work process.

If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Classical report events in SAP ABAP


1. Load-of-program.
2. Initialization.
3. At Selection-Screen output.
4. At Selection-Screen on field.
5. At Selection-Screen on value request.
6. At Selection-Screen on help request.
7. At Selection-Screen.
8. Start-of-Selection.
9. End-of-Selection.
10. Top-of-Page.
11. End-of-Page.

If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Difference between BDC Call Transaction and BDC Session Method


BDC Call Transaction
1. This is a synchronous processing.
2. Database update can be synchronous and asynchronous.
3. It is faster than session method.
4. Auto exception handling not possible here, we can handle the exception with the help of BDCMSGCOLL structure.
5. Suitable for 1 to 10000 data records.

BDC Session
1. This is an asynchronous processing.
2. Database update always synchronous
3. It is slower than call transaction method.
4. Auto exception handling possible here.
5. Suitable for more than 10000 records or mass of data records.

If you have any Question you can contact us or mail us.We will reply you as soon as possible.

BDC Call Transaction in SAP ABAP


1. Go to T-Code : SHDB for recording a transaction.

2. Give Recording name - ZVP_RCD_FI01 and give Transaction Code name FI01 and click on Start recording button.

3. Give Bank Country - IN and Bank Key - 1004785 and hit enter.

4. Then enter the following -
Bank Name - ABC Bank
Region - 25
City - KOLKATA
Bank Branch - TARATALA

5. After that press save button and again click save and click back button.

6. You will see your recording name in your screen. click the recording name and click on Program.

7. Give program name ZVP_BDC_UPLOAD_FI01, click on Transfer from recording and click on continue button and click on Source and your report program will come up.

8. Create a TXT file in desktop with content below -
IN 700153 AAA 25 INDIA KOLKATA
IN 700154 BBB 25 INDIA KOLKATA
IN 700155 CCC 25 INDIA KOLKATA
IN 700156 DDD 25 INDIA KOLKATA
IN 700157 EEE  25 INDIA KOLKATA

Source Code :
REPORT ZVP_BDC_UPLOAD_FI01
       NO STANDARD PAGE HEADING LINE-SIZE 255.

*include bdcrecx1.
TYPES: BEGIN OF TY_BANK,
       BANKS TYPE BANKS,
       BANKL TYPE BANKL,
       BANKA TYPE BANKA,
       PROVZ TYPE PROVZ,
       ORT01 TYPE ORT01,
       BRNCH TYPE BRNCH,
  END OF TY_BANK.

DATA: IT_BANK TYPE TABLE OF TY_BANK,
      WA_BANK TYPE TY_BANK.

DATA: IT_BDCDATA TYPE TABLE OF BDCDATA,
      WA_BDCDATA TYPE BDCDATA.

START-OF-SELECTION.

*perform open_group.

CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    FILENAME                      = 'C:\Users\soumyodeep\Desktop\BDC_UPLOAD_BNKA.TXT'
*   FILETYPE                      = 'ASC'
   HAS_FIELD_SEPARATOR           = 'X'
*   HEADER_LENGTH                 = 0
*   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
*   CODEPAGE                      = ' '
*   IGNORE_CERR                   = ABAP_TRUE
*   REPLACEMENT                   = '#'
*   CHECK_BOM                     = ' '
*   VIRUS_SCAN_PROFILE            =
*   NO_AUTH_CHECK                 = ' '
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =
  TABLES
    DATA_TAB                      = IT_BANK
* CHANGING
*   ISSCANPERFORMED               = ' '
* EXCEPTIONS
*   FILE_OPEN_ERROR               = 1
*   FILE_READ_ERROR               = 2
*   NO_BATCH                      = 3
*   GUI_REFUSE_FILETRANSFER       = 4
*   INVALID_TYPE                  = 5
*   NO_AUTHORITY                  = 6
*   UNKNOWN_ERROR                 = 7
*   BAD_DATA_FORMAT               = 8
*   HEADER_NOT_ALLOWED            = 9
*   SEPARATOR_NOT_ALLOWED         = 10
*   HEADER_TOO_LONG               = 11
*   UNKNOWN_DP_ERROR              = 12
*   ACCESS_DENIED                 = 13
*   DP_OUT_OF_MEMORY              = 14
*   DISK_FULL                     = 15
*   DP_TIMEOUT                    = 16
*   OTHERS                        = 17
          .
IF SY-SUBRC = 0.
MESSAGE: 'DATA UPLOADED SUCCESSFULLY' TYPE 'I'.
ENDIF.

LOOP AT IT_BANK INTO WA_BANK.

PERFORM BDC_DYNPRO      USING 'SAPMF02B' '0100'.
PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                              'BNKA-BANKL'.
PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                              '/00'.
PERFORM BDC_FIELD       USING 'BNKA-BANKS'
                              WA_BANK-BANKS.
PERFORM BDC_FIELD       USING 'BNKA-BANKL'
                              WA_BANK-BANKL.
PERFORM BDC_DYNPRO      USING 'SAPMF02B' '0110'.
PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                              'BNKA-BRNCH'.
PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                              '=UPDA'.
PERFORM BDC_FIELD       USING 'BNKA-BANKA'
                              WA_BANK-BANKA.
PERFORM BDC_FIELD       USING 'BNKA-PROVZ'
                              WA_BANK-PROVZ.
PERFORM BDC_FIELD       USING 'BNKA-ORT01'
                              WA_BANK-ORT01.
PERFORM BDC_FIELD       USING 'BNKA-BRNCH'
                              WA_BANK-BRNCH.
*PERFORM BDC_TRANSACTION USING 'FI01'.
CALL TRANSACTION 'FI01' USING IT_BDCDATA MODE 'A' UPDATE 'S'.
REFRESH IT_BDCDATA.
ENDLOOP.
*perform close_group.

*----------------------------------------------------------------------*
*        Start new screen                                              *
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
  CLEAR WA_BDCDATA.
  WA_BDCDATA-PROGRAM  = PROGRAM.
  WA_BDCDATA-DYNPRO   = DYNPRO.
  WA_BDCDATA-DYNBEGIN = 'X'.
  APPEND WA_BDCDATA TO IT_BDCDATA.
ENDFORM.

*----------------------------------------------------------------------*
*        Insert field                                                  *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
*  IF FVAL <> NODATA.
    CLEAR WA_BDCDATA.
    WA_BDCDATA-FNAM = FNAM.
    WA_BDCDATA-FVAL = FVAL.
    APPEND WA_BDCDATA TO IT_BDCDATA.
*  ENDIF.
ENDFORM.

Execute the program you will see data uploaded successfully and click on OKCODE popup and save the data and data inserted to table successfully.

You can go to SE11 and give the database name BNKA and check the content for your uploaded data.

IDE Used To Test This Code : ABAP Editor.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

BDC Download Program in SAP ABAP


Code :
REPORT ZVP_BDC_DOWNLOAD.

TYPES: BEGIN OF TY_MARA,
        MATNR TYPE MARA-MATNR,
        ERNAM TYPE MARA-ERNAM,
        MTART TYPE MARA-MTART,
        MBRSH TYPE MARA-MBRSH,
        MATKL TYPE MARA-MATKL,
      END OF TY_MARA.

DATA: IT TYPE STANDARD TABLE OF TY_MARA,
      WA TYPE TY_MARA,
      LV_MATNR TYPE MATNR.

SELECT-OPTIONS: S_MATNR FOR LV_MATNR.

SELECT MATNR
       ERNAM
       MTART
       MBRSH
       MATKL
  FROM MARA INTO TABLE IT WHERE MATNR IN S_MATNR.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
*   BIN_FILESIZE                    =
    FILENAME                        = 'C:\Users\system\Desktop\BDC_DOWNLOAD.TXT'
    FILETYPE                        = 'ASC'
*   APPEND                          = ' '
    WRITE_FIELD_SEPARATOR           = 'X'
*   HEADER                          = '00'
*   TRUNC_TRAILING_BLANKS           = ' '
*   WRITE_LF                        = 'X'
*   COL_SELECT                      = ' '
*   COL_SELECT_MASK                 = ' '
*   DAT_MODE                        = ' '
*   CONFIRM_OVERWRITE               = ' '
*   NO_AUTH_CHECK                   = ' '
*   CODEPAGE                        = ' '
*   IGNORE_CERR                     = ABAP_TRUE
*   REPLACEMENT                     = '#'
*   WRITE_BOM                       = ' '
*   TRUNC_TRAILING_BLANKS_EOL       = 'X'
*   WK1_N_FORMAT                    = ' '
*   WK1_N_SIZE                      = ' '
*   WK1_T_FORMAT                    = ' '
*   WK1_T_SIZE                      = ' '
*   WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
*   SHOW_TRANSFER_STATUS            = ABAP_TRUE
*   VIRUS_SCAN_PROFILE              = '/SCET/GUI_DOWNLOAD'
* IMPORTING
*   FILELENGTH                      =
  TABLES
    DATA_TAB                        = IT
*   FIELDNAMES                      =
* EXCEPTIONS
*   FILE_WRITE_ERROR                = 1
*   NO_BATCH                        = 2
*   GUI_REFUSE_FILETRANSFER         = 3
*   INVALID_TYPE                    = 4
*   NO_AUTHORITY                    = 5
*   UNKNOWN_ERROR                   = 6
*   HEADER_NOT_ALLOWED              = 7
*   SEPARATOR_NOT_ALLOWED           = 8
*   FILESIZE_NOT_ALLOWED            = 9
*   HEADER_TOO_LONG                 = 10
*   DP_ERROR_CREATE                 = 11
*   DP_ERROR_SEND                   = 12
*   DP_ERROR_WRITE                  = 13
*   UNKNOWN_DP_ERROR                = 14
*   ACCESS_DENIED                   = 15
*   DP_OUT_OF_MEMORY                = 16
*   DISK_FULL                       = 17
*   DP_TIMEOUT                      = 18
*   FILE_NOT_FOUND                  = 19
*   DATAPROVIDER_EXCEPTION          = 20
*   CONTROL_FLUSH_ERROR             = 21
*   OTHERS                          = 22
          .
IF SY-SUBRC <> 0.
MESSAGE 'DATA DOWNLOADED TO C:\Users\system\Desktop\BDC_DOWNLOAD.TXT SUCCESSFULLY' TYPE 'I'.
ENDIF.

Output :


IDE Used To Test This Code : ABAP Editor.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

What are the DDIC Objects in SAP ABAP?


DDIC / Data Dictionary Objects are - 
1. Database table
2. View
3. Data type
4. Type group
5. Domain
6. Search help
7. Lock object

If you have any Question you can contact us or mail us.We will reply you as soon as possible.

What is Data Dictionary in SAP ABAP?


Data Dictionary
In SAP ABAP Data Dictionary is the central repository system. It is used to develop and maintain data definitions or metadata. We can access the Data Dictionary through transaction code SE11. It is also called as DDIC.

If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Insert values from Report Parameters into custom Database Table in SAP ABAP


First create a custom table in SE11, give valid name start with Z. in my case i have given ZVP_STD_TBL. Then give the corresponding Data Element name and domain, give Field Label name etc.


Table fields are -
ID
NAME
AGE
ADDRESS

After that go to transaction code SE38 and five a valid name starting with Z.

Our focus is to insert data from report Parameter to custom table which we have created in SE11.

Code :
REPORT ZVP_INSERT_TO_DATABASE_TABLE.

PARAMETERS: P_ID TYPE ZDEID,
            P_NAME TYPE ZDENAME,
            P_AGE TYPE ZDEAGE,
            P_ADDRS TYPE ZDEADDRESS.

DATA: IT TYPE TABLE OF ZVP_STD_TBL,
      WA TYPE ZVP_STD_TBL.

MOVE P_ID TO WA-ID.
MOVE P_NAME TO WA-NAME.
MOVE P_AGE TO WA-AGE.
MOVE P_ADDRS TO WA-ADDRESS.
INSERT ZVP_STD_TBL FROM WA.

IF SY-SUBRC EQ 0.
  MESSAGE: 'SUCCESSFULLY SAVED' TYPE 'S'.
  ELSE.
  MESSAGE: 'NOT SAVED' TYPE 'E'.
ENDIF.

Output :

data insert from report parameters


Table Entries


IDE Used To Test This Code : ABAP Editors.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.