Dailycode.info

Short solution for short problems

SAP: outputparamas for printing properties

Component Component Type Data Type Length Short Description
DEVICE FPMEDIUM CHAR 8 Output device
NODIALOG FPNODIALOG CHAR 1 Suppress User Dialog
PREVIEW FPPREVIEW CHAR 1 Preview
GETPDF FPGETPDF CHAR 1 Request PDF Return
GETPDL FPGETPDL CHAR 1 Request PDL Return
GETXML FPGETXML CHAR 1 Get-Data-XML Request
CONNECTION RFCDEST CHAR 32 Logical Destination (Specified in Function Call)
ADSTRLEVEL FPADSTRL NUMC 2 Trace Level for Adobe Document Services
JOB_PROFILE FPJOBPROFILE STRING 0 Name of Job Profile
BUMODE FPBUMODE CHAR 1 Bundle Mode
ASSEMBLE FPASSEMBLE CHAR 1 Merge into one PDF document?
PARALLEL FPBOOLEAN CHAR 1 Data Type BOOLEAN
PDFVERSION FPPDFVERSION STRING 0 PDF Version
PDFTAGGED BOOLEAN CHAR 1 Boolean Variable (X=True, -=False, Space=Unknown)
PDFCHANGESRESTRICTED FPCHANGESRESTRICTED CHAR 1 Restricted Editing Options for PDF Document
.INCLUDE SFPPRIP   0 Form Processing: Print Parameters
DEST RSPOPNAME CHAR 4 Spool: Output device
REQNEW SYPRNEW CHAR 1 New Spool Request (Print Parameters)
REQIMM SYPRIMM CHAR 1 Print Immediately (Print Parameters)
REQDEL SYPRREL CHAR 1 Delete After Printing (Print Parameters)
REQFINAL RSPOFINAL CHAR 1 Spool request completed
SPOOLID RSPOID INT4 10 Spool request number
SENDDATE SKDATE DATS 8 Requested send date
SENDTIME SKTIME TIMS 6 Requested send time
SCHEDULE SKSCHEDULE CHAR 3 Send time request
COPIES FPCOPIES NUMC 3 Number of Copies
DATASET RSPO0NAME CHAR 6 Spool request: Name
SUFFIX1 RSPO1NAME CHAR 4 Spool request: Suffix 1
SUFFIX2 RSPO2NAME CHAR 12 Spool request: Suffix 2
COVTITLE SYPRTXT CHAR 68 Text for Cover Page (Print Parameters)
COVER SYPRSAP CHAR 1 Print: SAP cover page
RECEIVER SYPRREC CHAR 12 Recipient (Print Parameters)
DIVISION SYPRABT CHAR 12 Department on Cover Page (Print Parameters)
LIFETIME SYPEXPI NUMC 1 Spool Retention Period (Print Parameters)
AUTHORITY SYPRBER CHAR 12 Print: Authorization
RQPOSNAME RSPOPRNAME CHAR 50 Spool: Long name of printers for host spooler
PDLTYPE FPPDLTYPE CHAR 30 Printer Control Language
XDCNAME FPXDCNAME CHAR 51 XDC Name
NOPDF FPNOPDF CHAR 1 No PDF generation
SPONUMIV NRNR CHAR 2 Number range number
.INCLUDE SFPOUTARC   0 Form Processing: Options for Archiving
ARCMODE SYARMOD CHAR 1 Print: Archiving mode
NOARMCH FPNOARMCH CHAR 1 No Change of Archiving Mode
.INCLUDE SFPOUTBUT   0 Form Processing: Options for Dialog
TITLE FPTITLE CHAR 50 Title in dialog box
NOPREVIEW FPNOPREVIEW CHAR 1 No print preview
NOPRINT FPNOPRINT CHAR 1 No printing from print preview
NOARCHIVE FPNOARCHIVE CHAR 1 No archiving from print preview
IMMEXIT FPIMMEXIT CHAR 1 Exit Preview Immediately After Output
NOPRIBUTT FPNOPRIB CHAR 1 No Pushbuttons
.INCLUDE SFPXFPOPT   0 Options for XFP Output
XFP FPXFPACTIVE CHAR 1 XFP Output Activated
XFPTYPE FPXFPTYPE CHAR 1 XFP Variant
XFPOUTDEV RSPOPNAME CHAR 4 Spool: Output device

SAP: using PDF to print invoice uses wrong printer

I was looking at the configuration, but couldn't find any problems in NACE, SPRO or VV32.

So I took a deeper dive into the code and found this piece of code written by some guy before me:

fp_outputparams-dest          = 'LP01'.

So I changed this into this:

 IF NOT nast-ldest IS INITIAL.
    fp_outputparams-dest = nast-ldest.
  ELSE.
    fp_outputparams-dest          = 'LP01'.
  ENDIF.
Now it took the correct configured printer.
Here the complete printer code as it is now (the flag gv_e_invoice is used for sending the pdf via email, no printing!):
 
*&---------------------------------------------------------------------*
*& Get function for form processing
*&---------------------------------------------------------------------*
  SELECT SINGLE sform FROM tnapr
          INTO lv_formname
          WHERE nacha EQ nast-nacha
          AND kschl EQ nast-kschl.

  TRY.
      CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
        EXPORTING
          i_name           = lv_formname
        IMPORTING
          e_funcname       = ls_function
          e_interface_type = fp_interfacetype.
    CATCH cx_root INTO w_cx_root.
  ENDTRY.

*&---------------------------------------------------------------------*
*& Create the job with the selected output parameters
*&---------------------------------------------------------------------*

  IF gv_e_invoice EQ 'X'.
    fp_outputparams-preview       = 'X'.
    fp_outputparams-nodialog      = gv_e_invoice.

  ELSE.
    fp_outputparams-preview       = 'X'.
    fp_outputparams-nodialog      = 'X'.
    fp_outputparams-REQIMM        = 'X'.
  ENDIF.

  fp_outputparams-covtitle      = 'Invoice'.
  fp_outputparams-reqnew        = 'X'.
  fp_outputparams-reqfinal      = 'X'.

  IF NOT nast-ldest IS INITIAL.
    fp_outputparams-dest = nast-ldest.
  ELSE.
    fp_outputparams-dest          = 'LP01'.
  ENDIF.

  fp_outputparams-getpdf        = gv_e_invoice.


  CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
      ie_outputparams = fp_outputparams
    EXCEPTIONS
      cancel          = 1
      usage_error     = 2
      system_error    = 3
      internal_error  = 4
      OTHERS          = 5.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
 

Devexpress 10: WPF GridControl - Show bound column in date time format

I took me a while to find, but at the end I got it.

The problem was when I start using Devexpress 10 (we’re in the process of buying the latest version, but not there yet) WPF GridControl, the datatime column only showed date.

Not a big deal, or so I thought. The first solution I found was to use the TextEditSettings. But that was in a differtent namespace. Therefore I had to add an assembly that I couldn’t find.

Eg. xmlns:dxe="clr-namespace:DevExpress.Wpf.Editors.Settings;assembly=DevExpress.Wpf.Editors.v9.1"

 

So I looked around but couldn’t find it. Too bad I thought and start looking further into the Template columns, but everywhere the binding failed. This because I work with DataSource of the grid, not the DataContext.

 Now at the end I found that I already had the assembly and it wasn’t DevExpress.Wpf. Just by adding this namespace in my xaml I could use the TextEditSettings:

xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"

 

So now I just use this piece of code to show my desired format of the date:

<dxg:GridColumn Name="createdtest" Header="Erzellt" FieldName="Created">

<dxg:GridColumn.EditSettings>

             <dxe:TextEditSettings DisplayFormat="dd/MM/yyyy HH:MM" />

</dxg:GridColumn.EditSettings>

</dxg:GridColumn>

 

That’s al there is about it!

This is all the code for the GridControl:

<UserControl xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" 

             xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"

 

<dxg:GridControl DataSource="{Binding Path=SearchList}"  AutoPopulateColumns="False">

            <dxg:GridControl.Columns>

                <dxg:GridColumn Name="gridColumn1" Header="Kunde Nr." FieldName="Key2" ReadOnly="True"/>

                <dxg:GridColumn Name="gridColumn2" Header="Kunde Name" FieldName="Key3" ReadOnly="True" Width="500"/>

                <dxg:GridColumn Name="gridColumn3" Header="Mandant" FieldName="Key4" ReadOnly="True"/>

                <dxg:GridColumn Name="gridColumn4" Header="Kunde BW" FieldName="Key5" ReadOnly="True"/>

                <dxg:GridColumn Name="createdtest" Header="Erzellt" FieldName="Created">

                    <dxg:GridColumn.EditSettings>

                        <dxe:TextEditSettings DisplayFormat="dd/MM/yyyy HH:MM" />

                    </dxg:GridColumn.EditSettings>

                </dxg:GridColumn>

            </dxg:GridControl.Columns>

               

        </dxg:GridControl>

 

 

 

 


WPF - MVVM: Easy wait cursor implementation

Found a very good solution on StackOverflow.

Comes down to implementing a small class, better put it somewhere in your WPF framework or Shared library.

Call it like this:

UIHelper.SetBusyState();

The cursor will return to normal when the  application stops working.

 

Code:
using System;
using System.Windows.Input;
using System.Windows.Threading;

namespace Global.Wpf
{
    public static class UIHelper
    {
        /// <summary>
        ///   A value indicating whether the UI is currently busy
        /// </summary>
        private static bool IsBusy;

        /// <summary>
        /// Sets the busystate as busy.
        /// </summary>
        public static void SetBusyState()
        {
            SetBusyState(true);
        }

        /// <summary>
        /// Sets the busystate to busy or not busy.
        /// </summary>
        /// <param name="busy">if set to <c>true</c> the application is now busy.</param>
        private static void SetBusyState(bool busy)
        {
            if (busy != IsBusy)
            {
                IsBusy = busy;
                Mouse.OverrideCursor = busy ? Cursors.Wait : null;

                if (IsBusy)
                {
                    new DispatcherTimer(TimeSpan.FromSeconds(0), DispatcherPriority.ApplicationIdle, dispatcherTimer_Tick, System.Windows.Application.Current.Dispatcher);
                }
            }
        }

        /// <summary>
        /// Handles the Tick event of the dispatcherTimer control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private static void dispatcherTimer_Tick(object sender, EventArgs e)
        {
            var dispatcherTimer = sender as DispatcherTimer;
            if (dispatcherTimer != null)
            {
                SetBusyState(false);
                dispatcherTimer.Stop();
            }
        }
    }
}

iOS: easy using the Settings menu in your App

Here you can find a good tutorial:

http://useyourloaf.com/blog/2010/05/18/adding-a-settings-bundle-to-an-iphone-app.html

Comes down to this: Add a file -> Resource -> Settings Bundle

If you only have 1 level, add the settings to the root list. Mind the Identifier, for this is the identifier user later on in the program to get it.

The in your app you can simply address the UserDefaults with the identifier mentioned above:

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
BOOL enabled = [defaults boolForKey:@"enableRotation"];

iOS: FreeForm and UIScrollview: subviews do not react to scroll

After upgrading to iOS7 I've had some problems with a FreeForm combination with a UIScrollview.

First it didn't scroll at all, this was related to missing constraints. Then I noticed that some subviews were not sending their touches to the scrollview, or that the scrollview didn't react ot touches on subviews. 

After settings the 'Delays Content Touches' to YES, it worked again as normal.

What a relief.


iOS: Open second storyboard in modal with presentation curl.

I had a very large StoryBoard with a lot of relations. I started to group functionality and add the Views to different storyboards. Since iOS 7 and xcode 5 it came in a hurry, since the designer was crashing and messing up the layout.

First I just pushed the viewcontrollers in the navigation controller like this:

+(void) NavigateToCustomerLookupFrom:(UIViewController *)vc

{

    UIStoryboard * sb = [UIStoryboardstoryboardWithName:@"CustomerLookupStoryboard"bundle:nil];

    UIViewController * vcTo = [sb instantiateInitialViewController];

    

    [UIViewtransitionWithView:vc.viewduration:0.8options:UIViewAnimationOptionTransitionCrossDissolve

                    animations:^{

                        [vc.navigationController pushViewController:vcTo animated:NO];

                    }

                    completion:NULL];

    

}

That worked. But then I came up with a views that needed to be opened in a modal way. So this is the code to do just that. In this example I use the partial curl effect to open it:

+(void) NavigateToSignatureFrom:(UIViewController *)vc withSignee:(NSString *) Signee

{

    UIStoryboard * sb = [UIStoryboardstoryboardWithName:@"SignatureStoryboard"bundle:nil];

    UIViewController * vcTo = [sb instantiateInitialViewController];

    

    ((SignatureVC *) vcTo).Signee = Signee;

    

    [vcTo setModalTransitionStyle:UIModalTransitionStylePartialCurl];

    [vc presentViewController:vcTo animated:YEScompletion:nil];

}

The example also shows how to set properties of the destination controller.


xcode5: story board crashes

After upgrading to xcode 5, my xcode crashed when I opened a story board with some 20 Views on it. 

I tried several solutions, including waiting, clicking, wainting. But everytime the xcode seemed like loading and responded for a click every minute or so.

The reason the story board crashed, was apparently because I clicked once on the keep xcode 4.6 compatible. This made xcode crash. It started scanning the files and ...

So how to solve thisjQuery15201013488220050931_1381145930681

Right click on the storyboard and choose: 'Open As' -> Source code.

There you need to change the top of the document to be xcode 5 comatible. You can get the code from a story board in your solution that is working, or you can try to replace the code on the top of the document up until </dependencies> with this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4510" systemVersion="12F37" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES">

    <dependencies>

        <deployment defaultVersion="1552" identifier="iOS"/>

        <development version="5000" identifier="xcode"/>

        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>

    </dependencies>

 

You can now switch the View As to 'iOS 6.1 and Earlier' or 'iOS 7.0 and Later'.

You'll find this in the identity inspector when clicking on the story board outside of a view.


xcode5: story board crashes

After upgrading to xcode 5, my xcode crashed when I opened a story board with some 20 Views on it. 

I tried several solutions, including waiting, clicking, wainting. But everytime the xcode seemed like loading and responded for a click every minute or so.

The reason the story board crashed, was apparently because I clicked once on the keep xcode 4.6 compatible. This made xcode crash. It started scanning the files and ...

So how to solve thisjQuery15201013488220050931_1381145930680

Right click on the storyboard and choose: 'Open As' -> Source code.

There you need to change the top of the document to be xcode 5 comatible. You can get the code from a story board in your solution that is working, or you can try to replace the code on the top of the document up until </dependencies> with this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4510" systemVersion="12F37" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES">

    <dependencies>

        <deployment defaultVersion="1552" identifier="iOS"/>

        <development version="5000" identifier="xcode"/>

        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>

    </dependencies>