Powershell output format
Hi
I'm looking for the best way to output data from my powershell.
Basically im running a ForEach loop and want to print different data
foreach ($line in $data){
Eg.
get-mailbox | select-object identity,emailaddresses
get-mailbox | format-table identity,emailaddresses
get-mailbox | format-table identity,emailaddresses -Autosize
The emailaddresses value is to long to display in my powershell window (eventhoug I have set the Width extremely long)
The output is displayed as
{smtp:jel@XXX, SMTP:jel@xxx, SIP:jel@xxx, smtp:Jere_Lain...
I would like to get the hole string
cannot get select-object or format-table to Work for me
Format-table is not good to use in my ForEach loop
is there any best practise how to output data in the powershell window in a foreach loop ?
Any input is apreciated.
Hi again
I will try to explain a bit more about what i'm trying to achieve.
I have a list of users
"usr01","usr2",usr3"
For each user I woul like to print to the console (or csv if not possible)
Display Name,WindowsEmailAddress,ExternalEmailAddress,EmailAddresses
User01,[email protected],usr01ext.maildomain.com,STMP:[email protected];sip:[email protected]:smtp:[email protected];smtp:[email protected]
User02,[email protected],usr02ext.maildomain.com,SMTP:[email protected];sip:[email protected]:smtp:[email protected];smtp:[email protected]
User03,[email protected],usr03ext.maildomain.com,SMTP:[email protected];sip:[email protected]:smtp:[email protected];smtp:[email protected]
Maby more or other object attribute i the future
The format above is a wish scenario, I don't have a fixed size on any attribute, they can vary much in length.
also the last part of the UPN can be different.
What is the best way to output the result
When using Array, I seem to get too much info out it adds @{attributename=attribute;attributename=attribute}
I can't get Write-host to output the result even using "`t" because I don´t have a fixed length.
Normally I would use | Select-Object attribute01,attribute02
But this prints the header each time it is run, and when using it in a foreach loop gives me a lot for headers.
should I go for Export-csv instead ?
Or is there a magig powershell comand I don't know about.
Hi again
I will try to explain a bit more about what i'm trying to achieve.
I have a list of users
"usr01","usr2",usr3"
For each user I woul like to print to the console (or csv if not possible)
Display Name,WindowsEmailAddress,ExternalEmailAddress,EmailAddresses
User01,[email protected],usr01ext.maildomain.com,STMP:[email protected];sip:[email protected]:smtp:[email protected];smtp:[email protected]
User02,[email protected],usr02ext.maildomain.com,SMTP:[email protected];sip:[email protected]:smtp:[email protected];smtp:[email protected]
User03,[email protected],usr03ext.maildomain.com,SMTP:[email protected];sip:[email protected]:smtp:[email protected];smtp:[email protected]
Maby more or other object attribute i the future
The format above is a wish scenario, I don't have a fixed size on any attribute, they can vary much in length.
also the last part of the UPN can be different.
What is the best way to output the result
When using Array, I seem to get too much info out it adds @{attributename=attribute;attributename=attribute}
I can't get Write-host to output the result even using "`t" because I don´t have a fixed length.
Normally I would use | Select-Object attribute01,attribute02
But this prints the header each time it is run, and when using it in a foreach loop gives me a lot for headers.
should I go for Export-csv instead ?
Or is there a magig powershell comand I don't know about.
Similar Messages
-
[Forum FAQ] How to format and combine PowerShell outputs
Format the output with “Format-Table” and “Format-list”
Sometimes when we query Powershell cmdlet, we would get ellipses in the result, which is not desirable.
In this scenario, we can use the cmdlet “Format-Table” and “Format-list” to view the entire output:
Get-Service | where{$_.name -like "BrokerInfrastr*"}
Get-Service | where{$_.name -like "BrokerInfrastr*"}|Format-Table –AutoSize
Get-Service | where{$_.name -like "BrokerInfrastr*"}|Format-list
Figure 1: format powershell output
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.Thanks, this has been helpful. I have been trying to figure out how the PSObjects work.
I created a function that takes an object and creates a function to create PSObjects
Function Get-ObjectPropertiesFunction
[CmdletBinding()]
[OutputType([string])]
param
[Parameter(Mandatory=$true,
ValueFromPipeline=$false,
ValueFromPipelineByPropertyName=$false,
ValueFromRemainingArguments=$false,
Position=0,
ParameterSetName='Object')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Object]$Object
Begin
$Members=Get-Member -InputObject $Object
$ValidPropertyType = @{"{get;set;}"=$True;"{get;}"=$True;}
$ValidReturnType = @{"bool"=$True;"byte"=$True;"string"=$True;"string[]"=$True;
"int"=$True;"int16"=$True;"int32"=$True;"int64"=$True;
"uint"=$True;"uint16"=$True;"uint32"=$True;"uint64"=$True;
[string]$String=""
$String=$String+"Function Get-PSObjectPropertiesFromObject `n"
$String=$String+"{ `n"
$String=$String+" [CmdletBinding()] `n"
$String=$String+" [OutputType([PSObject[]])] `n"
$String=$String+" param `n"
$String=$String+" ( `n"
$String=$String+" [Parameter(Mandatory="+"$"+"true, `n"
$String=$String+" ValueFromPipeline="+"$"+"false, `n"
$String=$String+" ValueFromPipelineByPropertyName="+"$"+"false, `n"
$String=$String+" ValueFromRemainingArguments="+"$"+"false, `n"
$String=$String+" Position=0, `n"
$String=$String+" ParameterSetName='Object')] `n"
$String=$String+" [ValidateNotNull()] `n"
$String=$String+" [ValidateNotNullOrEmpty()] `n"
$String=$String+" [Object]"+"$"+"Object `n"
$String=$String+" ) `n"
$String=$String+" Begin `n"
$String=$String+" { `n"
$String=$String+" $"+"Output = New-Object PSObject -Property ([Ordered]@{ `n"
ForEach ($Member in $Members)
IF ($Member.MemberType -EQ "Property")
[string]$Name=$Member.Name
IF ($Name.Substring(1,1) -NE "_")
[String[]]$Definition=$Member.Definition.Split(" ")
[string]$PropertyType=$Definition[2]
IF ($ValidPropertyType[$PropertyType])
$ReturnType=$Definition[0]
if ($ValidReturnType[$ReturnType])
$String=$String+" $Name="+"$"+"Object.$Name `n"
$String=$String+" }) `n"
$String=$String+" $"+"Output `n"
$String=$String+" } `n"
$String=$String+"} `n"
$String
Here is the output from the above function for the WIN32_BootConfiguration class (Small Class)
$Class="Win32_BootConfiguration"
$Function=Get-ObjectPropertiesFunction (Get-WMIObject -Class $Class)
PS C:\>> $Function
Function Get-PSObjectPropertiesFromObject
[CmdletBinding()]
[OutputType([PSObject[]])]
param
[Parameter(Mandatory=$true,
ValueFromPipeline=$false,
ValueFromPipelineByPropertyName=$false,
ValueFromRemainingArguments=$false,
Position=0,
ParameterSetName='Object')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Object]$Object
Begin
$Output = New-Object PSObject -Property ([Ordered]@{
BootDirectory=$Object.BootDirectory
Caption=$Object.Caption
ConfigurationPath=$Object.ConfigurationPath
Description=$Object.Description
LastDrive=$Object.LastDrive
Name=$Object.Name
ScratchDirectory=$Object.ScratchDirectory
SettingID=$Object.SettingID
TempDirectory=$Object.TempDirectory
$Output
PS C:\>>
The function also works for other and more interesting classes like SQL Server.
PS C:\>>
$srv = New-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database($srv, "AdventureWorks2012")
$Function=Get-ObjectPropertiesFunction $db
$Function
Function Get-PSObjectPropertiesFromObject
[CmdletBinding()]
[OutputType([PSObject[]])]
param
[Parameter(Mandatory=$true,
ValueFromPipeline=$false,
ValueFromPipelineByPropertyName=$false,
ValueFromRemainingArguments=$false,
Position=0,
ParameterSetName='Object')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Object]$Object
Begin
$Output = New-Object PSObject -Property ([Ordered]@{
ActiveConnections=$Object.ActiveConnections
AnsiNullDefault=$Object.AnsiNullDefault
AnsiNullsEnabled=$Object.AnsiNullsEnabled
AnsiPaddingEnabled=$Object.AnsiPaddingEnabled
AnsiWarningsEnabled=$Object.AnsiWarningsEnabled
ArithmeticAbortEnabled=$Object.ArithmeticAbortEnabled
AutoClose=$Object.AutoClose
AutoCreateStatisticsEnabled=$Object.AutoCreateStatisticsEnabled
AutoShrink=$Object.AutoShrink
AutoUpdateStatisticsAsync=$Object.AutoUpdateStatisticsAsync
AutoUpdateStatisticsEnabled=$Object.AutoUpdateStatisticsEnabled
AvailabilityGroupName=$Object.AvailabilityGroupName
BrokerEnabled=$Object.BrokerEnabled
CaseSensitive=$Object.CaseSensitive
ChangeTrackingAutoCleanUp=$Object.ChangeTrackingAutoCleanUp
ChangeTrackingEnabled=$Object.ChangeTrackingEnabled
ChangeTrackingRetentionPeriod=$Object.ChangeTrackingRetentionPeriod
CloseCursorsOnCommitEnabled=$Object.CloseCursorsOnCommitEnabled
Collation=$Object.Collation
ConcatenateNullYieldsNull=$Object.ConcatenateNullYieldsNull
DatabaseOwnershipChaining=$Object.DatabaseOwnershipChaining
DatabaseSnapshotBaseName=$Object.DatabaseSnapshotBaseName
DateCorrelationOptimization=$Object.DateCorrelationOptimization
DboLogin=$Object.DboLogin
DefaultFileGroup=$Object.DefaultFileGroup
DefaultFileStreamFileGroup=$Object.DefaultFileStreamFileGroup
DefaultFullTextCatalog=$Object.DefaultFullTextCatalog
DefaultSchema=$Object.DefaultSchema
EncryptionEnabled=$Object.EncryptionEnabled
FilestreamDirectoryName=$Object.FilestreamDirectoryName
HonorBrokerPriority=$Object.HonorBrokerPriority
ID=$Object.ID
IsAccessible=$Object.IsAccessible
IsDatabaseSnapshot=$Object.IsDatabaseSnapshot
IsDatabaseSnapshotBase=$Object.IsDatabaseSnapshotBase
IsDbAccessAdmin=$Object.IsDbAccessAdmin
IsDbBackupOperator=$Object.IsDbBackupOperator
IsDbDatareader=$Object.IsDbDatareader
IsDbDatawriter=$Object.IsDbDatawriter
IsDbDdlAdmin=$Object.IsDbDdlAdmin
IsDbDenyDatareader=$Object.IsDbDenyDatareader
IsDbDenyDatawriter=$Object.IsDbDenyDatawriter
IsDbManager=$Object.IsDbManager
IsDbOwner=$Object.IsDbOwner
IsDbSecurityAdmin=$Object.IsDbSecurityAdmin
IsDesignMode=$Object.IsDesignMode
IsFederationMember=$Object.IsFederationMember
IsFullTextEnabled=$Object.IsFullTextEnabled
IsLoginManager=$Object.IsLoginManager
IsMailHost=$Object.IsMailHost
IsManagementDataWarehouse=$Object.IsManagementDataWarehouse
IsMirroringEnabled=$Object.IsMirroringEnabled
IsParameterizationForced=$Object.IsParameterizationForced
IsReadCommittedSnapshotOn=$Object.IsReadCommittedSnapshotOn
IsSystemObject=$Object.IsSystemObject
IsUpdateable=$Object.IsUpdateable
IsVarDecimalStorageFormatEnabled=$Object.IsVarDecimalStorageFormatEnabled
LocalCursorsDefault=$Object.LocalCursorsDefault
MirroringPartner=$Object.MirroringPartner
MirroringPartnerInstance=$Object.MirroringPartnerInstance
MirroringRedoQueueMaxSize=$Object.MirroringRedoQueueMaxSize
MirroringRoleSequence=$Object.MirroringRoleSequence
MirroringSafetySequence=$Object.MirroringSafetySequence
MirroringTimeout=$Object.MirroringTimeout
MirroringWitness=$Object.MirroringWitness
Name=$Object.Name
NestedTriggersEnabled=$Object.NestedTriggersEnabled
NumericRoundAbortEnabled=$Object.NumericRoundAbortEnabled
Owner=$Object.Owner
PrimaryFilePath=$Object.PrimaryFilePath
QuotedIdentifiersEnabled=$Object.QuotedIdentifiersEnabled
ReadOnly=$Object.ReadOnly
RecursiveTriggersEnabled=$Object.RecursiveTriggersEnabled
TargetRecoveryTime=$Object.TargetRecoveryTime
TransformNoiseWords=$Object.TransformNoiseWords
Trustworthy=$Object.Trustworthy
TwoDigitYearCutoff=$Object.TwoDigitYearCutoff
UserName=$Object.UserName
Version=$Object.Version
$Output
PS C:\>> -
Problem with Excel output format
Hi Guys,
I am creating a report in XML Publisher (not standalone). I am facing some problems could anyone please help me to figure out the issues.
Is it possible to have all three output format (PDF, HTML & EXCEL) exact (same aligned) only by creating a single RTF Template? I am facing the problem with Excel output format the output format of excel is taking excels cell formatting.
Example Numeric fields --> Right Aligned, text fields --> Left Aligned
One more issue with excel is -ve(negative) values are getting displayed in red and in brackets like ($13) (with red color).
Our client want excel output on priority.
Is there any limitation for excel output format of reports?
It is very urgent for us please help.
Any help would be highly appreciated.
Thanks,
Pragati
Edited by: user11237443 on Aug 27, 2009 1:22 AMHi Mahi,
Thanks for your response. But i could not understand how can we write wrapper program could you please give some light on this or provide some link it would be helpful for me:-)
I have read that blog for excel limitations but i have more question?
1) What about the negative values?
if any field is displaying negative amount then excel not displaying right value for that:(
2)How can we align header or data?
Do XMLP with EBS provide any solution for formatting in excel?
3) If for the alignment of numeric value we concatenate them with any special character then how can we perform calculation that field?
Here are so many formatting issues do we need to write any code in xml for that?
Please help.
Many Thanks,
Pragati -
Changing Oracle Report Output Format at runtime
Dear All,
I've custom Oracle Report in Oracle Apps., and would like to give the users an option to select the output format (XML, TEXT, PDF, etc.) whilst submitting the request.
As a SYSADMIN, we can modify the Output Format value of the concurrent program(Oracle Report in this case) to one we like.
But I would like the user to select this output format option at runtime, rather then hard coding at SYSADMIN level. For that I've to create a Value Set with the desired report output format options, and attach this to the concurrent program.
My question is, how we can make the desired output format to work at runtime?
If any one can help?
Thanks,
SandeepHi Steve,
I couldn't get it...???
I'm running an Oracle Report in Oracle Apps. release 11.5.9
The default output format of this report is TEXT, which is defined in its concurrent program.
This report is submitted using standard request submission screen, and after successful completion we can view the output by pressing "View Output" button on "Requests" screen. This will open an another window and we can view the output page by page. Using "Tools>Copy File..." menu option, we can view the same output in IE window.
Now, how does your resolution fits here and how can I view the same report in XML format?
Many Thanks,
Sandeep -
Output format in background is not same as Foreground
Dear All,
I am running a report in Background but output is not coming in desired format. Suppose output contains 35 columns ( while running the report in Foreground) but in doesn't show all the columns in background. Is there any SAP Standard settings by which we can set the output format as per our requirement while running the job in background.Thanx Sourabh for your reply,
I have check the variant , it is correct. It's a common problem that end users are facing in my organization.
What I want that if standard output has width of 35 columns ( in foreground ), it must show all the columns in background also. -
What output formats are supported by SAPConnect in SAP CRM 7.0
Is MHT document format and .doc format the only filetypes that are supported in SAP CRM 7.0? Could anyone please answer what are all the other output formats supported by SAP CRM 7.0.
Hi,
For interactive CRM report, please try link
http://help.sap.com/bp_crm70/BBLibrary/Documentation/C41_BB_ConfigGuide_EN_DE.doc
On page of
http://help.sap.com/bp_crm70/CRM_DE/HTML/index.htm
you may find some other info related to BW analytics, maybe there is info for dashboard? I am not so sure.
Hongyan -
How to align output formatted and output text in the same line?
Hi All,
I want an output formatted label and a text on the same line,. I've surrounded these components wth a panel form layout and they automatically align one below the other. how do I kepe them in the same line?
Thanks.Try as per the code snippet below:
<af:document title="TestPage.jspx" id="d1">
<af:messages id="m1" inline="true"/>
<af:form id="f1">
*<af:panelGroupLayout id="pgl1" layout="horizontal">*
*<af:outputFormatted value="outputFormatted1" id="of1"/>*
*<h:outputText value="outputText1" id="ot1"/>*
*</af:panelGroupLayout>*
</af:form>
</af:document>
Thanks,
Navaneeth -
Want text input containing HTML tags to appear as HTML in output format
Hi,
We have a table in Oracle database that has a column named detail,one of its values is like this: <bold><italics>Good Morning</italics></bold>. What our client wants is that the output format should show: <b><i>Good Morning</b></i>. That is,Bi Publisher should be able to parse the HTML tags and provide the desired output. Please tell me how to achieve this. Any help is much appreciated.
Thanks and regards,
Debarati,
[email protected]Hi,
have a look here (http://blogs.oracle.com/xmlpublisher/2007/01/formatting_html_with_templates.html) to get an idea.
regards
Rainer -
Please help.
I have a tutorial with in the output format of SWF and HTM. I have click boxes that On Success will open another tutorial (SWF file). When I click on the click box, I get prompted “Do you trust this content to connect to the Internet?” by the Adobe Flash Player. I can click “Yes” and continue, however I don’t want the user to get prompted for every click box with this action (there is one for every tutorial and navigation buttons to each tutorial). I also think that SCORM can't handle the prompt, because when I run the tutorial from the LMS the click boxes do not work at all.
I have tried selecting “Always allow” in the Global Security Settings panel as per the instruction on this website: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.htm l.
Any ideas?Hi,
I wanted to add on a question to this posting.... I believe Rod's instructions must be followed on a per-PC basis, correct? Is there any way to disable this globally when/after I publish the files rather than telling 1000 users across the globe that they have to change their security settings? I don't think so from the article (very thorough) but just hoping there's something I can do?!
Thank you!
Michele -
QM-How to add a New "Output Format" in Certificate Profile?
Hello QM Functional Experts,
Can any of you tell me how we can add a custom "Output Format" in the Certificate Profile (QC01/2/3). I tried the Configuration approach via QM-Quality Certificates-Certificate Profile-Define Data Origin. I do not see an option here to add a New Output Format.
If this is posted in a wrong forum, I apologize. I am not able to find the correct forum for QM. Please redirect me and I will be glad to post it in the right forum.
Thanks,
NageshHi,
You can use the FM ..RV_MESSAGE_UPDATE..
Thanks
Naren -
(Input and) output formats from Photoshop Elements 6 for Mac
I noticed that (until midnight PT, anyway) Amazon has Photoshop Elements for the Mac at a lower price than usual. This brings up a question for me: What output formats can Photoshop Elements 6 produce? In particular, can it produce PNG? Also, can it accept PNG as input?
I think that all the formats like .bmp, camera RAW, EPS,PICT, TIFF, Filmstripn, IFF, JPEG, Photoshop pdf, Photoshop RAW,PNG etc are supported for both input and output.
-
Different resolution in preview and output format
Hi Folks
I need your help. We already captured a lot of e-learning material but come to a problem.
The output format quality is less good than the preview quality.
Win7 /Captivate 6
Capture resolution for software simulation is 1024x768.
Producing the material in swf and html. No compressing, set to best quality.
Open the preview: quality is nearly the same as the original source.
Open the swf directly or the html --> output looks cloudy, diffuse.
Test with an without scalable html. In case of scalable html it is hard to find the right resolution (1024x768) on a 1280x1024 resolution monitor, but you can find it and the the output is clear as the preview.
The output format resolution within the project is set to 1024x768. We measured the "true" output resolution on different produced output formats, and they are all a little bit higher than 1024x768, about 4% more heigh and width.
Of course, I was able to change the html-script which sets the start-format for an swf to open, if I change it to 1024x768 and save it, the quality of the swf is like the preview and sharp and ok. But in case of scalable html I cannot set the format. However, why the swf -even when i start/opeen it directly- didn't start with the right resolution set in the settings within the project?
Also our target group should not "search" for the sharp resolution by scaling the output window.
Why does captivate change the resolution? why is the preview ok and the produced swf not? I didn't understand that fact.
Also we like to produce with TOC, so the widht for TOC is 250. If I change the html script in that case to 1024+250=1274x768 the swf is also unshapr/cloudy and I havee no change to fit it to the right resolution (1024+TOC).
Regards
RobVamsi mailed me offline and I have suggested looking at Using RH7 on my site where this problem is covered.
See www.grainge.org for RoboHelp and Authoring tips
Follow me @petergrainge -
Hi ,
Whle submitting AP prepayment balance report able to get the output in XML format.
But, if for the same report when the output format is changed to PDF or Text not able to get the report.
Anybody pls suggest any changes to be done in setup to resolve the problem.
Thank you in advance.
RajAre there any errors recorded in the log file of the concurrent request ?
HTH
Srini -
How to save the output format of Quotation in PDF
Dear all,
When i am take a print priew of Quotation it show the quotation format in std sap format but it dosenot allow to save ?
Is there any std setting for Saving the output format?
Plz send the some solution for the same.
Thx & Regards,
PM
Edited by: PM on Feb 7, 2008 12:46 PMHI
If the output is sapscript, you can convert it into PDF format . There is one standard report RSTXPDFT2 to convert into PDF .
Before Execute you will have to create a spool request . when you will execute this report you will have to enter the
spool no. Then you can send this PDF file as attachment.
Hope this will helpful.
Bye
Ellath -
How to get this output format in ALV report
Hi.
Can any one pls let me know how to get the following output format in ALV report.Following are the outputfields
companycode location position approver
300 800 01 watson
null null 03 candy
null null 04 smith
null null 05 michael
one empty line after this again
300 800 01 ryant
null null 02 gyan
null null 03 fermi
null null 04 ogata
*Note: Null indicates empty space .( i.e I need to get empty space in output where ever null is there.)
Thanks in advance.
Kind Regards,
samiulla.hi,
u can use 'REUSE_ALV_LIST_DISPLAY'
or
'REUSE_ALV_GRID_DISPLAY' function modules.
SAMPLE CODE :
*& Report Y101982CHD
* TABLES
TABLES: vbak. " standard table
* Type Pools *
TYPE-POOLS: slis.
* Global Structure Definitions *
*-- Structure to hold data from table CE1MCK2
TYPES: BEGIN OF tp_itab1,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
werks LIKE vbap-werks,
lgort LIKE vbap-lgort,
END OF tp_itab1.
*-- Data Declaration
DATA: t_itab1 TYPE TABLE OF tp_itab1.
DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
* Selection Screen *
*--Sales document-block
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.
SELECTION-SCREEN END OF BLOCK b1.
*--Display option - block
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
PARAMETERS: alv_list RADIOBUTTON GROUP g1,
alv_grid RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b2.
*file download - block
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
PARAMETERS: topc AS CHECKBOX,
p_file TYPE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK b3.
* Initialization. *
* At Selection Screen *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = 'P_FILE'
dyname = sy-cprog
dynumb = sy-dynnr
filetype = 'P' "P-->Physical
location = 'P' "P Presentation Srever
server = space.
AT SELECTION-SCREEN ON s_vbeln.
PERFORM vbeln_validate.
* Start Of Selection *
START-OF-SELECTION.
*-- Fetching all the required data into the internal table
PERFORM select_data.
* End Of Selection *
END-OF-SELECTION.
IF t_itab1[] IS NOT INITIAL.
IF topc IS NOT INITIAL.
PERFORM download.
MESSAGE 'Data Download Completed' TYPE 'S'.
ENDIF.
PERFORM display.
ELSE.
MESSAGE 'No Records Found' TYPE 'I'.
ENDIF.
* Top Of Page Event *
TOP-OF-PAGE.
*& Form : select_data
* Description : Fetching all the data into the internal tables
* parameters : none
FORM select_data .
SELECT vbeln
posnr
werks
lgort
INTO CORRESPONDING FIELDS OF TABLE t_itab1
FROM vbap
WHERE vbeln IN s_vbeln.
IF sy-subrc <> 0.
MESSAGE 'Enter The Valid Sales Document Number'(t04) TYPE 'I'.
EXIT.
ENDIF.
ENDFORM. " select_data
*& Form : display
* decription : to display data in given format
* parameters : none
FORM display .
IF alv_list = 'X'.
PERFORM build_fieldcat TABLES i_fieldcat[]
USING :
*-Output-field Table Len Ref fld Ref tab Heading Col_pos
'VBELN' 'T_ITAB1' 10 'VBAP' 'VBELN' '' 1,
'POSNR' 'T_ITAB1' 6 'VBAP' 'POSNR' '' 2,
'WERKS' 'T_ITAB1' 4 'VBAP' 'WERKS' '' 3,
'LGORT' 'T_ITAB1' 4 'VBAP' 'LGORT' '' 4.
*CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'*
*EXPORTING*
*i_callback_program = sy-repid*
** i_callback_pf_status_set = c_pf_status*
*i_callback_user_command = 'USER_COMMAND '*
** it_events = t_alv_events[]*
*it_fieldcat = i_fieldcat[]*
*TABLES*
*t_outtab = t_itab1[]*
*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.*
ENDIF.
IF alv_grid = 'X'.
PERFORM build_fieldcat TABLES i_fieldcat[]
USING :
*-Output-field Table Len Ref fld Ref tab Heading Col_pos
'VBELN' 'T_ITAB1' 10 'VBAP' 'VBELN' '' 1,
'POSNR' 'T_ITAB1' 6 'VBAP' 'POSNR' '' 2,
'WERKS' 'T_ITAB1' 4 'VBAP' 'WERKS' '' 3,
'LGORT' 'T_ITAB1' 4 'VBAP' 'LGORT' '' 4.
*CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'*
*EXPORTING*
*i_callback_program = sy-repid*
** i_callback_pf_status_set = c_pf_status*
*i_callback_user_command = 'USER_COMMAND '*
*it_fieldcat = i_fieldcat*
*TABLES*
*t_outtab = t_itab1[]*
*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.*
*ENDIF.*
ENDFORM. " display
*& Form : vbeln_validate
* description : to validate sales document number
* parameters : none
FORM vbeln_validate .
DATA: l_vbeln TYPE vbak-vbeln.
SELECT SINGLE vbeln
FROM vbak
INTO l_vbeln
WHERE vbeln IN s_vbeln.
IF sy-subrc NE 0.
MESSAGE 'ENTER THE VALID SALES DOCUMENT NO:' TYPE 'I'.
EXIT.
ENDIF.
ENDFORM. " vbeln_validate
*& Form :build_fieldcat
* Description : This routine fills field-catalogue
* Prameters : none
FORM build_fieldcat TABLES fpt_fieldcat TYPE slis_t_fieldcat_alv
USING fp_field TYPE slis_fieldname
fp_table TYPE slis_tabname
fp_length TYPE dd03p-outputlen
fp_ref_tab TYPE dd03p-tabname
fp_ref_fld TYPE dd03p-fieldname
fp_seltext TYPE dd03p-scrtext_l
fp_col_pos TYPE sy-cucol.
*-- Local data declaration
DATA: wl_fieldcat TYPE slis_fieldcat_alv.
*-- Clear WorkArea
wl_fieldcat-fieldname = fp_field.
wl_fieldcat-tabname = fp_table.
wl_fieldcat-outputlen = fp_length.
wl_fieldcat-ref_tabname = fp_ref_tab.
wl_fieldcat-ref_fieldname = fp_ref_fld.
wl_fieldcat-seltext_l = fp_seltext.
wl_fieldcat-col_pos = fp_col_pos.
*-- Update Field Catalog Table
APPEND wl_fieldcat TO fpt_fieldcat.
ENDFORM. "build_fieldcat
*& Form : download
* description : To Download The Data
* Parameters : none
FORM download .
DATA: l_file TYPE string.
l_file = p_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_file
filetype = 'ASC'
TABLES
data_tab = t_itab1
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 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.
ENDFORM. " download
HOPE IT WILL HELP YOU
REGARDS
RAHUL SHARMA
Maybe you are looking for
-
Problem with sound when import from Premiere into After Effects
Hi! I imported a sequence from a Premiere Pro project using File -> Import -> Adobe Premiere Project... The video in the sequence showed up in the After Effects project as a composition. However, the composition did not include the sound from the se
-
How to create validation on the field in WEBUI ?
Hi all, Can somebody inlight me with the following question? Is it possible in IC WebUI when New Customer is being created through IC center to put validation on some field for Example if customer with the Last Name, First Name, email exists already
-
Adobe Acrobat V9 Professional crashes or causes PDFs to be corrupted when using Dragon software
Adobe Acrobat V9 Professional crashes or causes PDFs to be corrupted when using Dragon software. I use Nuance Dragon NaturallySpeaking 11.5 to assist me when I add comments to a PDF. I also use it when making additions or changes to text. When I use
-
Method execute from the Guided Procedure
Hi All: I have a web dynpro application that has a view Evaluation and this one has a embed view from another component. I´m using guided procedures and setting in the execute method a parameter that is linked to the embed view. The problem is that i
-
Exploring the panel system | Learn Illustrator CS6 | Adobe TV
With Illustrator's panels ported over to a completely new system, it is easier than ever to make inline text edits and use keyboard shortcuts, freeing you from the tyranny of the mouse. http://adobe.ly/Jo2Jf9