DATA: ls_return TYPE bapireturn1. "bapi的返回结果 LOOP AT <gfs_t_output> ASSIGNING <gfs_s_output>. CLEAR:gv_pernr,gv_begda,gv_endda,gv_subty,gv_seqnr,ls_return. ASSIGN COMPONENT 'ZSTATUS' OF STRUCTURE <gfs_s_output> TO <gfs_field>. IF sy-subrc EQ 0 AND <gfs_field> IS NOT INITIAL AND <gfs_field> NE icon_yellow_light. CONTINUE. ENDIF. ASSIGN COMPONENT 'PERNR' OF STRUCTURE <gfs_s_output> TO <gfs_field>. IF sy-subrc EQ 0. gv_pernr = <gfs_field>. ENDIF. ASSIGN COMPONENT 'BEGDA' OF STRUCTURE <gfs_s_output> TO <gfs_field>. IF sy-subrc EQ 0. gv_begda = <gfs_field>. ENDIF. ASSIGN COMPONENT 'ENDDA' OF STRUCTURE <gfs_s_output> TO <gfs_field>. IF sy-subrc EQ 0. gv_endda = <gfs_field>. ENDIF. ASSIGN COMPONENT 'SUBTY' OF STRUCTURE <gfs_s_output> TO <gfs_field>. IF sy-subrc EQ 0. gv_subty = <gfs_field>. ENDIF. ASSIGN COMPONENT 'SEQNR' OF STRUCTURE <gfs_s_output> TO <gfs_field>. IF sy-subrc EQ 0. gv_seqnr = <gfs_field>. ENDIF. CLEAR:<gfs_s_ptype>. MOVE-CORRESPONDING <gfs_s_output> TO <gfs_s_ptype>. CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE' EXPORTING number = gv_pernr IMPORTING return = ls_return. IF ls_return-type NE 'E'. CLEAR:ls_return. CASE: p_actio. WHEN: 'INS'. CALL FUNCTION 'HR_INFOTYPE_OPERATION' EXPORTING infty = p_infty number = gv_pernr subtype = gv_subty validityend = gv_endda validitybegin = gv_begda record = <gfs_s_ptype> operation = p_actio IMPORTING return = ls_return. WHEN: 'MOD' OR 'DEL'. CALL FUNCTION 'HR_INFOTYPE_OPERATION' EXPORTING infty = p_infty number = gv_pernr subtype = gv_subty validityend = gv_endda validitybegin = gv_begda recordnumber = gv_seqnr record = <gfs_s_ptype> operation = p_actio IMPORTING return = ls_return. ENDCASE. IF ls_return-type EQ 'E'. ASSIGN COMPONENT 'ZSTATUS' OF STRUCTURE <gfs_s_output> TO <gfs_field>. IF sy-subrc EQ 0.<gfs_field> = icon_red_light. ENDIF. ASSIGN COMPONENT 'ZMSG' OF STRUCTURE <gfs_s_output> TO <gfs_field>. IF sy-subrc EQ 0.<gfs_field> = ls_return-message. ENDIF. ELSE. ASSIGN COMPONENT 'ZSTATUS' OF STRUCTURE <gfs_s_output> TO <gfs_field>. IF sy-subrc EQ 0.<gfs_field> = icon_green_light. ENDIF. ASSIGN COMPONENT 'ZMSG' OF STRUCTURE <gfs_s_output> TO <gfs_field>. IF sy-subrc EQ 0.<gfs_field> = '数据操作成功!'. ENDIF. ENDIF. CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE' "解锁人员号 EXPORTING number = gv_pernr IMPORTING return = ls_return. ELSE. ASSIGN COMPONENT 'ZSTATUS' OF STRUCTURE <gfs_s_output> TO <gfs_field>. IF sy-subrc EQ 0.<gfs_field> = icon_red_light. ENDIF. ASSIGN COMPONENT 'ZMSG' OF STRUCTURE <gfs_s_output> TO <gfs_field>. IF sy-subrc EQ 0.<gfs_field> = ls_return-message. ENDIF. ENDIF. ENDLOOP.
标签:gv,sy,return,HR,DEMO,ENDIF,OPERATION,EQ,ASSIGN From: https://www.cnblogs.com/rainysblog/p/17536604.html