Open data and close dataset
code required for how to upload to application server and download it from application server using open dataset and closedataset.
Hello bharath,
Check out this code:
EPORT Z_CRM_REP_SCORE100 no standard page heading message-id zmsgap.
*& Type Declaration
Types: Begin of t_file,
BPEXT type BU_BPEXT, "External Number of Business Partner
NAME_FIRST type BU_NAMEP_F, "First Name
NAME_LAST type BU_NAMEP_L, "Last Name
CITY1 type AD_CITY1, "City
COUNTRY type AD_COMCTRY, "Country
TEL_NUMBER type AD_TLNMBR1, "Telephone Number
End of t_file.
Types: Begin of t_but000, "External Number of Business Partner
PARTNER type BU_PARTNER,
BPEXT type BU_BPEXT,
NAME_FIRST type BU_NAMEP_F, "First Name
NAME_LAST type BU_NAMEP_L, "Last Name
PERSNUMBER type AD_PERSNUM, "Person Number
ADDRCOMM type BU_ADDRCOMM, "Address Number
end of t_but000.
Types: Begin of t_adr2,
ADDRNUMBER type AD_ADDRNUM, "Address Number
PERSNUMBER type AD_PERSNUM, "Person Number
COUNTRY type AD_COMCTRY, "Country
TEL_NUMBER type AD_TLNMBR, "Telephone Number
End of t_adr2.
Types: Begin of t_adrc,
ADDRNUMBER type AD_ADDRNUM, "Address Number
CITY1 type AD_CITY1, "City
End of t_adrc.
*& Internal tables and Work Areas Declaration
Data: it_file type standard table of t_file,
wa_file type t_file,
it_sapdata type standard table of t_file,
wa_sapdata type t_file,
it_output type standard table of t_file,
wa_output type t_file,
it_but000 type standard table of t_but000,
wa_but000 type t_but000,
it_adr2 type standard table of t_adr2,
wa_adr2 type t_adr2,
it_adrc type standard table of t_adrc,
wa_adrc type t_adrc.
*Variable Declaration for file path
Data:gv_path type SAPB-SAPPFAD value 'C:\FILE.TXT',
gv_path1 type string value 'file1.txt'.
*Variable Declaration for index.
Data: gv_tabix type sy-tabix.
*Variable Declaration for Line selection.
Data: v_fieldname type BUT000-BPEXT,
v_fieldvalue type BU_BPEXT.
*Calling subroutine to create flat file in application server.
Perform f_file_to_server.
*Calling subroutine to fetch values from flat file into an internal table.
Perform f_dataset.
*& Event Start-of-Selection.
Start-of-Selection.
*Calling subroutine to fetch values from table BUT000 into an internal table.
Perform f_select_but000.
*Calling subroutine to fetch values from table ADR2 into an internal table.
Perform f_select_adr2.
*Calling subroutine to fetch values from table ADRC into an internal table.
Perform f_select_adrc.
*& Event End-of-Selection.
End-of-Selection.
*Calling subroutine to fill an internal table with SAP data.
Perform f_fill_sapdata.
*Calling subroutine to compare the values between I_SAPDATA and I_FILE.
Perform f_compare.
*& Event At Line Selection.
At Line-Selection.
*Checking for list index.
Case sy-lsind.
*When list index is 1.
When '1'.
*Get the value of external number and apss it to the field value..
Get Cursor Field v_fieldname value v_fieldvalue.
*Passing field value to field name.
wa_sapdata-BPEXT = v_fieldvalue.
If v_fieldname = 'WA_SAPDATA-BPEXT'.
*Taking only that value whose External Number exist in the internal table IT_BUT000.
Read Table it_but000 into wa_but000 with key BPEXT = v_fieldvalue binary search.
*Checking if value exist.
If sy-subrc eq 0.
*If it exists then call BP transaction to change the values for that particualr BP according to Aries data.
Set Parameter id 'BPA' FIELD WA_BUT000-partner.
Call Transaction 'BP' and skip first screen..
Endif. "End of Sy-subrc check.
Endif.
Endcase.
*& Form f_file_to_server
* This module is used to create flat file in application server
* by using function module ARCHIVFILE_CLIENT_TO_SERVER .
FORM f_file_to_server .
*Calling function module to create flat file in application server.
CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'
EXPORTING
PATH = GV_PATH
TARGETPATH = 'FILE1.TXT '
EXCEPTIONS
ERROR_FILE = 1
OTHERS = 2.
*checking if file is created successfully
IF SY-SUBRC <> 0.
*If file is not created then display a message.
Message E009.
ENDIF. "End of Sy-subrc check.
ENDFORM. " f_file_to_server
*& Form f_dataset
* This module is used to fetch values from flat file,stored in
* application server, into an internal table it_file.
FORM f_dataset .
*Opening file from application server.
Open dataset gv_path1 for input in text mode encoding default.
*Reading the file.
While sy-subrc eq 0.
Read dataset gv_path1 into wa_file.
Append wa_file to it_file.
Clear wa_file.
Endwhile.
*closing the file in application server.
Close dataset gv_path1.
ENDFORM. " f_dataset
*& Form f_select_but000
* This module is used to select values from table BUT000 into an
* internal table i_but000.
FORM f_select_but000 .
*Selecting values from table BUT000.
Select PARTNER
BPEXT
NAME_FIRST
NAME_LAST
PERSNUMBER
ADDRCOMM
From but000 into table it_but000
where TYPE = '1'
and BPEXT ne ''
and ADDRCOMM ne ''.
*Checking if values are fetched in the internal table.
If sy-subrc eq 0.
sort it_but000 by BPEXT PERSNUMBER .
Endif. " End of Sy-subrc check.
ENDFORM. " f_select_but000
*& Form f_select_adr2
* This module is used to select values from table ADR2 into an
* internal table i_adr2 corresponding to the values in i_but000.
FORM f_select_adr2 .
*Checking if internal table i_but000 is not empty.
If not it_but000[] is initial.
*Selecting values from table ADR2.
Select ADDRNUMBER
PERSNUMBER
COUNTRY
TEL_NUMBER
into table it_adr2
from adr2
for all entries in it_but000
where PERSNUMBER = it_but000-PERSNUMBER.
*Checking if values are fetched in the internal table.
If sy-subrc eq 0.
sort it_adr2 by ADDRNUMBER. " End of Sy-subrc check.
Endif.
Endif. "End of internal table check.
ENDFORM. " f_select_adr2
*& Form f_select_adrc
* This module is used to select values from table ADRC into an
* internal table i_adrc on the basis of values in i_adr2.
FORM f_select_adrc .
*Checking if internal table i_but000 is not empty.
If not it_adr2[] is initial.
*Selecting values from table ADRC.
Select ADDRNUMBER
CITY1
from adrc
into table it_adrc
for all entries in it_adr2
where ADDRNUMBER = it_adr2-ADDRNUMBER.
*Checking if values are fetched in the internal table.
If sy-subrc eq 0.
sort it_adrc by ADDRNUMBER. " End of Sy-subrc check.
Endif.
Endif. "End of internal table check.
ENDFORM. " f_select_adrc
*& Form f_fill_sapdata
* This module is used to fill values in internal table i_sapdata
* with the values selected from BUT000,ADRC and ADR2.
FORM f_fill_sapdata .
*Checking if internal table it_but000 is not empty.
If not it_but000[] is initial.
Loop at it_but000 into wa_but000.
*Filling the values of internal table IT_BUT000 into workarea of IT_SAPDATA.
wa_sapdata-BPEXT = wa_but000-BPEXT.
wa_sapdata-NAME_FIRST = wa_but000-NAME_FIRST.
wa_sapdata-NAME_LAST = wa_but000-NAME_LAST.
*Taking only those values whose Person Number exist in the internal table IT_ADR2.
Read table it_adr2 into wa_adr2 with key PERSNUMBER = wa_but000-PERSNUMBER Binary Search.
*If value exists then populate those values in work area of IT_SAPDATA.
If sy-subrc eq 0.
wa_sapdata-COUNTRY = wa_adr2-COUNTRY.
wa_sapdata-TEL_NUMBER = wa_adr2-TEL_NUMBER .
*Taking only those values whose Address Number exist in the internal table I_ADRC.
Read table it_adrc into wa_adrc with key ADDRNUMBER = wa_adr2-ADDRNUMBER Binary Search.
*If value exists then populate that value in work area of I_SAPDATA.
If sy-subrc eq 0.
wa_sapdata-CITY1 = wa_adrc-CITY1.
Endif. "End of Sy-subrc Check.
Endif. "End of Sy-subrc Check.
*Inserting workarea of sapdata into its internal table.
Append wa_sapdata to it_sapdata.
*Clearing all workareas.
Clear: wa_adrc,wa_adr2,wa_sapdata.
Endloop.
Endif. "End of internal table check.
*Clearing workarea.
Clear wa_but000.
ENDFORM. " f_fill_sapdata
*& Form f_compare
* This module is used to compare values between the Aries data
* and SAP data and display those values which are different.
FORM f_compare .
*Checking if internal table it_sapdata is not empty.
If not it_sapdata[] is initial.
Loop at it_sapdata into wa_sapdata.
*Taking only those values whose External Number exist in the internal table IT_FILE.
Read table it_file into wa_file with key BPEXT = wa_sapdata-BPEXT.
*Comparing the workareas of two internal tables
If wa_sapdata ne wa_file.
*Checking if values of work area donot match then write the header.
Write: / sy-uline(120).
Format color 1.
Write: /1 'External Number' Centered.
Format Hotspot on.
Write: 17 wa_sapdata-BPEXT.
Format Hotspot off.
Write: 47 sy-vline,
48 'Aries data' Centered,
80 sy-vline,
81 'SAP data' Centered,
120 sy-vline.
WRITE: / sy-uline(120).
*Checking if first name in the aries data and SAP data does not match.
If wa_sapdata-NAME_FIRST ne wa_file-NAME_FIRST.
*If it doesnt match then display it using subroutine.
Perform f_write using 'First Name' wa_file-NAME_FIRST wa_sapdata-NAME_FIRST.
Endif. " End of Sy-subrc check.
*Checking if last name in the aries data and SAP data does not match.
If wa_sapdata-NAME_LAST ne wa_file-NAME_LAST.
*If it doesnt match then display it using subroutine.
Perform f_write using 'Last Name' wa_file-NAME_LAST wa_sapdata-NAME_LAST.
Endif. " End of Sy-subrc check.
*Checking if city in the aries data and SAP data does not match.
If wa_sapdata-CITY1 ne wa_file-CITY1.
*If it doesnt match then display it using subroutine.
Perform f_write using 'City' wa_file-CITY1 wa_sapdata-CITY1.
Endif. " End of Sy-subrc check.
*Checking if country in the aries data and SAP data does not match.
If wa_sapdata-COUNTRY ne wa_file-COUNTRY.
*If it doesnt match then display it using subroutine.
Perform f_write using 'Country' wa_file-COUNTRY wa_sapdata-COUNTRY.
Endif. " End of Sy-subrc check.
*Checking if phone number in the aries data and SAP data does not match.
If wa_sapdata-TEL_NUMBER ne wa_file-TEL_NUMBER.
*If it doesnt match then display it using subroutine.
Perform f_write using 'Phone Number' wa_file-TEL_NUMBER wa_sapdata-TEL_NUMBER.
Endif. " End of Sy-subrc check.
Endif. "End of Equality check.
Endloop.
*Clearing workareas.
Clear: wa_sapdata, wa_file.
Endif. "End of internal table check.
ENDFORM. " f_compare
*& Form f_write
* This module is used to display the field names which has been
* changed in SAP from Aries data.
* -->P_field_name text
* -->P_Aries_data text
* -->P_SAP_data text
FORM f_write USING VALUE(P_field_name)
VALUE(P_Aries_data)
VALUE(P_SAP_data).
Format color 2.
Write : /1 P_field_name,
47 sy-vline.
Format color off.
Write: 48 P_Aries_data,
80 sy-vline,
81 P_SAP_data,
120 sy-vline.
WRITE: / sy-uline(120).
ENDFORM. " f_write
Please reward points if helpful.
Regards,
Aditi
Similar Messages
-
Open dataset and close dataset
Hi
I need to write log file in fileshare.
I am using the following FM to create the file.
Z_FILE_OPEN_OUT_UNICODE'
I have following qns
1. do i need to use open dataset and close dataset stmts, even I create the files with the FM?Hi,
you can fill in the name of the FM in transaction SE37, then click 'Display' and look at the source code and the 'Tables' tab.
It's a custom build FM, so you might have to look at the import parameters it needs... ( Tab 'Import' and 'Tables' ).
To answer your question, as the name of the FM suggests it will write the file for you, so no open/close dataset. Please doublecheck tab 'Source code' and you might find these statements there...
hope that helps,
Rolf -
Automatically open, save and close excel?
I need import data from Excel to SQL.
Now, I use tSQL to directly read the excel files and transform to the SQL table.
As the user Excel is not a good format for SQL to read, I need use formula to transform the excel to be a SQL readable format.
Now, I add a sheet to copy the data from the sheet which user input the data and then ask the user to copy the excel to a specific location for import.
However, this will make the data in the excel double and result a large excel file.
I am thinking if it is possible to create a excel to use formula to copy the data from another excel.
Then, I need find some method to open that excel, let the content refresh from the source excel, save and close it.
Then I can directly use this excel for data import.
Is there any simple way to do so? I don't know marco much...
IvanNo formula could do this (Automatically open, save and close excel).
You need to recode a marco or write a macro. Why donot you ask in msdn?
http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
example:
Sub auto_open()
Application.OnTime Now + TimeValue("00:01:00"), "wswx"
End Sub
Sub
wswx() If Not ThisWorkbook.Saved
Then ThisWorkbook.Save
ThisWorkbook.Close
End Sub
KR -
I want to know if there is anyone out there with a similar issue-
When I *right click* on the Time (top right on Menu bar) and then *click on "Open Date and TIme"*, I get the beachball......it typically waits in beachball mode for about *45 sec-1min* before actually displaying the "*Date and Time"* window.
I was on the phone with Apple care about this *and the issue with the system freezing*.......they asked me to archive and re-install , but the issue with the date and time is still there. I will wait and see if the system freeze has been solved (I didnt install version 1.1).
Like the folks in other threads have already pointed out, my system freezes when it comes back from "Sleep".......and also when I am doing doing simple things like browsing.
Lets see....but please let me know if anyone sees the issue with the date/time...
Thanks,
New Mac Convert (a little frustrated that it crashes worse than my windows box)Thanks for the replies guys...
Yes, the date/time is set to auto and the source is "Apple Americas/US (time.apple.com)"
One thing I noticed is that whenever it hangs for 45 sec or so.....once the window shows up (after hanging), the lock for changes is "open".....but if I lock it at that point, close the window and then rt click on time and open Date/Time again, it does not hang......somehow when this is "locked", it does not hang when you want to open it.
But, if u are in the lock mode, and want to "click the lock" to make changes, it hangs on you again......hope this makes sense. -
Collapsible Panels - Links to open one, and close others
Hi,
I am new to Dreamweaver and have been creating my site by
learning as I go along. I have already read through all the other
related topics associated with Collapsible Panels on this blog and
have still not found an answer. I have been able to open and close
Collapsible Panels by using links - but unfortunately, I need more
than just opening and closing.
On my site i have approximately 5 pages, all with the same
header and Menu bar. The Information (that i have presented in
numerous Collapsible Panels) does however vary from page to page.
What I need to try and figure out is:
How can I open one collapsible panel and close all others? I
have seen the one example which leads to my next question:
How can I group Panels? Some examples of how to open one and
close all others use this grouping. Is there any other way of
opening one and closing all others without grouping?
Lastly, is it possible to set up a link that can be viewed on
one page which when clicked opens the relevant page and collapsible
panel? i.e. on my About Us page there is a link (using the Menu
bar) for one of my several services on the services drop down menu
(but services is on a different page with the same setup). When a
viewer clicks on the specific service, is it possible to get the
site to open the services page, and open the relevant collapsible
panel (with all other Panels closed)?
Any assistance would be greatly appreciated - I have been
searching for days now and cannot seem to find any
answers/directions in laymans terms.
Kind regards,
Johnwlsjoh013 wrote:
> Hi,
>
> I am new to Dreamweaver and have been creating my site
by learning as I go
> along. I have already read through all the other related
topics associated
> with Collapsible Panels on this blog and have still not
found an answer. I
> have been able to open and close Collapsible Panels by
using links - but
> unfortunately, I need more than just opening and
closing.
>
> On my site i have approximately 5 pages, all with the
same header and Menu
> bar. The Information (that i have presented in numerous
Collapsible Panels)
> does however vary from page to page. What I need to try
and figure out is:
>
> How can I open one collapsible panel and close all
others? I have seen the one
> example which leads to my next question:
This page has an example that has a link that can open and
close a panel:
http://labs.adobe.com/technologies/spry/samples/collapsiblepanel/collapsible_panel_sample. htm
One way to do this would be to have a single link that would
open one of your panels using the code, but then add to it code
that closes each of the other panels, for example:
<a href="#"
onclick="CollapsiblePanel4.open();CollapsiblePanel5.close();CollapsiblePanel6.close();">O pen
4, close 5 and 6</a>
To make this work, you'll need to look that the panel
constructors at the bottom of your page and make sure to match up
the panel variable names i.e. "var CollapsiblePanel1 =...." the
variable is CollapsiblePanel1.
You could also write a function that gathers together the
various panels you have on the page and then pass to it only the
panel that you want kept open. For now, though, it might be best to
use the above method, given your expertise. And taking that even
further, you could apply the function call unobtrusively. Both the
function call and the unobtrusive part you can work on later to get
this working for now.
> How can I group Panels? Some examples of how to open one
and close all others
> use this grouping. Is there any other way of opening one
and closing all
> others without grouping?
This is a little confusing, on one hand you ask about how to
group, but then ask how not to group. There is a concept of a
collapsible panel group:
http://labs.adobe.com/technologies/spry/samples/collapsiblepanel/CollapsiblePanelGroupSamp le.html
But there is another type of group, that may be more what
you're looking for, and that's an Accordion panel, which is similar
to the collapsible panel group, with the exception that it can only
have one panel open at a time.
> Lastly, is it possible to set up a link that can be
viewed on one page which
> when clicked opens the relevant page and collapsible
panel? i.e. on my About Us
> page there is a link (using the Menu bar) for one of my
several services on the
> services drop down menu (but services is on a different
page with the same
> setup). When a viewer clicks on the specific service, is
it possible to get
> the site to open the services page, and open the
relevant collapsible panel
> (with all other Panels closed)?
Probably the easiest way to do this particular one would be
to make sure that you have all of the panels set to be closed when
the page loads, and then take a look at the code for the last
example on this page:
http://labs.adobe.com/technologies/spry/samples/utils/URLUtilsSample.html
That example uses a tabbed panel, but the concept is the
same, use a URL parameter to determine what to show. You'll need to
link in the SpryURLUtils file in the Spry download package (look in
the includes folder):
http://labs.adobe.com/technologies/spry/home.html
Essentially, your link will look similar to:
sample.html?panel=1
Then your code could look something like:
var params = Spry.Utils.getLocationParamsAsObject();
var CollapsiblePanel1 = new
Spry.Widget.CollapsiblePanel("CollapsiblePanel1",
{contentIsOpen:(params.panel==1 )} );
var CollapsiblePanel2 = new
Spry.Widget.CollapsiblePanel("CollapsiblePanel2",
{contentIsOpen:(params.panel==2 )} );
Basically what this is doing is creating an object from the
URL parameters. Then for each of the panels the constructor has
code that determines whether or not to expand the panel when the
page loads. So it checks the value of params.panel to see if it
matches 1 (for the first one), if it does, then that means that
contentIsOpen is set to true, if it is some other number or is not
present at all, then that means that the panel is closed. This
would then be repeated down the line for how ever many panels you
want to operate like that.
Danilo Celic
|
http://blog.extensioneering.com/
| WebAssist Extensioneer
| Adobe Community Expert -
GL Account Start date and Close date
Hi,
Is it possible to maintain start date and close date of a GL account
Thanks & Regards
RadhaRequirement is, from a specific date the GL account should allow for posting and in the same way the GL account should not allow for posting for a specific posting.
So is it possible to give validity period for a GL account -
Open and Close Dataset problem
Hi All,
I am facing a weird problem in transferring data to application server.
I have used Open dataset to write my file in text format to the application server.
Now everything works fine when small amount of data is there.When the number of records increases and when it takes lot of time , the format of the text file is completely distorted.
I have used tab as the delimiter. Please suggest me some solution for this.
Is this due to the time taken?
Regards.Hi
in the above program , when i had created 1st i had same problem
then i had worte the logic likethis
parameter: file_nm type localfile.
types : begin of it_tab1,
f1(20),
f2(40),
f3(20),
end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
wa_tab2 type it_tab1,
w_message(100) TYPE c.
at selection-screen on value-request for file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = ' '
CHANGING
file_name = file_nm
EXCEPTIONS
MASK_TOO_LONG = 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.
start-of-selection.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '10'
i_end_row = '35'
tables
intern = it_tab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 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.
<b>loop at it_tab.
case it_tab-col.
when '002'.
wa_tab2-f1 = it_tab-value.
when '004'.
wa_tab2-f2 = it_tab-value.
when '008'.
wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
append wa_tab2 to it_tab2.
clear wa_tab2.
endat.
endloop.</b>
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
IF sy-subrc NE 0.
MESSAGE e001(zsd_mes).
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT it_tab2 INTO wa_tab2.
TRANSFER wa_tab2 TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file.
loop at it_tab2 into wa_tab2.
write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop.
with the bold letters above
i had wrote that logic for that
reward if usefull -
Report to find open items and close items for given vendor
Hi All,
What are the steps needed to write a REPORT to find out
open and close items for a given vendor.
Which are the fields i'll have to take and what are the comparisons i'll have to make.
I know,
BSIK is for open Vendor &
BSAK for closed Vendors..
what are the conditions i'll have to check.
Thanks in Advance..
Pradeep AlexHi Pradeep,
This report I developed is definitely useful to you.
*& Report ZFI_PROV_IT_VENDOR
REPORT ZFI_VENDOR.
TYPE-POOLS: slis.
tables: BKPF,
BSEG,
bsik,
bsak,
bsid,
bsad,
lfa1,
t005u, "Region Description
J_1IMOVEND.
TYPES: BEGIN OF ty_bkpf,
bukrs type bkpf-bukrs,
belnr TYPE bkpf-belnr,
gjahr type bkpf-gjahr,
blart TYPE bkpf-blart,
budat TYPE bkpf-budat,
END OF ty_bkpf.
types: begin of ty_J_1IMOVEND,
lifnr type lfa1-lifnr,
J_1IPANNO type J_1IMOVEND-J_1IPANNO,
J_1ICSTNO type J_1IMOVEND-J_1ICSTNO,
J_1ISERN type J_1IMOVEND-J_1ISERN,
end of ty_J_1IMOVEND.
TYPES: BEGIN OF ty_bseg,
belnr TYPE bseg-belnr,
gjahr type bseg-gjahr,
bschl TYPE bseg-bschl,
umskz type bseg-umskz,
shkzg type bseg-shkzg,
wrbtr TYPE bseg-wrbtr,
hkont type bseg-hkont,
lifnr TYPE bseg-lifnr,
END OF ty_bseg.
types: begin of ty_t005u,
bland type t005u-bland,
bezei type t005u-bezei,
end of ty_t005u.
types: begin of ty_lfa1,
lifnr type lfa1-lifnr,
name1 type lfa1-name1, "35
ort01 type lfa1-ort01, "35
ort02 type lfa1-ort02, "35
pfach type lfa1-pfach, "10
pstlz type lfa1-pstlz, "10
regio type lfa1-regio, "3
stras type lfa1-stras, "35
ktokk type lfa1-ktokk,
telf1 type lfa1-telf1, "16
telf2 type lfa1-telf2, "16
end of ty_lfa1.
types: begin of ty_bsik,
bukrs type bsik-bukrs,
lifnr type bsik-lifnr,
augdt type bsik-augdt,
augbl type bsik-augbl,
belnr type bsik-belnr,
budat type bsik-budat,
blart type bsik-blart,
shkzg type bsik-shkzg,
wrbtr type bsik-wrbtr,
end of ty_bsik.
types: begin of ty_bsid,
bukrs type bsid-bukrs,
lifnr type bsid-kunnr,
augdt type bsid-augdt,
augbl type bsid-augbl,
belnr type bsid-belnr,
budat type bsid-budat,
blart type bsid-blart,
shkzg type bsid-shkzg,
wrbtr type bsid-wrbtr,
end of ty_bsid.
types: begin of ty_out2,
lifnr type bsik-lifnr,
wrbtr type bsik-wrbtr,
end of ty_out2.
types: begin of ty_out,
lifnr type lfa1-lifnr,
name1 type lfa1-name1,
addr(162) type c,
J_1IPANNO type J_1IMOVEND-J_1IPANNO,
J_1ICSTNO type J_1IMOVEND-J_1ICSTNO,
J_1ISERN type J_1IMOVEND-J_1ISERN,
opbal type bseg-wrbtr,
purch type bseg-wrbtr,
PAYM type bseg-wrbtr,
grdeb type bseg-wrbtr,
othdeb type bseg-wrbtr,
othcre type bseg-wrbtr,
tds type bseg-wrbtr,
bal type bseg-wrbtr,
blart type bkpf-blart,
bschl type bseg-bschl,
end of ty_out.
types: begin of ty_bsegtemp,
lifnr TYPE bseg-lifnr,
end of ty_bsegtemp.
types: begin of ty_bsegnew,
wrbtr TYPE bseg-wrbtr,
lifnr TYPE bseg-lifnr,
end of ty_bsegnew.
data: it_bsik type table of ty_bsik with header line,
it_bsid type table of ty_bsid with header line,
it_bsak type table of ty_bsik with header line,
it_out2 type table of ty_out2 with header line,
it_out3 type table of ty_out2 with header line.
DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
it_listheader TYPE slis_t_listheader,
it_alvevent TYPE slis_t_event,
gt_events TYPE slis_t_event WITH HEADER LINE.
DATA: I_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA : wa_fieldcat TYPE slis_fieldcat_alv,
wa_listheader TYPE slis_listheader,
wa_alvevent TYPE slis_alv_event.
DATA: WA_SORT TYPE SLIS_SORTINFO_ALV.
DATA: ls_line TYPE slis_listheader.
DATA : g_repid LIKE sy-repid, " Program ID
g_layout TYPE slis_layout_alv. " Layout Workarea
DEFINE m_fieldcat.
wa_fieldcat-col_pos = &1. " Fieldcat column postion
wa_fieldcat-fieldname = &2. " Field name
wa_fieldcat-DO_SUM = &3.
wa_fieldcat-seltext_m = &4. " Column Text
wa_fieldcat-outputlen = &5.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
END-OF-DEFINITION.
DATA: wa_lfa1 TYPE ty_lfa1,
wa_bkpf TYPE ty_bkpf,
wa_bkpf1 type ty_bkpf,
wa_bsegtemp type ty_bsegtemp,
wa_bsegnew type ty_bsegnew,
wa_bsegnew1 type ty_bsegnew,
wa_J_1IMOVEND type ty_J_1IMOVEND,
wa_t005u type ty_t005u,
wa_bseg TYPE ty_bseg,
wa_out TYPE ty_out.
DATA: gt_out TYPE STANDARD TABLE OF ty_out,
gt_out1 TYPE STANDARD TABLE OF ty_out,
gt_lfa1 TYPE STANDARD TABLE OF ty_lfa1,
gt_bsegtemp type standard table of ty_bsegtemp with header line,
gt_bsegnew type standard table of ty_bsegnew with header line,
gt_bsegnew1 type standard table of ty_bsegnew with header line,
gt_J_1IMOVEND type standard table of ty_J_1IMOVEND,
gt_bkpf1 TYPE STANDARD TABLE OF ty_bkpf WITH HEADER LINE,
gt_t005u type standard table of ty_t005u,
gt_bseg TYPE STANDARD TABLE OF ty_bseg WITH HEADER LINE,
gt_bkpf TYPE STANDARD TABLE OF ty_bkpf WITH HEADER LINE.
selection-screen begin of block b1 with frame title text-001.
select-options: s_budat for bkpf-budat obligatory,
s_ktokk for lfa1-ktokk obligatory.
s_wrbtr for bseg-wrbtr.
parameters: p_bukrs type bkpf-bukrs obligatory default '1000'.
p_gjahr type bkpf-gjahr obligatory.
p_lifnr type bseg-lifnr obligatory default '300040',
p_ktokk type lfa1-ktokk obligatory default 'Z200'.
selection-screen end of block b1.
START-OF-SELECTION.
PERFORM sub_fetch_data.
PERFORM sub_process_data.
END-OF-SELECTION.
PERFORM sub_build_fieldcat.
PERFORM sub_build_layout.
PERFORM eventtab_build USING gt_events[].
PERFORM comment_build USING it_listheader[].
PERFORM sub_disp_data.
*& Form SUB_BUILD_FIELDCAT
text
--> p1 text
<-- p2 text
FORM sub_build_fieldcat .
sort gt_out by name1.
*DEFINE M_SORT.
ADD 1 TO WA_SORT-SPOS.
WA_SORT-FIELDNAME = &1.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = &2.
APPEND WA_SORT TO I_SORT.
END-OF-DEFINITION.
*m_sort 'NAME1' 'X'.
*M_SORT 'ADDR' 'X'.
m_fieldcat 1 'LIFNR' ' ' text-026 10.
m_fieldcat 2 'NAME1' ' ' text-006 35.
m_fieldcat 3 'ADDR' ' ' text-007 162.
m_fieldcat 4 'J_1IPANNO' '' text-008 40.
m_fieldcat 5 'J_1ICSTNO' '' text-009 40.
m_fieldcat 6 'J_1ISERN' '' text-010 40.
m_fieldcat 7 'OPBAL' '' text-011 18.
m_fieldcat 8 'PURCH' '' text-012 18.
m_fieldcat 9 'PAYM' '' text-013 18.
m_fieldcat 10 'GRDEB' '' text-014 18.
m_fieldcat 11 'OTHDEB' '' text-020 18.
m_fieldcat 12 'OTHCRE' '' text-021 18.
m_fieldcat 13 'BAL' '' text-023 18.
m_fieldcat 14 'TDS' '' text-022 18.
ENDFORM. " SUB_BUILD_FIELDCAT
*& Form SUB_BUILD_LAYOUT
text
--> p1 text
<-- p2 text
FORM sub_build_layout .
g_layout-zebra = 'X'.
g_layout-colwidth_optimize = 'X'.
ENDFORM. " SUB_BUILD_LAYOUT
*& Form EVENTTAB_BUILD
text
-->P_GT_EVENTS[] text
FORM eventtab_build USING gt_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gt_events.
READ TABLE gt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE 'TOP_OF_PAGE' TO ls_event-form.
APPEND ls_event TO gt_events.
ENDIF.
ENDFORM. " EVENTTAB_BUILD
*& Form COMMENT_BUILD
text
-->P_IT_LISTHEADER[] text
FORM comment_build USING p_it_listheader TYPE
slis_t_listheader.
data: v_text(30) type c,
v_datelow(10) type c,
v_datehigh(10) type c,
v_month(2) type c,
v_day(2) type c,
v_year(4) type c.
v_day = s_budat-low+6(2).
v_month = s_budat-low+4(2).
v_year = s_budat-low+0(4).
concatenate v_day '.' v_month '.' v_year into v_datelow.
clear: v_day,v_month,v_year.
v_day = s_budat-high+6(2).
v_month = s_budat-high+4(2).
v_year = s_budat-high+0(4).
concatenate v_day '.' v_month '.' v_year into v_datehigh.
clear: v_day,v_month,v_year.
concatenate 'From' v_datelow 'To' v_datehigh into v_text
separated by space.
clear: v_datelow, v_datehigh.
ls_line-typ = 'H'.
ls_line-info = text-116.
APPEND ls_line TO p_it_listheader.
ls_line-typ = 'S'.
ls_line-key = text-090.
ls_line-info = v_text.
APPEND ls_line TO p_it_listheader.
ENDFORM. " COMMENT_BUILD
*& Form TOP_OF_PAGE
text
--> p1 text
<-- p2 text
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader.
ENDFORM. " TOP_OF_PAGE
*& Form SUB_DISP_DATA
text
--> p1 text
<-- p2 text
FORM sub_disp_data .
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
it_fieldcat = it_fieldcat[]
is_layout = g_layout
i_save = 'U'
it_events = gt_events[]
IT_SORT = I_SORT[]
TABLES
t_outtab = gt_out1[].
ENDFORM. " SUB_DISP_DATA
*& Form sub_fetch_data
text
--> p1 text
<-- p2 text
form sub_fetch_data .
select bukrs
belnr
gjahr
blart
budat
from bkpf
into table gt_bkpf
where budat in s_budat
and bukrs = p_bukrs
and gjahr = p_gjahr
and blart in ('KR','KG','KZ','RE','DK','Z1','AB','SA','KA','DZ').
select belnr
gjahr
bschl
umskz
shkzg
wrbtr
hkont
lifnr
from bseg
into table gt_bseg
for all entries in gt_bkpf
where belnr = gt_bkpf-belnr
and gjahr = gt_bkpf-gjahr
and gjahr = p_gjahr
and bschl in (21,25,29,31,50,39,38,19,35).
and kunnr in gt_
and lifnr = '0000300019'.
select belnr
gjahr
bschl
umskz
shkzg
wrbtr
hkont
kunnr
from bseg
appending table gt_bseg
for all entries in gt_bkpf
where belnr = gt_bkpf-belnr
and gjahr = gt_bkpf-gjahr
and gjahr = p_gjahr
and bschl in (21,25,29,31,50,39,38,19).
break manukapur.
sort gt_bseg by lifnr bschl.
delete adjacent duplicates from gt_bseg comparing all fields.
loop at gt_bseg into wa_bseg.
if wa_bseg-lifnr is not initial.
move: wa_bseg-lifnr to wa_bsegtemp-lifnr.
append wa_bsegtemp to gt_bsegtemp.
endif.
endloop.
delete adjacent duplicates from gt_bsegtemp comparing lifnr.
select lifnr
name1
ort01
ort02
pfach
pstlz
regio
stras
ktokk
telf1
telf2
from lfa1
into table gt_lfa1
for all entries in gt_bseg
where lifnr = gt_bseg-lifnr
and ktokk in s_ktokk.
and lifnr = '0000300030'.
select bland
bezei
from t005u
into table gt_t005u
for all entries in gt_lfa1
where bland = gt_lfa1-regio
and land1 = 'IN'
and spras = sy-langu.
select lifnr
J_1IPANNO
J_1ICSTNO
J_1ISERN
from J_1IMOVEND
into table gt_J_1IMOVEND
for all entries in gt_bseg
where lifnr = gt_bseg-lifnr.
*select bukrs
belnr
blart
budat
from bkpf
into table gt_bkpf1
where budat < s_budat-low.
and zfdbt < s_budat-low.
select
wrbtr
lifnr
from bseg
into table gt_bsegnew
for all entries in gt_bkpf
where belnr = gt_bkpf-belnr
and xopvw = 'X' .
and zfbdt < s_budat-low.
select bukrs
lifnr
augdt
augbl
belnr
budat
blart
shkzg
wrbtr
from bsik
into table it_bsik
for all entries in gt_bseg
where lifnr = gt_bseg-lifnr
and lifnr = '0000300000'
and bukrs = '1000'
and budat <= s_budat-low.
select bukrs
lifnr
augdt
augbl
belnr
budat
blart
shkzg
wrbtr
from bsak
appending table it_bsik
for all entries in gt_bseg
where bukrs = '1000'
and lifnr = gt_bseg-lifnr
and lifnr = '0000300000'
and budat <= s_budat-low
and augdt > s_budat-low.
select bukrs
kunnr
augdt
augbl
belnr
budat
blart
shkzg
wrbtr
from bsid
into table it_bsid
for all entries in gt_bseg
where bukrs = '1000'
and kunnr = gt_bseg-lifnr
and kunnr = '0000300000'
and budat <= s_budat-low.
select bukrs
kunnr
augdt
augbl
belnr
budat
blart
shkzg
wrbtr
from bsad
appending table it_bsid
for all entries in gt_bseg
where bukrs = '1000'
and kunnr = gt_bseg-lifnr
and kunnr = '0000300000'
and budat <= s_budat-low
and augdt > s_budat-low.
if it_bsid[] is not initial.
append lines of it_bsid to it_bsik.
endif.
*delete gt_bsegnew where lifnr <> '0000300000'.
*break manukapur.
*sort gt_bsegnew by lifnr.
*loop at gt_bsegnew into wa_bsegnew.
*collect wa_bsegnew into gt_bsegnew1.
*endloop.
loop at it_bsik .
it_out2-lifnr = it_bsik-lifnr.
*it_out1-budat = it_bsik-budat.
*it_out1-blart = it_bsik-blart.
if it_bsik-SHKZG = 'H'.
it_out2-wrbtr = it_bsik-wrbtr.
else .
it_out2-wrbtr = it_bsik-wrbtr * -1.
endif.
append it_out2.
clear: it_out2, it_bsik.
*endif.
*clear it1.
endloop.
sort it_out2 by lifnr.
loop at it_out2.
it_out3-lifnr = it_out2-lifnr.
it_out3-wrbtr = it_out2-wrbtr.
collect it_out3.
clear: it_out3, it_out2.
endloop.
endform.
*& Form sub_process_data
text
--> p1 text
<-- p2 text
form sub_process_data .
*sort gt_bsegtemp by lifnr .
sort gt_bseg by lifnr bschl.
sort gt_bsegnew by lifnr.
sort it_out3 by lifnr.
*loop at gt_bsegnew into wa_bsegnew.
*at end of lifnr.
*sum.
*endat.
*endloop.
sort gt_bkpf by blart.
loop at gt_bseg into wa_bseg.
if wa_bseg-lifnr is not initial.
read table gt_lfa1 into wa_lfa1 with key lifnr = wa_bseg-lifnr.
move: wa_lfa1-name1 to wa_out-name1,
wa_lfa1-lifnr to wa_out-lifnr.
read table gt_t005u into wa_t005u with key bland = wa_lfa1-regio.
concatenate wa_lfa1-stras ',' wa_lfa1-ort01 ','
wa_lfa1-ort02 ',' wa_t005u-bezei ','
wa_lfa1-pfach ','
wa_lfa1-pstlz ',' 'Ph:'
wa_lfa1-telf1 ','
wa_lfa1-telf2
into wa_out-addr separated by space.
read table gt_J_1IMOVEND into wa_J_1IMOVEND with key lifnr = wa_bseg-lifnr.
move: wa_J_1IMOVEND-J_1IPANNO to wa_out-J_1IPANNO,
wa_J_1IMOVEND-J_1ICSTNO to wa_out-J_1ICSTNO,
wa_J_1IMOVEND-J_1ISERN to wa_out-J_1ISERN.
read table gt_bkpf into wa_bkpf with key belnr = wa_bseg-belnr.
if wa_bkpf-blart = 'RE' and wa_bseg-bschl = 31 or
wa_bkpf-blart = 'KR' and wa_bseg-bschl = 31.
if wa_bseg-shkzg = 'H'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-purch = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-purch = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'KR' and wa_bseg-bschl = 50.
*wa_out-tds = wa_out-tds + wa_bseg-wrbtr.
if wa_bseg-shkzg = 'H'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-tds = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-tds = wa_bseg-wrbtr * -1.
endif.
endif.
*wa_out-tds = wa_bseg-wrbtr.
endif.
if wa_bkpf-blart = 'KG' and wa_bseg-bschl = 21.
*wa_out-grdeb = wa_out-grdeb + wa_bseg-wrbtr.
if wa_bseg-shkzg = 'H'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-grdeb = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-grdeb = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'RE' and wa_bseg-bschl = 21.
*wa_out-grdeb = wa_out-grdeb + wa_bseg-wrbtr.
if wa_bseg-shkzg = 'H'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-grdeb = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-grdeb = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'KZ' and wa_bseg-bschl = 25
*or wa_bkpf-blart = 'KZ' and wa_bseg-bschl = 29
**and wa_bseg-umskz = 'A'
or wa_bkpf-blart = 'SA' and wa_bseg-bschl = 25.
if wa_bseg-shkzg = 'H'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-paym = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-paym = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'DK' and wa_bseg-bschl = 31.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'AB' and wa_bseg-bschl = 31.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'SA' and wa_bseg-bschl = 31.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'KZ' and wa_bseg-bschl = 38.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'DZ' and wa_bseg-bschl = 19
and wa_bseg-umskz = 'A'.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'KA' and wa_bseg-bschl = 39
and wa_bseg-umskz = 'G' or
wa_bseg-umskz = 'H' or
wa_bseg-umskz = 'J' or
wa_bseg-umskz = 'L' OR
wa_bseg-umskz = 'A'.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'KA' and wa_bseg-bschl = 35.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if ( wa_bkpf-blart = 'KZ' and wa_bseg-bschl = 29 )
and wa_bseg-umskz = 'A' or
wa_bseg-umskz = 'B' or
wa_bseg-umskz = 'I' or
wa_bseg-umskz = 'M' or
wa_bseg-umskz = 'O' or
wa_bseg-umskz = 'V'.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'AB' and wa_bseg-bschl = 27.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'Z1' and wa_bseg-bschl = 21 .
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
**if wa_bseg-shkzg = 'H'.
***wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
**wa_out-othdeb = wa_bseg-wrbtr.
**else.
**if wa_bseg-shkzg = 'S'.
***wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
**wa_out-othdeb = wa_bseg-wrbtr * -1.
**endif.
**endif.
**endif.
***if wa_bkpf-blart = 'AB' and wa_bseg-bschl = 27.
wa_out-othdeb = wa_bseg-wrbtr.
***endif.
***if wa_bkpf-blart = 'Z1' and wa_bseg-bschl = 21.
wa_out-othdeb = wa_bseg-wrbtr.
***endif.
read table it_out3 with key lifnr = wa_bseg-lifnr binary search.
on change of wa_bseg-lifnr.
*move: wa_lfa1-name1 to wa_out-name1,
wa_lfa1-lifnr to wa_out-lifnr.
wa_out-opbal = it_out3-wrbtr.
endon.
*if wa_out-opbal is not initial.
*wa_out-bal = wa_out-opbal + wa_out-purch - wa_out-grdeb - wa_out-othdeb + wa_out-othcre.
**else.
*wa_out-bal = wa_out-purch - wa_out-grdeb - wa_out-othdeb + wa_out-othcre.
*endif.
wa_out-bal = wa_out-opbal + wa_out-purch + wa_out-paym + wa_out-grdeb + wa_out-othdeb + wa_out-othcre.
at end of lifnr.
*wa_out-bal = wa_out-opbal + wa_out-purch - wa_out-grdeb - wa_out-othdeb + wa_out-othcre.
append wa_out to gt_out.
*collect wa_out into gt_out.
clear wa_out.
clear it_out3.
clear wa_bsegnew1.
endat.
endif.
clear: wa_bseg, wa_bkpf, wa_J_1IMOVEND.
endloop.
loop at gt_out into wa_out.
collect wa_out into gt_out1.
endloop.
endform. " sub_process_data
Regards,
Santosh Kumar M. -
Open, Write and Close the file using Powershell
Hi All,
I need to create/open a file and write some data into it and close that file.
Could anyone please help me with this.
Thanks.You don't need to explicitly create, open, or close a file in Powershell. Here are some ways to write to a file, in addition to New-Item:
$text = 'Hello World'
# Create file:
$text | Set-Content 'file.txt'
#or
$text | Out-File 'file.txt'
#or
$text > 'file.txt'
# Append to file:
$text | Add-Content 'file.txt'
#or
$text | Out-File 'file.txt' -Append
#or
$text >> 'file.txt'
Grant Ward, a.k.a. Bigteddy
The problem with Out-File is that it works like the console. When text is output, it will be truncated if it is wider than the default. So if you are looking for something where you need to store lots of long strings, then you may want to choose a different
route, or ensure than you specify a width for your output.
http://technet.microsoft.com/en-us/library/ee176924.aspx
For example to get 200 characters of width:
$text | Out-File
'myfile.txt' -width 200
I do not know for certain if there is a limit to how wide it can be. I also assume the default is the standard console width (80 characters I believe.) -
Mac Book Pro Locks up when opening Date and Time system preferences
Hi,
I have a macbook pro which i have had for about 6 months and i am so pleased with it. But now i have a problem.
Everytime i go into system preferences and then to the date and time settings it locks up. The date and time settings window will appear and looks normal but i cant do nething with it, and when i hover over the window with my mouse i get the little spinning coloured mouse icon. The only way i can then exit it is to "Force Quit" it. I reinstalled mac os x last night, to see if this would fix the problem, but it did not, and have received all updates for it.
I used to have a problem where the time would be either 1 hour fast or 1 hour slow and this would keep changing by itself everytime i started the computer.
Regards
CharlieThanks for the replies guys...
Yes, the date/time is set to auto and the source is "Apple Americas/US (time.apple.com)"
One thing I noticed is that whenever it hangs for 45 sec or so.....once the window shows up (after hanging), the lock for changes is "open".....but if I lock it at that point, close the window and then rt click on time and open Date/Time again, it does not hang......somehow when this is "locked", it does not hang when you want to open it.
But, if u are in the lock mode, and want to "click the lock" to make changes, it hangs on you again......hope this makes sense. -
Schedule jobs witj job open, submit and close
Hi gurus,
I need to know if there is any way to schedule various jobs using the FM job_open job_submit and job_close. Like schedule the first job for a date and a hour and schedule others jobs to run after the first job sequential.
Its this possible?
Thk in advanceHi
see the sample code for the Job scheduling using the fun modules
IF p_bjob = 'X'.
CONCATENATE sy-cprog sy-datum sy-uzeit
INTO jobname SEPARATED BY '_'.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = jobname
IMPORTING
jobcount = jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
IMPORTING
out_archive_parameters = arc_params
out_parameters = print_params
valid = valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF valid = chk.
SUBMIT yREP WITH s_kunnr IN s_cust
AND RETURN
USER sy-uname
VIA JOB jobname
NUMBER jobcount
TO SAP-SPOOL
SPOOL PARAMETERS print_params
ARCHIVE PARAMETERS arc_params
WITHOUT SPOOL DYNPRO.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount
jobname = jobname
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
invalid_target = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
MESSAGE i029 WITH jobname.
ENDIF.
ELSE.
MESSAGE s000 WITH text-003.
STOP.
ENDIF.
ENDIF.
Regards
anji -
8230 Flip - want it to make a sound when I open it and close it.
This is purely a personalization question, but the last clamshell phone I owned was Windows-based and I was able to customize the sounds that it made when I opened it and closed it. Pretty minor and geeky, but I loved having it make the old school Star Trek communicator sound when I flipped it open..."Kirk here". This phone is light years ahead of my old Windows phone, so I figured it should have this feature. Does anyone know how to assign sounds to these actions?
Briansyddall wrote:
Make sure mute switch is not set to red on the side of ipad. Also in control panel make sure half moon is not on for donot disturb. Bsydd uk
Many thanks for your response.
MY problem is now solved. -
My system time is always wrong, until I open date and time
Hello,
I have my system set to auto-update time.
However every time I boot up, the time is wrong, until I go into date and time.
For instance, right now, my system time says's it it 10:40 AM. It is currently 5:40 PM PST (had to look at my phone to know)
Please help me fix this ASAP!
NickHey Nick
If you have a desktop, there is a battery inside that keeps tabs on the time when it is powered down, or unplugged. If you have a laptop, that's the job of the battery that supplies your laptop when it's running.
if you have a desktop, most likely the battery is dead. This is a user replaceable part, so unplug it, look around inside for something that looks like a battery(like a AAA one, but not exactly), pull it out, and find a replacement.
If you have a laptop as I do, and your battery won't hold a charge very long, as mine won't, then every time I turn it on, I have to go into Date & Time and tell it to update.
Hope this helps. -
I have a windows vista and i tried downloading the newest version of itunes and it said it wasnt installed correctly.How can i reinstall it because i went to apple software update and it didnt let me,it told me your software is up to date and then closed on me,please help.
it said it wasnt installed correctly
What's the precise text of that error message, please? (There's a few different ones I can think of that you might be getting.) -
Problems creating background job for program (job open, submit and close)
Hi gurus,
im trying to start a background job using the FM BP_START_DATE_EDITOR to show the start date to the job or if it's imediate. this FM it's working fine, after call it im opening a job, submiting it and call the job close FM and the job close FM creates me the job.
The problem it's when i go to the sm37 to see the job status the job has been canceled, and the job log says that i have to give a start date to the job.
What i dont understand it's either the job is imediate or i choose a date to start the job always gives me this error...
Below goes my code,
any ideas will be rewarded
CLEAR: stdt_modify_type, stdt_output.
CALL FUNCTION 'BP_START_DATE_EDITOR'
EXPORTING
stdt_dialog = 'Y'
stdt_input = stdt_input
stdt_opcode = 14
IMPORTING
stdt_modify_type = stdt_modify_type
stdt_output = stdt_output
EXCEPTIONS
fcal_id_not_defined = 1
incomplete_last_startdate = 2
incomplete_startdate = 3
invalid_dialog_type = 4
invalid_eventid = 5
invalid_opcode = 6
invalid_opmode_name = 7
invalid_periodbehaviour = 8
invalid_predecessor_jobname = 9
last_startdate_in_the_past = 10
no_period_data_given = 11
no_startdate_given = 12
period_and_predjob_no_way = 13
period_too_small_for_limit = 14
predecessor_jobname_not_unique = 15
startdate_interval_too_large = 16
startdate_in_the_past = 17
startdate_is_a_holiday = 18
startdate_out_of_fcal_range = 19
stdt_before_holiday_in_past = 20
unknown_fcal_error_occured = 21
no_workday_nr_given = 22
invalid_workday_countdir = 23
invalid_workday_nr = 24
notbefore_stdt_missing = 25
workday_starttime_missing = 26
no_eventid_given = 27
OTHERS = 28.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
MOVE 'X' TO gv_flag.
ENDIF.
DATA jobname LIKE tbtcjob-jobname.
DATA jobcount LIKE tbtcjob-jobcount.
DATA job_release LIKE btch0000-char1.
DATA job_imediate TYPE c.
CLEAR: jobname, jobcount, job_release.
CONCATENATE 'MAPAEXEC' sy-uname sy-datum
INTO jobname SEPARATED BY space.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = jobname
IMPORTING
jobcount = jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i003(zmapas).
EXIT.
ENDIF.
SUBMIT z_mapa_execucao_orcamental
VIA JOB jobname NUMBER jobcount
WITH ano EQ ano
WITH so_perio IN so_perio
WITH so_date IN so_date
WITH so_org EQ so_org
WITH so_num IN so_num
AND RETURN.
IF stdt_output-startdttyp EQ 'I'.
CLEAR job_imediate.
job_imediate = 'X'.
ENDIF.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
calendar_id = stdt_output-calendarid
event_id = stdt_output-eventid
event_param = stdt_output-eventparm
event_periodic = stdt_output-periodic "?
jobcount = jobcount
jobname = jobname
laststrtdt = stdt_output-laststrtdt
laststrttm = stdt_output-laststrttm
prddays = stdt_output-prddays "??
prdhours = stdt_output-prdhours "?
prdmins = stdt_output-prdmins "??
prdmonths = stdt_output-prdmonths
prdweeks = stdt_output-prdweeks "?
predjob_checkstat = stdt_output-checkstat
pred_jobcount = stdt_output-predjobcnt
pred_jobname = stdt_output-predjob
sdlstrtdt = stdt_output-sdlstrtdt
sdlstrttm = stdt_output-sdlstrttm
strtimmed = job_imediate
targetsystem = stdt_output-instname
start_on_workday_not_before = stdt_output-notbefore
start_on_workday_nr = stdt_output-wdayno
workday_count_direction = stdt_output-wdaycdir
IMPORTING
job_was_released = job_release
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE i003(zmapas).
EXIT.
ELSE.
MESSAGE i004(zmapas) WITH jobname.
ENDIF.
Thanks in advance,
Best Regards
João MartinsHello João.
In debug mode, check the value of variables you passed to parameters sdlstrtdt and sdlstrttm.
As aditional info, I usually achieve your goal without FM BP_START_DATE_EDITOR.
Check this code:
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = w_jobname
IMPORTING
jobcount = w_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
CHECK sy-subrc = 0.
CLEAR seltab_wa.
MOVE: t_jobs-param TO seltab_wa-selname,
t_processar-line+34 TO seltab_wa-low.
APPEND seltab_wa TO seltab.
seltab_wa-selname = 'P_LOJA'.
seltab_wa-low = t_processar-ficheiro+7(4).
APPEND seltab_wa TO seltab.
*** Submete o programa para o JOB
SUBMIT (t_jobs-repid)
WITH SELECTION-TABLE seltab
USER sy-uname
VIA JOB w_jobname NUMBER w_jobcount
AND RETURN.
*** Encerra o JOB
l_hora = sy-uzeit.
ADD 60 TO l_hora.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = w_jobcount
jobname = w_jobname
sdlstrtdt = sy-datum
sdlstrttm = l_hora
targetserver = w_servidor
IMPORTING
job_was_released = l_liberado
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
Regards.
Valter Oliveira.
Maybe you are looking for
-
Can I send emails by date?
Can I send emails by date? This is what I can do using Eudora. In Eudora, I can set the date I want the email to be sent.
-
FMVT - fund balance carry forward
Hi everyone, I have a question about the transaction for Fund balance carry forward (FMVT). If the carry forward is being done on a GL account basis (through transaction F.16), is there still a need to run the FMVT transaction? If so, how is it diffe
-
Best approach to migrate from 9.2.0.1 to 9.2.0.6
Hi friends. Actually I have a production database running on Oracle 9.2.0.1 in Suse Linux. I bought a new server and I have to migrate my database from the old one. In this new server I´ll have Oracle 9.2.0.6 and RedHat. What is the best approach to
-
What is the "Smart Encoding Adjustments" option?
While choosing my importing settings, I couldn't help but notice the option "Smart Encoding Adjustments" at the bottom of the MP3 Encoder settings (just above the High-Pass Filter option and buttons). I searched the discussions, I searched Google, an
-
Display persistence in UIInput
Hi, I have got a problem of data persistence in my UIInput (textfield, output,...). Here is a description more detailled: In page1, I have a textField and a button. the action f the button assigns the value of the textField to a property of the sessi