Skip to Content
0
Former Member
Sep 08, 2009 at 09:37 AM

perform and form doubt

36 Views

Dear Experts,

For auto approval i'm using the following code..,.,

loop at it_mid into wa_mid.
****  write  :/10 'employee id' color 5 , wa_mid-pernr,
****          60 'CREATED DATE' color 4 ,wa_mid-wi_cd,
****          90 'REQUEST ID' COLOR 4, WA_MID-REQUEST_ID.

***  LV_EIGHTH_DATE = WA_MID-WI_CD + 7. "enable this during transport

***  IF WA_MID-WI_CD GE LV_EIGHTH_DATE. "enable this during transport

PERFORM AUTO_APPROVE USING WA_MID-PERNR
                           WA_MID-REQUEST_ID.

CLEAR : WA_MID-WI_CD.
CLEAR : LV_EIGHTH_DATE.
***    ENDIF.
  endloop.
*&---------------------------------------------------------------------*
*&      Form  AUTO_APPROVE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_WA_MID_WI_CD  text
*      -->P_WA_MID_WI_CD  text
*----------------------------------------------------------------------*
form AUTO_APPROVE  using    p_wa_mid_PERNR
                            p_wa_mid_REQUEST_ID.

DATA : LV_REQUEST_ID TYPE TIM_REQ_ID,
       LV_PERNR  TYPE  P_PERNR,
       LV_COMMAND TYPE PTREQ_COMMAND.
DATA : EX_COMMANDS TYPE PTARQ_UIA_COMMAND_TAB,
       ex_messages type PTARQ_UIA_MESSAGES_TAB.
data : lv_modus type PT_ARQ_MODE.

LV_REQUEST_ID = P_WA_mid_request_id.
LV_PERNR      = P_WA_MID_PERNR.
LV_COMMAND    = 'EXECUTE_APPROVE'.
lv_modus      = 'R'.

CALL FUNCTION 'PT_ARQ_REQUEST_EXECUTE'
  EXPORTING
    im_request_id        = LV_REQUEST_ID " P_WA_MID_REQUEST_ID
    IM_COMMAND           = LV_COMMAND
    im_pernr             = LV_PERNR " P_WA_MID_PERNR
    im_modus             = lv_modus
   IM_DEBUG             = ''
* IMPORTING
*   EX_REQUEST           =
*   EX_HAS_ERRORS        =
*   EX_SHOW_CHANGE       =
 tables
    ex_messages          = ex_messages
    ex_commands          = ex_commands.
CLEAR : p_wa_mid_PERNR,  p_wa_mid_REQUEST_ID.
clear : LV_REQUEST_ID, LV_PERNR .
endform.                    " AUTO_APPROVE

here only one request is getting approved , again when it goes into loop this f.m is going to dump, what is worng with this code

can some body suggest me is there any other way to do this.,.,

Thanks and Regards,

Thirukumaran. R