Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Multiple E1EDP05 segment needs to be populated

Hi,

I have a requirement for inbound ORDERS type of IDOC. My requirement is for mutiple E1EDP05 segment how to populate in the internal table.Below is my current code...

     LOOP AT  dedidd.                
       CLEAR : lw_e1edk01,
               lw_e1edka1,
               lw_e1edp01,
               lw_e1edp05,
               lw_e1edp19.
       CASE dedidd-segnam.
         WHEN 'E1EDK01'.
           lw_e1edk01 = dedidd-sdata.
           lf_curcy = lw_e1edk01-curcy.
           MOVE lf_curcy TO lw_e1edp05_data-koein.
         WHEN 'E1EDKA1'.
           lw_e1edka1 = dedidd-sdata.
           IF lw_e1edka1-parvw = 'AG'.
             lf_partn = lw_e1edka1-partn.
           ENDIF.
         WHEN 'E1EDP01'.
           CLEAR lf_e1edp05.
           lw_e1edp01 = dedidd-sdata.
           MOVE lw_e1edp01-posex TO lw_e1edp05_data-posex.
         loop at dedidd where segnam = 'E1EDP05'.
         WHEN 'E1EDP05'.
           lf_e1edp05 = 'X'.
           lw_e1edp05 = dedidd-sdata.
           MOVE lw_e1edp05-kotxt TO lw_e1edp05_data-kotxt.
           if lw_e1edp05-kotxt is initial.
             lw_e1edp05_data-kschl = 'ZAV1'.
           else.
             lw_e1edp05_data-kschl = 'ZAV2'.
           endif.
           MOVE lw_e1edp05-menge TO lw_e1edp05_data-menge.
           MOVE lw_e1edp05-kobtr TO lw_e1edp05_data-kobtr.
         endloop.
         WHEN 'E1EDP19'.
           lw_e1edp19 = dedidd-sdata.
           IF lw_e1edp19-qualf = '002'.
             MOVE lw_e1edp19-idtnr TO lw_e1edp05_data-matnr.
             IF lf_e1edp05 = 'X'.
* Select data from A503 table to condition type ZAV1
               SELECT SINGLE knumh FROM a807 INTO  lf_knumh
                  WHERE kappl = 'V'
                  AND   kschl = 'ZAV1'
                  AND zzfunloc_htp = lf_partn
                  AND matnr = lw_e1edp19-idtnr
                  AND varcond = lw_e1edp05_data-kotxt
                  AND waerk = lf_curcy
                  AND datbi GE sy-datum
                  AND datab LE sy-datum.
               IF sy-subrc = 0.
                 MOVE lf_knumh TO lw_e1edp05_data-knumh.
                 APPEND lw_e1edp05_data TO lt_e1edp05_data.
               ELSE.
* Select data from A505 table to condition type ZAV2
                 SELECT SINGLE knumh FROM a805 INTO lf_knumh
                       WHERE kappl = 'V'
                       AND   kschl = 'ZAV2'
                       AND zzfunloc_htp = lf_partn
                       AND matnr = lw_e1edp19-idtnr
                       AND waerk = lf_curcy
                       AND datbi GE sy-datum
                       AND datab LE sy-datum.
                 IF sy-subrc = 0.
                   MOVE lf_knumh TO lw_e1edp05_data-knumh.
                   APPEND lw_e1edp05_data TO lt_e1edp05_data.
                 ENDIF.
               ENDIF.
             ENDIF.
           ENDIF.
       ENDCASE.
     ENDLOOP.

Former Member
Not what you were looking for? View more on this topic or Ask a question