<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic inbound idoc in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-idoc/m-p/1663973#M294072</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;here i am picking the file from APPS and also inbound IDOC creation.&lt;/P&gt;&lt;P&gt;just anyone check my code and give some suggestions in the areas of impovemet technically.&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;report  znsd007.&lt;/P&gt;&lt;P&gt;*tables : zih001, zid001.                                      &lt;/P&gt;&lt;P&gt;tables: zstbm_lots, zstbm_stages, zibmordertype.&lt;/P&gt;&lt;P&gt;data: t_zstbmlot like zstbm_lots occurs 0 with header line,&lt;/P&gt;&lt;P&gt;      t_zstbmstage like zstbm_stages occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters :&lt;/P&gt;&lt;P&gt;   fromdir    like	rsmrgstr-path lower case default&lt;/P&gt;&lt;P&gt;'/apps/MQBridge/idocmsgs/',&lt;/P&gt;&lt;P&gt;   fromfile   like rsmrgstr-name  lower case default '*.txt',&lt;/P&gt;&lt;P&gt;   todir      like rsmrgstr-path lower case default&lt;/P&gt;&lt;P&gt;'/apps/MQBridge/idoctemp/',&lt;/P&gt;&lt;P&gt;   tofile     like edi_path-pthnam lower case no-display,&lt;/P&gt;&lt;P&gt;   procdir    like rsmrgstr-path lower case default&lt;/P&gt;&lt;P&gt;'/apps/MQBridge/idocproc/',&lt;/P&gt;&lt;P&gt;   procfile   like edi_path-pthnam lower case no-display,&lt;/P&gt;&lt;P&gt;   toport     like edipo-port no-display.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;constants:  c_tst(7) value 'IBM_TST',&lt;/P&gt;&lt;P&gt;            c_bi(6) value 'IBM_BI',&lt;/P&gt;&lt;P&gt;            c_mrk(7) value 'IBM_MRK',&lt;/P&gt;&lt;P&gt;            c_sbt(7) value 'IBM_SBT'.&lt;/P&gt;&lt;P&gt;data: w_tst(1) type c,&lt;/P&gt;&lt;P&gt;      w_bi(1) type c,&lt;/P&gt;&lt;P&gt;      w_mrk(1) type c,&lt;/P&gt;&lt;P&gt;      w_sbt(1) type c,&lt;/P&gt;&lt;P&gt;      w_err(1) type c,&lt;/P&gt;&lt;P&gt;      w_processcd(20) type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data :&lt;/P&gt;&lt;P&gt;file_list	like	rsfillst occurs 100 with header line,&lt;/P&gt;&lt;P&gt;pattern	like	rsmrgstr-name,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tmpfile(128),&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;begin of in1 occurs 100,&lt;/P&gt;&lt;P&gt;  dir(128),&lt;/P&gt;&lt;P&gt;  file(128),&lt;/P&gt;&lt;P&gt;  data(63000) occurs 0,        &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; data(1063) occurs 0,&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;end of in1,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;str(63000),                    &lt;/P&gt;&lt;P&gt;*str(1063),&lt;/P&gt;&lt;P&gt;str2 like str,&lt;/P&gt;&lt;P&gt;*outfile(63000) occurs 100 with header line,&lt;/P&gt;&lt;P&gt;*outfile(128),&lt;/P&gt;&lt;P&gt;crtl like edi_dc40,&lt;/P&gt;&lt;P&gt;*counter type i,                                              &lt;/P&gt;&lt;P&gt;segment like edi_dd40-segnam,                               &lt;/P&gt;&lt;P&gt;segment_no(6) type n,                                       &lt;/P&gt;&lt;P&gt;data like edi_dd40-sdata,                                   &lt;/P&gt;&lt;P&gt;productid_ecid(25),                                         &lt;/P&gt;&lt;P&gt;edidd40 like edi_dd40.&lt;/P&gt;&lt;P&gt;field-symbols : &amp;lt;fs2&amp;gt;,&amp;lt;fs&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:   messtab like bdcmsgcoll occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;break-point.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  perform getfile_list tables file_list using fromdir fromfile.&lt;/P&gt;&lt;P&gt;  delete file_list where type = 'directory'.&lt;/P&gt;&lt;P&gt;  toport = 'FILE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at file_list.&lt;/P&gt;&lt;P&gt;    perform getfile tables in1 using file_list.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  sort in1 by dir file.                                     &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  check not in1[] is initial.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------" /&gt;&lt;P&gt;  loop at in1.&lt;/P&gt;&lt;P&gt;    at new file.                                           &lt;/P&gt;&lt;P&gt;      concatenate todir '/' in1-file  into tofile.&lt;/P&gt;&lt;P&gt;      replace '//' with '/' into tofile.&lt;/P&gt;&lt;P&gt;      condense tofile no-gaps.&lt;/P&gt;&lt;P&gt;      open dataset tofile for output in text mode encoding default.&lt;/P&gt;&lt;P&gt;      if sy-subrc ne 0.                                    &lt;/P&gt;&lt;P&gt;        message e168(j4) with tofile.                       &lt;/P&gt;&lt;P&gt;      endif.                                                &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Copy the populated dataset to be saved into a processed directory&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      concatenate procdir '/' in1-file  into procfile.&lt;/P&gt;&lt;P&gt;      replace '//' with '/' into procfile.&lt;/P&gt;&lt;P&gt;      condense procfile no-gaps.&lt;/P&gt;&lt;P&gt;      open dataset procfile for output in text mode encoding default.&lt;/P&gt;&lt;P&gt;      if sy-subrc ne 0.                                     &lt;/P&gt;&lt;P&gt;        message e168(j4) with procfile.                     &lt;/P&gt;&lt;P&gt;      endif.                                                &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      clear : edidd40, crtl.&lt;/P&gt;&lt;P&gt;      crtl-tabnam     = 'EDI_DC40'.&lt;/P&gt;&lt;P&gt;      crtl-mandt      = sy-mandt.&lt;/P&gt;&lt;P&gt;      crtl-docrel     = '620'.&lt;/P&gt;&lt;P&gt;      crtl-direct     = '02'.&lt;/P&gt;&lt;P&gt;      concatenate 'SAP' sy-sysid into crtl-rcvpor.&lt;/P&gt;&lt;P&gt;      crtl-rcvprt     = 'LS'.&lt;/P&gt;&lt;P&gt;      crtl-rcvprn     = 'SSD_PN0001'.&lt;/P&gt;&lt;P&gt;      crtl-mestyp     = 'ZCPAOC'.                           &lt;/P&gt;&lt;P&gt;      crtl-idoctyp    = 'ZCPAOC01'.                         &lt;/P&gt;&lt;P&gt;      crtl-sndpor     = 'SSD0000001'.&lt;/P&gt;&lt;P&gt;      crtl-sndprt     = 'LS'.&lt;/P&gt;&lt;P&gt;      crtl-sndprn     = 'SSD_PN0001'.&lt;/P&gt;&lt;P&gt;      transfer crtl to : procfile.&lt;/P&gt;&lt;P&gt;      clear segment_no.                                     &lt;/P&gt;&lt;P&gt;    endat.                                                  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    refresh t_zstbmlot.&lt;/P&gt;&lt;P&gt;    refresh t_zstbmstage.&lt;/P&gt;&lt;P&gt;    loop at in1-data into str.&lt;/P&gt;&lt;P&gt;      clear edidd40.&lt;/P&gt;&lt;P&gt;      edidd40-mandt = sy-mandt.&lt;/P&gt;&lt;P&gt;      check not str is initial.&lt;/P&gt;&lt;P&gt;      search str for ','.&lt;/P&gt;&lt;P&gt;      if sy-subrc = 0.                                      &lt;/P&gt;&lt;P&gt;        segment = str+0(sy-fdpos).                         &lt;/P&gt;&lt;P&gt;        sy-fdpos = sy-fdpos + 1.                            &lt;/P&gt;&lt;P&gt;        data = str+sy-fdpos.                                &lt;/P&gt;&lt;P&gt;        case segment.&lt;/P&gt;&lt;P&gt;          when 'ZSTBM_LOT'.&lt;/P&gt;&lt;P&gt;            clear t_zstbmlot.&lt;/P&gt;&lt;P&gt;            split data at ',' into t_zstbmlot-aufnr&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-ordertype&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-plant&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-productid&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-ec&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-lotlabel&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-other_lot_label1&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-orderqty&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-customercd&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-srcevendor&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-waferid&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-lotowner&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-lottype&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-prty&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-planstart&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-planfinish&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-linecodejc&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-qualitycod&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-poi&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-poi_text&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-cot&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-cot_text&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-lotprodtyp&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-productcd&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-familycd&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-lot_cmmnt&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-devassem&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-devassemtx&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-numdevices&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-date_of_mfg&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-pur_order&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-process_cd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            append t_zstbmlot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            edidd40-segnam = 'ZSTBM_LOT'.&lt;/P&gt;&lt;P&gt;            edidd40-hlevel = '2'.                           &lt;/P&gt;&lt;P&gt;            segment_no = segment_no + 1.                    &lt;/P&gt;&lt;P&gt;            edidd40-segnum = segment_no.                    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            edidd40-sdata  = t_zstbmlot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          when 'ZSTBM_STAGE'.&lt;/P&gt;&lt;P&gt;            clear t_zstbmstage.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           split data at ',' into t_zstbmstage-stage.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            move data to t_zstbmstage-stage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            append t_zstbmstage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            edidd40-segnam = 'ZSTBM_STAGE'.&lt;/P&gt;&lt;P&gt;            edidd40-hlevel = '3'.&lt;/P&gt;&lt;P&gt;            edidd40-psgnum = segment_no.&lt;/P&gt;&lt;P&gt;            edidd40-sdata = t_zstbmstage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        endcase.                                            &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        transfer edidd40 to : procfile.&lt;/P&gt;&lt;P&gt;      endif.                                                &lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    t_zstbmlot-date_of_mfg = t_zstbmlot-date_of_mfg(8).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Determine the order type here using t_zstbmstage and t_zstbmlot&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;and update order type int t_zstbmlot.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear w_tst. clear w_bi. clear w_mrk. clear w_sbt. clear w_err.&lt;/P&gt;&lt;P&gt;    clear w_processcd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    loop at t_zstbmstage.&lt;/P&gt;&lt;P&gt;      if t_zstbmstage-stage = c_tst.&lt;/P&gt;&lt;P&gt;        w_tst = 'X'.&lt;/P&gt;&lt;P&gt;      elseif t_zstbmstage-stage = c_bi.&lt;/P&gt;&lt;P&gt;        w_bi = 'X'.&lt;/P&gt;&lt;P&gt;      elseif t_zstbmstage-stage = c_mrk.&lt;/P&gt;&lt;P&gt;        w_mrk = 'X'.&lt;/P&gt;&lt;P&gt;      elseif t_zstbmstage-stage = c_sbt.&lt;/P&gt;&lt;P&gt;        w_sbt = 'X'.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    if t_zstbmlot-process_cd = 'SubStock Release' or&lt;/P&gt;&lt;P&gt;       t_zstbmlot-process_cd = 'SUBSTOCK RELEASE'.&lt;/P&gt;&lt;P&gt;      w_processcd = 'SUBSTOCK RELEASE'.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    select single * from zibmordertype&lt;/P&gt;&lt;P&gt;           into zibmordertype where&lt;/P&gt;&lt;P&gt;           ibm_tst = w_tst and&lt;/P&gt;&lt;P&gt;           ibm_bi = w_bi and&lt;/P&gt;&lt;P&gt;           ibm_mrk = w_mrk and&lt;/P&gt;&lt;P&gt;           ibm_sbt = w_sbt and&lt;/P&gt;&lt;P&gt;           processcd = w_processcd.&lt;/P&gt;&lt;P&gt;    if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      t_zstbmlot-ordertype = zibmordertype-ordertype.&lt;/P&gt;&lt;P&gt;    else.&lt;/P&gt;&lt;P&gt;      write: 'Order type not determined for lot label:',&lt;/P&gt;&lt;P&gt;              t_zstbmlot-lotlabel.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Put into zih001 to create idoc&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    clear : edidd40, crtl.&lt;/P&gt;&lt;P&gt;    crtl-tabnam     = 'EDI_DC40'.&lt;/P&gt;&lt;P&gt;    crtl-mandt      = sy-mandt.&lt;/P&gt;&lt;P&gt;    crtl-docrel     = '620'.&lt;/P&gt;&lt;P&gt;    crtl-direct     = '02'.&lt;/P&gt;&lt;P&gt;    concatenate 'SAP' sy-sysid into crtl-rcvpor.&lt;/P&gt;&lt;P&gt;    crtl-rcvprt     = 'LS'.&lt;/P&gt;&lt;P&gt;    crtl-rcvprn     = 'SSD_PN0001'.&lt;/P&gt;&lt;P&gt;    crtl-mestyp     = 'ZCPAOC'.&lt;/P&gt;&lt;P&gt;    crtl-idoctyp    = 'ZCPAOC01'.&lt;/P&gt;&lt;P&gt;    crtl-sndpor     = 'SSD0000001'.&lt;/P&gt;&lt;P&gt;    crtl-sndprt     = 'LS'.&lt;/P&gt;&lt;P&gt;    crtl-sndprn     = 'SSD_PN0001'.&lt;/P&gt;&lt;P&gt;    transfer crtl to : tofile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear : edidd40.&lt;/P&gt;&lt;P&gt;    edidd40-segnam =  'ZIH001'.&lt;/P&gt;&lt;P&gt;    edidd40-mandt = sy-mandt.&lt;/P&gt;&lt;P&gt;    edidd40-hlevel = 1.&lt;/P&gt;&lt;P&gt;    edidd40-sdata = t_zstbmlot.&lt;/P&gt;&lt;P&gt;    transfer edidd40 to : tofile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    check not in1-data[] is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    at end of file.                                         &lt;/P&gt;&lt;P&gt;      close dataset : procfile, tofile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      call function 'EDI_DATA_INCOMING'&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          pathname = tofile&lt;/P&gt;&lt;P&gt;          port     = toport.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      check sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Remove file from idocmsgs directory after idoc processing&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      clear tmpfile.&lt;/P&gt;&lt;P&gt;      concatenate in1-dir '/' in1-file  into tmpfile.&lt;/P&gt;&lt;P&gt;      replace '//' with '/' into tmpfile.&lt;/P&gt;&lt;P&gt;      condense tmpfile no-gaps.&lt;/P&gt;&lt;P&gt;      delete dataset tmpfile.&lt;/P&gt;&lt;P&gt;    endat.                                                  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form getfile_list tables intab1 structure rsfillst using inval1 inval2 .&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call function 'SUBST_GET_FILE_LIST'&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      dirname            = inval1&lt;/P&gt;&lt;P&gt;      filenm             = ''&lt;/P&gt;&lt;P&gt;      pattern            = inval2&lt;/P&gt;&lt;P&gt;    tables&lt;/P&gt;&lt;P&gt;      file_list          = intab1&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  ACCESS_ERROR       = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  OTHERS             = 2&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            .&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    "getfile_list&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  getfile&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     --&amp;gt;P_FIELD_LIST  text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form getfile  tables intab1 structure in1&lt;/P&gt;&lt;P&gt;              using    inval structure file_list.&lt;/P&gt;&lt;P&gt;  data : xfile(128).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  clear xfile.&lt;/P&gt;&lt;P&gt;  concatenate inval-dirname '/' inval-name  into xfile.&lt;/P&gt;&lt;P&gt;  replace '//' with '/' into xfile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  open dataset xfile for input message messtab&lt;/P&gt;&lt;P&gt;                          in text mode encoding default.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  check sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  clear : str, intab1. refresh intab1-data.&lt;/P&gt;&lt;P&gt;  do.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; replace ALL OCCURRENCES OF&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        cl_abap_char_utilities=&amp;gt;horizontal_tab&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                   in xfile with space.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; replace all occurrences of '#' in xfile with space.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; replace all occurrences of ':' in xfile with space.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; replace all occurrences of '_' in xfile with space.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    read dataset xfile into str.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; replace all occurrences of '#' in str with space.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; replace all occurrences of ':' in str with space.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; replace all occurrences of '_' in str with space.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;      exit.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    intab1-file = inval-name.&lt;/P&gt;&lt;P&gt;    intab1-dir  = inval-dirname.&lt;/P&gt;&lt;P&gt;    append str to intab1-data.&lt;/P&gt;&lt;P&gt;  enddo.&lt;/P&gt;&lt;P&gt;  if not intab1-data[] is initial.&lt;/P&gt;&lt;P&gt;    append intab1.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  close dataset xfile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    " getfile&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form showdata changing inval indat.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  data : xxtab like sval occurs 100 with header line,&lt;/P&gt;&lt;P&gt;           ff0(100), ff1(30), ff2(30),  yesno.&lt;/P&gt;&lt;P&gt;  inval = indat.&lt;/P&gt;&lt;P&gt;  do.&lt;/P&gt;&lt;P&gt;    assign component sy-index of structure inval to &amp;lt;fs&amp;gt;.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Z1STB_HDR TO &amp;lt;FS&amp;gt;.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    if sy-subrc &amp;lt;&amp;gt; 0. exit. endif.&lt;/P&gt;&lt;P&gt;    describe field &amp;lt;fs&amp;gt; help-id ff0.&lt;/P&gt;&lt;P&gt;    split ff0 at  '-' into ff1 ff2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear xxtab.&lt;/P&gt;&lt;P&gt;    xxtab-tabname = ff1. xxtab-fieldname = ff2. xxtab-value = &amp;lt;fs&amp;gt;.&lt;/P&gt;&lt;P&gt;    append xxtab.&lt;/P&gt;&lt;P&gt;  enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call function 'POPUP_GET_VALUES_USER_HELP'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      popup_title     = 'Enter Order Information'&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      fields          = xxtab&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      error_in_fields = 1&lt;/P&gt;&lt;P&gt;      others          = 2.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0 .&lt;/P&gt;&lt;P&gt;    message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endform.                    "showdata&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Nov 2006 02:06:31 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-14T02:06:31Z</dc:date>
    <item>
      <title>inbound idoc</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-idoc/m-p/1663973#M294072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;here i am picking the file from APPS and also inbound IDOC creation.&lt;/P&gt;&lt;P&gt;just anyone check my code and give some suggestions in the areas of impovemet technically.&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;report  znsd007.&lt;/P&gt;&lt;P&gt;*tables : zih001, zid001.                                      &lt;/P&gt;&lt;P&gt;tables: zstbm_lots, zstbm_stages, zibmordertype.&lt;/P&gt;&lt;P&gt;data: t_zstbmlot like zstbm_lots occurs 0 with header line,&lt;/P&gt;&lt;P&gt;      t_zstbmstage like zstbm_stages occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters :&lt;/P&gt;&lt;P&gt;   fromdir    like	rsmrgstr-path lower case default&lt;/P&gt;&lt;P&gt;'/apps/MQBridge/idocmsgs/',&lt;/P&gt;&lt;P&gt;   fromfile   like rsmrgstr-name  lower case default '*.txt',&lt;/P&gt;&lt;P&gt;   todir      like rsmrgstr-path lower case default&lt;/P&gt;&lt;P&gt;'/apps/MQBridge/idoctemp/',&lt;/P&gt;&lt;P&gt;   tofile     like edi_path-pthnam lower case no-display,&lt;/P&gt;&lt;P&gt;   procdir    like rsmrgstr-path lower case default&lt;/P&gt;&lt;P&gt;'/apps/MQBridge/idocproc/',&lt;/P&gt;&lt;P&gt;   procfile   like edi_path-pthnam lower case no-display,&lt;/P&gt;&lt;P&gt;   toport     like edipo-port no-display.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;constants:  c_tst(7) value 'IBM_TST',&lt;/P&gt;&lt;P&gt;            c_bi(6) value 'IBM_BI',&lt;/P&gt;&lt;P&gt;            c_mrk(7) value 'IBM_MRK',&lt;/P&gt;&lt;P&gt;            c_sbt(7) value 'IBM_SBT'.&lt;/P&gt;&lt;P&gt;data: w_tst(1) type c,&lt;/P&gt;&lt;P&gt;      w_bi(1) type c,&lt;/P&gt;&lt;P&gt;      w_mrk(1) type c,&lt;/P&gt;&lt;P&gt;      w_sbt(1) type c,&lt;/P&gt;&lt;P&gt;      w_err(1) type c,&lt;/P&gt;&lt;P&gt;      w_processcd(20) type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data :&lt;/P&gt;&lt;P&gt;file_list	like	rsfillst occurs 100 with header line,&lt;/P&gt;&lt;P&gt;pattern	like	rsmrgstr-name,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tmpfile(128),&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;begin of in1 occurs 100,&lt;/P&gt;&lt;P&gt;  dir(128),&lt;/P&gt;&lt;P&gt;  file(128),&lt;/P&gt;&lt;P&gt;  data(63000) occurs 0,        &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; data(1063) occurs 0,&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;end of in1,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;str(63000),                    &lt;/P&gt;&lt;P&gt;*str(1063),&lt;/P&gt;&lt;P&gt;str2 like str,&lt;/P&gt;&lt;P&gt;*outfile(63000) occurs 100 with header line,&lt;/P&gt;&lt;P&gt;*outfile(128),&lt;/P&gt;&lt;P&gt;crtl like edi_dc40,&lt;/P&gt;&lt;P&gt;*counter type i,                                              &lt;/P&gt;&lt;P&gt;segment like edi_dd40-segnam,                               &lt;/P&gt;&lt;P&gt;segment_no(6) type n,                                       &lt;/P&gt;&lt;P&gt;data like edi_dd40-sdata,                                   &lt;/P&gt;&lt;P&gt;productid_ecid(25),                                         &lt;/P&gt;&lt;P&gt;edidd40 like edi_dd40.&lt;/P&gt;&lt;P&gt;field-symbols : &amp;lt;fs2&amp;gt;,&amp;lt;fs&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:   messtab like bdcmsgcoll occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;break-point.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  perform getfile_list tables file_list using fromdir fromfile.&lt;/P&gt;&lt;P&gt;  delete file_list where type = 'directory'.&lt;/P&gt;&lt;P&gt;  toport = 'FILE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at file_list.&lt;/P&gt;&lt;P&gt;    perform getfile tables in1 using file_list.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  sort in1 by dir file.                                     &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  check not in1[] is initial.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------" /&gt;&lt;P&gt;  loop at in1.&lt;/P&gt;&lt;P&gt;    at new file.                                           &lt;/P&gt;&lt;P&gt;      concatenate todir '/' in1-file  into tofile.&lt;/P&gt;&lt;P&gt;      replace '//' with '/' into tofile.&lt;/P&gt;&lt;P&gt;      condense tofile no-gaps.&lt;/P&gt;&lt;P&gt;      open dataset tofile for output in text mode encoding default.&lt;/P&gt;&lt;P&gt;      if sy-subrc ne 0.                                    &lt;/P&gt;&lt;P&gt;        message e168(j4) with tofile.                       &lt;/P&gt;&lt;P&gt;      endif.                                                &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Copy the populated dataset to be saved into a processed directory&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      concatenate procdir '/' in1-file  into procfile.&lt;/P&gt;&lt;P&gt;      replace '//' with '/' into procfile.&lt;/P&gt;&lt;P&gt;      condense procfile no-gaps.&lt;/P&gt;&lt;P&gt;      open dataset procfile for output in text mode encoding default.&lt;/P&gt;&lt;P&gt;      if sy-subrc ne 0.                                     &lt;/P&gt;&lt;P&gt;        message e168(j4) with procfile.                     &lt;/P&gt;&lt;P&gt;      endif.                                                &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      clear : edidd40, crtl.&lt;/P&gt;&lt;P&gt;      crtl-tabnam     = 'EDI_DC40'.&lt;/P&gt;&lt;P&gt;      crtl-mandt      = sy-mandt.&lt;/P&gt;&lt;P&gt;      crtl-docrel     = '620'.&lt;/P&gt;&lt;P&gt;      crtl-direct     = '02'.&lt;/P&gt;&lt;P&gt;      concatenate 'SAP' sy-sysid into crtl-rcvpor.&lt;/P&gt;&lt;P&gt;      crtl-rcvprt     = 'LS'.&lt;/P&gt;&lt;P&gt;      crtl-rcvprn     = 'SSD_PN0001'.&lt;/P&gt;&lt;P&gt;      crtl-mestyp     = 'ZCPAOC'.                           &lt;/P&gt;&lt;P&gt;      crtl-idoctyp    = 'ZCPAOC01'.                         &lt;/P&gt;&lt;P&gt;      crtl-sndpor     = 'SSD0000001'.&lt;/P&gt;&lt;P&gt;      crtl-sndprt     = 'LS'.&lt;/P&gt;&lt;P&gt;      crtl-sndprn     = 'SSD_PN0001'.&lt;/P&gt;&lt;P&gt;      transfer crtl to : procfile.&lt;/P&gt;&lt;P&gt;      clear segment_no.                                     &lt;/P&gt;&lt;P&gt;    endat.                                                  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    refresh t_zstbmlot.&lt;/P&gt;&lt;P&gt;    refresh t_zstbmstage.&lt;/P&gt;&lt;P&gt;    loop at in1-data into str.&lt;/P&gt;&lt;P&gt;      clear edidd40.&lt;/P&gt;&lt;P&gt;      edidd40-mandt = sy-mandt.&lt;/P&gt;&lt;P&gt;      check not str is initial.&lt;/P&gt;&lt;P&gt;      search str for ','.&lt;/P&gt;&lt;P&gt;      if sy-subrc = 0.                                      &lt;/P&gt;&lt;P&gt;        segment = str+0(sy-fdpos).                         &lt;/P&gt;&lt;P&gt;        sy-fdpos = sy-fdpos + 1.                            &lt;/P&gt;&lt;P&gt;        data = str+sy-fdpos.                                &lt;/P&gt;&lt;P&gt;        case segment.&lt;/P&gt;&lt;P&gt;          when 'ZSTBM_LOT'.&lt;/P&gt;&lt;P&gt;            clear t_zstbmlot.&lt;/P&gt;&lt;P&gt;            split data at ',' into t_zstbmlot-aufnr&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-ordertype&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-plant&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-productid&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-ec&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-lotlabel&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-other_lot_label1&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-orderqty&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-customercd&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-srcevendor&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-waferid&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-lotowner&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-lottype&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-prty&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-planstart&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-planfinish&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-linecodejc&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-qualitycod&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-poi&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-poi_text&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-cot&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-cot_text&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-lotprodtyp&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-productcd&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-familycd&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-lot_cmmnt&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-devassem&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-devassemtx&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-numdevices&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-date_of_mfg&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-pur_order&lt;/P&gt;&lt;P&gt;                                   t_zstbmlot-process_cd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            append t_zstbmlot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            edidd40-segnam = 'ZSTBM_LOT'.&lt;/P&gt;&lt;P&gt;            edidd40-hlevel = '2'.                           &lt;/P&gt;&lt;P&gt;            segment_no = segment_no + 1.                    &lt;/P&gt;&lt;P&gt;            edidd40-segnum = segment_no.                    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            edidd40-sdata  = t_zstbmlot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          when 'ZSTBM_STAGE'.&lt;/P&gt;&lt;P&gt;            clear t_zstbmstage.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           split data at ',' into t_zstbmstage-stage.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            move data to t_zstbmstage-stage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            append t_zstbmstage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            edidd40-segnam = 'ZSTBM_STAGE'.&lt;/P&gt;&lt;P&gt;            edidd40-hlevel = '3'.&lt;/P&gt;&lt;P&gt;            edidd40-psgnum = segment_no.&lt;/P&gt;&lt;P&gt;            edidd40-sdata = t_zstbmstage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        endcase.                                            &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        transfer edidd40 to : procfile.&lt;/P&gt;&lt;P&gt;      endif.                                                &lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    t_zstbmlot-date_of_mfg = t_zstbmlot-date_of_mfg(8).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Determine the order type here using t_zstbmstage and t_zstbmlot&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;and update order type int t_zstbmlot.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear w_tst. clear w_bi. clear w_mrk. clear w_sbt. clear w_err.&lt;/P&gt;&lt;P&gt;    clear w_processcd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    loop at t_zstbmstage.&lt;/P&gt;&lt;P&gt;      if t_zstbmstage-stage = c_tst.&lt;/P&gt;&lt;P&gt;        w_tst = 'X'.&lt;/P&gt;&lt;P&gt;      elseif t_zstbmstage-stage = c_bi.&lt;/P&gt;&lt;P&gt;        w_bi = 'X'.&lt;/P&gt;&lt;P&gt;      elseif t_zstbmstage-stage = c_mrk.&lt;/P&gt;&lt;P&gt;        w_mrk = 'X'.&lt;/P&gt;&lt;P&gt;      elseif t_zstbmstage-stage = c_sbt.&lt;/P&gt;&lt;P&gt;        w_sbt = 'X'.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    if t_zstbmlot-process_cd = 'SubStock Release' or&lt;/P&gt;&lt;P&gt;       t_zstbmlot-process_cd = 'SUBSTOCK RELEASE'.&lt;/P&gt;&lt;P&gt;      w_processcd = 'SUBSTOCK RELEASE'.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    select single * from zibmordertype&lt;/P&gt;&lt;P&gt;           into zibmordertype where&lt;/P&gt;&lt;P&gt;           ibm_tst = w_tst and&lt;/P&gt;&lt;P&gt;           ibm_bi = w_bi and&lt;/P&gt;&lt;P&gt;           ibm_mrk = w_mrk and&lt;/P&gt;&lt;P&gt;           ibm_sbt = w_sbt and&lt;/P&gt;&lt;P&gt;           processcd = w_processcd.&lt;/P&gt;&lt;P&gt;    if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      t_zstbmlot-ordertype = zibmordertype-ordertype.&lt;/P&gt;&lt;P&gt;    else.&lt;/P&gt;&lt;P&gt;      write: 'Order type not determined for lot label:',&lt;/P&gt;&lt;P&gt;              t_zstbmlot-lotlabel.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Put into zih001 to create idoc&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    clear : edidd40, crtl.&lt;/P&gt;&lt;P&gt;    crtl-tabnam     = 'EDI_DC40'.&lt;/P&gt;&lt;P&gt;    crtl-mandt      = sy-mandt.&lt;/P&gt;&lt;P&gt;    crtl-docrel     = '620'.&lt;/P&gt;&lt;P&gt;    crtl-direct     = '02'.&lt;/P&gt;&lt;P&gt;    concatenate 'SAP' sy-sysid into crtl-rcvpor.&lt;/P&gt;&lt;P&gt;    crtl-rcvprt     = 'LS'.&lt;/P&gt;&lt;P&gt;    crtl-rcvprn     = 'SSD_PN0001'.&lt;/P&gt;&lt;P&gt;    crtl-mestyp     = 'ZCPAOC'.&lt;/P&gt;&lt;P&gt;    crtl-idoctyp    = 'ZCPAOC01'.&lt;/P&gt;&lt;P&gt;    crtl-sndpor     = 'SSD0000001'.&lt;/P&gt;&lt;P&gt;    crtl-sndprt     = 'LS'.&lt;/P&gt;&lt;P&gt;    crtl-sndprn     = 'SSD_PN0001'.&lt;/P&gt;&lt;P&gt;    transfer crtl to : tofile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear : edidd40.&lt;/P&gt;&lt;P&gt;    edidd40-segnam =  'ZIH001'.&lt;/P&gt;&lt;P&gt;    edidd40-mandt = sy-mandt.&lt;/P&gt;&lt;P&gt;    edidd40-hlevel = 1.&lt;/P&gt;&lt;P&gt;    edidd40-sdata = t_zstbmlot.&lt;/P&gt;&lt;P&gt;    transfer edidd40 to : tofile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    check not in1-data[] is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    at end of file.                                         &lt;/P&gt;&lt;P&gt;      close dataset : procfile, tofile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      call function 'EDI_DATA_INCOMING'&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          pathname = tofile&lt;/P&gt;&lt;P&gt;          port     = toport.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      check sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Remove file from idocmsgs directory after idoc processing&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      clear tmpfile.&lt;/P&gt;&lt;P&gt;      concatenate in1-dir '/' in1-file  into tmpfile.&lt;/P&gt;&lt;P&gt;      replace '//' with '/' into tmpfile.&lt;/P&gt;&lt;P&gt;      condense tmpfile no-gaps.&lt;/P&gt;&lt;P&gt;      delete dataset tmpfile.&lt;/P&gt;&lt;P&gt;    endat.                                                  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form getfile_list tables intab1 structure rsfillst using inval1 inval2 .&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call function 'SUBST_GET_FILE_LIST'&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      dirname            = inval1&lt;/P&gt;&lt;P&gt;      filenm             = ''&lt;/P&gt;&lt;P&gt;      pattern            = inval2&lt;/P&gt;&lt;P&gt;    tables&lt;/P&gt;&lt;P&gt;      file_list          = intab1&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  ACCESS_ERROR       = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  OTHERS             = 2&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            .&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    "getfile_list&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  getfile&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     --&amp;gt;P_FIELD_LIST  text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form getfile  tables intab1 structure in1&lt;/P&gt;&lt;P&gt;              using    inval structure file_list.&lt;/P&gt;&lt;P&gt;  data : xfile(128).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  clear xfile.&lt;/P&gt;&lt;P&gt;  concatenate inval-dirname '/' inval-name  into xfile.&lt;/P&gt;&lt;P&gt;  replace '//' with '/' into xfile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  open dataset xfile for input message messtab&lt;/P&gt;&lt;P&gt;                          in text mode encoding default.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  check sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  clear : str, intab1. refresh intab1-data.&lt;/P&gt;&lt;P&gt;  do.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; replace ALL OCCURRENCES OF&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        cl_abap_char_utilities=&amp;gt;horizontal_tab&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                   in xfile with space.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; replace all occurrences of '#' in xfile with space.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; replace all occurrences of ':' in xfile with space.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; replace all occurrences of '_' in xfile with space.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    read dataset xfile into str.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; replace all occurrences of '#' in str with space.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; replace all occurrences of ':' in str with space.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; replace all occurrences of '_' in str with space.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;      exit.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    intab1-file = inval-name.&lt;/P&gt;&lt;P&gt;    intab1-dir  = inval-dirname.&lt;/P&gt;&lt;P&gt;    append str to intab1-data.&lt;/P&gt;&lt;P&gt;  enddo.&lt;/P&gt;&lt;P&gt;  if not intab1-data[] is initial.&lt;/P&gt;&lt;P&gt;    append intab1.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  close dataset xfile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    " getfile&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form showdata changing inval indat.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  data : xxtab like sval occurs 100 with header line,&lt;/P&gt;&lt;P&gt;           ff0(100), ff1(30), ff2(30),  yesno.&lt;/P&gt;&lt;P&gt;  inval = indat.&lt;/P&gt;&lt;P&gt;  do.&lt;/P&gt;&lt;P&gt;    assign component sy-index of structure inval to &amp;lt;fs&amp;gt;.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Z1STB_HDR TO &amp;lt;FS&amp;gt;.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    if sy-subrc &amp;lt;&amp;gt; 0. exit. endif.&lt;/P&gt;&lt;P&gt;    describe field &amp;lt;fs&amp;gt; help-id ff0.&lt;/P&gt;&lt;P&gt;    split ff0 at  '-' into ff1 ff2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear xxtab.&lt;/P&gt;&lt;P&gt;    xxtab-tabname = ff1. xxtab-fieldname = ff2. xxtab-value = &amp;lt;fs&amp;gt;.&lt;/P&gt;&lt;P&gt;    append xxtab.&lt;/P&gt;&lt;P&gt;  enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call function 'POPUP_GET_VALUES_USER_HELP'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      popup_title     = 'Enter Order Information'&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      fields          = xxtab&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      error_in_fields = 1&lt;/P&gt;&lt;P&gt;      others          = 2.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0 .&lt;/P&gt;&lt;P&gt;    message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endform.                    "showdata&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Nov 2006 02:06:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-idoc/m-p/1663973#M294072</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-14T02:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: inbound idoc</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-idoc/m-p/1663974#M294073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi &lt;/P&gt;&lt;P&gt;i can see views are increasing inmy post. bu ti am not unable to see any when i enter. where are the views stored for this thread. now i am just clicking the reply to this thread.&lt;/P&gt;&lt;P&gt;please let me know where can i see th eviews.&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Nov 2006 02:37:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-idoc/m-p/1663974#M294073</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-14T02:37:15Z</dc:date>
    </item>
  </channel>
</rss>

