// // SAP-ABAP-FIND.VDM Ch. Ziemski 18.11.2003 // 19.11.2003 // // sucht in der Datei "abaps", die alle Y+Z-Reports enthält, // nach einem String und gibt alle Reportnamen mit den gefunden Stringzeilen // in einen weiteren Buffer aus. // #103=Buf_Num #104=Buf_Free Reg_Empty(103) // found title Reg_Empty(104) // found contents for current title Reg_Set(105,"#@$%&***") // search title Reg_Set(106,"/daten/transfer") // search string // prepare the search string Buf_Switch(#104) // try to find a string delimiter not included in the user's search strings Reg_Ins(105) // the original search string 1 Reg_Ins(106) // the original search string 2 BoF Ins_Text(.`'´"%&*:;/~^=.) // and all possible delimiters (but without comma!) Ins_Text(".") for (#105=0; #105<14 ; #105++) { // loop through all the possible delimiters Goto_Pos(#105) Reg_Copy_Block(101, Cur_Pos, CP+1) // get this possible delimiter Char(1) // advance past it Search(.|@(101)., NOERR) // search for it in the rest of the string if (EM) { // if not found: good Goto_Pos(#105+1) // delete the rest of the possible ones Del_Char(14-#105-1) Del_Block(0, #105) EoF Reg_Ins(101) // and add the found delimiter at end too break // leave the loop } } if (#105 == 14) { // if no delimiter found Dialog_Input_1(1,"`Error`, `There are no more string delimiters possible for internal use.\nAll of them are used in your string.`, `Please change your search string a bit!`", WORKAREA+CENTER,0,0) return // or so ..... } Goto_Pos(1) // just after the starting delimiter Ins_Text("|{") // and a } to please the parser BoF Ins_Text('Search(') Search(@105, ADVANCE) Reg_Ins(101) // and add the found delimiter temporary here too EoF Char(-1) // just before the ending delimiter // and a { to please the parser Ins_Text("}") Replace(",","|,", BEGIN+ALL+NOERR) // prepare the commas Search(@101, BEGIN+COUNT,2) // replace the temp. delim. with comma Del_Char(1) Ins_Text(",") EoF Ins_Text(", NOERR+ERRBREAK)") Reg_Copy_Block(101, 0, File_Size) Buf_Empty(OK) Buf_Switch(#103) while (! AT_EoF) { Buf_Switch(#103) Call(101) if (Match_Item == 1) { // if title found if (Reg_Size(103) > 0) { // already title set? if (Reg_Size(104) > 0) { // already contents for this title? Buf_Switch(#104) // append found data to result buffer Reg_Ins(103) Ins_NewLine(1) Reg_Ins(104) Ins_NewLine(1) Reg_Empty(104) Buf_Switch(#103) } } BoL Reg_Copy(103, 1) // save complete title line }else{ // else: that are found contents BoL Reg_Copy(104,1, APPEND) // save that contents (whole line) } Line(1) }