Tuesday, November 29, 2016

Upload Result Recording

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
SELECT * FROM QALS INTO TABLE i_QALS
  WHERE prueflos  IN S_IIN AND
        enstehdat IN S_CO AND
        werk      IN S_PL AND
        art       IN S_IT AND
        matnr     IN S_MN AND
        pastrterm IN s_iibdt AND
        paendterm IN s_iiedt AND
        slwbez ne space .
*        ART eq 'Z3'.

 SELECT * FROM QASE INTO TABLE I_QASE
   WHERE prueflos IN S_IIN AND
         probenr  IN s_ipn  .

 SELECT * FROM jest INTO TABLE i_jest
   FOR ALL ENTRIES IN i_QALS
   WHERE objnr = i_qals-objnr AND inact eq space AND
   ( stat eq 'I0212 ' or stat eq 'I0002').

 LOOP AT i_QALS INTO s_QALS .
   READ TABLE i_jest WITH KEY objnr = s_qals-objnr TRANSPORTING NO FIELDS .
   IF sy-subrc ne 0.
     delete i_QALS  WHERE objnr eq s_QALS-objnr .
   ENDIF.

 ENDLOOP.

 SELECT * FROM MAKT INTO TABLE i_makt
   FOR ALL ENTRIES IN i_qals
   WHERE matnr eq i_qals-SELMATNR AND spras eq 'En'.

SELECT * FROM qamv INTO TABLE i_qamv
  FOR ALL ENTRIES IN i_qals
  WHERE prueflos eq i_qals-prueflos.

LOOP AT I_QALS INTO S_QALS.

G_INSPLOT = S_QALS-prueflos.
G_HANDHELD = ''.

CALL FUNCTION 'BAPI_INSPOPER_GETLIST'
 EXPORTING
   INSPLOT                    = G_INSPLOT
   HANDHELD_APPLICATION       = G_HANDHELD
 IMPORTING
   RETURN                     = G_RETURN
   RETURN2                    = G_RETURN2
 TABLES
   INSPOPER_LIST              = I_INSPOPER
   HANDHELD_WORKLIST          = I_HANDHELD
          .

IF G_RETURN-type ne 'S'.
CONTINUE.
ELSE.
CLEAR g_tbx. DESCRIBE TABLE I_INSPOPER LINES g_tbx.
ENDIF.

loop at I_INSPOPER into S_INSPOPER.
* S_EXCEL-inspection_lot_number          = s_qals-PRUEFLOS  .
  CONCATENATE ' ' ''s_qals-PRUEFLOS INTO S_EXCEL-inspection_lot_number.
*  CONCATENATE '=TEXT(0,"'s_qals-PRUEFLOS'")' INTO S_EXCEL-inspection_lot_number.
 S_EXCEL-material_number                = s_qals-SELMATNR  .
 s_excel-operation                      = S_INSPOPER-inspoper.
 s_excel-operation_description          = S_INSPOPER-txt_oper.

* s_excel-insp_point          = s_qals-PRUEFLOS.


READ TABLE i_makt INTO s_makt WITH KEY matnr = s_qals-SELMATNR.
IF sy-subrc eq 0.
  S_EXCEL-material_number_desc = s_makt-MAKTX.
ENDIF.

g_insplot2 = s_qals-PRUEFLOS.
G_inspoper = S_INSPOPER-inspoper.

CALL FUNCTION 'BAPI_INSPOPER_GETDETAIL'
  EXPORTING
    insplot                            = g_insplot2     "                            s_qals-PRUEFLOS
    inspoper                           = G_inspoper     "                          S_INSPOPER-inspoper
   READ_INSPPOINTS                    = 'X'
   READ_CHAR_REQUIREMENTS             = 'X'
   READ_CHAR_RESULTS                  = 'X'
   READ_SAMPLE_RESULTS                = 'X'
   READ_SINGLE_RESULTS                = 'X'
   READ_CHARS_WITH_CLASSES            = 'X'
   READ_CHARS_WITHOUT_RECORDING       = 'X'
   RES_ORG                            = ' '
   CHAR_FILTER_NO                     = '1   '
   CHAR_FILTER_TCODE                  = 'QE11'
   MAX_INSPPOINTS                     = 100
   INSPPOINT_FROM                     = 0
   HANDHELD_APPLICATION               = ' '
   RESULT_COPY                        = ' '
 IMPORTING
   OPERATION                          = G_OPERATION
   INSPPOINT_REQUIREMENTS             = G_INSPPOINT_REQUIREMENTS
   RETURN                             = g_RETURN3
 TABLES
   INSPPOINTS                         = i_INSPPOINTS
   CHAR_REQUIREMENTS                  = i_CHAR_REQUIREMENTS
   CHAR_RESULTS                       = i_CHAR_RESULTS
   SAMPLE_RESULTS                     = i_SAMPLE_RESULTS
   SINGLE_RESULTS                     = i_SINGLE_RESULTS
          .
READ TABLE i_CHAR_REQUIREMENTS INTO s_CHAR_REQUIREMENTS INDEX 1.
IF sy-subrc eq 0.
S_EXCEL-mic_code = s_char_requirements-mstr_char.
READ TABLE i_qamv INTO s_qamv WITH KEY verwmerkm = S_EXCEL-mic_code.
IF sy-subrc eq 0.
*s_excel-upper = s_qamv-TOLERANZOB .
    WRITE s_qamv-TOLERANZOB to g_c1.
    WRITE s_qamv-TOLERANZUN to g_c2.
    SPLIT g_c1 at ',' INTO g_c3 g_c4.
    SPLIT g_c2 at ',' INTO g_c5 g_c6.
*    CONCATENATE '=TEXT(0,"'g_c3'")' INTO s_excel-upper.
    CONCATENATE '' ''g_c3 INTO s_excel-upper.
    CONCATENATE '' ''g_c5 INTO s_excel-lower.
*    CONCATENATE '=TEXT(0,"'g_c5'")' INTO s_excel-lower.
*s_excel-lower = s_qamv-TOLERANZUN .


S_EXCEL-mic_description = s_qamv-kurztext.
S_EXCEL-number_or_sample = s_qamv-sollstpumf. CONDENSE S_EXCEL-number_or_sample.
S_EXCEL-uom              = s_CHAR_REQUIREMENTS-meas_unit.

if s_qamv-pmethode IS INITIAL.
*  s_excel-insp_method_code = ''.
  CLEAR s_excel-insp_method_code.
else.
  s_excel-insp_method_code = s_qamv-pmethode.
endif.

CONDENSE s_excel-insp_method_code.

s_excel-insp_methode_desc = ''.

APPEND s_excel to i_excel.
ENDIF.


ENDIF.

ENDLOOP.
ENDLOOP.

No comments:

Post a Comment