Purpose Generate a Word document |
Solution
Remark Example The upper part of the page, including the column headers, is
within the page heading of the Word document so that the column headers
are repeated on each new page. Result
|
InputScript We read the customer orders directly from the database tables VBAK and KNA1 via the function /GUIXT/dbselect. Other options would be to use a BAPI or to call up a suitable transaction, ABAP report or an SQ01 query. // read customer orders as database join of VBAK and KNA1 Call "/guixt/dbselect" _ in.table="VBAK join KNA1 on KNA1~KUNNR = VBAK~KUNNR" _ in.fields="KNA1~NAME1,KNA1~STRAS,KNA1~PSTLZ,KNA1~ORT01, VBAK~VBELN,VBAK~AUDAT AS D1,VBAK~NETWR AS P1" _ in.orderBy="D1 ascending" _ in.condition="VBAK~AUDAT BETWEEN '20180101' AND '20180131' AND VBAK~TRVOG = '0'" _ table.values="r" // fill rtf variables Set V[rtf.month] "January" Set V[rtf.year] "2018" Set V[k] 1Set V[n] 1 label next_value// customer name if Q[ok]Set V[k] &V[k] + 1 // street CopyText fromText="r" toString="rtf.cs.&V[n]" line=&V[k] Set V[k] &V[k] + 1 // post code CopyText fromText="r" toString="rtf.cp.&V[n]" line=&V[k] Set V[k] &V[k] + 1 // city CopyText fromText="r" toString="rtf.cc.&V[n]" line=&V[k] Set V[k] &V[k] + 1 // order number CopyText fromText="r" toString="rtf.on.&V[n]" line=&V[k] Set V[k] &V[k] + 1 // order date CopyText fromText="r" toString="rtf.od.&V[n]" line=&V[k] Set V[k] &V[k] + 1 // order value CopyText fromText="r" toString="rtf.ov.&V[n]" line=&V[k] //
no decimal places, use Space as group separator "&V[rtf.ov.&V[n]]" + 0 decimals=0 groupSeparator=" " Set V[k] &V[k] + 1 Set V[n] &V[n] + 1 goto next_value endif // all GuiXT variables
are set, copy template now // save to file // display in MS Word Return Components InputAssistant |