<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Locking a document when printing? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475162#M1253733</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any idea?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mon Magallanes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Apr 2009 03:38:22 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-29T03:38:22Z</dc:date>
    <item>
      <title>Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475161#M1253732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope you can help me with this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I made a customized printing program in ABAP that will print a certain document. My requirement is, I need to prohibit/lock the document to be printed until SAP is done passing the spool request to the printer. I tried to research the concept of enqueue and dequeue but I guess i need sample code for customized programs so that I can understand it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope you can help me with this requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mon Magallanes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2009 07:09:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475161#M1253732</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-28T07:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475162#M1253733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any idea?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mon Magallanes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2009 03:38:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475162#M1253733</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-29T03:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475163#M1253734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create a Lock Object, for Table TSP01, then use that LOCK OBJECT to ENQUE and DEQUE in your program.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2009 03:56:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475163#M1253734</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-29T03:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475164#M1253735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tripat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I can lock the spool table as you suggested but I believe, if I will do that, I will prohibit everyone in printing other documents. I only need to lock the specific document which i'm currently printing and unlock this document after spool request was passed to the printer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope you can help me with this requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mon Magallanes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2009 05:41:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475164#M1253735</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-29T05:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475165#M1253736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't lock whole table, in SE11 see LOCK OBJECT 'ENQ_TSP01'.It has RQIDENT as the only LOCK PARAMETER, so in your Program LOCK only that record of your given RQIDENT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pass RQUIDENT(Spool request number) to the below FM in ur code, and at end Deque it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'ENQUEUE_ENQ_TSP01'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   EXPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        MODE_TSP01     = 'E'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        RQIDENT        =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        X_RQIDENT      = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        _SCOPE         = '2'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        _WAIT          = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        _COLLECT       = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        FOREIGN_LOCK   = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        SYSTEM_FAILURE = 2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        OTHERS         = 3&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2009 05:54:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475165#M1253736</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-29T05:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475166#M1253737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We can use FMs ENQUE_E_table and Deque_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there table name is u r table name &lt;/P&gt;&lt;P&gt;and KEY, concatinamte the Primary fields into a variable for your document number&lt;/P&gt;&lt;P&gt;and pass it to KEY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex: Let u r printing sales order 0000001000,&lt;/P&gt;&lt;P&gt;then then KEY = '0000001000' TABLE VBAK&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex: Let u r printing sales order 0000001000 item 0010,&lt;/P&gt;&lt;P&gt;then then KEY = '00000010000010' TABLE VBAP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2009 06:01:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475166#M1253737</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-29T06:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475167#M1253738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tripat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the suggestion. I will try it. Just a favor. Can you provide a sample code for dequeue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll update you with this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mon Magallanes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2009 07:08:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475167#M1253738</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-29T07:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475168#M1253739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope you can provide a sample code on how to use the function you were suggesting, as well as with its dequeue counter-part. Also, I get the information from different tables specifically vbak, vbap, vbrk, vbrp, etc. in my form.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mon Magallanes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2009 07:12:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475168#M1253739</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-29T07:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475169#M1253740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Data:v_tabname   TYPE tabname VALUE 'ANLB',&lt;/P&gt;&lt;P&gt;        v_varkey    TYPE vim_enqkey.&lt;/P&gt;&lt;P&gt;CONCATENATE sy-mandt wa_asset-bukrs wa_asset-anln1&lt;/P&gt;&lt;P&gt;        wa_asset-anln2 wa_asset-afabe wa_asset-bdatu INTO  v_varkey.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'ENQUEUE_E_TABLE'&lt;/P&gt;&lt;P&gt;          EXPORTING&lt;/P&gt;&lt;P&gt;            tabname        = v_tabname&lt;/P&gt;&lt;P&gt;            varkey         = v_varkey&lt;/P&gt;&lt;P&gt;          EXCEPTIONS&lt;/P&gt;&lt;P&gt;            foreign_lock   = 1&lt;/P&gt;&lt;P&gt;            system_failure = 2&lt;/P&gt;&lt;P&gt;            OTHERS         = 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2009 07:47:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475169#M1253740</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-29T07:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475170#M1253741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use f.modules ENQUEUE* using the key on the table, which includes also the line item! So you won't lock all the table but just one row/document line.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2009 08:35:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475170#M1253741</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-29T08:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475171#M1253742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used 'ENQUEUE_E_TABLE' but still I can print documents with the same document number at the same time. I believe this function only lock table for update not for getting a query. Actually the table where i'm extracting my data is VBRK and VBRP. I enqueue the key (billing document number) in VBRK and did not dequeue it. And then I ran the same printing program with the same billing document number, but it still continue to program on the line where I select in table VBRK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope you can help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mon Magallanes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2009 02:36:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475171#M1253742</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-30T02:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475172#M1253743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tripat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your suggestion did not run properly. I think because when I ran my program, eventhough they are the same document number they will have different spool request number. TSP01 table only have the property of the spool request but not the document itself. I have an idea to solve it by locking the table VBRK and VBRP ( tables where I get the data) from queries. Do you know any built in functions that will lock a standard table from ABAP queries?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope you can help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mon Magallanes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2009 02:42:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475172#M1253743</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-30T02:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475173#M1253744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use the Lock Object EVVBRKE.&lt;/P&gt;&lt;P&gt;Ask if any further problems faced.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2009 03:51:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475173#M1253744</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-30T03:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475174#M1253745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tripat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used ENQUEUE_EVVBRKE form, but still I can select a query on table vbrk eventhough i haven't dequeue the same document. here is my code for your reference.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 v_varkey = invnum.

  select kunrg fkdat into (comcode, invdate) from vbrk where vbeln = invnum.
  endselect.

  CALL FUNCTION 'ENQUEUE_EVVBRKE'
    EXPORTING
      vbeln         = v_varkey
    EXCEPTIONS
      foreign_lock   = 1
      system_failure = 2
      OTHERS         = 3.

  p_dest = 'LP01'.

  gt_itcpo-tdimmed = 'X'.  "Print immediately
  gt_itcpo-tdnewid = 'X'.  "New Spool
  gt_itcpo-tddest  = p_dest.   "Output Device
  APPEND gt_itcpo.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your assistance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mon Magallanes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2009 05:10:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475174#M1253745</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-30T05:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475175#M1253746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The simplest example i can give is given below.&lt;/P&gt;&lt;P&gt;Make a program with given code.&lt;/P&gt;&lt;P&gt;Run this program with some value of Billing document and press LOCK on selection screen.&lt;/P&gt;&lt;P&gt;In another session open the same program with same values, and press lock, it won't allow unless u unlock.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
tables:vbrk.

data: begin of i_vbrk occurs 0,
        vbeln like vbrk-vbeln,
      end of i_vbrk.

select-options: s_vbeln for vbrk-vbeln.
SELECTION-SCREEN PUSHBUTTON /10(20) B_LOCK USER-COMMAND LOCK.
SELECTION-SCREEN PUSHBUTTON /10(20) B_UNLOCK USER-COMMAND UNLOCK.

*----------------------------------------------------------------------*
* INITIALIZATION
*----------------------------------------------------------------------*
INITIALIZATION.
  MOVE 'Lock'   TO B_LOCK.
  MOVE 'UnLock' TO B_UNLOCK.

at selection-screen.
  if sy-ucomm eq 'LOCK'.
    perform LOCK_DATA.
  elseif sy-ucomm eq 'UNLOCK'.
    perform UNLOCK_DATA.
  endif.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  LOCK_DATA
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form lock_data.
  select vbeln from vbrk into table i_vbrk
  where vbeln in s_vbeln.
  if sy-subrc eq 0.
    loop at i_vbrk.
     CALL FUNCTION 'ENQUEUE_EVVBRKE'
         EXPORTING
              MODE_VBRK      = 'E'
              MANDT          = SY-MANDT
              VBELN          = i_vbrk-vbeln
*              X_VBELN        = ' '
*              _SCOPE         = '2'
*              _WAIT          = ' '
*              _COLLECT       = ' '
         EXCEPTIONS
              FOREIGN_LOCK   = 1
              SYSTEM_FAILURE = 2
              OTHERS         = 3
               .
     IF sy-subrc &amp;lt;&amp;gt; 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
     ENDIF.

    endloop.
  else.
    message I999(FG) with 'No Billing document found.'.
    leave list-processing.
  endif.
endform.                    " LOCK_DATA

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  UNLOCK_DATA
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form unlock_data.
 CALL FUNCTION 'DEQUEUE_ALL'
*     EXPORTING
*          _SYNCHRON = ' '
           .
  endform.                    " UNLOCK_DATA

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2009 05:16:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475175#M1253746</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-30T05:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475176#M1253747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call the function module this way...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'ENQUEUE_EVVBRKE'
    EXPORTING
     MODE_VBRK = 'X'
      vbeln         = v_varkey
    EXCEPTIONS
      foreign_lock   = 1
      system_failure = 2
      OTHERS         = 3.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this resolves your issue&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2009 05:16:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475176#M1253747</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-30T05:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Locking a document when printing?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475177#M1253748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tripat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I successfully blocked the document using your sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mon Magallanes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2009 06:03:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/locking-a-document-when-printing/m-p/5475177#M1253748</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-30T06:03:56Z</dc:date>
    </item>
  </channel>
</rss>

