ZRFI032

 REPORT ZRFI032 NO STANDARD PAGE HEADING LINE-COUNT 65 LINE-SIZE  255.

*Declaration tables for this program
TABLES:BSIS,BSAS,BSEG, USR01.
*Data declaration: ALV parameters
TYPE-POOLS: SLIS.
DATA: GT_FIELDCAT  TYPE SLIS_T_FIELDCAT_ALV."Field catalogue
DATA: GT_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: T_FIELDCAT   TYPE SLIS_T_FIELDCAT_ALV,
      W_FILEDCAT   LIKE LINE OF T_FIELDCAT.
DATA: T_SORT       TYPE SLIS_T_SORTINFO_ALV.
 
DATA: BEGIN OF IT_HEAD OCCURS 0,
  BUKRS LIKE BSIS-BUKRS,
  BELNR LIKE BSIS-BELNR,
  GJAHR LIKE BSIS-GJAHR,
  GSBER LIKE BSIS-GSBER,
  BUDAT LIKE BSIS-BUDAT,
  BUZEI LIKE BSIS-BUZEI,
  HKONT LIKE BSIS-HKONT,
  END OF IT_HEAD.
 
DATA: BEGIN OF IT_RESULT OCCURS 0,
  BUKRS LIKE BSIS-BUKRS,
  BELNR LIKE BSIS-BELNR,
  GJAHR LIKE BSIS-GJAHR,
  GSBER LIKE BSIS-GSBER,
  GSBER2 TYPE STRING,
  BUDAT LIKE BSIS-BUDAT,
  BUZEI LIKE BSIS-BUZEI,
  HKONT LIKE BSIS-HKONT,
  TXT50 LIKE SKAT-TXT50,
  KUNNR LIKE BSEG-KUNNR,
  LIFNR LIKE BSEG-LIFNR,
  SHKZG LIKE BSIS-SHKZG,
  WAERS LIKE BSIS-WAERS,
  WRBTR LIKE BSIS-WRBTR,
  DMBTR LIKE BSIS-DMBTR,
  ZTYPE LIKE BSIS-SGTXT,
  ZUONR LIKE BSIS-ZUONR,
  SGTXT LIKE BSIS-SGTXT,
  STBLG LIKE BKPF-STBLG,
  MITKZ LIKE SKB1-MITKZ,
 END OF IT_RESULT.
DATA: GT_RESULT LIKE TABLE OF IT_RESULT WITH HEADER LINE.
DATA: GT_RESULT_TMP LIKE TABLE OF IT_RESULT WITH HEADER LINE.
DATA: GT_HKONT LIKE TABLE OF IT_RESULT WITH HEADER LINE.
 
*Define the selection-screen
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_BUKRS LIKE BSIS-BUKRS DEFAULT '3999' MATCHCODE OBJECT SEARCH_HELP .
SELECT-OPTIONS: S_GSBER FOR BSIS-GSBER.
SELECT-OPTIONS: S_BELNR FOR BSIS-BELNR.
SELECT-OPTIONS: S_BUDAT FOR BSIS-BUDAT OBLIGATORY.
SELECT-OPTIONS: S_HKONT FOR BSIS-HKONT.
SELECTION-SCREEN END OF BLOCK B1.
*----------------------------------------------------------------------*
* INITIALIZATION
*----------------------------------------------------------------------*
INITIALIZATION.
 
AT SELECTION-SCREEN.
 
AT SELECTION-SCREEN OUTPUT.
  PERFORM INIT_SCREEN_VALUE.
 
TOP-OF-PAGE.
 
END-OF-PAGE.
*----------------------------------------------------------------------*
* START-OF-SELECTION
*----------------------------------------------------------------------*
START-OF-SELECTION.
  PERFORM Z_REPORT_LIST.
  PERFORM GET_DATA.
 
END-OF-SELECTION.
  PERFORM OUTPUT_DATA.
*&---------------------------------------------------------------------*
*&      Form  GET_DATA
*&---------------------------------------------------------------------*
FORM GET_DATA.
  IF S_HKONT-LOW = '' AND S_GSBER-LOW = ''.
    SELECT A~BUKRS A~BELNR A~GJAHR A~GSBER A~BUDAT A~BUZEI A~HKONT A~SHKZG A~WAERS A~WRBTR A~DMBTR A~ZUONR A~SGTXT B~STBLG
      INTO CORRESPONDING FIELDS OF TABLE IT_RESULT FROM BSIS AS A
      INNER JOIN BKPF AS B ON A~BUKRS = B~BUKRS AND A~BELNR = B~BELNR AND A~GJAHR = B~GJAHR
      WHERE A~BUKRS = P_BUKRS AND A~BELNR IN S_BELNR AND A~BUDAT IN S_BUDAT.
    SELECT A~BUKRS A~BELNR A~GJAHR A~GSBER A~BUDAT A~BUZEI A~HKONT A~SHKZG A~WAERS A~WRBTR A~DMBTR A~ZUONR A~SGTXT B~STBLG
      APPENDING CORRESPONDING FIELDS OF TABLE IT_RESULT FROM BSAS AS A
      INNER JOIN BKPF AS B ON A~BUKRS = B~BUKRS AND A~BELNR = B~BELNR AND A~GJAHR = B~GJAHR
      WHERE A~BUKRS = P_BUKRS AND A~BELNR IN S_BELNR AND A~BUDAT IN S_BUDAT.
  ELSE. "如果有输入科目或者业务范围,就分两步来缩小查询范围。
    SELECT BUKRS BELNR GJAHR GSBER BUDAT BUZEI HKONT INTO CORRESPONDING FIELDS OF TABLE IT_HEAD FROM BSIS
      WHERE BUKRS = P_BUKRS AND HKONT IN S_HKONT AND BELNR IN S_BELNR AND BUDAT IN S_BUDAT AND GSBER IN S_GSBER.
    SELECT BUKRS BELNR GJAHR GSBER BUDAT BUZEI HKONT APPENDING CORRESPONDING FIELDS OF TABLE IT_HEAD FROM BSAS
      WHERE BUKRS = P_BUKRS AND HKONT IN S_HKONT AND BELNR IN S_BELNR AND BUDAT IN S_BUDAT AND GSBER IN S_GSBER.
    IF IT_HEAD[] IS NOT INITIAL.
      SELECT A~BUKRS A~BELNR A~GJAHR A~GSBER A~BUDAT A~BUZEI A~HKONT A~SHKZG A~WAERS A~WRBTR A~DMBTR A~ZUONR A~SGTXT B~STBLG
        INTO CORRESPONDING FIELDS OF TABLE IT_RESULT
        FROM BSIS AS A INNER JOIN BKPF AS B ON A~BUKRS = B~BUKRS AND A~BELNR = B~BELNR AND A~GJAHR = B~GJAHR
        FOR ALL ENTRIES IN IT_HEAD
        WHERE A~BUKRS = IT_HEAD-BUKRS AND A~BELNR = IT_HEAD-BELNR AND A~GJAHR = IT_HEAD-GJAHR.
      SELECT A~BUKRS A~BELNR A~GJAHR A~GSBER A~BUDAT A~BUZEI A~HKONT A~SHKZG A~WAERS A~WRBTR A~DMBTR A~ZUONR A~SGTXT B~STBLG
        APPENDING CORRESPONDING FIELDS OF TABLE IT_RESULT
        FROM BSAS AS A INNER JOIN BKPF AS B ON A~BUKRS = B~BUKRS AND A~BELNR = B~BELNR AND A~GJAHR = B~GJAHR
        FOR ALL ENTRIES IN IT_HEAD
        WHERE A~BUKRS = IT_HEAD-BUKRS AND A~BELNR = IT_HEAD-BELNR AND A~GJAHR = IT_HEAD-GJAHR.
    ENDIF.
  ENDIF.
 
  IF IT_RESULT[] IS NOT INITIAL.
 
    APPEND LINES OF IT_RESULT TO GT_HKONT.
    SORT GT_HKONT BY BUKRS HKONT.
    DELETE ADJACENT DUPLICATES FROM GT_HKONT COMPARING BUKRS HKONT.
    LOOP AT GT_HKONT.
      SELECT SINGLE MITKZ INTO GT_HKONT-MITKZ FROM SKB1 WHERE BUKRS = GT_HKONT-BUKRS AND SAKNR = GT_HKONT-HKONT.
      MODIFY GT_HKONT.
    ENDLOOP.
    DELETE GT_HKONT WHERE MITKZ = ''. "整理出不重复的冲销标记
 
    APPEND LINES OF IT_RESULT TO GT_RESULT.
 
    LOOP AT IT_RESULT.
      READ TABLE GT_HKONT WITH KEY BUKRS = IT_RESULT-BUKRS HKONT = IT_RESULT-HKONT.
      IF SY-SUBRC EQ 0.
        IT_RESULT-MITKZ = GT_HKONT-MITKZ.
      ENDIF.  "把冲销标记更新到总表
 
      SELECT SINGLE TXT50 INTO IT_RESULT-TXT50  FROM SKAT WHERE SPRAS = SY-LANGU AND KTOPL = '3000' AND SAKNR = IT_RESULT-HKONT.
      IF IT_RESULT-SHKZG = 'H'.
        IT_RESULT-WRBTR = IT_RESULT-WRBTR * -1.
        IT_RESULT-DMBTR = IT_RESULT-DMBTR * -1.
        MODIFY IT_RESULT.
      ENDIF.
      LOOP AT GT_RESULT WHERE BELNR = IT_RESULT-BELNR AND SHKZG <> IT_RESULT-SHKZG.
        IF IT_RESULT-GSBER2 = ''.
          IT_RESULT-GSBER2 = GT_RESULT-GSBER.
        ELSE.
          SEARCH IT_RESULT-GSBER2 FOR GT_RESULT-GSBER.
          IF SY-SUBRC NE 0.
            CONCATENATE IT_RESULT-GSBER2 GT_RESULT-GSBER INTO IT_RESULT-GSBER2 SEPARATED BY ','.
          ENDIF.
        ENDIF.
        IF IT_RESULT-GSBER = '' OR IT_RESULT-GSBER2 = ''.
          IT_RESULT-ZTYPE = '业务范围错误'.
        ELSE.
          IF IT_RESULT-GSBER = IT_RESULT-GSBER2.
            CONCATENATE IT_RESULT-GSBER '内部调整' INTO IT_RESULT-ZTYPE.
          ELSEIF IT_RESULT-GSBER2+0(2) = IT_RESULT-GSBER+0(2).
            CONCATENATE IT_RESULT-GSBER+0(2) '**内部调整' INTO IT_RESULT-ZTYPE.
          ELSEIF IT_RESULT-GSBER2+0(1) = IT_RESULT-GSBER+0(1).
            CONCATENATE IT_RESULT-GSBER+0(1) '***内部调整' INTO IT_RESULT-ZTYPE.
          ENDIF.
        ENDIF.
        MODIFY IT_RESULT.
      ENDLOOP.
    ENDLOOP.
 
    LOOP AT IT_RESULT.
      IF IT_RESULT-MITKZ <> ''. "以这个条件来访问BSEG表
        SELECT SINGLE KUNNR LIFNR INTO (IT_RESULT-KUNNR,IT_RESULT-LIFNR) FROM BSEG
          WHERE BUKRS = IT_RESULT-BUKRS AND BELNR = IT_RESULT-BELNR AND GJAHR = IT_RESULT-GJAHR AND BUZEI = IT_RESULT-BUZEI.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
          EXPORTING
            INPUT  = IT_RESULT-KUNNR
          IMPORTING
            OUTPUT = IT_RESULT-KUNNR.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
          EXPORTING
            INPUT  = IT_RESULT-LIFNR
          IMPORTING
            OUTPUT = IT_RESULT-LIFNR.
      ENDIF.
 
      IF IT_RESULT-GSBER2 CS ',' AND IT_RESULT-GSBER2 CS IT_RESULT-GSBER.
        IT_RESULT-ZTYPE = '业务范围错误'.
      ENDIF.
      MODIFY IT_RESULT.
    ENDLOOP.
 
    IF S_HKONT-LOW <> '' OR S_GSBER <> ''.  "根据屏幕条件,筛选数据
      APPEND LINES OF IT_RESULT TO GT_RESULT_TMP.
      CLEAR:IT_RESULT,IT_RESULT[].
      LOOP AT IT_HEAD.
        IF S_HKONT-LOW <> '' AND S_GSBER <> ''.
          LOOP AT GT_RESULT_TMP WHERE BELNR = IT_HEAD-BELNR AND BUZEI = IT_HEAD-BUZEI AND HKONT = IT_HEAD-HKONT AND GSBER = IT_HEAD-GSBER.
            APPEND GT_RESULT_TMP TO IT_RESULT.
          ENDLOOP.
        ELSEIF S_HKONT-LOW <> ''.
          LOOP AT GT_RESULT_TMP WHERE BELNR = IT_HEAD-BELNR AND BUZEI = IT_HEAD-BUZEI AND HKONT = IT_HEAD-HKONT.
            APPEND GT_RESULT_TMP TO IT_RESULT.
          ENDLOOP.
        ELSEIF S_GSBER <> ''.
          LOOP AT GT_RESULT_TMP WHERE BELNR = IT_HEAD-BELNR AND BUZEI = IT_HEAD-BUZEI AND GSBER = IT_HEAD-GSBER.
            APPEND GT_RESULT_TMP TO IT_RESULT.
          ENDLOOP.
        ENDIF.
      ENDLOOP.
    ENDIF.
 
    SORT IT_RESULT BY BUKRS BELNR BUZEI.
  ENDIF.
 
ENDFORM.                    "GET_DATA
 
*&---------------------------------------------------------------------*
*&      Form  OUTPUT_DATA
*&---------------------------------------------------------------------*
FORM OUTPUT_DATA.
  IF IT_RESULT[] IS INITIAL.
    MESSAGE 'No data!' TYPE 'S'.
    STOP.
  ELSE.
    CLEAR GT_FIELDCAT.
    PERFORM GET_FIELDS_ATTRIBUTE USING 'IT_RESULT'.
    PERFORM GET_ALV_FIELDS USING 'IT_RESULT'.
    PERFORM OUTPUT_DETAIL_ALV.
  ENDIF.
ENDFORM.                    "OUTPUT_DATA
 
*&---------------------------------------------------------------------*
*&      Form  GET_FIELDS_ATTRIBUTE
*&---------------------------------------------------------------------*
FORM GET_FIELDS_ATTRIBUTE USING P_TABLE .
 
  PERFORM CHANGE_FIELD_NAME USING 'BUKRS'  P_TABLE '公司' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'BELNR'  P_TABLE '会计凭证' '' '' '' '' '' 'BELNR' 'BSIS'.
  PERFORM CHANGE_FIELD_NAME USING 'GSBER'  P_TABLE '业务范围1' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'GSBER2'  P_TABLE '业务范围2' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'BUDAT'  P_TABLE '过账日期' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'BUZEI'  P_TABLE '行项目' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'HKONT'  P_TABLE '总账科目' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'TXT50'  P_TABLE '描述' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'KUNNR'  P_TABLE '客户代码' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'LIFNR'  P_TABLE '供应商代码' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'SHKZG'  P_TABLE '借/贷' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'WAERS'  P_TABLE '币别' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'WRBTR'  P_TABLE '原币金额' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'DMBTR'  P_TABLE '本币金额' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'ZTYPE'  P_TABLE '调整类型' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'ZUONR'  P_TABLE '分配' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'SGTXT'  P_TABLE '文本' '' '' '' '' '' '' ''.
  PERFORM CHANGE_FIELD_NAME USING 'STBLG'  P_TABLE '冲销凭证号' '' '' '' '' '' '' ''.
*    PERFORM BUILD_ALV_SORT USING:  'BUKRS' P_TABLE 'X' '' 'X' ''.
 
ENDFORM.                    "GET_FIELDS_ATTRIBUTE
 
*&---------------------------------------------------------------------*
*&      Form  CHANGE_FIELD_NAME
*&---------------------------------------------------------------------*
FORM CHANGE_FIELD_NAME  USING PL_FIELD PL_ITAB   PL_TEXT PL_SUM PL_FIX PL_EDIT  PL_CHECKBOX PL_INPUT  PL_REF_FIELDNAME  PL_REF_TABNAME.
  DATA  LT_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
  LT_FIELDCAT-FIELDNAME    = PL_FIELD.
  LT_FIELDCAT-TABNAME      = PL_ITAB.
  LT_FIELDCAT-REPTEXT_DDIC   = PL_TEXT.
  LT_FIELDCAT-SELTEXT_L      = PL_TEXT.
  LT_FIELDCAT-SELTEXT_M      = PL_TEXT.
  LT_FIELDCAT-SELTEXT_S      = PL_TEXT.
  LT_FIELDCAT-DO_SUM         = PL_SUM.
  LT_FIELDCAT-FIX_COLUMN     = PL_FIX.
  LT_FIELDCAT-EDIT_MASK      = ''.
  LT_FIELDCAT-EDIT           = PL_EDIT.
  LT_FIELDCAT-CHECKBOX       = PL_CHECKBOX. "the column is checkbox
  LT_FIELDCAT-INPUT          = PL_INPUT.    "the column can be edited in ALV
  LT_FIELDCAT-DDICTXT        = 'L'.
  LT_FIELDCAT-REF_FIELDNAME        = PL_REF_FIELDNAME.
  LT_FIELDCAT-REF_TABNAME          = PL_REF_TABNAME.
*  lt_fieldcat-no_zero = '1' .
  APPEND LT_FIELDCAT TO GT_FIELDCAT.
  CLEAR: LT_FIELDCAT.
ENDFORM.                    "CHANGE_FIELD_NAME
 
*&---------------------------------------------------------------------*
*&      Form  GET_ALV_FIELDS
*&---------------------------------------------------------------------*
FORM GET_ALV_FIELDS  USING    P_ITABN.
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      I_PROGRAM_NAME         = SY-REPID
      I_INTERNAL_TABNAME     = P_ITABN
    CHANGING
      CT_FIELDCAT            = GT_FIELDCAT
    EXCEPTIONS
      INCONSISTENT_INTERFACE = 1
      PROGRAM_ERROR          = 2
      OTHERS                 = 3.
ENDFORM.                    " GET_ALV_FIELDS
 
*&---------------------------------------------------------------------*
*&      Form  OUTPUT_DETAIL_ALV
*&---------------------------------------------------------------------*
FORM OUTPUT_DETAIL_ALV .
*  gt_layout-zebra = 'X'.
  GT_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM      = SY-CPROG
      I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
*      I_CALLBACK_PF_STATUS_SET   = 'SET_PF_STATUS'
      IT_FIELDCAT             = GT_FIELDCAT[]
        IT_SORT                 = T_SORT
*I_DEFAULT                      = 'X'
      I_SAVE                  = 'A'
      IS_LAYOUT               = GT_LAYOUT
    TABLES
      T_OUTTAB                = IT_RESULT
    EXCEPTIONS
      PROGRAM_ERROR           = 1
      OTHERS                  = 2.
ENDFORM.                    "OUTPUT_DETAIL_ALV
 
*&---------------------------------------------------------------------*
*&      Form  BUILD_ALV_SORT
*&---------------------------------------------------------------------*
FORM BUILD_ALV_SORT USING FNAME FITAB FUP FDOWN FSUBT FSUM.
  DATA: ZSORT TYPE SLIS_SORTINFO_ALV.
  CLEAR ZSORT.
  ZSORT-FIELDNAME = FNAME.
  ZSORT-TABNAME   = FITAB.
  ZSORT-UP = FUP.
  ZSORT-DOWN = FDOWN.
  ZSORT-SUBTOT = FSUBT.
  APPEND ZSORT TO T_SORT.
ENDFORM.                    "BUILD_ALV_SORT
 
*&---------------------------------------------------------------------*
*&      Form  Z_REPORT_LIST
*&---------------------------------------------------------------------*
FORM Z_REPORT_LIST.
  CALL FUNCTION 'Z_REPORT_LIST'
    EXPORTING
      P_CPROG = SY-CPROG
      P_UNAME = SY-UNAME.
ENDFORM.                    "Z_REPORT_LIST
 
*&---------------------------------------------------------------------*
*&      Form  USER_COMMAND
*&---------------------------------------------------------------------*
FORM USER_COMMAND USING P_UCOMM P_SELFIELD TYPE SLIS_SELFIELD.
  FIELD-SYMBOLS: <FS>,<FS1>,<FS2>.
  ASSIGN COMPONENT  6 OF STRUCTURE P_SELFIELD TO <FS>.
  ASSIGN COMPONENT 14 OF STRUCTURE P_SELFIELD TO <FS1>.
  ASSIGN COMPONENT  2 OF STRUCTURE P_SELFIELD TO <FS2>.
  DATA: WA_ANALY LIKE IT_RESULT.
 
  READ TABLE IT_RESULT INDEX <FS2> INTO WA_ANALY.
 
  IF P_UCOMM = '&IC1'.  "Double cliek
    IF <FS1> = 'BELNR'  .
      SET PARAMETER ID 'BLN' FIELD WA_ANALY-BELNR.
      SET PARAMETER ID 'BUK' FIELD WA_ANALY-BUKRS.
      SET PARAMETER ID 'GJR' FIELD WA_ANALY-GJAHR.
      CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
    ENDIF.
  ENDIF.
ENDFORM.                    "USER_COMMAND
 
*&---------------------------------------------------------------------*
*&      Form  GET_FIRST_LAST_MONTH
*&---------------------------------------------------------------------*
FORM GET_FIRST_LAST_MONTH USING PF_FIRST PF_LAST.
  CALL FUNCTION 'FIMA_DATE_CREATE'
    EXPORTING
      I_DATE                  = SY-DATUM
      I_MONTHS                = '-1'
      I_SET_LAST_DAY_OF_MONTH = 'X'
    IMPORTING
      E_DATE                  = PF_LAST.
  IF SY-SUBRC = 0.
    CONCATENATE PF_LAST+0(6) '01' INTO PF_FIRST.
  ELSE.
    PF_LAST  = SY-DATUM.
    PF_FIRST = SY-DATUM.
  ENDIF.
ENDFORM.     "GET_FIRST_LAST_MONTH
 
*&---------------------------------------------------------------------*
*&      Form  INIT_SCREEN_VALUE
*&---------------------------------------------------------------------*
FORM INIT_SCREEN_VALUE.
  DATA: LT_FIRST LIKE SY-DATUM,
        LT_LAST  LIKE SY-DATUM.
 
  PERFORM GET_FIRST_LAST_MONTH USING LT_FIRST LT_LAST.
  S_BUDAT-LOW    = LT_FIRST.
  S_BUDAT-SIGN   = 'I'.
  S_BUDAT-OPTION = 'BT'.
  S_BUDAT-HIGH   = LT_LAST.
  APPEND S_BUDAT.
  CLEAR  S_BUDAT.
 
  LOOP AT SCREEN.
    IF SCREEN-NAME = 'P_BUKRS'.
      SCREEN-INPUT = '0'.
      MODIFY SCREEN.
      EXIT.
    ENDIF.
  ENDLOOP.
ENDFORM.                    "INIT_SCREEN_VALUE
 
*DATA: BEGIN OF IT_BSEG OCCURS 0,
*BUKRS LIKE BSEG-BUKRS,
*BELNR LIKE BSEG-BELNR,
*GJAHR LIKE BSEG-GJAHR,
*BUZEI LIKE BSEG-BUZEI,
*KUNNR LIKE BSEG-KUNNR,
*LIFNR LIKE BSEG-LIFNR,
*END OF IT_BSEG.
 
*    SELECT BUKRS BELNR GJAHR BUZEI KUNNR LIFNR INTO CORRESPONDING FIELDS OF TABLE IT_BSEG FROM BSEG
*      FOR ALL ENTRIES IN IT_RESULT
*          WHERE BUKRS = IT_RESULT-BUKRS AND BELNR = IT_RESULT-BELNR AND GJAHR = IT_RESULT-GJAHR AND BUZEI = IT_RESULT-BUZEI.
 
*      READ TABLE IT_BSEG WITH KEY BUKRS = IT_RESULT-BUKRS BELNR = IT_RESULT-BELNR GJAHR = IT_RESULT-GJAHR BUZEI = IT_RESULT-BUZEI.
*      IF SY-SUBRC EQ 0.
*        IT_RESULT-KUNNR = IT_BSEG-KUNNR.
*        IT_RESULT-LIFNR = IT_BSEG-LIFNR.
*        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
*          EXPORTING
*            INPUT  = IT_RESULT-KUNNR
*          IMPORTING
*            OUTPUT = IT_RESULT-KUNNR.
*        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
*          EXPORTING
*            INPUT  = IT_RESULT-LIFNR
*          IMPORTING
*            OUTPUT = IT_RESULT-LIFNR.
*      ENDIF.
 
*    LOOP AT IT_RESULT WHERE GSBER2 CS ','.
*      IF IT_RESULT-GSBER2 CS IT_RESULT-GSBER.
**          SEARCH IT_RESULT-GSBER2 FOR IT_RESULT-GSBER.
*        IT_RESULT-ZTYPE = '业务范围错误'.
*        MODIFY IT_RESULT.
*      ENDIF.
*    ENDLOOP.

你可能感兴趣的:(职场,Data,休闲,ZRFI032)