Header data and item data into same internal table
Hi Experts,
I WANT TO KNOW THE LOGIC TO POPULATE HEADER DATA AND ITEM DATA INTO SAME INTERNAL TABLE AND AGAIN DOWNLOAD THE SAME TO EXCEL FILE .Output file should be displayed like this format
Header1 rectyp ,hdnum ,sbank ,bankl ,accnr , paytp , crda ,iso.
Item1 : rectyp ,valut ,cknum ,amount,bankl,accnr,pdate,bnktc.
Item2 : rectyp ,valut ,cknum ,amount,bankl,accnr,pdate,bnktc.
Header2: rectyp ,hdnum ,sbank ,bankl ,accnr , paytp , crda ,iso.
Item1 : rectyp ,valut ,cknum ,amount,bankl,accnr,pdate,bnktc.
Thanks
Moderator message: Please do not use all upper case in the future.
Edited by: Thomas Zloch on May 12, 2010 3:10 PM
Hi,
for example we have 3 internal tables
1> it_header 2>it_items 3>it_final (which contains all the header and item fields)
once it_header it_items are filled
loop at it_items.
read table it_header with key xyz = it_item-xyz.
if sy-subrc = 0.
here move all the header fields to it_final like below.
it_final -xfield = it_header-xfield.
endif.
here move all the item fields to it_final like below.
it_final -yfield = it_item-yfield.
append it_final.
clear it_final.
endloop.
now header and item fileds will be fillled in it_item
Similar Messages
-
How we will display the header data and item data seperately in lists
how we will display the header data and item data seperately in lists
REPORT z_alv_list_block.
TYPE-POOLS: slis. " ALV Global types
SELECTION-SCREEN :
SKIP,
BEGIN OF LINE,
COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(2) TYPE n DEFAULT '02' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
DATA:
1st Table
BEGIN OF gt_kna1 OCCURS 0, " Data displayed
kunnr LIKE kna1-kunnr, " Customer number
ernam LIKE kna1-ernam, " Name of Person who Created
erdat LIKE kna1-erdat, " Creation date
name1 LIKE kna1-name1, " Name 1
END OF gt_kna1,
2nd Table
BEGIN OF gt_mara OCCURS 0,
ernam LIKE mara-ernam, " Name of Person who Created
matnr LIKE mara-matnr, " Material number
ersda LIKE mara-e rsda, " Creation date
brgew LIKE mara-brgew, " Gross weight
END OF gt_mara,
3rd Table
BEGIN OF gt_vbak OCCURS 0,
vkorg LIKE vbak-vkorg, " Sales organization
kunnr LIKE vbak-kunnr, " Sold-to party
vbeln LIKE vbak-vbeln, " Sales document
netwr LIKE vbak-netwr, " Net Value of the Sales Order
waerk LIKE vbak-waerk, " SD document currency
END OF gt_vbak.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
Read data
SELECT * FROM kna1
UP TO p_max ROWS
INTO CORRESPONDING FIELDS OF TABLE gt_kna1.
SELECT * FROM mara
UP TO p_max ROWS
INTO CORRESPONDING FIELDS OF TABLE gt_mara.
SELECT * FROM vbak
UP TO p_max ROWS
INTO CORRESPONDING FIELDS OF TABLE gt_vbak.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'.
PERFORM list_append TABLES gt_kna1
USING '1'
'GT_KNA1'.
PERFORM list_append TABLES gt_mara
USING '2'
'GT_MARA'.
PERFORM list_append TABLES gt_vbak
USING '3'
'GT_VBAK'.
PERFORM f_list_display.
FORM USER_COMMAND *
FORM user_command USING i_ucomm LIKE sy-ucomm
is_selfield TYPE slis_selfield. "#EC CALLED
CASE i_ucomm.
WHEN '&IC1'. " Pick
CASE is_selfield-tabname.
WHEN 'GT_MARA'.
WHEN 'GT_KNA1'.
WHEN 'GT_VBAK'.
READ TABLE gt_vbak INDEX is_selfield-tabindex.
IF sy-subrc EQ 0.
Sales order number
SET PARAMETER ID 'AUN' FIELD gt_vbak-vbeln.
Display Sales Order
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM. " USER_COMMAND
----< /div>
Form list_append
FORM list_append TABLES ut_table
USING u_no TYPE char1
u_tabname TYPE slis_tabname.
Macro definition
DEFINE m_fieldcat.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA :
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv. " Sort table
DATA:
lt_events TYPE slis_t_event,
ls_event TYPE slis_alv_event,
ls_layout TYPE slis_layout_alv.
ls_layout-group_change_edit = 'X'.
ls_layout-colwidth_optimize = 'X'.
ls_layout-zebra = 'X'.
ls_layout-detail_popup = 'X'.
ls_layout-get_selinfos = 'X'.
ls_layout-max_linesize = '200'.
CASE u_no.
WHEN '1'.
Build field catalog and sort table
m_fieldcat 'KUNNR' 'KNA1'.
m_fieldcat 'ERNAM' 'KNA1'.
m_fieldcat 'ERDAT' 'KNA1'.
m_fieldcat 'NAME1' 'KNA1'.
m_sort 'KUNNR'.
WHEN '2'.
m_fieldcat 'MATNR' 'MARA'.
m_fieldcat 'ERNAM' 'MARA'.
m_fieldcat 'ERSDA' 'MARA'.
m_fieldcat 'BRGEW' 'MARA'.
m_sort 'MATNR'.
WHEN '3'.
m_fieldcat 'VBELN' 'VBAK'.
m_fieldcat 'VKORG' 'VBAK'.
m_fieldcat 'KUNNR' 'VBAK'.
m_fieldcat 'NETWR' 'VBAK'.
m_fieldcat 'WAERK' 'VBAK'.
m_sort 'VBELN'.
ENDCASE.
IF u_no CA '13'.
MOVE 'TOP_OF_PAGE' TO ls_event-name.
CONCATENATE 'TOP_OF_PAGE' u_no INTO ls_event-form.
APPEND ls_event TO lt_events.
ELSE.
MOVE 'TOP_OF_LIST' TO ls_event-name.
CONCATENATE 'TOP_OF_LIST' u_no INTO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
it_fieldcat = lt_fieldcat
is_layout = ls_layout
i_tabname = u_tabname
it_events = lt_events
it_sort = lt_sort
i_text =
TABLES
t_outtab = ut_table
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " LIST_APPEND
Form f_list_display
FORM f_list_display.
DATA ls_print TYPE slis_print_alv.
ls_print-no_print_selinfos = 'X'. " Display no selection infos
ls_print-no_print_listinfos = 'X'. " Display no listinfos
ls_print-reserve_lines = 2. " Lines reserved for end of page
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
is_print = ls_print
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " F_LIST_DISPLAY
FORM top_of_page1 *
FORM top_of_page1. "#EC CALLED
PERFORM top_of_page.
ENDFORM.
FORM top_of_page3 *
FORM top_of_page3. "#EC CALLED
PERFORM top_of_page.
ENDFORM.
FORM top_of_page *
FORM top_of_page.
ULINE.
WRITE : sy-uname, sy-title(56) CENTERED, sy-datum.
ULINE.
ENDFORM.
FORM top_of_list2 *
FORM top_of_list2. "#EC CALLED
WRITE 'TOP OF LIST2'.
ENDFORM.
END OF PROGRAM Z_ALV_LIST_BLOCK *********************** -
How to extract data from info cube into an internal table using ABAP code
HI
Can Anyone plz suggest me
How to extract data from info cube into an internal table using ABAP code like BAPI's or function modules.
Thankx in advance
regds
AJAYHI Dinesh,
Thankq for ur reply
but i ahve already tried to use the function module.
When I try to Use the function module RSDRI_INFOPOV_READ
I get an information message "ERROR GENERATION TEST FRAME".
can U plz tell me what could be the problem
Bye
AJAY -
In BDC how you handled header data and item data
In BDC how you handled header data and item data
Raja,
Can you be more clear ?
Usually you load the header data one and then loop at the item data and then load the item data.
This example should help you.
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
Regards,
Ravi
Note - Please mark all the helpful answers -
Data from field symbol into an internal table or workarea
Hi Experts,
I have field symbol in which i get the data. I want to get this data into an internal table of type any or into an work area. How is this possible.
My declaration for field symbol is as follow:
FIELD-SYMBOLS: <l_t_data> TYPE any.
DATA l_r_data TYPE REF TO data.
CREATE DATA l_r_data type STANDARD TABLE OF (l_local_tab).
ASSIGN l_r_data->* TO <l_t_data>.
I get the data in this field symbol <l_t_data>. by passing into a funtion module. and I get the data into it. Now i have to assign the values of this field symbol to any internal table or to a work are how do i do it. Please help.
Regards,
Prashant.Not exactly sure what you need here, but.....
FIELD-SYMBOLS: <l_t_data> TYPE TABLE. "<<-- Change this
FIELD-SYMBOLS: <l_s_data> TYPE ANY. "<<---Add This
DATA l_r_data TYPE REF TO data.
CREATE DATA l_r_data type STANDARD TABLE OF (l_local_tab).
ASSIGN l_r_data->* TO <l_t_data>.
Loop at <l_t_data> assigning <l_s_data>.
* Do what ever using <l_s_data>
Endloop.
Regards,
Rich Heilman
Edited by: Rich Heilman on Feb 28, 2008 2:42 PM -
How to Down load Data in Application server into the Internal Table
hi freinds,
iam having a file in the application server.
now i need to send the data in the file to the internal table.
is there any Function Module?
i need with out using the OPEN DATA SET and CLOSE DATA SET Keywords.
is there any possible?
Regard's,
Ranjith.Hi,
There is no other option for uploading the data from the application server to the internal table without using OPEN DATASET and CLOSE DATASET. Even if you find the FM internal logic in FM uses these keywords to read the data from Application server. -
How to read xml file and place it into an internal table...
hello all,
can any one help me in - how to read xml data file (placed in application server) and placing the same into an internal table (remove the xml tags or say fetching the xml data without xml tags).Hi Murashali,
use this.
TYPES: BEGIN OF day,
name TYPE string,
work(1) TYPE c,
END OF day.
DATA: BEGIN OF week,
day1 TYPE day,
day2 TYPE day,
day3 TYPE day,
day4 TYPE day,
day5 TYPE day,
day6 TYPE day,
day7 TYPE day,
END OF week.
DATA xml_string TYPE string.
DATA result LIKE week.
week-day1-name = 'Monday'. week-day1-work = 'X'.
week-day2-name = 'Tuesday'. week-day2-work = 'X'.
week-day3-name = 'Wednesday'. week-day3-work = 'X'.
week-day4-name = 'Thursday'. week-day4-work = 'X'.
week-day5-name = 'Friday'. week-day5-work = 'X'.
week-day6-name = 'Saturday'. week-day6-work = ' '.
week-day7-name = 'Sunday'. week-day7-work = ' '.
CALL TRANSFORMATION ...
SOURCE root = week
RESULT XML xml_string.
CALL TRANSFORMATION ...
SOURCE XML xml_string
RESULT root = result.
Regards,
Vijay -
hello all,
i am a novice in ABAP. in tables can someone tell me what is header data, item data. how do u recognise the tables from their name? like someone told me that if the table name start with B the table is related to FICO and if it ends with K it is header data. can some one give me an in-depth explanation of how to identify these and what actually are these?
thanx in advance.HI,
While adding or retrieving records to / from internal table we have to keep the record temporarily.
The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.
e.g.
data: begin of itab occurs 10,
ab type c,
cd type i,
end of itab. " this table will have the header line.
data: wa_itab like itab. " explicit work area for itab
data: itab1 like itab occurs 10. " table is without header line.
The header line is a field string with the same structure as a row of the body, but it can only hold a single row.
It is a buffer used to hold each record before it is added or each record as it is retrieved from the internal table. It is the default work area for the internal table
1) The difference between
whih header line and with out heater line of internal table.
ex:-
a) Data : itab like mara occurs 0 with header line.
b) Data: itab like mara occurs 0.
-While adding or retrieving records to / from internal table we have to keep the record temporarily.
-The area where this record is kept is called as work area for the internal table.
-The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
-Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.
a) Data : itab like mara occurs 0 with header line.
table is with header line
b) Data: itab like mara occurs 0.
table is without header line
Regards,
Laxmi. -
NESTED TABLES,,Header data and Item data
How to arrange them in the hierarchy view?
How to put a condition on the item table so that only corresponding items from the item table will be shown for each header.
header table data 1211
1212
item table data is 1211 10
1211 20
1212 10
1212 20
so final output should be
1211
1211 10
1211 20
1212
1212 10
1212 20.
So how to put this condition?
Can you please help me
Regards
sasiHi,
If you designing the form using SFP Transaction, then you have to set the where clause on the item table in the context.
In the SFP context drag the header table from interface.drag the item table from interface on the DATA in the header table. it will placed at the end of the header table. Now select the item table select where clause in the properties ( at the bottom of the screen ).there you create a line for condition using create button. drag the field from header table field ( say header-matnr ) on the right side and then drag the same field from the item table ( say item-matnr) in the left side.This will filter the item records relevent for header record.
In the layout, design the table as I explained in the forum message .( search forum with text "Nested Tables and Multiple Pages" )
pavan meda -
SAMPLE download PROG USING HEAER DATA AND ITEM DATA
HI, ALL
I AM NEW TO BDC PLZ ANY ONE CAN HELP
my requirement is
header data like this :
first headr data should be download after that corresponding multipule line item should be download it should possibule to download and upload
ex:
header data : 9000 abac 333 4343
item data : 12 fdf vfdf
13 dfdfd fdfdf
14 545
plz any one can send sample bdc program for uploading and downloading
THANKS AND REGARDS
SAI
Edited by: k sai ram on Jan 7, 2008 8:43 AMTry the ABAP forums instead of the suggestions and comments forum.
Paul -
Conversion of a string output and store them into the internal table fields
Hi,
I'm writing a program in which I'm populating the values generated in TCODE- 'AL11' I'm able to retrieve the data in string format but I've to break the string and put the values in an internal table. The internal table has fields of various lengths and no specific position where I can use a delimiter and use the Split command.
Kindly provide me suggestions how I can break the string and assign the values in the fields of the internal table.
Regards,
Sreedhar.Hi,
Take the screen fields length and create an internal table.
loop the internal table and first split the string at delimeter( use cl_abap_char_utilities)
CONSTANTS:
c_delimiter TYPE c VALUE
cl_abap_char_utilities=>horizontal_tab,
c_delimiter_enter TYPE c VALUE
cl_abap_char_utilities=>cr_lf.
loop at itab into fs.
SPLIT w_str AT c_delimiter_enter INTO w_str w_dummy .
" SPLITTING AT 'ENTER KEY'
SPLIT w_str AT c_delimiter INTO
" SPLITTING AT 'TAB'
fs-f1,
fs-f2.
append fs to itab.
clear fs.
endloop. -
Selecting values into same internal table from 2 differrnt select statement
Hi Friends,
code :
types :
begin of ty_bsad,
augbl type bsad-augbl,
end of ty_bsad.
begin of ty_bsad1,
augbl type bsad-augbl,
belnr type bsad-belnr,
end of ty_bsad1.
select augbl
from bsad
into table it_bsad
where belnr = l_vbeln and
bukrs = l_bukrs and
kunnr = l_kunrg.
if sy-subrc = 0 .
select belnr
into table lt_bsad1
from bsad
for all entries in lt_bsad
where augbl = lt_bsad-augbl and
kunnr = l_kunnr and
burks = l_bukrs and
blart = 'xy'.
now my requiremnt is i need to get both the augbl and belnr in single internal table but not in differnrnt internal table.
how can i get it.
Regards,
Priyanka.
Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 10:53 AMHI.
No Need to create two internal table because your feyching values from same table BSAD with diffrent where condition.try this code.it s work.
select augbl
from bsad
into table it_bsad
where belnr = l_vbeln and
bukrs = l_bukrs and
kunnr = l_kunrg and
blart = 'xy'.
else Refer this code.
LOOP AT it_bill_data INTO wa_bill_data.
MOVE-CORRESPONDING wa_bill_data TO wa_final_data.
READ TABLE it_material_data INTO wa_material_data
WITH KEY matnr = wa_bill_data-matnr.
IF sy-subrc = 0.
wa_final_data-meins_mara = wa_material_data-meins.
ENDIF.
APPEND wa_final_data TO it_final_data.
ENDLOOP.
Regards.
Jay
Edited by: Jay on Jan 8, 2009 2:53 PM
Edited by: Jay on Jan 8, 2009 2:57 PM
Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 10:56 AM -
Download the KTOPL field data and GLT0 table data into one Internal table
Hi,
I have downloaded GLT0 table fields data to PC file . But i need to download KTOPL(Chart Of Accounts) data also. in GLT0 table there is no KTOPL field.
But in SKA1 table have KTOPL field. Then what is the issue is GLT0 data & KTOPL field data needs to download into one Internal Table.
anybody could you please solve this problem. immediately need to solve this.
Below is the code.
REPORT ZFXXEABL_1 NO STANDARD PAGE HEADING
LINE-SIZE 200.
Tables Declaration
TABLES : GLT0.
Data Declaration
DATA : FP(8) TYPE C,
YEAR LIKE GLT0-RYEAR,
PERIOD(3) TYPE C,
DBALANCE LIKE VBAP-NETWR VALUE 0 ,
CBALANCE LIKE VBAP-NETWR VALUE 0.
*Internal table for for final data..
DATA : BEGIN OF REC1 OCCURS 0,
BAL LIKE GLT0-TSLVT value 0,
COAREA LIKE GLT0-RBUSA,
CA(4) TYPE C,
KTOPL LIKE ska1-ktopl,
CCODE LIKE GLT0-BUKRS,
CREDIT LIKE VBAP-NETWR,
CURRENCY LIKE GLT0-RTCUR,
CURTYPE(2) TYPE N,
DEBIT LIKE VBAP-NETWR,
YEAR(8) TYPE C,
FY(2) TYPE C,
ACCOUNT LIKE GLT0-RACCT,
VER LIKE GLT0-RVERS,
VTYPE(2) TYPE N,
CLNT LIKE SY-MANDT,
S_SYS(3) TYPE C,
INDICATOR LIKE GLT0-DRCRK,
END OF REC1.
DATA : C(2) TYPE N,
D(2) TYPE N.
DATA REC1_H LIKE REC1.
Variable declarations
DATA :
W_FILES(4) TYPE N,
W_DEBIT LIKE GLT0-TSLVT,
W_CREDIT LIKE GLT0-TSLVT,
W_PCFILE LIKE RLGRAP-FILENAME ,
W_UNIXFILE LIKE RLGRAP-FILENAME,
W_PCFILE1 LIKE RLGRAP-FILENAME,
W_UNIXFIL1 LIKE RLGRAP-FILENAME,
W_EXT(3) TYPE C,
W_UEXT(3) TYPE C,
W_PATH LIKE RLGRAP-FILENAME,
W_UPATH LIKE RLGRAP-FILENAME,
W_FIRST(1) TYPE C VALUE 'Y',
W_CFIRST(1) TYPE C VALUE 'Y',
W_PCFIL LIKE RLGRAP-FILENAME.
DATA: "REC LIKE GLT0 OCCURS 0 WITH HEADER LINE,
T_TEMP LIKE GLT0 OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF REC3 OCCURS 0.
INCLUDE STRUCTURE GLT0.
DATA: KTOPL LIKE SKA1-KTOPL,
END OF REC3.
DATA: BEGIN OF T_KTOPL OCCURS 0,
KTOPL LIKE SKA1-KTOPL,
SAKNR LIKE SKA1-SAKNR,
END OF T_KTOPL.
Download data.
DATA: BEGIN OF I_REC2 OCCURS 0,
BAL(17), " like GLT0-TSLVT value 0,
COAREA(4), " like glt0-rbusa,
CA(4), " chart of accounts
CCODE(4), " like glt0-bukrs,
CREDIT(17), " like vbap-netwr,
CURRENCY(5), " like glt0-rtcur,
CURTYPE(2), " type n,
DEBIT(17), " like vbap-netwr,
YEAR(8), " type c,
FY(2), " type c, fiscal yr variant
ACCOUNT(10), " like glt0-racct,
VER(3), " like glt0-rvers,
VTYPE(3), " type n,
CLNT(3), "like sy-mandt,
S_SYS(3), "like sy-sysid,
INDICATOR(1), " like glt0-drcrk,
END OF I_REC2.
Selection screen. *
SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-BL1.
SELECT-OPTIONS : COMPCODE FOR GLT0-BUKRS,
GLACC FOR GLT0-RACCT,
FISYEAR FOR GLT0-RYEAR,
no intervals no-extension, "- BG6661-070212
FISCPER FOR GLT0-RPMAX,
busarea for glt0-rbusa,
CURRENCY FOR GLT0-RTCUR.
SELECTION-SCREEN END OF BLOCK BL1.
SELECTION-SCREEN BEGIN OF BLOCK BL2 WITH FRAME TITLE TEXT-BL2.
PARAMETERS:
P_UNIX AS CHECKBOX, "Check box for Unix Option
P_UNFIL LIKE RLGRAP-FILENAME, " Unix file Dnload file name
default '/var/opt/arch/extract/GLT0.ASC', "- BG6661-070212
P_PCFILE AS CHECKBOX, "Check box for Local PC download.
P_PCFIL LIKE RLGRAP-FILENAME " PC file Dnload file name
default 'C:\GLT0.ASC'. "- BG6661-070212
DEFAULT 'C:\glt0_gl_balance_all.asc'. "+ BG6661-070212
SELECTION-SCREEN END OF BLOCK BL2.
*eject
Initialization. *
INITIALIZATION.
Try to default download filename
p_pcfil = c_pcfile.
p_unfil = c_unixfile.
if sy-sysid eq c_n01.
p_unfil = c_unixfile.
endif.
if sy-sysid eq c_g21.
p_unfil = c_g21_unixfile.
endif.
if sy-sysid eq c_g9d.
p_unfil = c_g9d_unixfile.
endif.
Default for download filename
*{ Begin of BG6661-070212
CONCATENATE C_UNIXFILE
SY-SYSID C_FSLASH C_CHRON C_FILENAME INTO P_UNFIL.
*} End of BG6661-070212
AT SELECTION-SCREEN OUTPUT.
loop at screen.
if screen-name = 'P_PCFIL'. "PC FILE
screen-input = '0'.
modify screen.
endif.
if screen-name = 'P_UNFIL'. "UN FILE
screen-input = '0'.
modify screen.
endif.
endloop.
if w_first = 'Y'.
perform path_file.
w_first = 'N'.
endif.
if w_cfirst = 'Y'.
perform cpath_file.
w_cfirst = 'N'.
endif.
Start-of-Selection. *
START-OF-SELECTION.
*COLLECT DATA
PERFORM COLLECT_DATA.
*BUILD FILENAMES
PERFORM BUILD_FILES.
*LOCAL
IF P_PCFILE = C_YES.
PERFORM LOCAL_DOWNLOAD.
ENDIF.
*UNIX
IF P_UNIX = C_YES.
PERFORM UNIX_DOWNLOAD.
ENDIF.
IF P_PCFILE IS INITIAL AND P_UNIX IS INITIAL.
MESSAGE I000(ZL) WITH 'Down load flags both are unchecked'.
ENDIF.
END-OF-SELECTION.
IF P_PCFILE = C_YES.
WRITE :/ 'PC File' , C_UNDER, P_PCFIL.
ENDIF.
*& Form DOWNLOAD
Download *
FORM DOWNLOAD.
P_PCFIL = W_PATH.
DATA LIN TYPE I.
DESCRIBE TABLE I_REC2 LINES LIN.
WRITE:/ 'No of Records downloaded = ',LIN.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = P_PCFIL
FILETYPE = C_ASC "c_dat "dat
TABLES
DATA_TAB = I_REC2 " t_str
fieldnames = t_strhd
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
IF SY-SUBRC EQ 0.
ENDIF.
ENDFORM.
*& Form WRITE_TO_SERVER
text *
--> p1 text
<-- p2 text
FORM WRITE_TO_SERVER.
DATA : L_MSG(100) TYPE C,
L_LINE(5000) TYPE C.
P_UNFIL = W_UPATH.
DATA LIN TYPE I.
DESCRIBE TABLE I_REC2 LINES LIN.
WRITE:/ 'No of Records downloaded = ',LIN.
OPEN DATASET P_UNFIL FOR OUTPUT IN TEXT MODE. " message l_msg.
IF SY-SUBRC <> 0.
WRITE: / L_MSG.
ENDIF.
perform header_text1.
LOOP AT I_REC2.
TRANSFER I_REC2 TO P_UNFIL.
ENDLOOP.
CLOSE DATASET P_UNFIL.
WRITE : / C_TEXT , W_UPATH.
SPLIT W_UNIXFILE AT C_DOT INTO W_UNIXFIL1 W_UEXT.
CLEAR W_UPATH.
IF NOT W_UEXT IS INITIAL.
CONCATENATE W_UNIXFIL1 C_DOT W_UEXT INTO W_UPATH.
ELSE.
W_UEXT = C_ASC. " c_csv.
CONCATENATE W_UNIXFIL1 C_DOT W_UEXT INTO W_UPATH.
ENDIF.
ENDFORM. " WRITE_TO_SERVER
*& Form BUILD_FILES
FORM BUILD_FILES.
IF P_PCFILE = C_YES.
W_PCFILE = P_PCFIL.
***Split path at dot**
SPLIT W_PCFILE AT C_DOT INTO W_PCFILE1 W_EXT.
IF NOT W_EXT IS INITIAL.
CONCATENATE W_PCFILE1 C_DOT W_EXT INTO W_PATH.
ELSE.
W_PATH = W_PCFILE1.
ENDIF.
ENDIF.
IF P_UNIX = C_YES.
W_UNIXFILE = P_UNFIL.
SPLIT W_UNIXFILE AT C_DOT INTO W_UNIXFIL1 W_UEXT.
IF NOT W_UEXT IS INITIAL.
CONCATENATE W_UNIXFIL1 C_DOT W_UEXT INTO W_UPATH.
ELSE.
W_UPATH = W_UNIXFIL1.
ENDIF.
ENDIF.
ENDFORM.
FORM CPATH_FILE.
CLEAR P_PCFIL.
CONCATENATE C_PCFILE
C_COMFILE SY-SYSID C_UNDER SY-DATUM SY-UZEIT
C_DOT C_ASC INTO P_PCFIL.
ENDFORM. " CPATH_FILE
FORM PATH_FILE.
CLEAR P_UNFIL.
if sy-sysid eq c_n01.
CONCATENATE C_UNIXFILE
C_COMFILE SY-SYSID C_UNDER SY-DATUM SY-UZEIT
C_DOT C_ASC INTO P_UNFIL.
endif.
if sy-sysid eq c_g21.
concatenate c_g21_unixfile
c_comfile sy-sysid c_under sy-datum sy-uzeit
c_dot c_asc into p_unfil.
endif.
if sy-sysid eq c_g9d.
concatenate c_g9d_unixfile
c_comfile sy-sysid c_under sy-datum sy-uzeit
c_dot c_asc into p_unfil.
endif.
ENDFORM. " PATH_FILE
Local_Download *
Local *
FORM LOCAL_DOWNLOAD.
perform header_text.
LOOP AT REC1.
REC1-CLNT = SY-MANDT.
REC1-S_SYS = SY-SYSID.
MOVE: REC1-BAL TO I_REC2-BAL,
REC1-COAREA TO I_REC2-COAREA,
REC1-CA TO I_REC2-CA,
REC1-KTOPL TO I_REC2-CA,
REC1-CCODE TO I_REC2-CCODE,
REC1-CREDIT TO I_REC2-CREDIT,
REC1-CURRENCY TO I_REC2-CURRENCY,
REC1-CURTYPE TO I_REC2-CURTYPE,
REC1-DEBIT TO I_REC2-DEBIT,
REC1-YEAR TO I_REC2-YEAR,
REC1-FY TO I_REC2-FY,
REC1-ACCOUNT TO I_REC2-ACCOUNT,
REC1-VER TO I_REC2-VER,
REC1-VTYPE TO I_REC2-VTYPE,
REC1-CLNT TO I_REC2-CLNT,
REC1-S_SYS TO I_REC2-S_SYS,
REC1-INDICATOR TO I_REC2-INDICATOR.
APPEND I_REC2.
CLEAR I_REC2.
ENDLOOP.
IF NOT I_REC2[] IS INITIAL.
PERFORM DOWNLOAD .
CLEAR I_REC2.
REFRESH I_REC2.
ELSE.
WRITE : / ' no record exist due to unavailability of data'.
ENDIF.
ENDFORM. " LOCAL_DOWNLOAD
*& Form UNIX_DOWNLOAD
FORM UNIX_DOWNLOAD.
LOOP AT REC1.
REC1-CLNT = SY-MANDT.
REC1-S_SYS = SY-SYSID.
MOVE: REC1-BAL TO I_REC2-BAL,
REC1-COAREA TO I_REC2-COAREA,
REC1-CA TO I_REC2-CA,
REC1-KTOPL TO I_REC2-CA,
REC1-CCODE TO I_REC2-CCODE,
REC1-CREDIT TO I_REC2-CREDIT,
REC1-CURRENCY TO I_REC2-CURRENCY,
REC1-CURTYPE TO I_REC2-CURTYPE,
REC1-DEBIT TO I_REC2-DEBIT,
REC1-YEAR TO I_REC2-YEAR,
REC1-FY TO I_REC2-FY,
REC1-ACCOUNT TO I_REC2-ACCOUNT,
REC1-VER TO I_REC2-VER,
REC1-VTYPE TO I_REC2-VTYPE,
SY-MANDT TO I_REC2-CLNT,
SY-SYSID TO I_REC2-S_SYS,
REC1-INDICATOR TO I_REC2-INDICATOR.
APPEND I_REC2.
CLEAR I_REC2.
ENDLOOP.
IF NOT I_REC2[] IS INITIAL.
PERFORM WRITE_TO_SERVER.
CLEAR I_REC2.
REFRESH I_REC2.
ELSE.
WRITE : / ' no record exist due to unavailability of data'.
ENDIF.
ENDFORM. " UNIX_DOWNLOAD
*& Form HEADER_TEXT
text *
--> p1 text
<-- p2 text
*form header_text.
concatenate c_bal c_ba c_ca c_cc c_credit c_currency c_curtype
c_debit c_fisyear c_fisvar c_acct c_ver c_vtype c_indicator
into t_strhd
separated by c_comma.
append t_strhd.
*endform. " HEADER_TEXT
*& Form HEADER_TEXT1
text *
*form header_text1.
concatenate c_bal c_ba c_ca c_cc c_credit c_currency c_curtype
c_debit c_fisyear c_fisvar c_acct c_ver c_vtype c_indicator
into t_strhd1
separated by c_comma.
append t_strhd1.
transfer t_strhd1 to p_unfil.
*endform. " HEADER_TEXT1
*& Form COLLECT_DATA
Collect Data *
FORM COLLECT_DATA.
SELECT * FROM GLT0 INTO TABLE REC3
WHERE BUKRS IN COMPCODE
AND RYEAR IN FISYEAR
AND RPMAX IN FISCPER
AND RACCT IN GLACC
AND RTCUR IN CURRENCY.
SELECT KTOPL FROM SKA1
INTO TABLE T_KTOPL
FOR ALL ENTRIES IN REC3
WHERE SAKNR = REC3-RACCT.
LOOP AT REC3 .
select *
from glt0
into table t_temp
where rldnr = rec-rldnr
and rrcty = rec-rrcty
and rvers = rec-rvers
and bukrs = rec-bukrs
and ryear = rec-ryear
and racct = rec-racct
and rbusa = rec-rbusa
and rtcur <> 'ZAR'
and rpmax = rec-rpmax.
if sy-subrc = 0.
rec1-bal = '0.00'.
else.
rec1-bal = rec-hslvt.
endif.
*READ TABLE T_KTOPL WITH KEY SAKNR = REC-RACCT BINARY SEARCH.
MOVE T_KTOPL-KTOPL TO REC3-KTOPL.
CLEAR: CBALANCE, DBALANCE.
REC1-BAL = REC3-HSLVT.
IF REC3-DRCRK = 'S'.
IF REC3-HSLVT NE C_ZERO.
YEAR = REC-RYEAR.
PERIOD = '000'.
CONCATENATE PERIOD C_DOT YEAR INTO FP.
REC1-INDICATOR = REC-DRCRK.
REC1-DEBIT = C_ZERO.
REC1-CREDIT = C_ZERO.
REC1-CCODE = REC-BUKRS.
REC1-YEAR = FP.
REC1-CURRENCY = REC-RTCUR.
REC1-ACCOUNT = REC-RACCT.
rec1-bal = rec-hslvt.
dbalance = rec1-bal.
REC1-CURTYPE = C_CTYPE.
REC1-FY = C_FY.
REC1-COAREA = REC-RBUSA.
REC1-VER = REC-RVERS.
REC1-VTYPE = C_CTYPE.
REC1-CA = C_CHART.
APPEND REC1.
C = 0.
PERFORM D.
ENDIF.
IF REC3-HSL01 NE C_ZERO.
YEAR = REC3-RYEAR.
PERIOD = '001'.
CONCATENATE PERIOD C_DOT YEAR INTO FP.
REC1-INDICATOR = REC3-DRCRK.
REC1-DEBIT = REC3-HSL01 .
REC1-CCODE = REC3-BUKRS.
REC1-YEAR = FP.
REC1-CURRENCY = REC3-RTCUR.
REC1-ACCOUNT = REC3-RACCT.
rec1-bal = REC3-hsl01 + dbalance.
dbalance = rec1-bal.
REC1-CURTYPE = C_CTYPE.
REC1-FY = C_FY.
REC1-COAREA = REC3-RBUSA.
REC1-VER = REC3-RVERS.
REC1-VTYPE = C_CTYPE.
REC1-CA = C_CHART.
REC1-KTOPL = REC3-KTOPL.
APPEND REC1.
C = 1.
PERFORM D.
ENDIF.
IF REC3-HSL02 NE C_ZERO.
REC1-DEBIT = REC3-HSL02.
YEAR = REC3-RYEAR.
PERIOD = '002'.
CONCATENATE PERIOD C_DOT YEAR INTO FP.
REC1-INDICATOR = REC3-DRCRK.
REC1-DEBIT = REC3-HSL02.
REC1-CCODE = REC3-BUKRS.
REC1-YEAR = FP.
REC1-CURRENCY = REC3-RTCUR.
REC1-ACCOUNT = REC3-RACCT.
rec1-bal = REC3-hsl02 + dbalance.
dbalance = rec1-bal.
REC1-CURTYPE = C_CTYPE.
REC1-FY = C_FY.
REC1-COAREA = REC3-RBUSA.
REC1-VER = REC3-RVERS.
REC1-VTYPE = C_CTYPE.
REC1-CA = C_CHART. "-BF7957-070503
REC1-KTOPL = REC3-KTOPL. "+BF7957-070503
APPEND REC1.
C = 2.
PERFORM D.
ENDIF.
IF REC3-HSL03 NE C_ZERO.
YEAR = REC3-RYEAR.
PERIOD = '003'.
CONCATENATE PERIOD C_DOT YEAR INTO FP.
REC1-INDICATOR = REC3-DRCRK.
REC1-DEBIT = REC3-HSL03.
REC1-CCODE = REC3-BUKRS.
REC1-YEAR = FP.
REC1-CURRENCY = REC3-RTCUR.
REC1-ACCOUNT = REC3-RACCT.
rec1-bal = REC3-hsl03 + dbalance .
dbalance = rec1-bal.
REC1-CURTYPE = C_CTYPE.
REC1-FY = C_FY.
REC1-COAREA = REC3-RBUSA.
REC1-VER = REC3-RVERS.
REC1-VTYPE = C_CTYPE.
REC1-CA = C_CHART. "-BF7957-070503
REC1-KTOPL = REC3-KTOPL. "+BF7957-070503
APPEND REC1.
C = 3.
PERFORM D.
ENDIF.
IF REC3-HSL04 NE C_ZERO.
REC1-DEBIT = REC3-HSL04.
YEAR = REC3-RYEAR.
PERIOD = '004'.
CONCATENATE PERIOD C_DOT YEAR INTO FP.
REC1-INDICATOR = REC3-DRCRK.
REC1-DEBIT = REC3-HSL04.
REC1-CCODE = REC3-BUKRS.
REC1-YEAR = FP.
REC1-CURRENCY = REC3-RTCUR.
REC1-ACCOUNT = REC3-RACCT.
rec1-bal = REC3-hsl04 + dbalance .
REC1-CURTYPE = C_CTYPE.
REC1-FY = C_FY.
REC1-COAREA = REC3-RBUSA.
REC1-VER = REC3-RVERS.
REC1-VTYPE = C_CTYPE.
REC1-CA = C_CHART. "-BF7957-070503
REC1-KTOPL = REC3-KTOPL. "+BF7957-070503
APPEND REC1.
dbalance = rec1-bal.
C = 4.
PERFORM D.
ENDIF.
Thanks and Regards,
Ramuse logical database SDF, nodes ska1 and skc1c
A. -
Header and Item Data Extraction
Hi Gurus,
For reporting needs, I have to extract both Sales Billing Header (2LIS_13_VDHDR) and Item Data (2LIS_13_VDITM).
Can anyone please give me some idea about the Data Staging.
1. Do I need to create 2 DSO (1 for Header and 1 for Item) for loading the respective Data and then push them into 1 Cube ?
Or
2. I create 2 Cubes (1 for Header and 1 for Item) and load the Data into them.
Or
3. I extract both Data Sources into 1 DSO or 1 Cube.
I have to do reporting on MultiProvider so in all 3 cases (OR as you suggest) I have to link all the InfoProvider to 1 MultiProvider.
Please let me know the right way and guide me ASAP.
Points will be awarded !!!Hi as you are loading with the standard Business content datasources for the cubes , it is better to load for their respective cubes which are in business content. The performance of the system also good ,if we use business content objects.
Then come to your requirement, just load the data for the Business content cubes for the respected datasource and combine them With Multiproviders and generate reports
Hope it can help you -
Hi All,
I have loaded a DSO, with Hdr data and Item Data,. The Key is DOC_NUM and DOC_ITEM.
I hv taken a PO number for testing and henceforth, the data in DSO, shows something like this.
456000337 > > 0.00 $
456000337 > 10 > 1000 $
456000337 > 20 > 1000 $
The first row shows the header data and then next two rows is header + Item data.
I expected the Bex report to show the PO and its 2 items only,, but it shows the header # data also..
as shown below:
456000337 > # > 0.00 $
456000337 > 10 > 1000 $
456000337 > 20 > 1000 $
Can any 1 please help me, how to restrict this at the data target level only,,
i can restrict this # query level, but thats nt the solution rt??
thanksHi,
The current set up is wrong and this is bound to give wrong result.
Right now one extra row is separately maintained for the header of same PO doc and I am sure this record will not contains values in the fields which are specific to item.
Either create two DSO's each for item and header and use an infoset or in one DSO add new fileds specially for header ...
Not all the fields are specific to items and some header fields are common to items...so you can write routine at the transformation level where you can populate the new added fields for header values only.
In the queries you can use these columns to see the header information.
This will make sure that the extra row is changed to new set of columns and you can see the report for desired records only.
Thanks
Ajeet
Maybe you are looking for
-
Trying to move the Media Cache Folder
I have the current version of Premiere Pro CC on OSX 10.9.4. I want to move my media cache files and media cache database folder from the default, USERS/LIBRARY/APPLICATION SUPPORT/ADOBE/COMMON to my external media scratch drive. I have changed this
-
my computer has been seen at Genius bar 6 times for freezing up, reloaded all original settings, all of their diagnostics, and they even sent it to the apple shop where they replaced the battery and logic board. Still freezes after I try to reload iT
-
How to create a PDF page that displays in Email and contains links to a page in the full PDF.
Mac, CS 5 I was able to create the PDF page and activate links to pages in the full PDF document. But when I test-email both files to myself, the links do not work.
-
Messages do not appear in trash
I seem to have done something to my trash files within mail. As soon as I delete something it disappears without appearing in a trash folder, even though the mailbox settings say keep it for a week. Have I accidentally deleted the trash boxes, as the
-
I have a old abap transport request for a program which was transported to qa and production to restore the old version in the production server. when new changes were made to the program , along with the changes the latest version has gone to produc