Showing posts with label ALV. Show all posts
Showing posts with label ALV. Show all posts

Thursday, June 27, 2013

SAP ECC6.0 : LINE-SIZE and LINE-COUNT in any location.

I have to admit, these LINE-SIZE and LINE-COUNT has never come into my mind that one could put it anywhere in the coding but not at the REPORT syntax at the the first line. Nevertheless, the placement and its' way of usage had caught me by surprise. 

One of my assignments was to remove "Deleted" parts (line items) from a report. These parts, deleted, meaning no longer active or exist in the factory. All I had to do was to put in a line of code to remove this parts. That is simple. Unfortunately, this report did not properly optimized its' column width. The program was already coded in such a way it only use ALV fieldcat's output length to size its' own column. This is okay for me as long as the report work perfectly and beautifully but some of the columns were too tight. As a result of it, some values were chopped off by the ALV report. 

One way to lengthen this to display all the columns nicely is to increase the output length. Another way is to use back the DDIC structure's declared type's length (using "REUSE_ALV_FIELDCATALOG_MERGE" function module[1]). Both of these are fine way to adjust an ALV report column. However, both were not feasible at the moment. Why? There's only one reason to this and it is due to the LINE-SIZE that was initially declared in the REPORT heading. 

Generally, at one glance, one would assume, that this report does not use LINE-SIZE and LINE-COUNT too. This very report proved me wrong. W-R-O-N-G. The LINE-SIZE was strategically placed at a few locations because this is due to report types. Different report type sometimes prefer different type of LINE-SIZE. Here it goes. Now I know. I see. Mystery is solved. The LINE-SIZE was at another location.

Sources : 
[1]. For all SAP ALV Samples, go to SE80, select Package, and put "SLIS", and press Enter.

williamwilstroth... LINE-SIZE

Tuesday, June 11, 2013

SAP ECC6.0 : Maximum Char. Length Per Cell in an ALV report

I had to combine several lines (records) of a column into a string. This string will then become a value in a column. This field is known as Ref Designator or technically known as EBORT. EBORT is a field part of the explosion of BOM material. EBORT field and value can be derive from Function Module "CSAP_MAT_BOM_READ" and output is a table known as "IT_STPU". So, imagine a material being exploded into multiple sub parts; this EBORT represented the exploded BOM material.

As the main material may consist more than a hundreds of sub-materials, the string will need to be longer in order to hold as many as the sub-parts it could in a manufacturing facility. In this report, it was finely displaying because it was displaying in rows of records. Now, when the change to combine all of the referential designation of BOM parts into one single string to be displayed in an ALV; most of the remaining parts were chopped off. 

This chopping off was due to ALV's per cell only allowed 128 maximum characters to be displayed out. Hence, I had a chopped off parts of combined EBORT. So, i had the following attempt to try to expand the length in the ALV : 
- Put in "255" characters in ALV Fieldcat's INTLEN = '255'.
- Put in "255" characters in ALV Fieldcat's OUTPUTLEN = '255'.
- Declared "255" characters in the holding variable; GV_EBORT(255) TYPE C.

None of the above were able to force ALV to display a string longer than 128 in its' cell. 

Then, I found this note, 857823, that specifically states that this is "standard system behavior and cannot be changed". Now, I really need to find an alternative.

To tackle this problem, and user still insist on displaying EBORT's value in a single stream, I had to let them know the maximum characters that cell can display; I suggested that they break it into two streams or more if EBORT gets bigger.

So, my alternative solution - retain a single stream of combined EBORT but it will break into second line if it reaches 128 character. But the ceiling length I need to start breaking nicely will be reaching 120 characters or less depending on the EBORT whole next word. We don't want to break something half of a whole word.

williamwilstroth... EBORT, CSAP_MAT_BOM_READ, 128 Characters Only.