DATA: BEGIN OF IT_OUT OCCURS 100,
ID(5) TYPE C,
Status(5) type C,
END OF IT_OUT.
DATA: WA_OUT LIKE IT_OUT.
SELECTION-SCREEN BEGIN OF BLOCK SEL WITH FRAME TITLE T-001.
PARAMETERS: P_ID(5) TYPE C,
P_STATUS(5) TYPE C.
SELECTION-SCREEN END OF BLOCK SEL.
SELECT SINGLE ID STATUS INTO WA_OUT FROM ZKBSP WHERE ID = P_ID.
IF SY-SUBRC = 0.
WA_OUT-STATUS = P_STATUS.
MODIFY ZKBSP FROM WA_OUT.
MESSAGE 'DATA HAS BEEN MODIFIED SUCCESSFUL!' TYPE 'S'.
ENDIF.
perform bdc_dynpro using 'ZABAP_BSP' '1000'.
perform bdc_field using 'BDC_CURSOR'
'P_STATUS'.
perform bdc_field using 'BDC_OKCODE'
'=ONLI'.
perform bdc_field using 'P_ID'
I_ID.
perform bdc_field using 'P_STATUS'
I_STATUS.
perform bdc_dynpro using 'ZABAP_BSP' '1000'.
perform bdc_field using 'BDC_OKCODE'
'/EE'.
perform bdc_field using 'BDC_CURSOR'
'P_ID'.
perform bdc_transaction.
ENDFUNCTION.
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL IS NOT INITIAL.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.
FORM bdc_transaction.
CALL TRANSACTION 'ZABAP_BSP' USING BDCDATA
MODE 'N'
UPDATE 'L'.(最主要是这一句话实现了这一个BAPI调用T_code的功能)
ENDFORM.
<html>
<head>
<title>First Page</title>
</head>
<body>
<form method="post" action="first.htm">
ID: <input name="S_ID"/><br>
STATUS: <input name="S_STATUS"/><br>
<input value="submit" type="submit" name="OnInputProcessing"/>
</form>
</body>
</html>
CALL FUNCTION 'Z_CALL_BSP'
EXPORTING
i_id = S_ID
i_status = S_STATUS
IMPORTING
OUTPUT = OUTPUT
.
ENDIF.
if output = 0.
MESSAGE 'sucessful!' type 'S'.
ENDIF.