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 .



Wednesday, June 1, 2022

How to changes Sales Order via IDOC .

 To changes sales order by IDOC we have to use FM-IDOC_INPUT_ORDCHG Basic type-ORDERS05 .

Basically it uses BDC inside FM to change sales order .

Difference between workbench and Customizing Request

 When you have to do configration in all the client manually or by transport then that request gets captured as customizing Request .

Other than all request are Workbench request .

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...