A quick HowTo on Background-Task queues for functions.

**Background Queue variables
  DATAL_TCODE_ID   TYPE ARFCTID,
        L_QNAME      TYPE TRFCQOUT-QNAME..

* Generate Name
  CONCATENATE SY-TCODE '_' SY-DATUM '_' SY-UZEIT INTO L_QNAME.
  CONDENSE L_QNAME NO-GAPS.

* Set Queue name in Programm
  CALL FUNCTION 'TRFC_SET_QUEUE_NAME'
    EXPORTING
      QNAME L_QNAME.

* Start your queue Transaction
  CALL FUNCTION 'TRANSACTION_BEGIN'
    IMPORTING
      TRANSACTION_ID L_TCODE_ID.

...... Do some Codng in your programm, and somewhere start your function in Background Task:

 CALL FUNCTION 'ARTICLE_RECLASSIFY_LITE_RETAIL' IN BACKGROUND TASK
      EXPORTING
        I_MATNR              MARA-MATNR
        I_NEWWG              SET_MATKL
        I_TEST               P_TEST
        I_NEWPROFIL          DMY_NEWPROF

....

        CALL FUNCTION 'Y_ISR_SET_REKLA_YPOSDWL' IN BACKGROUND TASK
          EXPORTING
            I_VAR_MATNR    MARA-MATNR
            I_VAR_MATKL    SET_MATKL.


..... Do some more Coding in the programm and close the Transaction somewhere

  CALL FUNCTION 'TRANSACTION_END'
    EXPORTING
      TRANSACTION_ID L_TCODE_ID.


Call SMQ1 to se open Queues, for e.g. if some error occured.



Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP S/4 HANA Logistics Team Lead
Contact : serkurumsal@yandex.com