Advertisement
jarturon55

eak

Aug 27th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.15 KB | None | 0 0
  1. private String toFileFormat(List<String> listOfColumn) {
  2.         int controlField = 10;
  3.         int docDate = 8;
  4.         int postingDate = 8;
  5.         int docType = 2;
  6.         int companyCode = 4;
  7.         int docNumber = 10;
  8.         int docCurrency = 5;
  9.         int rate = 10;
  10.         int translationDate = 8;
  11.         int reference = 16;
  12.         int crossCompanyCodePostingNumber = 16;
  13.         int docHeaderText = 25;
  14.         int calculateTaxAutomatically = 1;
  15.         int operationFunctionFlag = 1;
  16.         int processControlFlag = 1;
  17.         int remarks1 = 40;
  18.         int remarks2 = 40;
  19.         int remarks3 = 40;
  20.         int remarks4 = 40;
  21.         int tradingPartner = 6;
  22.         int reportingCntry = 2;
  23.         int postingKey = 2;
  24.         int account = 17;
  25.         int special = 1;
  26.         int assetTransctionType = 3;
  27.         int newCoCode = 4;
  28.         int generalLedgerAccount = 10;
  29.         int amountInDocumentCurrency = 13;
  30.         int amountInLocalCurrency = 13;
  31.         int lc2Amount = 13;
  32.         int taxCode = 2;
  33.         int taxJurisdictionCode = 15;
  34.         int valueDate = 8;
  35.         int assignmentNumber = 18;
  36.         int itemText = 50;
  37.         int materialNumber = 18;
  38.         int businessArea = 4;
  39.         int orderNumber = 12;
  40.         int wbsElement = 24;
  41.         int profitCenter = 10;
  42.         int purchasingDoc = 10;
  43.         int itemNumberOfPurchasing = 5;
  44.         int costCenter = 12;
  45.         int plant = 4;
  46.         int personnelNumber = 8;
  47.         int quantity = 13;
  48.         int unitOfMeasure = 3;
  49.         int paymentTerms = 4;
  50.         int discountBaseAmount = 13;
  51.         int cashDiscountDays1 = 3;
  52.         int cashDiscountPercentage1 = 5;
  53.         int cashDiscountDays2 = 3;
  54.         int cashDiscountPercentage12 = 5;
  55.         int netPaymentTermsPeriod = 3;
  56.         int fixedPaymentTerms = 1;
  57.         int paymentMethod = 1;
  58.         int pmtMethSupl = 2;
  59.         int baselineDate = 8;
  60.         int paymentBlock = 1;
  61.         int partnerBankType = 4;
  62.         int houseBank = 5;
  63.         int issueDate = 8;
  64.         int billExchStatus = 1;
  65.         int plannedUsage = 1;
  66.         int invoiceRef = 10;
  67.         int referenceKey1 = 10;
  68.         int referenceKey2 = 12;
  69.         int referenceKey3 = 20;
  70.         int speclGLAssgt = 18;
  71.         int hedgedExchangeRate = 10;
  72.         int hedgedAmountInForeignCurrency = 13;
  73.         int paymentReference = 30;
  74.         int taxAmountInDocumentCurrency = 13;
  75.         int taxAmountInLocalCurrency = 13;
  76.         int paymentCur = 5;
  77.         int pmntCAmnt = 13;
  78.         int sequentialNumberOfAccountAssignment = 2;
  79.         int lengthOfList = listOfColumn.size();
  80.         String fileFormatResult = "";
  81.         int[] length = {  
  82.             controlField ,
  83.             docDate ,
  84.             postingDate ,
  85.             docType ,
  86.             companyCode ,
  87.             docNumber ,
  88.             docCurrency ,
  89.             rate ,
  90.             translationDate ,
  91.             reference ,
  92.             crossCompanyCodePostingNumber ,
  93.             docHeaderText ,
  94.             calculateTaxAutomatically ,
  95.             operationFunctionFlag ,
  96.             processControlFlag ,
  97.             remarks1 ,
  98.             remarks2 ,
  99.             remarks3 ,
  100.             remarks4 ,
  101.             tradingPartner ,
  102.             reportingCntry ,
  103.             postingKey ,
  104.             account ,
  105.             special ,
  106.             assetTransctionType ,
  107.             newCoCode ,
  108.             generalLedgerAccount ,
  109.             amountInDocumentCurrency ,
  110.             amountInLocalCurrency ,
  111.             lc2Amount ,
  112.             taxCode ,
  113.             taxJurisdictionCode ,
  114.             valueDate ,
  115.             assignmentNumber ,
  116.             itemText ,
  117.             materialNumber ,
  118.             businessArea ,
  119.             orderNumber ,
  120.             wbsElement ,
  121.             profitCenter ,
  122.             purchasingDoc ,
  123.             itemNumberOfPurchasing ,
  124.             costCenter ,
  125.             plant ,
  126.             personnelNumber ,
  127.             quantity ,
  128.             unitOfMeasure ,
  129.             paymentTerms ,
  130.             discountBaseAmount ,
  131.             cashDiscountDays1 ,
  132.             cashDiscountPercentage1 ,
  133.             cashDiscountDays2 ,
  134.             cashDiscountPercentage12 ,
  135.             netPaymentTermsPeriod ,
  136.             fixedPaymentTerms ,
  137.             paymentMethod ,
  138.             pmtMethSupl ,
  139.             baselineDate ,
  140.             paymentBlock ,
  141.             partnerBankType ,
  142.             houseBank ,
  143.             issueDate ,
  144.             billExchStatus ,
  145.             plannedUsage ,
  146.             invoiceRef ,
  147.             referenceKey1 ,
  148.             referenceKey2 ,
  149.             referenceKey3 ,
  150.             speclGLAssgt ,
  151.             hedgedExchangeRate ,
  152.             hedgedAmountInForeignCurrency ,
  153.             paymentReference ,
  154.             taxAmountInDocumentCurrency ,
  155.             taxAmountInLocalCurrency ,
  156.             paymentCur ,
  157.             pmntCAmnt ,
  158.             sequentialNumberOfAccountAssignment
  159.         };
  160.         for (int index = 0; index<= lengthOfList - 1; index++) {
  161.             if (listOfColumn.get(index).length() < length[index]) {
  162.                 fileFormatResult +=  padRight(listOfColumn.get(index), length[index]);
  163.             } else {
  164.                 fileFormatResult += listOfColumn.get(index);
  165.             }
  166.            
  167.         }
  168.         return fileFormatResult;
  169.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement