Life in a Random Box
Friday, July 27, 2012
SAP ABAP Report using Period as Column Headers
Good Day!
This is my first blog about SAP Abap. I love this programming language though quite very complex not mentioning the thousands of tables it had.
With this, I want to share some tips in creating reports using ALV. There are times when top management want to have a report like product trending in a certain period. Is it possible to create ALV column header using the period as inputted by the user? Just like the sample picture below.
The above output can be done by putting some limitations on period being entered. Period covered should only be approximately 1 year and below, unless you love to through a lot of pain, well, most proggy dork love to do it. For this sample report, I restrict period higher than 1 year. I guess you can do how to do it, co'z even a 5th grader can do it. lol..
Okay! Let's start!
In the Data declaration, I have this code in internal table.
BEGIN OF alv_Tab occurs 100,
AGENT(25),
KUNNR LIKE KNA1-KUNNR,
NAME1 LIKE KNA1-NAME1,
ARKTX LIKE VBAP-ARKTX,
QTY01 LIKE VBAP-KWMENG,
QTY02 LIKE VBAP-KWMENG,
QTY03 LIKE VBAP-KWMENG,
QTY04 LIKE VBAP-KWMENG,
QTY05 LIKE VBAP-KWMENG,
QTY06 LIKE VBAP-KWMENG,
QTY07 LIKE VBAP-KWMENG,
QTY08 LIKE VBAP-KWMENG,
QTY09 LIKE VBAP-KWMENG,
QTY10 LIKE VBAP-KWMENG,
QTY11 LIKE VBAP-KWMENG,
QTY12 LIKE VBAP-KWMENG,
TOTQTY LIKE VBAP-KWMENG,
END OF Alv_Tab.
And in the Form Field Catalog, do this.
nCol = 3.
dDate = pDate-low.
ld_color = 0.
WHILE dDate <= pDate-High.
CLEAR: xField, cWhat, xMonth, cMon.
nCol = nCol + 1.
xMonth = dDate+4(2).
xYear = dDate+2(2).
PERFORM Get_Month_Desc. ""This function will just get the month desc. in 3 ""chars
CONCATENATE cMon '-' xYear INTO cWhat.
CONCATENATE 'QTY' xMonth INTO xField.
int_fcat-fieldname = xField.
int_fcat-seltext_m = cWhat.
int_fcat-col_pos = nCol.
int_fcat-outputlen = 17.
int_fcat-do_sum = 'X'.
int_fcat-no_zero = 'X'.
append int_fcat to int_fcat.
clear int_fcat.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
MONTHS = 1
OLDDATE = dDate
IMPORTING
NEWDATE = dDate.
ENDWHILE.
That's it folks. I know this blog quite edgy, so sorry for that, it's my first time.
Wednesday, December 9, 2009
My first proggie in JAVA "Hello World!"
Good Day!
Voila! Eureka! This is my first blog. Am quite ecstatic yet nervous in writing this first blog. This first blog of mine will be about my first proggie in Java. Yes, you hear/read it, its JAVA. They say its the coolest darn thing in programming world. You could even read some quotes about java. "Can you code Java?" as a mere example. And this thing really challenges me up. Though i've been a programmer for quite a time now, starting from Clipper and now in ABAP.
And now for thousands/millions of attendance, lets get it on. Harharharhar. So sorry for that. I cant hold myself to the upcoming fights between Pacman and MoneyMan!
Anyway, today i just created my first "Hello World" proggie in Java. First and foremost, I've download the JDK 6 and after the download install. After installing, i cant hold myself to try it. So, I created my first source code of the well-known "HelloWorld!" in Notepad, obcourse!. Those beautiful GUI will come soon! As of now, i'm downloading the NetBeans 6.7.1 the recent updated one. And my fingers cant wait to try its power.
Here it is, my first Hello World from Java!
Compiling...
I've got a minor problem though i know it will, co'z i hadn't set up the path/parameters.
After searching for proper use, it compile successfully.
Running the "Hello World!".
First, i've got so annoyed why it doesn't run though it compile successfully. After a quite of trials it run. Only then i realised that Java is case-sensitive. Meaning you should type the proper filename as what you invoked in your source code. I code it as class HelloWorldApp, so i had to run it as Java HelloWorldApp.
Well, that's all for now. I've got lot of pending reports for SAP-Abap. But i'll try my best to blod anything about Information Technology can offer. From Programming to Technical help to the dreaded virus.
Voila! Eureka! This is my first blog. Am quite ecstatic yet nervous in writing this first blog. This first blog of mine will be about my first proggie in Java. Yes, you hear/read it, its JAVA. They say its the coolest darn thing in programming world. You could even read some quotes about java. "Can you code Java?" as a mere example. And this thing really challenges me up. Though i've been a programmer for quite a time now, starting from Clipper and now in ABAP.
And now for thousands/millions of attendance, lets get it on. Harharharhar. So sorry for that. I cant hold myself to the upcoming fights between Pacman and MoneyMan!
Anyway, today i just created my first "Hello World" proggie in Java. First and foremost, I've download the JDK 6 and after the download install. After installing, i cant hold myself to try it. So, I created my first source code of the well-known "HelloWorld!" in Notepad, obcourse!. Those beautiful GUI will come soon! As of now, i'm downloading the NetBeans 6.7.1 the recent updated one. And my fingers cant wait to try its power.
Here it is, my first Hello World from Java!
Compiling...
I've got a minor problem though i know it will, co'z i hadn't set up the path/parameters.
After searching for proper use, it compile successfully.
Running the "Hello World!".
First, i've got so annoyed why it doesn't run though it compile successfully. After a quite of trials it run. Only then i realised that Java is case-sensitive. Meaning you should type the proper filename as what you invoked in your source code. I code it as class HelloWorldApp, so i had to run it as Java HelloWorldApp.
Well, that's all for now. I've got lot of pending reports for SAP-Abap. But i'll try my best to blod anything about Information Technology can offer. From Programming to Technical help to the dreaded virus.
Subscribe to:
Posts (Atom)