Author Archive fjourneau

Byfjourneau

Upload file with UTF8 or ANSi encoding

EDIT : Warning, solution below will work only if there is an accentuated caracter in first line.

Wrong encoding format file is a reccurent issue, especially when working on Windows.
If you don’t want to impose to end used an encoding format for text files, you can use the code below.

Read More
Byfjourneau

Sapscript – Center an include text

Let’s say we have a paragraph to center text declared as CS, to use this paragraph on an include text, add PARAGRAPH <paragraph name> at the end of INCLUDE TEXT declaration :


INCLUDE Z_SO10_TEXT OBJECT TEXT ID ST LANGUAGE FR PARAGRAPH CS

Byfjourneau

Get fullname from User-id

Use code below :


" ADRP-NAME_FIRST : First name
" ADRP-NAME_LAST  : Last name
" ADRP-NAME_TEXT  : Full name

DATA : lv_usrid     TYPE XUBNAME,
       lv_name_text TYPE ADRP-NAME_TEXT.

" [...]

SELECT SINGLE adrp~name_text INTO lv_name_text
  FROM usr21 JOIN adrp ON usr21~persnumber = adrp~persnumber
                      AND adrp~date_from   = '00010101'
                      AND adrp~nation      = ''
  WHERE usr21~bname = lv_usrid.

Byfjourneau

Insert break line in ABAP string

To insert a BR in a string char, use the following constant :


cl_abap_char_utilities=>cr_lf

Search tag : CrLf, retour chariot, ligne, newline, new, carriage return

Byfjourneau

Transport data from applicative table

Check the step by step process here : https://blogs.sap.com/2013/07/18/step-by-step-guide-to-transport-table-contents-from-one-environment-to-other-in-sap/ .

Key to put in Development/Correction TO task :

Short description Prog. Obj. Obj. name Fun
Table Contents R3TR TABU <Table name>
Icon to add tabke keys to transport

Click on this Icon to add lines to transport (precise the keys)

Search tags : OT, TO, order, donnée

Byfjourneau

Edit shipping point informations

To edit the shipping point information (data stored into TVST table), use transaction OVXD.

Search tag: d’expé, d’expédition, VSTEL

Byfjourneau

Convert standard texts to string

The method below enables to convert standard texts to string (with carriage returns). It can be useful when standard texts need to be changed or completed before being printed on Adobe forms.
(Otherwise, it is recommanded to use the standard text objet for Adobe forms).

Read More
Byfjourneau

Catch HTML events with ABAP

Check program SAPHTML_EVENTS_DEMO.

Byfjourneau

Implement BADI ACC_DOCUMENT (code example)

When input parameters of Bapi ACC_DOCUMENT_POST do not enable to pass BKPF or BSEG fields, it is necessary to pass theses data to LT_EXTENTION2 table and implement the Badi ACC_DOCUMENT.

This code manage dynamically field affectation from LT_EXTENTION2 to corresponding fields.
To be added in class implementation of BADI ACC_DOCUMENT, method change.


METHOD if_ex_acc_document~change.

  DATA: wa_extension TYPE bapiparex,
        wa_accit     TYPE accit.

  DATA : lv_field_name  TYPE char100.        

  FIELD-SYMBOLS :  TYPE ANY,      
                   TYPE ACCIT.    

  LOOP AT c_extension2 INTO wa_extension.

    IF wa_extension-structure = 'BKPF'.
      CONCATENATE 'C_ACCHD-' wa_extension-valuepart2 INTO lv_field_name.
      ASSIGN (lv_field_name) TO .
      IF  IS ASSIGNED.
         = wa_extension-valuepart3.
      ENDIF.
    ENDIF.

    IF wa_extension-structure = 'BSEG'.
      READ TABLE c_accit ASSIGNING  WITH KEY posnr = wa_extension-valuepart1.
      IF sy-subrc IS INITIAL.

        CONCATENATE '-' wa_extension-valuepart2 INTO lv_field_name.
        ASSIGN (lv_field_name) TO .
        IF  IS ASSIGNED.
           = wa_extension-valuepart3.
        ENDIF.
      ENDIF.
    ENDIF.

  ENDLOOP.

ENDMETHOD.

Search tags : FI,