Monday, September 16, 2024

Procure to PAY Cycle

 SAP Tcodes in Procure to Pay ( P2P ):


In the Procure-to-Pay (P2P) process in SAP ECC several transaction codes (T-codes) are commonly used.
**Purchase Requisition (PR)**
**ME51N**: Create Purchase Requisition
**ME52N**: Change Purchase Requisition
**ME53N**: Display Purchase Requisition

**Purchase Order (PO)**
**ME21N**: Create Purchase Order
**ME22N**: Change Purchase Order
**ME23N**: Display Purchase Order
**ME29N**: Release Purchase Order

**Goods Receipt (GR)**
**MIGO**: Goods Movement (for Goods Receipt, Goods Issue, etc.)
**MB03**: Display Material Document

**Invoice Verification**
**MIRO**: Enter Incoming Invoice
**MR8M**: Cancel Invoice Document
**MRBR**: Release Blocked Invoices

**Vendor Management**
**XK01**: Create Vendor
**XK02**: Change Vendor
**XK03**: Display Vendor

**Inventory Management**
**MMBE**: Stock Overview
**MB1C**: Other Goods Receipts

**Reporting**
**ME2N**: Purchase Orders by PO Number
**ME80FN**: General Analysis of Purchase Orders

Friday, September 13, 2024

Consume Rest API in SAP-

 


PARAMETERS: url TYPE swc_value.

DATA: l_url                TYPE string.

TYPE-POOLS: swfxc, icon.

DATA: l_http_client        TYPE REF TO if_http_client.

DATA: l_code               TYPE sy-subrc.

DATA: lt_http_fields       TYPE tihttpnvp.

DATA: lt_header_fields TYPE tihttpnvp .

DATA: l_message_string     TYPE string.

DATA: l_body_string        TYPE string.

l_url = url.

CALL METHOD cl_http_client=>create_by_url

    EXPORTING

      url                = l_url

*      PROXY_HOST         = l_proxy_host

*      PROXY_SERVICE      = l_proxy_service

    IMPORTING

      client             = l_http_client

    EXCEPTIONS

      argument_not_found = 1

      plugin_not_active  = 2

      internal_error     = 3

      OTHERS             = 4

      .

  IF sy-subrc <> 0.

*    MESSAGE ID SY-MSGID TYPE 'S' NUMBER SY-MSGNO

*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4

*            into l_message_string.

 

  ENDIF.

 

APPEND VALUE #( name = 'Content-Type' value = 'application/json' ) TO lt_header_fields.

APPEND VALUE #( name = 'accept' value = 'application/json' ) TO lt_header_fields.

 

 

l_http_client->request->set_header_fields( fields = lt_header_fields ).

 

l_http_client->request->set_method( if_http_request=>co_request_method_get ) .

 

 

 

cl_http_utility=>set_request_uri(

EXPORTING

 request = l_http_client->request    " HTTP Framework (iHTTP) HTTP Request

 uri     = l_url                    " URI String (in the Form of /path?query-string)

).

 

 

 

 

  CALL METHOD l_http_client->send

    EXCEPTIONS

      http_communication_failure = 1

      http_invalid_state         = 2.

  IF sy-subrc <> 0.

 

  ENDIF.

 

   CALL METHOD l_http_client->receive

    EXCEPTIONS

      http_communication_failure = 1

      http_invalid_state         = 2.

  IF sy-subrc <> 0.

CALL METHOD l_http_client->get_last_error

      IMPORTING

        code    = l_code

        MESSAGE = l_message_string.

 

    CALL METHOD l_http_client->close.

  ENDIF.

 

  CALL METHOD l_http_client->response->get_status

    IMPORTING

      code = l_code.

 

*-- get the http header fields

  CALL METHOD l_http_client->response->get_header_fields

    CHANGING

      fields = lt_http_fields.

 

l_body_string = l_http_client->response->get_cdata(  ).

   CALL METHOD l_http_client->close.

Monday, August 26, 2024

Upload File from AL11 Directory to DMS(Tcode CV03N)

 There is a BAPI by using this BAPI we can upload file to DMS Server .





 


data :ls_doc      TYPE bapi_doc_draw2,

lt_files1   TYPE TABLE OF bapi_doc_files2,

        ls_files1   TYPE bapi_doc_files2.



data :lv_filepth type rlgrap-filename ,

      lv_fp2 type rlgrap-filename .

lv_filepth = '/usr/sap/DE1/sales/' .


data:lv_file_name type string .

CONCATENATE gs_bill-vbeln '.pdf' INTO lv_file_name .


ls_doc-documenttype       = 'INV'.

  ls_doc-documentversion    = '00'.

  ls_doc-description        = 'DESCRIPTION'.

  ls_doc-laboratory         = '552'.  <- Enter Lab no .

 " ls_doc-docfile1           = lv_file_path.

 " ls_doc-docfile2           = '.PDF'.

  ls_files1-documenttype    = 'INV'.

  ls_files1-documentnumber  = ''.

  ls_files1-documentversion = '00'.

  ls_files1-docpath         = lv_filepth.

  ls_files1-docfile         = lv_file_name.

  ls_files1-wsapplication = 'PDF'.

  ls_files1-storagecategory = 'DMS_C1_XX'. --> MUST PASS This zsxz

  APPEND ls_files1 TO lt_files1.


  CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'

    EXPORTING

      documentdata         = ls_doc

       pf_ftp_dest     = 'SAPFTPA'

      pf_http_dest    =  'SAPHTTPA'

    IMPORTING

      documenttype         = ls_doc-documenttype

      documentnumber       = ls_doc-documentnumber

      documentversion      = ls_doc-documentversion

    TABLES

      characteristicvalues = lt_char

      documentdescriptions = lt_drat

      objectlinks          = lt_drad

      documentfiles        = lt_files1.

* Check for any errors

  LOOP AT lt_return INTO DATA(ls_return).

    WRITE: / ls_return-message.

  ENDLOOP.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.


  IF sy-subrc <> 0.

    WRITE: / 'Error attaching PDF to DMS document'.

    EXIT.

  ENDIF.

  WRITE: / 'PDF successfully uploaded to DMS document', ls_doc-documentnumber.    

Sunday, June 23, 2024

When to Use VL31N for Creating Delivery

 First Create PO using Tcode-ME21N and in Item section under Delivery Select it .

Then Go to Tcode VL31N and Create Delivery Against PO .

Sunday, February 19, 2023

How to know custom Enhancement for Any Tcode

 To know all custom Enhncement like BADI,Userexit,BTE fo any tcode,just go to tcode-ANST

Type,Tcode name exa-CJ20N in transaction code box and press enter .

After that one screen will come select you module and press customer code in upper ribbon .

Another option is to use Report in transaction code-SNIF .



Procure to PAY Cycle

  SAP Tcodes in Procure to Pay ( P2P ): In the Procure-to-Pay (P2P) process in SAP ECC several transaction codes (T-codes) are commonly used...