set/get Parameter anlegen

Alles Rund um SAP®.
4 Beiträge • Seite 1 von 1
4 Beiträge Seite 1 von 1

set/get Parameter anlegen

Beitrag von Betze (ForumUser / 50 / 0 / 0 ) »
Hallo,

brauche mal wieder eure HILFE. Wie lege ich ein Set/Get Parameter an den ich später einem User und einem Programm zuordnen kann.

Danke schon mal für die Hilfe!

Betze

gesponsert
Stellenangebote auf ABAPforum.com schalten
kostenfrei für Ausbildungsberufe und Werksstudenten


Beitrag von Haubi (Expert / 625 / 20 / 30 ) »
Moinsen.

Am besten über die SE80.
Hochnavigieren bis zur Entwicklungsklasse/Paket, Rechtsklick auf die Entwicklungsklasse. Aus dem Kontextmenü auswählen:
"Anlegen -> Weitere -> SET/GET-Parameter-ID"

Gruss,
Haubi
Das ABAP Kochbuch ab sofort bei Amazon...

I'd rather write code that writes code than write code...

Re: set/get Parameter anlegen

Beitrag von AWinter (ForumUser / 2 / 0 / 0 ) »
... oder mit Transaktion SM30 direct in Tabelle TPARA pflegen.

Re: set/get Parameter anlegen

Beitrag von horst1959 (ForumUser / 20 / 0 / 0 ) »
Hallo

Hier mal kurz ein Beispiel was den alten obsoleten Bausteinen der SAP genüge tun sollte.
Eventuell hilft das ja weiter. Wichtig ist beim Schreiben ... alle Parameter neu schreiben.
Sap nimmt dazu BAPI's und ich habe mir mal ein kleines Objekt gebastelt. Die BAPI's würden aber
ausreichen!

Gruß Horst

*&---------------------------------------------------------------------*
*& Include ZCL_NEW_USRPARA *
*&---------------------------------------------------------------------*


*----------------------------------------------------------------------*
* CLASS ZCL_NEW_USRPARA DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS zcl_new_usrpara DEFINITION.

PUBLIC SECTION.

TYPES : i_self TYPE REF TO zcl_new_usrpara.
TYPES : ty_shortterm TYPE REF TO zcl_new_shortterm.

METHODS constructor.

CLASS-METHODS create RETURNING VALUE(ref) TYPE i_self.

METHODS get_value IMPORTING e_parid TYPE memoryid
EXPORTING i_value TYPE xuvalue
i_error TYPE sysubrc.

METHODS set_value IMPORTING e_parid TYPE memoryid
e_value TYPE xuvalue
EXPORTING i_error TYPE sysubrc.

METHODS free.

PRIVATE SECTION.

DATA : o_tpara TYPE REF TO zcl_new_tpara,
my_perma TYPE c.

TYPES : BEGIN OF ty_slave,
parid TYPE memoryid,
shortterm TYPE ty_shortterm,
utc TYPE tzntstmps,
index TYPE i.
TYPES END OF ty_slave.
DATA : ta_slave TYPE HASHED TABLE OF ty_slave
WITH UNIQUE KEY parid,
wa_slave TYPE ty_slave.

DATA : lines TYPE i,
my_value TYPE xuvalue,
my_maxanz TYPE i,
my_reorgmax TYPE i.

ENDCLASS. "zcl_new_usrpara DEFINITION


*----------------------------------------------------------------------*
* CLASS ZCL_NEW_USRPARA IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS zcl_new_usrpara IMPLEMENTATION.

METHOD create.
CREATE OBJECT ref.
ENDMETHOD. "create

METHOD constructor.
o_tpara = zcl_new_tpara=>create( ).
my_maxanz = 1000.
my_reorgmax = 0.
FREE ta_slave.
ENDMETHOD. "constructor

METHOD set_value.

DATA : lwa_parmx TYPE bapiparamx,
lta_par TYPE STANDARD TABLE OF bapiparam,
lta_par1 TYPE STANDARD TABLE OF bapiparam1,
lwa_return TYPE bapiret2,
lta_return TYPE STANDARD TABLE OF bapiret2,
l_ok TYPE boolean.
FIELD-SYMBOLS : <lfs_par> TYPE bapiparam,
<lfs_par1> TYPE bapiparam1.

i_error = 1.
my_perma = o_tpara->get_data( e_parid ).
CHECK my_perma = 'X'. " Ist Benutzervorgabe/Festwert
CLEAR my_value.
FIELD-SYMBOLS <wa_slave> TYPE ty_slave.
READ TABLE ta_slave WITH TABLE KEY parid = e_parid
ASSIGNING <wa_slave>.
IF sy-subrc = 0.
DELETE TABLE ta_slave WITH TABLE KEY parid = e_parid.
ENDIF.


FREE lta_par.
APPEND INITIAL LINE TO lta_par ASSIGNING <lfs_par>.
<lfs_par>-parid = e_parid.

CALL FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTING
username = sy-uname
cache_results = 'X'
* IMPORTING
* LOGONDATA =
* DEFAULTS =
* ADDRESS =
* COMPANY =
* SNC =
* REF_USER =
* ALIAS =
* UCLASS =
* LASTMODIFIED =
* ISLOCKED =
* IDENTITY =
* ADMINDATA =
* DESCRIPTION =
TABLES
parameter = lta_par
* PROFILES =
* ACTIVITYGROUPS =
return = lta_return
* ADDTEL =
* ADDFAX =
* ADDTTX =
* ADDTLX =
* ADDSMTP =
* ADDRML =
* ADDX400 =
* ADDRFC =
* ADDPRT =
* ADDSSF =
* ADDURI =
* ADDPAG =
* ADDCOMREM =
parameter1 = lta_par1
* GROUPS =
* UCLASSSYS =
* EXTIDHEAD =
* EXTIDPART =
* SYSTEMS =
.

CLEAR lwa_parmx.
lwa_parmx-parva = abap_true.
l_ok = abap_false.
LOOP AT lta_par1 ASSIGNING <lfs_par1>.
IF <lfs_par1>-parid = e_parid.
<lfs_par1>-parva = e_value.
l_ok = abap_true.
ENDIF.
ENDLOOP.
IF l_ok = abap_false.
APPEND INITIAL LINE TO lta_par1 ASSIGNING <lfs_par1>.
<lfs_par1>-parid = e_parid.
<lfs_par1>-parva = e_value.
ENDIF.

CALL FUNCTION 'BAPI_USER_CHANGE'
EXPORTING
username = sy-uname
* LOGONDATA =
* LOGONDATAX =
* DEFAULTS =
* DEFAULTSX =
* ADDRESS =
* ADDRESSX =
parameterx = lwa_parmx
* COMPANY =
* COMPANYX =
* SNC =
* SNCX =
* BACK_DISTRIBUTION = ' '
* PASSWORD =
* PASSWORDX =
* ADDCOMX =
* REF_USER =
* REF_USERX =
* ALIAS =
* ALIASX =
* GROUPSX =
* UCLASS =
* UCLASSX =
* EXTIDSX =
* PRODUCTIVE_PWD = ' '
* GENERATE_PWD = ' '
* DESCRIPTION =
* DESCRIPTIONX =
* IMPORTING
* GENERATED_PASSWORD =
TABLES
* PARAMETER =
return = lta_return
* ADDTEL =
* ADDFAX =
* ADDTTX =
* ADDTLX =
* ADDSMTP =
* ADDRML =
* ADDX400 =
* ADDRFC =
* ADDPRT =
* ADDSSF =
* ADDURI =
* ADDPAG =
* ADDCOMREM =
* GROUPS =
parameter1 = lta_par1
* UCLASSSYS =
* EXTIDHEAD =
* EXTIDPART =
.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = abap_true
IMPORTING
return = lwa_return.

* CALL FUNCTION 'BWDT_SET_PARAMETER'
* EXPORTING
* parameter = e_parid
* value = e_value.

ENDMETHOD. "set_value
*
METHOD get_value.

DATA : lta_par TYPE STANDARD TABLE OF bapiparam,
lta_par1 TYPE STANDARD TABLE OF bapiparam1,
lta_return TYPE STANDARD TABLE OF bapiret2.
FIELD-SYMBOLS : <lfs_par> TYPE bapiparam,
<lfs_par1> TYPE bapiparam1.

i_error = 1.
CLEAR : i_value, my_value.
my_perma = o_tpara->get_data( e_parid ).
CHECK my_perma = 'X'. " Ist Benutzervorgabe/Festwert
* Ist der Krempel schon mal gelesen und im Kurzzeitgedächtnis
FIELD-SYMBOLS <wa_slave> TYPE ty_slave.
READ TABLE ta_slave WITH TABLE KEY parid = e_parid
ASSIGNING <wa_slave>.
IF sy-subrc = 0.
i_error = 0.
<wa_slave>-utc = zcl_new_utc=>get_utc( ).
<wa_slave>-index = <wa_slave>-index + 1.
ELSE.
my_reorgmax = my_reorgmax + 1.
IF my_reorgmax >= 10.
my_reorgmax = 0.
DESCRIBE TABLE ta_slave LINES lines.
IF lines > my_maxanz.
SORT ta_slave BY utc index.
CALL METHOD zcl_new_sizer=>resize
EXPORTING
e_size = my_maxanz " Kurzeitgedächtnis
CHANGING
c_table = ta_slave.
ENDIF.
ENDIF.
ASSIGN wa_slave TO <wa_slave>.
<wa_slave>-utc = zcl_new_utc=>get_utc( ).
<wa_slave>-index = 1.
<wa_slave>-parid = e_parid.
<wa_slave>-shortterm = zcl_new_shortterm=>create( ).

FREE lta_par.
APPEND INITIAL LINE TO lta_par ASSIGNING <lfs_par>.
<lfs_par>-parid = e_parid.

CALL FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTING
username = sy-uname
cache_results = 'X'
* IMPORTING
* LOGONDATA =
* DEFAULTS =
* ADDRESS =
* COMPANY =
* SNC =
* REF_USER =
* ALIAS =
* UCLASS =
* LASTMODIFIED =
* ISLOCKED =
* IDENTITY =
* ADMINDATA =
* DESCRIPTION =
TABLES
parameter = lta_par
* PROFILES =
* ACTIVITYGROUPS =
return = lta_return
* ADDTEL =
* ADDFAX =
* ADDTTX =
* ADDTLX =
* ADDSMTP =
* ADDRML =
* ADDX400 =
* ADDRFC =
* ADDPRT =
* ADDSSF =
* ADDURI =
* ADDPAG =
* ADDCOMREM =
parameter1 = lta_par1
* GROUPS =
* UCLASSSYS =
* EXTIDHEAD =
* EXTIDPART =
* SYSTEMS =
.

DELETE lta_par1 WHERE parid <> e_parid.
IF NOT lta_par1[] IS INITIAL.
READ TABLE lta_par1 INDEX 1 ASSIGNING <lfs_par1>.
my_value = <lfs_par1>-parva.
ELSE.
CLEAR my_value.
ENDIF.

* CALL FUNCTION 'BWDT_GET_PARAMETER'
* EXPORTING
* parameter = e_parid
* IMPORTING
* value = my_value.


CALL METHOD <wa_slave>-shortterm->set_data
EXPORTING
e_data = my_value.
IF sy-subrc = 0.
INSERT <wa_slave> INTO TABLE ta_slave.
ENDIF.
ENDIF.

CALL METHOD <wa_slave>-shortterm->get_data
IMPORTING
i_data = i_value.
IF NOT i_value IS INITIAL.
i_error = 0.
ENDIF.

ENDMETHOD. "get_value

METHOD free.
FIELD-SYMBOLS <wa_slave> TYPE ty_slave.
CHECK NOT ta_slave[] IS INITIAL.
LOOP AT ta_slave ASSIGNING <wa_slave>.
CALL METHOD <wa_slave>-shortterm->free.
ENDLOOP.
FREE ta_slave.
* CALL METHOD cl_abap_memory_utilities=>do_garbage_collection.
ENDMETHOD. "free

*
ENDCLASS. "zcl_new_usrpara IMPLEMENTATION

Seite 1 von 1

Vergleichbare Themen

4
Antw.
9714
Views
Parameter-ID anlegen
von Roddy » 30.08.2017 11:46 • Verfasst in ABAP® Core
0
Antw.
1013
Views
SET/GET Parameter
von SAP_ENTWICKLER » 14.10.2013 13:29 • Verfasst in ABAP® Core
1
Antw.
1674
Views
Get Parameter ID
von LittleT » 30.05.2007 10:38 • Verfasst in ABAP® für Anfänger
0
Antw.
2222
Views
ITS-Parameter
von tgifch » 21.01.2005 16:06 • Verfasst in Tips + Tricks & FAQs
3
Antw.
525
Views
SET PARAMETER ID
von ZF_SAPler » 06.07.2022 08:32 • Verfasst in ABAP® für Anfänger

Über diesen Beitrag


Unterstütze die Community und teile den Beitrag für mehr Leser und Austausch

Newsletter Anmeldung

Keine Beiträge verpassen! Wöchentlich versenden wir lesenwerte Beiträge aus unserer Community.
Die letzte Ausgabe findest du hier.
Details zum Versandverfahren und zu Ihren Widerrufsmöglichkeiten findest du in unserer Datenschutzerklärung.

Unbeantwortete Forenbeiträge

Daten an Tabelle binden
vor 2 Stunden von Bright4.5 1 / 61
aRFC im OO-Kontext
vor 4 Wochen von ralf.wenzel 1 / 1711
Hilfe bei SWEC/SWE2
letzen Monat von retsch 1 / 8315