cancel
Showing results for 
Search instead for 
Did you mean: 

CSV file generation with Blank places

0 Kudos

Dear Experts,

I have a scenario Proxy to File(CSV) in SAP PI/PO 7.5

Mapping is done currently and able to get the required target structure in CSV file format which will open perfectly in excel file.

CSV file consists of multiple records ( Each record is one full report ) which is going to print as further processing. Customer want the single record should be in 36 line/rows.

For Eg:-  If the report comes in 20lines, remaining lines should appear blank upto 36lines ( 36-20 = 16lines at the end of report should come blank).

End of the report i.e., 36 line consists of page no.

So next report should start from 37line as another record (append) in the same csv file.

This blank lines might vary, if the report comes more than 20, the corresponding blank lines might change. But 36lines for single report is fixed.

Target csv file screen shot attached.

Please let me know, how to achieve that empty lines after each record ( 36 lines ) in csv file.

Thanks

Raj.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member182412
Active Contributor
0 Kudos

Hi Raj,

You can include Footer in your receiver file structure and pass required new line characters.

Structure:

Mapping:

UDF:

Execution Type: Single Values


public String createNewLines(String count, Container container) {

  StringBuilder sb = new StringBuilder();

  int start = Integer.parseInt(count);

  for (int i = start; i < 8; i++) {

  sb.append("\n");

  }

  return sb.toString();

  }

Output File:


I used 10 lines only instead of 36 lines, you can adjust based on your requirement.

Regards,

Praveen.

former_member194786
Active Contributor
0 Kudos

Hi Raj,

I am assuming you are using message mapping and content conversion subsequently for creating the records for each node. If so, have you used mapWithDefault for both nodes and fields to ensure that rows and columns are created even there is no data with the input.

Regards,

Sanjeev.

konrad_thalheim3
Active Participant
0 Kudos

Hello Raj,

if you have a mapping, then create these empty lines there with graphical mapping or an UDF.

Alternative way would be the

Kind regards

Konrad