Tuesday, August 7, 2018

Interactive ALV report in sap abap.

Interactive ALV report in sap abap
*&---------------------------------------------------------------------*
*& Report  ZSW_IN_ALV
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZSW_IN_ALV.

*REPORT  zsr_test.

TABLESekkoekpo.
TYPE-POOLSslis.

TYPESBEGIN OF ty_ekko,
        ebeln TYPE ekko-ebeln,
        bukrs TYPE ekko-bukrs,
        lifnr TYPE ekko-lifnr,
       END OF ty_ekko,

       BEGIN OF ty_out_ekko,
        sel,
        ebeln TYPE ekko-ebeln,
        bukrs TYPE ekko-bukrs,
        lifnr TYPE ekko-lifnr,
       END OF ty_out_ekko,

       BEGIN OF ty_ekpo,
         ebeln TYPE ekpo-ebeln,
         ebelp TYPE ekpo-ebelp,
         matnr TYPE ekpo-matnr,
         werks TYPE ekpo-werks,
         lgort TYPE ekpo-lgort,
         menge TYPE ekpo-menge,
         meins TYPE ekpo-meins,
       END OF ty_ekpo,

       BEGIN OF ty_out_ekpo,
         sel,
         ebeln TYPE ekko-ebeln,
         ebelp TYPE ekpo-ebelp,
         matnr TYPE ekpo-matnr,
         werks TYPE ekpo-werks,
         lgort TYPE ekpo-lgort,
         menge TYPE ekpo-menge,
         meins TYPE ekpo-meins,
       END OF ty_out_ekpo,

       BEGIN OF ty_ebeln,
         ebeln TYPE ekpo-ebeln,
       END OF ty_ebeln.

DATAwa_ekko TYPE ty_ekko,
      wa_ekpo TYPE ty_ekpo,
      it_ekko TYPE STANDARD TABLE OF ty_ekko,
      it_ekpo TYPE STANDARD TABLE OF ty_ekpo,

      wa_out_ekko TYPE ty_out_ekko,
      wa_out_ekpo TYPE ty_out_ekpo,
      wa_ebeln    TYPE ty_ebeln,
      it_out_ekko TYPE STANDARD TABLE OF ty_out_ekko,
      it_out_ekpo TYPE STANDARD TABLE OF ty_out_ekpo,
      it_ebeln    TYPE STANDARD TABLE OF ty_ebeln,

      wa_fcat_ekko TYPE slis_fieldcat_alv,
      wa_fcat_ekpo TYPE slis_fieldcat_alv,
      it_fcat_ekko TYPE slis_t_fieldcat_alv,
      it_fcat_ekpo TYPE slis_t_fieldcat_alv,

      wa_layout TYPE slis_layout_alv,

      wa_top_ekko TYPE slis_listheader,
      wa_top_ekpo TYPE slis_listheader,
      it_top_ekko TYPE slis_t_listheader,
      it_top_ekpo TYPE slis_t_listheader,

      wa_event TYPE slis_alv_event,
      wa_event_ekpo TYPE slis_alv_event,
      it_event TYPE slis_t_event,
      it_event_ekpo TYPE slis_t_event,

      r_ucomm    TYPE sy-ucomm,
      rs_selfield TYPE slis_selfield,
      v_selfield TYPE slis_selfield-value,
      v_ebeln TYPE ekko-ebeln,
      v_prog  TYPE sy-repid,
      v_name  TYPE sy-uname.

INITIALIZATION.
  v_prog sy-repid.
  v_name sy-uname.

  SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
  SELECT-OPTIONS   s_ebeln FOR ekko-ebeln OBLIGATORY.
  SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.
  PERFORM get_ekko.
  PERFORM fieldcat_ekko.
  PERFORM layout.
  PERFORM event_ekko.
  PERFORM grid_ekko.
  PERFORM ucomm_ekko USING    r_ucomm
                     CHANGING rs_selfield.

*&---------------------------------------------------------------------*
*&      Form  GET_EKKO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_ekko .

  REFRESH it_ekko.
  SELECT ebeln bukrs lifnr
    FROM ekko INTO TABLE it_ekko
    WHERE ebeln IN s_ebeln.

  IF sy-subrc 0.
    SORT it_ekko BY ebeln.
    REFRESH it_out_ekko.

    LOOP AT it_ekko INTO wa_ekko.
      wa_out_ekko-ebeln wa_ekko-ebeln.
      wa_out_ekko-bukrs wa_ekko-bukrs.
      wa_out_ekko-lifnr wa_ekko-lifnr.
      APPEND wa_out_ekko TO it_out_ekko.
      CLEARwa_out_ekkowa_ekko.
    ENDLOOP.

  ELSE.
    MESSAGE 'Purchase Order doesn''t exist' TYPE 'I'.
  ENDIF.

ENDFORM.                    " GET_EKKO
*&---------------------------------------------------------------------*
*&      Form  FIELDCAT_EKKO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM fieldcat_ekko .

  CLEAR wa_fcat_ekko.
  REFRESH it_fcat_ekko.

  IF it_out_ekko IS NOT INITIAL.
    DATA lv_col TYPE VALUE 0.

    lv_col                 + lv_col.
    wa_fcat_ekko-col_pos   lv_col.
    wa_fcat_ekko-fieldname 'EBELN'.
    wa_fcat_ekko-tabname   'IT_OUT_EKKO'.
    wa_fcat_ekko-seltext_l 'Purchase Order'.
    APPEND wa_fcat_ekko TO it_fcat_ekko.
    CLEAR wa_fcat_ekko.

    lv_col                 + lv_col.
    wa_fcat_ekko-col_pos   lv_col.
    wa_fcat_ekko-fieldname 'BUKRS'.
    wa_fcat_ekko-tabname   'IT_OUT_EKKO'.
    wa_fcat_ekko-seltext_l 'Company Code'.
    APPEND wa_fcat_ekko TO it_fcat_ekko.
    CLEAR wa_fcat_ekko.

    lv_col                 + lv_col.
    wa_fcat_ekko-col_pos   lv_col.
    wa_fcat_ekko-fieldname 'LIFNR'.
    wa_fcat_ekko-tabname   'IT_OUT_EKKO'.
    wa_fcat_ekko-seltext_l 'Vendor'.
    APPEND wa_fcat_ekko TO it_fcat_ekko.
    CLEAR wa_fcat_ekko.
  ENDIF.

ENDFORM.                    " FIELDCAT_EKKO
*&---------------------------------------------------------------------*
*&      Form  LAYOUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM layout .

  wa_layout-zebra 'X'.
  wa_layout-colwidth_optimize 'X'.
  wa_layout-box_fieldname 'SEL'.

ENDFORM.                    " LAYOUT
*&---------------------------------------------------------------------*
*&      Form  EVENT_EKKO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM event_ekko .

  REFRESH it_event.

  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
*  EXPORTING
*    I_LIST_TYPE           = 0
   IMPORTING
     et_events             it_event
   EXCEPTIONS
     list_type_wrong       1
     OTHERS                2.

  IF it_event IS NOT INITIAL.
    CLEAR wa_event.
    READ TABLE it_event INTO wa_event
    WITH KEY name 'USER_COMMAND'(001).

    IF sy-subrc 0.
      wa_event-form 'UCOMM_EKKO'.
      MODIFY it_event FROM wa_event
      INDEX sy-tabix TRANSPORTING form.
    ENDIF.
  ENDIF.

ENDFORM.                    " EVENT_EKKO
*&---------------------------------------------------------------------*
*&      Form  GRID_EKKO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM grid_ekko .

  IF    it_out_ekko IS NOT INITIAL
    AND it_fcat_ekko IS NOT INITIAL.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
     EXPORTING
*       I_INTERFACE_CHECK                 = ' '
*       I_BYPASSING_BUFFER                = ' '
*       I_BUFFER_ACTIVE                   = ' '
        i_callback_program                v_prog
        i_callback_pf_status_set          'PF_STATUS'
        i_callback_user_command           'UCOMM_EKKO'
        i_callback_top_of_page            'TOP_EKKO'
*       I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*       I_CALLBACK_HTML_END_OF_LIST       = ' '
*       I_STRUCTURE_NAME                  =
*       I_BACKGROUND_ID                   = ' '
*       I_GRID_TITLE                      =
*       I_GRID_SETTINGS                   =
        is_layout                         wa_layout
        it_fieldcat                       it_fcat_ekko
*       IT_EXCLUDING                      =
*       IT_SPECIAL_GROUPS                 =
*       IT_SORT                           =
*       IT_FILTER                         =
*       IS_SEL_HIDE                       =
*       I_DEFAULT                         = 'X'
*       I_SAVE                            = ' '
*       IS_VARIANT                        =
        it_events                         it_event
*       IT_EVENT_EXIT                     =
*       IS_PRINT                          =
*       IS_REPREP_ID                      =
*       I_SCREEN_START_COLUMN             = 0
*       I_SCREEN_START_LINE               = 0
*       I_SCREEN_END_COLUMN               = 0
*       I_SCREEN_END_LINE                 = 0
*       I_HTML_HEIGHT_TOP                 = 0
*       I_HTML_HEIGHT_END                 = 0
*       IT_ALV_GRAPHICS                   =
*       IT_HYPERLINK                      =
*       IT_ADD_FIELDCAT                   =
*       IT_EXCEPT_QINFO                   =
*       IR_SALV_FULLSCREEN_ADAPTER        =
*     IMPORTING
*       E_EXIT_CAUSED_BY_CALLER           =
*       ES_EXIT_CAUSED_BY_USER            =
      TABLES
        t_outtab                          it_out_ekko
      EXCEPTIONS
        program_error                     1
        OTHERS                            2.
  ENDIF.

ENDFORM.                    " GRID_EKKO

*&---------------------------------------------------------------------*
*&      Form  pf_status
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM pf_status USING ut_extab TYPE slis_t_extab.
  SET PF-STATUS 'PF_EKKO'.
ENDFORM.                    "pf_status

*&---------------------------------------------------------------------*
*&      Form  top_ekko
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM top_ekko.

  CLEAR wa_top_ekko.
  REFRESH it_top_ekko.

  DATA date TYPE char12.

  CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
    EXPORTING
      date_internal            sy-datum
    IMPORTING
      date_external            date
    EXCEPTIONS
      date_internal_is_invalid 1
      OTHERS                   2.

  wa_top_ekko-typ 'H'.
  wa_top_ekko-info 'Purchase Order Header'.
  APPEND wa_top_ekko TO it_top_ekko.
  CLEAR wa_top_ekko.

  wa_top_ekko-typ 'S'.
  wa_top_ekko-info 'Report: '.
  CONCATENATE wa_top_ekko-info v_prog
  INTO wa_top_ekko-info.
  APPEND wa_top_ekko TO it_top_ekko.
  CLEAR wa_top_ekko.

  wa_top_ekko-typ 'S'.
  wa_top_ekko-info 'User Name: '.
  CONCATENATE wa_top_ekko-info v_name
  INTO wa_top_ekko-info.
  APPEND wa_top_ekko TO it_top_ekko.
  CLEAR wa_top_ekko.

  wa_top_ekko-typ 'S'.
  wa_top_ekko-info 'Date: '.
  CONCATENATE wa_top_ekko-info date
  INTO wa_top_ekko-info.
  APPEND wa_top_ekko TO it_top_ekko.
  CLEAR wa_top_ekko.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary       it_top_ekko
*     I_LOGO                   =
*     I_END_OF_LIST_GRID       =
*     I_ALV_FORM               =
            .

ENDFORM.                    "top_ekko
*&---------------------------------------------------------------------*
*&      Form  UCOMM_EKKO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_R_UCOMM  text
*      <--P_RS_SELFIELD  text
*----------------------------------------------------------------------*
FORM ucomm_ekko  USING    r_ucomm_ekko     TYPE sy-ucomm
                 CHANGING rs_selfield_ekko TYPE slis_selfield.

  CASE r_ucomm_ekko.
    WHEN 'DISP'.
      REFRESHit_out_ekpoit_ebeln.
      LOOP AT it_out_ekko INTO wa_out_ekko
        WHERE sel 'X'.

        wa_ebeln-ebeln wa_out_ekko-ebeln.
        APPEND wa_ebeln TO it_ebeln.
        CLEAR wa_ebeln.
      ENDLOOP.

      PERFORM get_ekpo.
      PERFORM fieldcat_ekpo.
      PERFORM layout.
      PERFORM grid_ekpo.

    WHEN 'BACK' OR 'EXIT' OR 'CANCEL' OR 'E'.
      REFRESH it_out_ekko.
      LEAVE TO SCREEN 0.
  ENDCASE.

ENDFORM.                    " UCOMM_EKKO
*&---------------------------------------------------------------------*
*&      Form  GET_EKPO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_ekpo .

  IF it_ebeln IS NOT INITIAL.
    REFRESH it_ekpo.

    SELECT ebeln ebelp matnr werks
           lgort menge meins
      FROM ekpo INTO TABLE it_ekpo
      FOR ALL ENTRIES IN it_ebeln
      WHERE ebeln it_ebeln-ebeln.

    IF sy-subrc 0.
      SORT it_ekpo BY ebeln.

      LOOP AT it_ekpo INTO wa_ekpo.
        AT NEW ebeln.
          wa_out_ekpo-ebeln wa_ekpo-ebeln.
        ENDAT.
        wa_out_ekpo-ebelp wa_ekpo-ebelp.
        wa_out_ekpo-matnr wa_ekpo-matnr.
        wa_out_ekpo-werks wa_ekpo-werks.
        wa_out_ekpo-lgort wa_ekpo-lgort.
        wa_out_ekpo-menge wa_ekpo-menge.
        wa_out_ekpo-meins wa_ekpo-meins.
        APPEND wa_out_ekpo TO it_out_ekpo.
        CLEARwa_out_ekpowa_ekpo.
      ENDLOOP.
    ENDIF.
  ENDIF.

ENDFORM.                    " GET_EKPO
*&---------------------------------------------------------------------*
*&      Form  FIELDCAT_EKPO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM fieldcat_ekpo .

  CLEAR wa_fcat_ekpo.
  REFRESH it_fcat_ekpo.

  IF it_out_ekpo IS NOT INITIAL.
    DATA lv_col TYPE VALUE 0.

    lv_col                 + lv_col.
    wa_fcat_ekpo-col_pos   lv_col.
    wa_fcat_ekpo-fieldname 'EBELN'.
    wa_fcat_ekpo-tabname   'IT_OUT_EKPO'.
    wa_fcat_ekpo-seltext_l 'Purchase Order'.
    APPEND wa_fcat_ekpo TO it_fcat_ekpo.
    CLEAR wa_fcat_ekpo.

    lv_col                 + lv_col.
    wa_fcat_ekpo-col_pos   lv_col.
    wa_fcat_ekpo-fieldname 'EBELP'.
    wa_fcat_ekpo-tabname   'IT_OUT_EKPO'.
    wa_fcat_ekpo-seltext_l 'PO Item'.
    APPEND wa_fcat_ekpo TO it_fcat_ekpo.
    CLEAR wa_fcat_ekpo.

    lv_col                 + lv_col.
    wa_fcat_ekpo-col_pos   lv_col.
    wa_fcat_ekpo-fieldname 'MATNR'.
    wa_fcat_ekpo-tabname   'IT_OUT_EKPO'.
    wa_fcat_ekpo-seltext_l 'Material'.
    APPEND wa_fcat_ekpo TO it_fcat_ekpo.
    CLEAR wa_fcat_ekpo.

    lv_col                 + lv_col.
    wa_fcat_ekpo-col_pos   lv_col.
    wa_fcat_ekpo-fieldname 'WERKS'.
    wa_fcat_ekpo-tabname   'IT_OUT_EKPO'.
    wa_fcat_ekpo-seltext_l 'Plant'.
    APPEND wa_fcat_ekpo TO it_fcat_ekpo.
    CLEAR wa_fcat_ekpo.

    lv_col                 + lv_col.
    wa_fcat_ekpo-col_pos   lv_col.
    wa_fcat_ekpo-fieldname 'LGORT'.
    wa_fcat_ekpo-tabname   'IT_OUT_EKPO'.
    wa_fcat_ekpo-seltext_l 'Storage Location'.
    APPEND wa_fcat_ekpo TO it_fcat_ekpo.
    CLEAR wa_fcat_ekpo.

    lv_col                 + lv_col.
    wa_fcat_ekpo-col_pos   lv_col.
    wa_fcat_ekpo-fieldname 'MENGE'.
    wa_fcat_ekpo-tabname   'IT_OUT_EKPO'.
    wa_fcat_ekpo-seltext_l 'Quantity'.
    APPEND wa_fcat_ekpo TO it_fcat_ekpo.
    CLEAR wa_fcat_ekpo.

    lv_col                 + lv_col.
    wa_fcat_ekpo-col_pos   lv_col.
    wa_fcat_ekpo-fieldname 'MEINS'.
    wa_fcat_ekpo-tabname   'IT_OUT_EKPO'.
    wa_fcat_ekpo-seltext_l 'Unit'.
    APPEND wa_fcat_ekpo TO it_fcat_ekpo.
    CLEAR wa_fcat_ekpo.
  ENDIF.

ENDFORM.                    " FIELDCAT_EKPO
*&---------------------------------------------------------------------*
*&      Form  GRID_EKPO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM grid_ekpo .

  IF    it_out_ekpo IS NOT INITIAL
    AND it_fcat_ekpo IS NOT INITIAL.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
     EXPORTING
*     I_INTERFACE_CHECK                 = ' '
*     I_BYPASSING_BUFFER                = ' '
*     I_BUFFER_ACTIVE                   = ' '
      i_callback_program                v_prog
*     I_CALLBACK_PF_STATUS_SET          = ' '
*     I_CALLBACK_USER_COMMAND           = ' '
      i_callback_top_of_page            'TOP_EKPO'
*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*     I_CALLBACK_HTML_END_OF_LIST       = ' '
*     I_STRUCTURE_NAME                  =
*     I_BACKGROUND_ID                   = ' '
*     I_GRID_TITLE                      =
*     I_GRID_SETTINGS                   =
      is_layout                         wa_layout
      it_fieldcat                       it_fcat_ekpo
*     IT_EXCLUDING                      =
*     IT_SPECIAL_GROUPS                 =
*     IT_SORT                           =
*     IT_FILTER                         =
*     IS_SEL_HIDE                       =
*     I_DEFAULT                         = 'X'
*     I_SAVE                            = ' '
*     IS_VARIANT                        =
*     IT_EVENTS                         =
*     IT_EVENT_EXIT                     =
*     IS_PRINT                          =
*     IS_REPREP_ID                      =
*     I_SCREEN_START_COLUMN             = 0
*     I_SCREEN_START_LINE               = 0
*     I_SCREEN_END_COLUMN               = 0
*     I_SCREEN_END_LINE                 = 0
*     I_HTML_HEIGHT_TOP                 = 0
*     I_HTML_HEIGHT_END                 = 0
*     IT_ALV_GRAPHICS                   =
*     IT_HYPERLINK                      =
*     IT_ADD_FIELDCAT                   =
*     IT_EXCEPT_QINFO                   =
*     IR_SALV_FULLSCREEN_ADAPTER        =
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER           =
*     ES_EXIT_CAUSED_BY_USER            =
    TABLES
      t_outtab                          it_out_ekpo
    EXCEPTIONS
      program_error                     1
      OTHERS                            2.
  ENDIF.

ENDFORM.                    " GRID_EKPO
*&---------------------------------------------------------------------*
*&      Form  top_ekpo
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM top_ekpo.

  CLEAR wa_top_ekpo.
  REFRESH it_top_ekpo.

  wa_top_ekpo-typ 'H'.
  wa_top_ekpo-info 'Purchase Order Item Display'.
  APPEND wa_top_ekpo TO it_top_ekpo.
  CLEAR wa_top_ekpo.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary       it_top_ekpo
*     I_LOGO                   =
*     I_END_OF_LIST_GRID       =
*     I_ALV_FORM               =
            .

ENDFORM.                    "top_ekpo



Sunday, August 5, 2018

IDOC in sap ABAP.


                                                                 IDOC Short Note Details.

IDOC Short Note:
T-CODE:--WE30.

IDOC use for “simply a data container” that is used to exchange information between any two systems or process.
  • This is use for store the data in database.
  • Data store in the database table.
  • This is use for sending and receiving data independently.


Segment creating T-code details:-
  •  Creating Segment T-CODE:- WE31
  •  Creating message type. T-CODE:- we81
  •  Assigning message type to IDOC type T-CODE:- we82


IDOC has 2 processes.
1.       Outbound Process.
2.       Inbound Process.

Outbound process:-When a data send from out of the system. This process called outbound process.
Inbound process:-When a data send from in the system. This process also called  inbound process.
IDOC contains the following three types of records...

1. One Control Record.
2. One or many Data Record
3. One or many Status record. 

MM Module Table & Flow Details In SAP.





MM Module Table & Flow Details

MM T-code  With Flow details.
1...Purchase Requisition --- T.code ---ME51
2...Source List -----T.code-----ME41
3...Request for Quation (RFQ)---T.code--ME21N  (To Vendor)
4...Purchase Order  ---- T.code ----ME21N (To Vendor)
5...Goods Receipt-------T.code....MIGO
      (Tables:  MKPF, MSEG)

6...Invoice Verification----T.code...MIRO
      (Tables: BKPF , BSEG)

7...Vendor Payment----T.code...FB60 (FI - Account Payable).





===========================================================

Materials 

MARA - Material Master: General data 
MAKT - Material Master: Description 
MARM - Material Master: Unit of Measure 
MAPE - Material master: Export control file 
MARC - Material master: Plant data 
MARD - Material master: Storage location 
MBEW - Material valuation 
MLGN - Material Master: WM Inventory 
MLGT - Material Master: WM Inventory type 
MDIP - Material: MRP profiles (field contents) 
MKOP - Consignment price segment (old versions of SAP) 
EBEW - Valuation of sales order stock 
QBEW - Valuation of project stock 
MVER - Material Master: Consumption <Plant> 
DVER - Material Master: Consumption <MRP Area> 
MVKE - Material Master: Sales <Sales Org, Distr Ch> 
MLAN - Material Master: Tax indicator 
MAPR - Material Master: Forecast 
MCH1 - Material Master: X Plant Batches 
MCHA - Material Master: Batches 
MCHB - Material Master: Batch Stock 
MDMA - MRP Area data 
DBVM - MRP Planning File Entry: MRP Area 
MOFF - Outstanding Material Master Records (Maintenance status) 
MARCH - Material Master C Segment: History 
MARDH - Material Master Storage Location Segment: History 
MBEWH - Material Valuation: History 
MCHBH - Batch Stocks: History 
MKOLH - Special Stocks from Vendor: History 
MSCAH - Sales Order Stock at Vendor: History 
MSKAH - Sales Order Stock: History 
MSKUH - Special Stocks at Customer: History 
MSLBH - Special Stocks at Vendor: History 
MSPRH - Project Stock: History 
MSSAH - Total Sales Order Stocks: History 
MSSQH - Total Project Stocks: History 

BOM 

STKO – BOM Header Details 
STPO – BOM Item Details 
MAST –Material to BOM Link 

Vendors 

LFA1 - Vendor Master: General data 
LFB1 - Vendor Master: Company data 
LFM1 - Vendor Master: Purchasing Data (Purchasing organization) 
LFM2 - Vendor Master: Purchasing Data (Plant, Vendor sub-range) 
WYT3 - Vendor Partner Functions 

External Service Management 

ASMD - Service Master: Basic Data 
ASMDT - Service Short Texts 

ESKL - Account assignment specification for service line 
ESKN - Account assignment in service package 
ESLH - Service package header data 
ESLL - Lines in service package 
ESSR - Service entry sheet header data 
ESUC - External services management: Unplanned limits for contract item 
ESUH - External services management: unplanned service limits header data 
ESUP - External services management: unplanned limits for service packages 
ESUS - External services management: Unplanned limits for service types 

Purchasing 

EBAN - Purchase requisition: items 
EBKN - Purchase Requisition: account assignment 
STXH - SAP Script Text Header 
STXL - SAP Script Text Lines 

EKKO - Purchasing document header 
EKPO - Purchasing Document: Item 
EKET - Purchasing Document: Delivery Schedules 
MDBS - Material View of Order Item/Schedule Line (good to find open PO's) 
EKKN - Account assignment in purchasing document 
EORD - Purchasing Source List 
EIPA - Order price history record 
EKAB - Release documentation 
EKBE - Purchasing document history 
EKBZ - Purchasing document history: delivery costs 
EKPB - "Material to be provided" item in purchasing document 

EINA - Purchase Info Record: General 
EINE - Purchasing info record: purchasing organization data 
KONP - Condition Item 
KONH - Condition Header 


Inventory Management 

ISEG - Physical inventory document items 

MKPF - Material document: Header 
MSEG - Material document: item 

RKPF - Reservation: Header 
RESB - Reservation: Item 


Invoice Verification 

BSIM - Secondary index: documents for material 
MYMFT - FIFO results table 
MYML - LIFO material layer 
MYMLM - LIFO material layer (monthly) 
MYMP - LIFO period stocks, single material 
MYMP1 - Receipt data LIFO/FIFO valuation 
MYPL - LIFO pool layer 
MYPLM - LIFO pool layer (monthly) 
RBCO - Document item, incoming invoice account assignment 
RBDIFFKO - Invoice Verification: conditions 
RBDIFFME - Invoice Verification: quantity differences 
RBDRSEG - Invoice Verification batch: invoice document items 
RBKP - Document header: incoming invoice 
RBKPB - Invoice document header (batch invoice verification) 
RBTX - Taxes:incoming invoice 
RBVD - Invoice document: summarization data 
RBVDMAT - Invoice Verification: summarization data, material 
RBWT - Withholding tax:incoming invoice 
RKWA - Consignment withdrawals 
RSEG - Document item, incoming invoice 

Customising and other master data 

T001 - Company Codes 
T001W - Plants/branches 
T001L - Storage Locations 
T024E - Purchasing Organizations 
T024W - Valid Purchasing Organizations for Plant 

MDLV - MRP Areas 
MDLG - MRP Areas - Storage Locations 
MDLW - MRP Areas - Plants 
MDLL - MRP Areas - Subcontractor 
T023 - Material Groups 
T024 - Purchasing groups 
T030 - Standard Accounts Table (Automatic Account Determination) 
T156 - Movement Type 
T156T - Movement Type: Text 
T16FS - Release Strategies 
T16FT - Descriptions of Release Strategies 
T16FV - Release Prerequisites 
T16FD - Description of Release Codes 
T16FK - Release Statuses 
T16FC - Release Codes 
T161 - Purchasing Document Types 

T052 - Terms of Payment & FM FI_TEXT_ZTERM for long text 

AUSP - Release Procedure: Strategy values (cl20n, cl24n) 
AGR_USERS - Assignment of roles to users 
CDHDR & CDPOS - Change history of master data and documents 
EDID4 - EDI information 
TSTC - SAP Transaction Codes, lock/unlock: sm01, created: se93 
TSTCT - Transaction codes TEXT 

NAST - Message status 
MM Transaction Codes
Materials Management Master DataTransactions
Material Master
 MM01
 Create Material Master
MM02
Change Material Master
MM50
Extend Material Views
MMPV
Close Period For Materials
MM06
Flag For Deletion ± Material
MM17
Mass Maintenance ± Material
MM71
Archive/Delete ± Material
MM72
Display Archive
Vendor Master
MK01
Create Vendor ± Purchasing
MK02
Change Vendor ± Purchasing
MK05
Vendor Block ± Purchasing
MK06
Flag for Deletion ± Purchasing
XK01
Create Vendor ± Central
XK02
Change Vendor ± Central
XK05
Vendor Block ± Central
XK06
Flag for Deletion ± Central
XK99
Mass Maintenance ± Vendor Record
Customer Master
 VD01
Create Customer Master Data ± Sales Area
VD02
Change Customer Master Data ± Sales Area
XD01
Create Customer Master Data ± Complete
XD02
Change Customer Master Data ± Complete







Friday, June 22, 2018

Create incoming vendor invoice (MIRO) using BAPI BAPI_INCOMINGINVOICE_CREATE IN SAP ABAP..

Create incoming vendor invoice (MIRO) using  BAPI BAPI_INCOMINGINVOICE_CREATE.

*&---------------------------------------------------------------------*
*& Report  ZSW_BAPI_INC_INV_CREATE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZSW_BAPI_INC_INV_CREATE.

DATAwa_header LIKE bapi_incinv_create_header.

DATAit_item TYPE STANDARD TABLE OF bapi_incinv_create_item,
      wa_item TYPE bapi_incinv_create_item.

DATAit_ret LIKE bapiret2 OCCURS WITH HEADER LINE.

DATAg_invno LIKE bapi_incinv_fld-inv_doc_no,
      g_fyear LIKE bapi_incinv_fld-fisc_year.

********************************************
****<<<<<<<<<<<<DATA DECLARE>>>>>>>>>>>>****
********************************************

wa_header-invoice_ind 'X'.
wa_header-doc_date '20120131'.     "Document date
wa_header-pstng_date '20120201'.   "Posting date
wa_header-ref_doc_no 'Test'.       "Ref doc. No.
wa_header-comp_code '3101'.        "Company Code
wa_header-gross_amount '5908.11'.  "Gross amount(aft. tax) for the invoice
wa_header-calc_tax_ind 'X'.
wa_header-currency 'USD'.          "Currency Field

wa_item-invoice_doc_item '000011'.
wa_item-po_number '4590038151'.    "PO number
wa_item-po_item '00121'.           "PO item number
wa_item-ref_doc '5007548571'.      "GR number
wa_item-ref_doc_year '2018'.       "GR fiscal year
wa_item-ref_doc_it '0011'.         "GR item number
wa_item-tax_code 'V7'.             "Tax code applicable
wa_item-item_amount '5521.61'.     "Item amount
wa_item-quantity '3381'.           "Invoice quantity
wa_item-po_unit 'EA'.              "UoM
APPEND wa_item TO it_item.

*********************************************************
*<<<<<<<<<CALL BAPI fOR INCOMINGINVOICE_CREATE>>>>>>>>>>*
*********************************************************
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
  EXPORTING
    headerdata                wa_header
*   ADDRESSDATA               =
 IMPORTING
   invoicedocnumber          g_invno
   fiscalyear                g_fyear
  TABLES
    itemdata                  it_item
*   ACCOUNTINGDATA            =
*   GLACCOUNTDATA             =
*   MATERIALDATA              =
*   TAXDATA                   =
*   WITHTAXDATA               =
*   VENDORITEMSPLITDATA       =
    return                    it_ret
*   EXTENSIONIN               =
          .
*********************************************************
******<<<<<<<<<<<<Bapi Commit section start.>>>>>>>>>>***
*********************************************************
IF g_invno IS NOT INITIAL.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*   EXPORTING
*     WAIT          =
*   IMPORTING
*     RETURN        =
            .
ENDIF.
*********************************************************
******<<<<<<<<<<<<Bapi Commit section End.>>>>>>>>>>***
*********************************************************
WRITE:/1 g_invnog_fyear.

LOOP AT it_ret.
  WRITE:/1 it_ret-message.
ENDLOOP.
*****************<<<<<<<<<<<<END>>>>>>>>>>>>*************