Google Search - Blog...........

Showing posts with label /SAPDMC/LSM_F4_SERVER_FILE. Show all posts
Showing posts with label /SAPDMC/LSM_F4_SERVER_FILE. Show all posts

Mass Approval For The Leave Workflow Data - PT_ARQ_REQUEST_EXECUTE

When there is a requirement for approving the mass approvals for the leave request workflow , then use the below function module PT_ARQ_REQUEST_EXECUTE to approve it.

Before running the functional module check the record status in the table PTREQ_HEADER with field status. It has the status 'SENT' .

data : EX_MESSAGES TYPE PTARQ_UIA_MESSAGES_TAB,
EX_COMMANDS TYPE PTARQ_UIA_COMMAND_TAB.

CALL FUNCTION 'PT_ARQ_REQUEST_EXECUTE'
EXPORTING
im_request_id = 'E079F211C65FEFF188150050569A609B' "PTREQ_HEADER-REQUEST_ID
IM_COMMAND = 'EXECUTE_APPROVE'
im_pernr = '00000001'
im_modus = 'R'
* IM_DEBUG =
* IMPORTING
* EX_REQUEST =
* EX_HAS_ERRORS =
* EX_SHOW_CHANGE =
tables
ex_messages = EX_MESSAGES
ex_commands = EX_COMMANDS
.

After running this function module the status become 'APPROVED' in the table PTREQ_HEADER , and if u check in the workflow the workflow would be completed. for detailed data run the report RPTARQDBVIEW.

Line Feed & Updates For Open Dataset

REPORT ztest.

*---data declarations
DATA: file_content TYPE string.

*---selection screen
PARAMETERS:p_file TYPE char100 DEFAULT 'F:\usr\sap\put\venkat.txt',
p_input TYPE char20,
p_char TYPE char30,
p_pos TYPE i.
*---get f4 help for the file
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

PERFORM f4_file.

*---start of selection
START-OF-SELECTION.

PERFORM write_file.

PERFORM update_file.

PERFORM display_file.

*&---------------------------------------------------------------------*
*& Form write_file
*----------------------------------------------------------------------*
FORM write_file .

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT
with smart linefeed.

TRANSFER p_input TO p_file.
CLOSE DATASET p_file .

ENDFORM. " write_file
*&---------------------------------------------------------------------*
*& Form update_file
*----------------------------------------------------------------------*
FORM update_file .

OPEN DATASET p_file FOR UPDATE IN TEXT MODE
ENCODING DEFAULT
with smart linefeed
AT POSITION p_pos.
TRANSFER p_char TO p_file.
CLOSE DATASET p_file.

ENDFORM. " update_file
*&---------------------------------------------------------------------*
*& Form display_file
*----------------------------------------------------------------------*
FORM display_file .

OPEN DATASET p_file FOR INPUT IN TEXT MODE
ENCODING DEFAULT
with smart linefeed.
WHILE sy-subrc = 0.
READ DATASET p_file INTO file_content.
WRITE / file_content.
ENDWHILE.
CLOSE DATASET p_file.

ENDFORM. " display_file
*&---------------------------------------------------------------------*
*& Form f4_file
*----------------------------------------------------------------------*
FORM f4_file .

*-- if the file location is application server
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
directory = '/'
filemask = '*'
IMPORTING
serverfile = p_file
EXCEPTIONS
canceled_by_user = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

ENDFORM. " f4_file

the selection screen is like this:



and the output is like this: