Archiv der Kategorie: Tipps & Tricks

SALV Table – Display table data in a popup window

This is an easy way to fetch data and show it in a table popup using the class cl_salv_table. Enjoy.


DATA: lr_alv TYPE REF TO cl_salv_table.
DATA: lr_functions TYPE REF TO cl_salv_functions_list.
DATA: lt_t100a TYPE STANDARD TABLE OF t100a.

* fetch data
clear lt_t100a.
SELECT * FROM t100a INTO TABLE lt_t100a uP TO 20 ROWS.


cl_salv_table=>factory(
IMPORTING
r_salv_table = lr_alv
CHANGING
t_table = lt_t100a ).

*set funtion toolbar
lr_functions = lr_alv->get_functions( ).
lr_functions->set_default( 'X' ).

* Set pop-up-dimensions
lr_alv->set_screen_popup(
start_column = 75
end_column = 150
start_line = 2
end_line = 9 ).


*Calling the display-method
lr_alv->display( ).

Enjoy the snippet.

HR ABAP Enhancements – HR BADI HRPAD00INFTY

HR BADI HRPAD00INFTY

Business Add-In (BAdI) Update/Infotype Maintenance (HRPAD00INFTY) allows you to react to specific events in Personnel Administration.
The BAdI has three methods for this, in which the user can store his or her own coding:

 

  • Infotype Maintenance: Call-Up Time PBO (BEFORE_OUTPUT)
  • Infotype Maintenance: Call-Up Time PAI (AFTER_INPUT)
  • Update: Call During Update (IN_UPDATE)

Infotype Maintenance: Call-Up Time PBO

Functionality

The method Infotype Maintenance: Call at PBO Event (BEFORE_OUTPUT) is called at the PBO event when the single screen of an infotype.
This method is then always processed if a new infotype record is selected.

Parameters

TCLAS – Transaction class
IPSYST – Workfields for infotypes
I001P – Personnel area/subarea
I503 – Employee group/subgroup
INNNN – Current infotype
IPREF – Assignment values for HR objects

 

Infotype Maintenance: Call-Up Time PAI

Functionality

The method Infotype Maintenance: Call at Event PAI (AFTER_INPUT) is called after the entries have been made on the single screen and the fields have been checked – as function exit EXIT_SAPFP50M_002 in HR Master Data – at event PAI.

Parameters

TCLAS – Transaction class
NEW_INNNN – Infotype created
OLD_INNNN – Infotype prior to change
IPSYST – Work fields for dialog control
I001P – Personnel area/subarea
I503 – Employee group/subgroup
IPREF – Assignment values for HR objects

Update Program: Call-Up During Update

Functionality

The method Update: Call During Update (IN_UPDATE) is called in the update task of Personnel Administration in the UPDATE form.

Parameters

IPSPAR – Work fields for dialog control
OLD_IMAGE – Before Image: Infotype records prior to change
NEW_IMAGE – After Image: Infotype records following change
OLD_PREF_IMAGE – Before Image for assignment values
NEW_PREF_IMAGE – After Image for assignment values

Infotype Update: Call During Update (IN_UPDATE)

Functionality

The method Update: Call During Update (IN_UPDATE) is called in the update task of Personnel Administration in the UPDATE form.

Parameters

IPSPAR – Work fields for dialog control
OLD_IMAGE – Before Image: Infotype records prior to change
NEW_IMAGE – After Image: Infotype records following change
OLD_PREF_IMAGE – Before Image for assignment values
NEW_PREF_IMAGE – After Image for assignment values

Transporting SAP Smartforms – Upload and download via XML

Sometimes you need to transport your smartforms between different SAP Systems. It’s quite easy with SAP-standard upload and download funtion.

HOW TO DOWNLOAD YOUR SMARTFORM:

Step 1: Start with SMARTFORM Transaction.
Utilities/Hilfsmittel -> Download Form/Formular runterladen

Step2: Enter the original Smartform you want to download (Original Formname)

Step3: Saveit on your local client – choose a folder and save the form in XML format

Step4: Once the smart form is downloaded. Success message is displayed as shown below

HOW TO UPLOAD YOUR SMARTFORM:

Step 1: Start with SMARTFORM Transaction.
Go to Utilities/Hilfsmittel -> Upload Form/Formular hochladen

Step2: Give the Form name(Z_MY_NEW_FORMNAME)

Step3: Select the form from the destination folder which has been downloaded and that has to be uploaded

Step4: Once the SMARTFORM is uploaded and form is saved, the SMARTFORM is ready to use and make necessary changes and activate.

SAP ABAP: Converting a floating point number to a packed field

In some cases we need to convert float values. Here’s a simple example.

DATA :
lv_in TYPE atflv VALUE ‚2.1000000000000000E+01‘,
lv_out     TYPE cha_class_viewsollwert.

CLEAR lv_out.
CALL FUNCTION ‚QSS0_FLTP_TO_CHAR_CONVERSION‘
EXPORTING
i_number_of_digits   2
i_fltp_value         lv_in
i_screen_fieldlength 16
IMPORTING
e_char_field         lv_out.
WRITE /  lv_out.

output :  21.00

SAP ABAP: Selektionsbilddetails im ABAP-Report ausgeben

Um dem Anwender nach der Ergebnisanzeige noch seine eingegebenen Select-Options anzuzeigen empfiehlt sich der SAP Funktionsbaustein RS_REFRESH_FROM_SELECTOPTIONS

CALL FUNCTION ‚RS_REFRESH_FROM_SELECTOPTIONS‘
EXPORTING
curr_report = sy-repid
TABLES
selection_table = lt_seloptions

EXCEPTIONS

not_found = 01

no_report = 02.

Der Funktionsbaustein liefert den Inhalt der aktuellen Abgrenzungen des Programms  in der Tabelle SELECTION_TABLE zurück.

Die Rückgabetabelle hat die Struktur von RSPARAMS:

SELNAME = Name des Selektionskriteriums
KIND = Art der Selektion (Parameter oder Select-Option)
SIGN = ‚I‘ inklusive oder ‚E‘ exklusiv
OPTION = z.B. ‚BT‘, ‚EQ‘, ‚LE‘, u.s.w
LOW = Untergrenze
HIGH = Obergrenze.

SAP ALV Grid – Zellen einfärben – Farbcodes

Einfärben einer bestimmten Zelle im ALV Grid…eine kleine Step-by-Step Anleitung

  1. Erweitere deine Ausgabetabelle um eine Komponente (Feld) mit Typ LVC_T_SCOL
  2. Trage den Namen dieser Komponente Namen (z.B. COL_TAB) in der Spalte CTAB_FNAME der Layoutstruktur ein. Bsp:

ABAP: SAP Smartforms: Checkbox ins Formular einbinden

Oft sind einfache Symbole in einem Formular hilfreich. Dies muss nicht gezwungenermaßen mit einer selbst importierten Grafik realisiert werden. Deshalb ein kleines nice-to-know über die Integration von SAP-Standard-Symbolen (in diesem Fall eine Checkbox) in ein SAP Smartform.

Auf die Schnelle: Textelement->Editoransicht->Insert/Insert -> SAP Symbols/Icons

  1. Legt euch ein Textelement in eurem Smartform an
  2. Anschliessedn zur Editoransicht wechseln.Das geht über den kleinen EDIT Knopf am linken Rand – oberhalb des Syntaxcheckers 🙂
  3. Na gefunden? Wunderbar, du bist jetzt in der Editoransicht. Dann als nächstes in der oberen Menüleiste zwischen Format und System den Menüpunkt Include/Insert öffnen.
  4. Dann auf Characters->SAP Symbols
  5. Ggfs bei Bedarf können auch SAP Icons eingebunden werden
  6. Bleiben wir beim Beispiel der Checkbox. Wenn du diese in den SAP Symbolen einbindest, dann erscheint diese als <697>-Variable im Editor

Das wars auch schon, viel Spaß.

SAP ABAP – Smartforms Systemfelder erleichtern die Arbeit

  • &SFSY-DATE&:  Anzeige des Datums. Das Anzeigeformat wird im Benutzerstammsatz festgelegt.
  • &SFSY-TIME&: Uhrzeit in der Form HH:MM:SS (HH: Stunden, MM: Minuten, SS: Sekunden).
  • &SFSY-PAGE&: Mit diesem Symbol können Sie die Nummer der aktuellen Druckseite in Ihren Text einfügen. Das Format der Seitenzahl (z.B. arabisch, numerisch) legen Sie über den Seiten-Knoten fest.
  • &SFSY-FORMPAGES&: Gesamtseitenzahl für das gerade aufbereitete Formular. Damit können Sie Angaben der Art:‘Seite x von y’ in Ihre Ausgabe einbauen.
  • &SFSY-JOBPAGES&: Dieses Feld enthält die Gesamtseitenzahl aller Formulare, die in dem gerade aufbereiteten Druckauftrag enthalten sind.
  • &SFSY-WINDOWNAME&:  Name des aktuellen Fensters
  • &SFSY-PAGENAME&: Name der aktuellen Seite
  • &SFSY-COPYCOUNT&: Abfrage, ob das Orginal oder die wievielte Kopie des Formulars ausgegeben wird. COPYCOUNT = 1 : Orginal, COPYCOUNT = 2 : erste Kopie; COPYCOUNT = 3: zweite Kopie, usw.
  • &SFSY-SUBRC&: Rückgabewert, den Sie in Programmzeilen-Knoten abfragen können, um auf Fehlersituationen bei der Ausgabe dynamisch reagieren zu können. Bisher hat dieses Feld nur für Include-Texte und Textbausteine eine Bedeutung:
    0:Textbaustein/Include-Text gefunden und ausgegeben
    4:Textbaustein/Include-Text nicht gefunden
  • &SFSY-USERNAME&: Anmeldename des Benutzers, der das Formular druckt

Quelle: http://help.sap.com/erp2005_ehp_04/helpdata/de/1c/f40c67ddf311d3b574006094192fe3/content.htm

RS_ABAP_SOURCE_SCAN -String-Suche in ABAP-Objekten

RS_ABAP_SOURCE_SCAN

Um bestimmte Literale oder Zeichenketten innerhalb eurer Entwicklungsobjekte zu suchen empfiehlt sich der SAP Standardreport RS_ABAP_SOURCE_SCAN . Dieser durchsucht ABAP-Codingstrecken nach eurem Suchmuster und listet alle Fundstellen des in einer Trefferliste auf. Nach Klick auf den Treffer wird zum entsprechenden Programm navigiert.

Über das detaillierte Selektionsbild lassen sich spezifische Einschränkungen machen. Dies wirkt sich positiv auf die Suchperformance aus.

TRANSAKTIONSCODE:  AUK/SRC_SCAN

rs abap source scan(Quelle:http://www.berater-wiki.de/index.php?title=ABAP_Source-Scan)