Skip to Content
0
Former Member
Jul 08, 2009 at 03:29 AM

get/set parameter id or import/export to memory id - for locking dbtable

1476 Views

Hi experts,

i am trying to use import and export to avoid another user accessing a table when a user is performing some action on the particular table.

DATA: text1 TYPE c.
          IMPORT text1 FROM MEMORY ID 'Y222'.
*          IF sy-subrc = 0.
          IF text1 = 'X'.
            MESSAGE e000(z1) WITH 'SOME USER IS ACCESSING THE PROGRAM'.
*            ENDIF.
          ELSE.
*            DATA: text1 TYPE c VALUE 'X'.
            EXPORT text1 = 'X' TO MEMORY ID 'Y222'.
            PERFORM update_dbase.
            FREE MEMORY ID 'Y222'.
          ENDIF.

but import not working.

similarly, i tried using GET and SET parameter id', for the same purpose.

DATA : repid1 LIKE sy-repid.

          CLEAR repid1.
          GET PARAMETER ID 'Y222' FIELD repid1.
          IF repid1 = 'YMCONFLA_N'.          
            MESSAGE e000(z1) WITH 'SOME USER IS ACCESSING THE PROGRAM'.
          ELSE.
            DATA : repid LIKE sy-repid VALUE 'YMCONFLA_N'.
            SET PARAMETER ID 'Y222' FIELD repid.
            PERFORM update_dbase.
            CLEAR repid.
          ENDIF.

this also not working.

in PERFORM update_dbase.

loop at itab.
SELECT SINGLE * FROM zy222 WHERE ebeln = itab-ebeln
                                 AND ebelp = itab-item
                                 AND xblnr = itab-xblnr.
    IF sy-subrc = 0.
      zy222-ebeln = itab-ebeln.
      zy222-ebelp = itab-item.
      zy222-xblnr = itab-xblnr.
      zy222-flag  = itab-status.
      zy222-eindt = itab-eindt.   
      zy222-matnr = itab-matnr .  
      zy222-qty = itab-qty .
      MODIFY zy222.
      COMMIT WORK.
    ELSE.
      zy222-ebeln = itab-ebeln.
      zy222-ebelp = itab-item.
      zy222-xblnr = itab-xblnr.
      zy222-flag  = itab-status.
      zy222-eindt = itab-eindt.   
      zy222-matnr = itab-matnr .
      zy222-qty = itab-qty .
      INSERT zy222.
      IF sy-subrc EQ 0.
        COMMIT WORK.
      ELSE.
        ROLLBACK WORK.
      ENDIF.
    ENDIF.
endloop.

i tried using the enqueue and dequeue_eztable FM's. but my TL says not to use that.

is there anyway to achieve the result using these memory id's? and what mistake i am doing here. plz guide me.

thanks,

Sakthi.