Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private String toFileFormat(List<String> listOfColumn) {
- int controlField = 10;
- int docDate = 8;
- int postingDate = 8;
- int docType = 2;
- int companyCode = 4;
- int docNumber = 10;
- int docCurrency = 5;
- int rate = 10;
- int translationDate = 8;
- int reference = 16;
- int crossCompanyCodePostingNumber = 16;
- int docHeaderText = 25;
- int calculateTaxAutomatically = 1;
- int operationFunctionFlag = 1;
- int processControlFlag = 1;
- int remarks1 = 40;
- int remarks2 = 40;
- int remarks3 = 40;
- int remarks4 = 40;
- int tradingPartner = 6;
- int reportingCntry = 2;
- int postingKey = 2;
- int account = 17;
- int special = 1;
- int assetTransctionType = 3;
- int newCoCode = 4;
- int generalLedgerAccount = 10;
- int amountInDocumentCurrency = 13;
- int amountInLocalCurrency = 13;
- int lc2Amount = 13;
- int taxCode = 2;
- int taxJurisdictionCode = 15;
- int valueDate = 8;
- int assignmentNumber = 18;
- int itemText = 50;
- int materialNumber = 18;
- int businessArea = 4;
- int orderNumber = 12;
- int wbsElement = 24;
- int profitCenter = 10;
- int purchasingDoc = 10;
- int itemNumberOfPurchasing = 5;
- int costCenter = 12;
- int plant = 4;
- int personnelNumber = 8;
- int quantity = 13;
- int unitOfMeasure = 3;
- int paymentTerms = 4;
- int discountBaseAmount = 13;
- int cashDiscountDays1 = 3;
- int cashDiscountPercentage1 = 5;
- int cashDiscountDays2 = 3;
- int cashDiscountPercentage12 = 5;
- int netPaymentTermsPeriod = 3;
- int fixedPaymentTerms = 1;
- int paymentMethod = 1;
- int pmtMethSupl = 2;
- int baselineDate = 8;
- int paymentBlock = 1;
- int partnerBankType = 4;
- int houseBank = 5;
- int issueDate = 8;
- int billExchStatus = 1;
- int plannedUsage = 1;
- int invoiceRef = 10;
- int referenceKey1 = 10;
- int referenceKey2 = 12;
- int referenceKey3 = 20;
- int speclGLAssgt = 18;
- int hedgedExchangeRate = 10;
- int hedgedAmountInForeignCurrency = 13;
- int paymentReference = 30;
- int taxAmountInDocumentCurrency = 13;
- int taxAmountInLocalCurrency = 13;
- int paymentCur = 5;
- int pmntCAmnt = 13;
- int sequentialNumberOfAccountAssignment = 2;
- int lengthOfList = listOfColumn.size();
- String fileFormatResult = "";
- int[] length = {
- controlField ,
- docDate ,
- postingDate ,
- docType ,
- companyCode ,
- docNumber ,
- docCurrency ,
- rate ,
- translationDate ,
- reference ,
- crossCompanyCodePostingNumber ,
- docHeaderText ,
- calculateTaxAutomatically ,
- operationFunctionFlag ,
- processControlFlag ,
- remarks1 ,
- remarks2 ,
- remarks3 ,
- remarks4 ,
- tradingPartner ,
- reportingCntry ,
- postingKey ,
- account ,
- special ,
- assetTransctionType ,
- newCoCode ,
- generalLedgerAccount ,
- amountInDocumentCurrency ,
- amountInLocalCurrency ,
- lc2Amount ,
- taxCode ,
- taxJurisdictionCode ,
- valueDate ,
- assignmentNumber ,
- itemText ,
- materialNumber ,
- businessArea ,
- orderNumber ,
- wbsElement ,
- profitCenter ,
- purchasingDoc ,
- itemNumberOfPurchasing ,
- costCenter ,
- plant ,
- personnelNumber ,
- quantity ,
- unitOfMeasure ,
- paymentTerms ,
- discountBaseAmount ,
- cashDiscountDays1 ,
- cashDiscountPercentage1 ,
- cashDiscountDays2 ,
- cashDiscountPercentage12 ,
- netPaymentTermsPeriod ,
- fixedPaymentTerms ,
- paymentMethod ,
- pmtMethSupl ,
- baselineDate ,
- paymentBlock ,
- partnerBankType ,
- houseBank ,
- issueDate ,
- billExchStatus ,
- plannedUsage ,
- invoiceRef ,
- referenceKey1 ,
- referenceKey2 ,
- referenceKey3 ,
- speclGLAssgt ,
- hedgedExchangeRate ,
- hedgedAmountInForeignCurrency ,
- paymentReference ,
- taxAmountInDocumentCurrency ,
- taxAmountInLocalCurrency ,
- paymentCur ,
- pmntCAmnt ,
- sequentialNumberOfAccountAssignment
- };
- for (int index = 0; index<= lengthOfList - 1; index++) {
- if (listOfColumn.get(index).length() < length[index]) {
- fileFormatResult += padRight(listOfColumn.get(index), length[index]);
- } else {
- fileFormatResult += listOfColumn.get(index);
- }
- }
- return fileFormatResult;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement