DATA: ls_idoc_control TYPE edidc,
lt_edid4 TYPE TABLE OF edid4,
lf_posex TYPE edi1082_a,
lf_segnum TYPE idocdsgnum,
ls_e1edp01 TYPE e1edp01,
ls_e1edp19 TYPE e1edp19,
ls_e1cucfg TYPE e1cucfg,
lf_idtnr TYPE edi_idtnr,
lf_flag TYPE xfeld,
lf_flag_config TYPE xfeld,
lf_matnr TYPE matnr,
lf_ivbap_tabix_aktuell TYPE sy-tabix,
lf_ivbap_pos TYPE int4,
lf_ivbap_posex TYPE edi1082_a.
.
FIELD-SYMBOLS : <ls_edid4> TYPE edid4.
*This enhancement should work only in case of ORDERS Inbound idoc.
IF idoc_number IS NOT INITIAL.
*Find the current position number using the variable ivbap_tabix_aktuell .
lf_ivbap_tabix_aktuell = ivbap_tabix_aktuell .
lf_ivbap_pos = lf_ivbap_tabix_aktuell * 10 .
lf_ivbap_posex = lf_ivbap_pos .
CONDENSE lf_ivbap_posex .
IF idoc_edidc-mestyp = 'ORDERS' AND idoc_edidc-direct = '2'.
*Orders Idoc Scenario, read the data segments.
SELECT * FROM edid4 INTO TABLE lt_edid4 WHERE docnum = idoc_number.
IF lt_edid4 IS NOT INITIAL.
LOOP AT lt_edid4 ASSIGNING <ls_edid4> WHERE segnam = 'E1EDP01' OR segnam = 'E1EDP19' .
IF lf_flag NE 'X' .
IF <ls_edid4>-segnam = 'E1EDP01'.
MOVE <ls_edid4>-sdata TO ls_e1edp01 .
*From E1EDP01 segment position number is required.
IF ls_e1edp01 IS NOT INITIAL .
lf_posex = ls_e1edp01-posex.
lf_segnum = <ls_edid4>-segnum.
ENDIF.
ENDIF.
*From E1EDP19 segment material number is required.
IF <ls_edid4>-segnam = 'E1EDP19'.
MOVE <ls_edid4>-sdata TO ls_e1edp19 .
lf_IDTNR = ls_e1edp19-idtnr .
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = lf_idtnr
IMPORTING
output = lf_matnr
EXCEPTIONS
length_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
IF lf_matnr = vbap-matnr AND lf_posex = lf_ivbap_posex .
*The variables set above are for this position and can be used to find the config segment.
lf_flag = 'X' .
EXIT.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
*Check the flag and see if there is any configuration segment for this posex.
IF lf_flag = 'X' .
LOOP AT lt_edid4 ASSIGNING <ls_edid4> WHERE segnam = 'E1CUCFG' .
MOVE <ls_edid4>-sdata TO ls_e1cucfg .
IF ls_e1cucfg-posex = lf_posex .
*Configuration segments for this position available in the idoc. First position from the substituition possibilities will be taken.
*No need to do anything. Set the flag to signify that it is a Idoc position with Config segments.
lf_flag_config = 'X'.
EXIT.
ENDIF.
ENDLOOP.
IF lf_flag_config NE 'X'.
REFRESH : konddp_tab[].
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*clear variables here if required .
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 |