Read and write windows forms textboxes into DTO

by Mark Deraeve 24. July 2013 23:17

Without using any kind of existing binding protocols, these functions will fill the controls with the corresponding fields from a class (DTO in this case).

The most important requirement in this case is that you name the textfields like your DTO properties. you can use a random prefix for the text fields. Contain the text fields in a panel or group box. Then for eg. each group box use a different container. In my case I had several tab pages, for each tab page I use a prefix txt1 up to txt5. So a text field is called txt1CREATED or ...

The first function is to Fill the fields on the form. You provide a DTO class, a container and a number that is equal to the number of prefix characters.

    Private Sub FillDataFieldsOnForm(Of T)(ByVal DTO As T, ByVal collection As Control.ControlCollection, ByVal i As Short)

        Dim myType As Type = GetType(T)

 

        For Each txt In collection

            If (TypeOf txt Is DevExpress.XtraEditors.TextEdit) Then

                Try

                    Dim name As String = DirectCast(txt, DevExpress.XtraEditors.TextEdit).Name.Substring(i)

                    Dim myProp As PropertyInfo = myType.GetProperty(name)

 

                    DirectCast(txt, DevExpress.XtraEditors.TextEdit).EditValue = myProp.GetValue(DTO, Nothing)

                Catch ex As Exception

                    DirectCast(txt, DevExpress.XtraEditors.TextEdit).EditValue = ex.Message

                End Try

            End If

        Next txt

 

    End Sub

Here you can see an implementation of this function:

FillDataFieldsOnForm(kKna1, grpHeader.Controls, 3)

Now when you want to read the controls, its equally easy:

ReadDataFieldsOnForm(Of KNB1)(kKnb1, grpCustomerMasterData, 4)

The function for to do this is:

    Private Sub ReadDataFieldsOnForm(Of T)(ByVal DTO As T, ByVal grp As DevExpress.XtraEditors.GroupControl, ByVal i As Short)

        Dim myType As Type = GetType(T)

 

        For Each txt In grp.Controls

            If (TypeOf txt Is DevExpress.XtraEditors.TextEdit) Then

                Try

                    Dim name As String = DirectCast(txt, DevExpress.XtraEditors.TextEdit).Name.Substring(i)

                    Dim myProp As PropertyInfo = myType.GetProperty(name)

 

                    myProp.SetValue(DTO, DirectCast(txt, DevExpress.XtraEditors.TextEdit).EditValue, Nothing)

                Catch ex As Exception

                End Try

            End If

        Next txt

 

    End Sub


Tags:

Comments (15) -

differenthaircolorss.com
differenthaircolorss.com United States
9/15/2013 3:29:25 AM #

Sorry for the huge review, but I'm really loving the new Zune, and hope this, as well as the excellent reviews some other people have written, will help you decide if it's the right choice for you.

Lorean Nicholason
Lorean Nicholason United States
11/30/2013 5:53:56 PM #

Thanks for the good writeup. It in truth was once a amusement account it. Look complex to far added agreeable from you! However, how could we communicate?

sex and fuck
sex and fuck United States
12/6/2013 7:23:58 AM #

Magnificent beat ! I wish to apprentice whilst you amend your website, how could i subscribe for a weblog website? The account helped me a acceptable deal. I have been a little bit familiar of this your broadcast provided brilliant transparent concept

austin personal injury
austin personal injury United States
1/1/2014 10:13:31 AM #

My website :: on line coupon codes - hilden.rene-pickhardt.de/.../Coupon_Fraud_How_To_Distinguish_A_Counterfeit_Coupon Hey are employing Wordpress to your website platform? I am new into the website globe but I'm trying to acquire commenced and set up my very own. Do you want any html coding know-how to generate your very own website? Any aid can be greatly appreciated!

personal injury lawyers austin
personal injury lawyers austin United States
1/4/2014 6:05:35 AM #

Also pay a visit to my webpage :: levitra - kspcus.org/index.php I'm really delighted to uncover this website. I want to to thank you for types time for this notably superb read!! I absolutely savored each portion of it and that i have you ever guide marked to view new points inside your world wide web web site.

Austin injury attorneys
Austin injury attorneys United States
1/9/2014 10:12:08 AM #

called. Thanks! I did developed the website myself and i received the concept from Google look for engine. These are actually grea tips in about running a blog. Tanks , I have recently been wanting foor information concerning this subject matter for the though and yours may be the best I have came on until now.

car accident attorney Austin
car accident attorney Austin United States
1/23/2014 5:27:00 PM #

Glimpse at my site article - my free credit report - answers.yahoo.com/.../index I've beeing scouring the google for this info and basically necessary to thanks for your submit. BTW, just off matter, how can i get yourself a duplicate of the theme? - Many thanks I gotta preferred this world-wide-web web-site it seems particularly beneficial . You should participate inside a contest for among the very best blogs on the world wide web. I'll advocate this page! I reflect this web page has acquired some pretty pleasant facts for every person. "Variety is definitely the soul of pleasure." by Aphra Behn. Hiya, I'm specially cheerful I have originate this details. Currently bloggers publish just regarding gossips and obtain and this is often specially frustrating. A clear site with exciting delighted, that is what I ought. Merit for keeping this site, I will ensue visiting it. Solve you perform newsletters? Can not get again it. Hiya. Similar great web-site!! Guy .. Beautiful .. Wonderful .. I am going to bookmark your website and consider the feeds also...I'm delighted to locate numerous beneficial in sequence here in just the post. Be grateful you for sharing.. Together with the objective of fear could attain every single punish to the contrary several. Hello there! Quick question that's entirely off subject matter. Would you know how to make your internet site mobile friendly? My weblog looks weird when viewing from my iphone. I am trying to seek out a template or plugin that may possibly be capable of fix this problem. For those who have any recommendations, be sure to share. Quite a few many thanks!

car accident attorney Austin
car accident attorney Austin United States
1/26/2014 1:09:16 PM #

Feel free to surf to my web page viagra - cooshow.nttu.edu.tw/.../index.php Your suggests of explaining everything in this submit is genuinely very good, just about every just one be capable of basically be aware of it, Many thanks quite a bit.

accident attorney Austin
accident attorney Austin United States
2/24/2014 11:59:54 PM #

and would want to uncover out wherever you got this from or particularly what the topic is

Wally Vanveldhuize
Wally Vanveldhuize United States
3/5/2014 9:02:17 PM #

Amazing article, very informative. I think about the reason the other blogger from this niche do not recognise this. You  must continue your posting. I am certain, you have an awesome readers' base already!

Blair Fast
Blair Fast United States
3/5/2014 9:02:17 PM #

Hello, Attractive site!! I will be developing a New web site. Any recommendations how to develop it correctly?? Looking forward to hearing back.

Dorian Lingle
Dorian Lingle United States
3/19/2014 5:59:00 PM #

Great read, I just refer this onto a friend who was carrying out a study on that. And he just bought me lunch since I discovered it for him. So: Thank you for the lunch!

Maisie Norton
Maisie Norton United States
5/26/2014 1:17:32 AM #

�E�I'll gear this review to 2 types of people: current Zune owners who are considering an upgrade, and people trying to decide between a Zune and an iPod. (There are other players worth considering out there, like the Sony Walkman X,  And We Make HomePage And WebSite AT <A href="http://www.akibare-hp.jp">;ホ�Eムペ�Eジ作�E</A>  but I hope this gives you enough info to make an informed decision of the Zune vs players other than the iPod line as well.)

Phyllis Chloe MacKenzie
Phyllis Chloe MacKenzie United States
5/26/2014 1:45:05 AM #

�E�I'll gear this review to 2 types of people: current Zune owners who are considering an upgrade, and people trying to decide between a Zune and an iPod. (There are other players worth considering out there, like the Sony Walkman X,  And We Make HomePage And WebSite AT <A href="http://www.blogdehp.jp">Homepage Sakusei</A><A href="http://www.blogdehp.jp">;ビジネスブログホ�Eムペ�Eジ作�Eビジネスブログ</A>  but I hope this gives you enough info to make an informed decision of the Zune vs players other than the iPod line as well.)

Naomi Karen Boult
Naomi Karen Boult United States
8/3/2014 11:19:04 AM #

I'll gear this review to 2 types of people: current Zune owners who are considering an upgrade, and people trying to decide between a Zune and an iPod. (There are other players worth considering out there, like the Sony Walkman X,  And We Make HomePage And WebSite AT�@<A href="www.akibare-hp.jp">www.akibare-hp.jp</A>;  but I hope this gives you enough info to make an informed decision of the Zune vs players other than the iPod line as well.)

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

About the author

I started as a VB6 developer, programming all kinds of applications. I also got involved in the development of a e-market in ASP.

When .Net was introduced, I had the privilege to start in a team of professionals and develop a framework. I learned a lot and started to work as a c#.Net consultant from then on.

After 2 years I also got the chance to work for several months with Sharepoint. Sharepoint kept chasing me all the years after and when the product got more and more mature I started to love it. Now Sharepoint is a somewhat daily occupation for me. I implemented a large quality document management system at PMRL being the only developper/technical analyst. Working close togehter with the QA department we succeeded in making and improving a very good Quality document management system. Its used up until this day.

I worked for 6 years as a .Net consultant for 2 of the largest consultancy companies in Belgium. I mainly worked as a Sharepoint engineer, but also .Net expert and several ASP.Net and Windows applications. One of my last projects with the consultancy was creating a custom LIMS system. This was a succes and the customer asked me to stay and help to expand and maintain this LIMS. I had great years in this company. There was a focus on innovation and a lot of opportunities for improving and developping new IS systems. Apart from several small projects I further more improved the custom LIMS system, created a SOP library based on Sharepoint and a web based Skill matrix system to handle the skills of the employees in the company. 

Then I was involved in transferring the LIMS to a new lab in Singapore. This was done in a short time frame. The deployment was again a success and it passed the GLP inspection tests. I learned a lot from the Quality engineers about validation of computerized systems.

At my current job I have a wide range of challenges. Mainly I'm still working with .Net (VB.net and C#.Net). But outside of the Microsoft world I also do some ABAB programming in our SAP system. Like developing Adobe Forms and the program behind it. Or making small changes to customized code.

Latest I started to follow a course from Stanford Univercity on Objective C programming for IPAD and IPHONE.I just finished the first app for IPad and it appears to be a great succes. People in the factory are working with IPad to take pictures and upload them to orders. Already more and more projects are coming my way. The iOS apps are supported by a home made .Net architecture that exposes WCF services. Its working great. My second app is almost ready for deployment in factories. Now I started an App for the management team so they can manage projects on their IPAD and IPHONE.

My linkedIn!

Month List

Tag cloud

Locations of visitors to this page

Dailycode.info Dailycode.Info | SAP

SAP: Adobe forms not printing the quantity set in VV32

by Mark Deraeve 28. March 2014 00:49

When printing PDF invoices or any other document in SAP, you need to give the correct output parameters.

My problem was that when I specified 3 as quantity (ANZAHL) as the number of copies to print. But everytime only 1 appeared.

At the end, the problem was solved by settings the number of copies to the NAST-ANZAHL parameter:

fp_outputparams-copies    = nast-anzal.

So the complete set of parameters looks like this:

IF gv_e_invoice EQ 'X'.

    fp_outputparams-preview       = 'X'.

    fp_outputparams-nodialog      = gv_e_invoice.

 

  ELSE.

    fp_outputparams-reqimm        = 'X'.

    fp_outputparams-preview       = 'X'.

    fp_outputparams-nodialog      = 'X'.

    fp_outputparams-copies    = nast-anzal.

  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.

I have a difference when generating PDF for email. On our development system this did the trick.

But then on the QAS system it still ony printed 1 time. The solution to this couldn't be in the code, for it worked on development. It appeared to be a printer setting in SAP that wasn't correct. I had to set the Host Spool Access Method to C: Direct operating system call. 

 


Tags:

SAP: Program (IS_VARIANT-REPORT) not specified (SAP Message 0K522)

by Mark Deraeve 25. March 2014 06:55
I looked on the internet for a while, but couldn't find a solution that worked for me.
I noticed that when I used the transaction, this error came, but when I ran the program from SE383 it didn't gave any error.

So I looked myself for a short while and found out that it was the transaction I created that had a problem. I recreated the transaction using SE80. First I deleted the old transaction. Then I created the transaction following these steps:

1. Create the tranaction:

2. Select the second option from the list:

3. Then fill in the program behind the transaction and save.



I believe the mistake I did was the first time I created the transaction, I selected the first option in step 2.

Tags:

SAP: Adobe Forms - Print Sales conditions on the back.

by Mark Deraeve 24. March 2014 06:57

There are many solutions to find for something you would expect to be kind of default functionality. But no, no default, rahter painfull when you are figuring out you selve. In my opinion, the setup is not logic. If you try the logic way, you'll get strange and unexpected behaviour.  

So the one solution that works for me in all cases is still the by far simplest solution I found here!

Start with putting your pageset to Print on both sides:

 

To use this solution, you'll need 2 extra pages (I called them BackPage and Dummy). 

Then you set the first page (the page that contains your data) like this:

Next you set the backpage like this:

And last the last page (Dummy) like this:

This will make sure that any blank page is set to the sales conditions. This page doesn't have a content area, only the text of the salesconditions:

 

Now finally very important is to tell the content to where is has to go when the page is full. It must go to the content area of the FirstPage, not the content area of the back page. If we leave the field blank, it will automatically put the items on the back page.

 

 -->  --> 

Now the pages will come out nicely  with the sales conditions on the back, when there's only 1 page or more pages.

Just as example how you can design your sales conditions:

 

And the result:


Tags:

SAP: Adobe forms document not printing!

by Mark Deraeve 17. January 2014 02:43

I'm deploying new invoices for several different countries, last week Poland started with invoicing and it went smooth. 

This week, they started to test in Germany. The output types were created, the preview was shown, but the direct print was not working. You could however print from the generated PDF using the windows printer. Offcourse this was not enough, because the automatic print was not working. So I started to look, first in code, then in configuration.

Finally I found that there were errors in the spool queueu of the printer. It looked like this:

If you look in detail it shows this:

So this got me going a little further. Eventually I looked at the printer spool request. When I try to edit it, it told me the the format of the spool request was not supported by the printer.

So the problem was found, the printer didn't support the G_RAW format. Now how to solve this. 

This was the easy part, you just look for a recent driver that supports this, in my case it was the ZHPP3005 : HP LJ P3005  R4.5+ device type that did the trick.

Spool request are now succesfully processed and printed out!


Tags:

SAP: calculate invoice due date

by Mark Deraeve 15. January 2014 01:40

I had a lot of trouble calculating the due date of the invoice. The main reason was because the payment term text had beside the date also some extra text like discount 2,000 %.

Eg. On day 19.01.2014 discount 2,000%

The way they implemented this was like this:

ln_due_date = vbdkr-zterm_tx1. 
CONCATENATE ln_due_date+4(4) ln_due_date+2(2) ln_due_date(2)     
 INTO ls_header-vervaldag.

And the result would be something like this: 20001420 in stead of 20140119

So the procedure was casting the text to a numeric field and when the discount was there, the date got messed up. A consultant then introduced the Procedure:

  CALL FUNCTION 'SD_PRINT_TERMS_OF_PAYMENT'

    EXPORTING

*      bldat                        = vbdkr-erdat

      budat                        = vbdkr-fkdat

      language                     = nast-spras

      terms_of_payment             = vbdkr-zterm

    TABLES

      top_text                     = lt_vtopis

    EXCEPTIONS

      terms_of_payment_not_in_t052 = 1

      OTHERS                       = 2.

  LOOP AT lt_vtopis INTO ls_vtopis.

    ln_due_date = ls_vtopis-hdatum.

  ENDLOOP.

But this procedure still had problems returning the correct date, even if I passed the ERDAT. 

So at last I altered the first procedure, just reading the ztermtext character by character and taking the first 8 numeric chars as date value:

DATA: textString TYPE string,

      dueDateText TYPE string,

      index TYPE i,

      counter TYPE i,

      length TYPE i,

      char  TYPE c,

      num   TYPE i.

textString = vbdkr-zterm_tx1.

 

length = STRLEN( textString ).

counter = 0.

WHILE index < length.

  char = textString+index(1).

  TRY .

      IF counter LT 8 AND char NE ' '.

        num = char.

        CONCATENATE dueDateText char

        INTO dueDateText.

        counter = counter + 1.

      ENDIF.

    CATCH cx_sy_conversion_no_number.

 

  ENDTRY.

  ADD 1 TO index.

ENDWHILE.

 

CONCATENATE dueDateText+4(4) dueDateText+2(2) dueDateText(2)

INTO ls_header-vervaldag.

 


Tags:

SAP: outputparamas for printing properties

by Mark Deraeve 14. January 2014 01:07
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

Tags:

SAP: using PDF to print invoice uses wrong printer

by Mark Deraeve 6. January 2014 04:13

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.
 

Tags:

How to find the due date for SAP invoices? (extra: or get a date from a string in ABAB)

by Mark Deraeve 3. August 2012 05:12

 

Some of the customized code was not going so good all the time. They asked me to look into this. It appears that the previous programmer did not do such a great job. He simply took the date from the vbdkr-zterm_tx1 text. But this text can have different formats and multiple numbers inside. This was the line of code used before:

ln_due_date vbdkr-zterm_tx1.
CONCATENATE ln_due_date(2'.' ln_due_date+2(2'.' ln_due_date+4(4)
INTO gd_due_date.

The ln_due_date was only 8 char and when you cast a string to type n , it will take the numbers in the string and start from the rear or overwrites. An example:

ln_due_date(8)    TYPE n. 

The content of vbdkr-zterm_tx1 normally looks like this (then the code will work):

Tot 31.08.2012 zonder aftrek

But when the vbdkr-zterm_tx1 was:

Tot 31.08.2012 krijgt u 1,000  % betalingskorting

It went wrong, it became 20.12.1000 instead of 31.08.2012.

Now I replaced this code with a program that is designed to get calculate the due date. This code replaces it and provides a stable and decent solution:

DATABEGIN OF TERMS OCCURS 3.
          
INCLUDE STRUCTURE VTOPIS.
  
DATA:  END OF TERMS.
* Due Date

  
CALL FUNCTION 'SD_PRINT_TERMS_OF_PAYMENT'
    
EXPORTING
     BLDAT                              
vbdkr-FKDAT
     BUDAT                              
vbdkr-FKDAT
     CPUDT                              
vbdkr-FKDAT
     
LANGUAGE                           nast-SPRAS
     TERMS_OF_PAYMENT                   
vbdkr-ZTERM
     
COUNTRY                            vbdkr-LAND1
    
TABLES
      TOP_TEXT                           
TERMS            .

  IF SY-SUBRC <> 0.

 *use the old date conversion if something goes wrong.

 
     ln_due_date 
vbdkr-zterm_tx1.
     
CONCATENATE ln_due_date(2'.' ln_due_date+2(2'.' ln_due_date+4(4)
     
INTO gd_due_date.
  
ENDIF.

  
CONCATENATE TERMS-HDATUM+6(2'.' TERMS-HDATUM+4(2'.' TERMS-HDATUM(4)
      
INTO gd_due_date.

You can find an example of an implamentation by SAP in following procedure: LV05NF17

If you just to get a date from a string, you'll find your answer on this site using regular expresssions:

REPORT Z_RegEx_Fetch_Date_from_Text.
**
** Regular Expression Matching using ABAP RegEx
**

DATA gv_text TYPE string.
DATA gt_dates TYPE char10_t,
DATA ls_dates TYPE char10.

gv_text = 'Date of entry : 17.02.2012, Sample text including dates in various forms like 8.8.2008 or 21.03.2012 or 2013.08.17 in order to test Regular Expression in ABAP string operations'.
WRITE :/ gv_text.

PERFORM uGetDatesRegEx USING gv_text CHANGING gt_dates.

LOOP AT gt_dates INTO ls_dates.
IF SY-TABIX = 1.
WRITE :/ 'Matched date list :'.
ENDIF.
WRITE :/ ls_dates.
ENDLOOP.


FORM uGetDatesRegEx USING p_text TYPE string
CHANGING pt_dates TYPE char10_t.

DATA lv_txt TYPE string.
DATA lv_pattern TYPE string.
DATA lt_result_tab TYPE match_result_tab.
DATA ls_submatch_result_tab TYPE match_result.

lv_pattern = '(\d{1,2}[.|/]\d{1,2}[.|/]\d{4})|(\d{4}[.|/]\d{1,2}[.|/]\d{1,2})'.

FIND ALL OCCURRENCES OF REGEX lv_pattern IN p_text RESULTS lt_result_tab.

LOOP AT lt_result_tab INTO ls_submatch_result_tab.

lv_txt = p_text+ls_submatch_result_tab-offset(ls_submatch_result_tab-length).
APPEND lv_txt TO pt_dates.

ENDLOOP.

ENDFORM. 


Tags:

SAP: How to set the list of output types as a selection area parameter?

by Mark Deraeve 13. June 2012 23:45

 

My ALV needs a selection screen were you can filter the invoices on the output that is used for them.

I tried to find the correct table were the list of document outputs is defined. First I came up with RV13B, then VN_T685B, but at the end I found the DNAST table. So now the selection parameter definition looks like this:

SELECT-OPTIONS: s_kschl FOR DNAST-KSCHL DEFAULT 'ZBC1' TO 'ZKN2'.


Tags:

Sometimes RV_PRICE_PRINT_HEAD return no values

by Mark Deraeve 16. March 2012 05:47

We are creating Adobe forms to eventually use with PI for E-invoicing. The adobe form works fine if we use it as a printer output type. But when PI calls it with the special function, the RV_PRICE_PRINT_HEAD return nu values. Very strange and very hard to test. At the end we came across this post that help us solve the problem: http://scn.sap.com/thread/1450764

 

So before you call the function RV_PRICE_PRINT_HEAD, call another function to correctly refresh the header:

  CALL FUNCTION 'RV_PRICE_PRINT_REFRESH'
    
TABLES
      tkomv 
tkomv.


  
CALL FUNCTION 'RV_PRICE_PRINT_HEAD'
    
EXPORTING
      comm_head_i 
komk
      
language    nast-spras
    
IMPORTING
      comm_head_e 
komk
      comm_mwskz  
print_mwskz
    
TABLES
      tkomv       
tkomv

       tkomvd      hkomvd. 


Tags:

About the author

I started as a VB6 developer, programming all kinds of applications. I also got involved in the development of a e-market in ASP.

When .Net was introduced, I had the privilege to start in a team of professionals and develop a framework. I learned a lot and started to work as a c#.Net consultant from then on.

After 2 years I also got the chance to work for several months with Sharepoint. Sharepoint kept chasing me all the years after and when the product got more and more mature I started to love it. Now Sharepoint is a somewhat daily occupation for me. I implemented a large quality document management system at PMRL being the only developper/technical analyst. Working close togehter with the QA department we succeeded in making and improving a very good Quality document management system. Its used up until this day.

I worked for 6 years as a .Net consultant for 2 of the largest consultancy companies in Belgium. I mainly worked as a Sharepoint engineer, but also .Net expert and several ASP.Net and Windows applications. One of my last projects with the consultancy was creating a custom LIMS system. This was a succes and the customer asked me to stay and help to expand and maintain this LIMS. I had great years in this company. There was a focus on innovation and a lot of opportunities for improving and developping new IS systems. Apart from several small projects I further more improved the custom LIMS system, created a SOP library based on Sharepoint and a web based Skill matrix system to handle the skills of the employees in the company. 

Then I was involved in transferring the LIMS to a new lab in Singapore. This was done in a short time frame. The deployment was again a success and it passed the GLP inspection tests. I learned a lot from the Quality engineers about validation of computerized systems.

At my current job I have a wide range of challenges. Mainly I'm still working with .Net (VB.net and C#.Net). But outside of the Microsoft world I also do some ABAB programming in our SAP system. Like developing Adobe Forms and the program behind it. Or making small changes to customized code.

Latest I started to follow a course from Stanford Univercity on Objective C programming for IPAD and IPHONE.I just finished the first app for IPad and it appears to be a great succes. People in the factory are working with IPad to take pictures and upload them to orders. Already more and more projects are coming my way. The iOS apps are supported by a home made .Net architecture that exposes WCF services. Its working great. My second app is almost ready for deployment in factories. Now I started an App for the management team so they can manage projects on their IPAD and IPHONE.

My linkedIn!

Month List

Tag cloud

Locations of visitors to this page