TRY.
* Adding a field into the Field catalog
INSERT VALUE #( fieldname = 'LICHA'
tabname = 'BESTAND'
ref_fieldname = 'LICHA'
ref_tabname = 'MCH1'
col_pos = fieldcat[ fieldname = 'CHARG' ]-col_pos ) INTO TABLE fieldcat.
* Selecting materials with batches
DATA(lt_batches_query) = CORRESPONDING tt_mcha( bestand[] ).
* Getting batch attributes
SELECT matnr, charg, licha
INTO TABLE @DATA(lt_batch_master)
FROM mch1 FOR ALL ENTRIES IN @lt_batches_query
WHERE matnr = @lt_batches_query-matnr AND
charg = @lt_batches_query-charg and
lvorm = ''.
IF sy-subrc EQ 0.
LOOP AT bestand[] ASSIGNING FIELD-SYMBOL(<lfs_output>) WHERE charg IS NOT INITIAL.
TRY.
* Assign the value to a an output line
<lfs_output>-licha = lt_batch_master[ matnr = <lfs_output>-matnr
charg = <lfs_output>-charg ]-licha.
CATCH cx_sy_itab_line_not_found.
CONTINUE.
ENDTRY.
ENDLOOP.
ENDIF.
CATCH cx_sy_itab_line_not_found.
" No exception handling
ENDTRY.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
9 | |
3 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 | |
1 |