Clubbing all Data packages into together an processing as one data packet

Hi Friends,
We may get requirement that, you need to club all the data package data into one internal table in start routine and then after if you want to send it to further targets.. :) Is it Possible in BW?
Yes It is Possible. Stop all the data packets and process them in one sequence is possible.
In BW 3.5 We can club all data packets together into one data packet in start routine.
In Start routine we can club all the data packet data into one internal table, then after you can send this internal table for further processing.

Logic to stop data packets:

DATA: packet_nbr TYPE i VALUE 1.

DATA: y_requnr TYPE rsrequnr.

DATA: Is_rec TYPE string VALUE 'G_S_IS-RECNO',
is_requnr TYPE string VALUE 'G_S_MINFO-REQUNR',
it_rsmonfact TYPE STANDARD TABLE OF ls_rsmonfact
FIELD-SYMBOLS: TYPE ANY,
TYPE ANY.
ASSIGN (is_requnr) TO .

SELECT dp_nr FROM rsmonfact
INTO TABLE it_rsmonfact
WHERE rnr = .

DESCRIBE TABLE it_rsmonfact LINES v_packet_max.

IF v_packet_nbr < v_packet_max.
APPEND LINES OF DATA_PACKAGE[] TO lt_data_package_collect[].
CLEAR: DATA_PACKAGE.
REFRESH DATA_PACKAGE.
v_packet_nbr = v_packet_nbr + 1.

CLEAR: MONITOR[], MONITOR.
MONITOR-msgid = '00'.
MONITOR-msgty = 'I'.
MONITOR-msgno = '398'.
MONITOR-msgv1 = 'All data_packages have been gathered in one. '.
MONITOR-msgv2 = 'The last DATA_PACKAGE contains all records.'.
APPEND MONITOR.

ELSE.
last data_package => perform Business Rules.
IF v_packet_max > 1.
APPEND LINES OF DATA_PACKAGE[] TO lt_data_package_collect[].
CLEAR: DATA_PACKAGE[], DATA_PACKAGE.
Write your logic @ here....

ENDIF.
ENDIF.

Dwonloading internal table into Pivot table using function moudle XXL_SIMPLE_API



Hi Friends,

Now we are discussing on how to download the data from internal table Excel in tabular format or Pivot table Format by using Function Moule "XXL_SIMPLE_API".



Here i am sharing you the example program:

EPORT ZDOWNLOAD_PIVOT.
data : begin of it_data occurs 0,
vbeln type vbeln_va,
posnr type posnr_va,
matnr type matnr,
NETPR type NETPR,
end of it_data.

DATA : " XXL_SIMPLE_API parameters and tables
y_filename LIKE gxxlt_f-file, " File name on the workstation
y_header LIKE gxxlt_p-text, " XXL interface: texts for printing a list
y_wa_col_text TYPE gxxlt_v,
y_it_col_text TYPE TABLE OF gxxlt_v, " Headings for DATA columns
y_wa_online_text TYPE gxxlt_o,
y_it_online_text TYPE TABLE OF gxxlt_o, " Table with online texts
y_wa_print_text TYPE gxxlt_p,
y_it_print_text TYPE TABLE OF gxxlt_p. " Table with print texts

*Selction Screen Options

SELECT-OPTIONS s_vbeln FOR it_data-vbeln.

*Retriving data

SELECT * from vbap INTO CORRESPONDING FIELDS OF TABLE it_data where vbeln IN s_vbeln.

IF sy-subrc NE 0.

MESSAGE 'No Data' TYPE 'I'.

ENDIF.


y_filename = 'download.xls'.
y_header = text-001. " Header Information "

* Column Headings

y_wa_col_text-col_no = '1'.
y_wa_col_text-col_name = 'Sales Order Number'.

APPEND y_wa_col_text TO y_it_col_text.

y_wa_col_text-col_no = '2'.
y_wa_col_text-col_name = 'Item Number'.
APPEND y_wa_col_text TO y_it_col_text.

y_wa_col_text-col_no = '3'.
y_wa_col_text-col_name = 'Material'.
APPEND y_wa_col_text TO y_it_col_text.

y_wa_col_text-col_no = '4'.
y_wa_col_text-col_name = 'Net Price'.
APPEND y_wa_col_text TO y_it_col_text.

* Calling a function module to down load the data

CALL FUNCTION 'XXL_SIMPLE_API'
EXPORTING
filename = y_filename
header = y_header " Heading
n_key_cols = 1 " Number of (hierarchical) key columns
TABLES
col_text = y_it_col_text
data = it_data
online_text = y_it_online_text
print_text = y_it_print_text
EXCEPTIONS
dim_mismatch_data = 1 " Non-present DATA column is referenced
file_open_error = 2 " File FILENAME cannot be opened
file_write_error = 3 " File FILENAME cannot be written to
inv_winsys = 4 " Wrong window system, DOS windows required
inv_xxl = 5 " Installation at the frontend incorrect
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*******************************************************************


After that you need to save and activate it.


“Error generating the test frame” In SE37

Normally when we are executing some function modules (through SE37) we will get some kind of error like “Error generating the test frame”.

Solution:
This error will come when we have complex parameters in the Function modules.
Test environment of function builder can’t represent these parameters in the import tab (in input) For example : generic data types, Strings, xstrings, Object references.

For more information on this check SAP OSS notes.
Regards,
Vamsi