adesso orange🍊Stellenangebote:
Software Engineer Trainee · Senior
| (Senior) Cloud Software Engineer BTP
(Senior) Consultant Technologie
Werkstudent Softwareentwicklung · Fiori / UI5 · Consulting
R PURCHASINGSOURCELISTTP: Unterschied zwischen den Versionen
Aus SAP Wiki ツ
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
(10 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
[[Kategorie: Behavior | [[Kategorie:Behavior Definitionen und Implementierungen]] | ||
=== Orderbuch erstellen === | === Orderbuch erstellen === | ||
<syntaxhighlight line copy> | |||
lt_creation = VALUE #( | |||
( | |||
%cid = cl_uuid_factory=>create_system_uuid( )->create_uuid_x16( ) | |||
%key-Material = '000000000000000001' | |||
%key-Plant = '1990' | |||
%data-ValidityStartDate = cl_abap_context_info=>get_system_date( ) | |||
%data-ValidityEndDate = '99991231' | |||
%data-PurchasingOrganization = '1000' | |||
%data-Supplier = '0000129302' | |||
%control-Material = if_abap_behv=>mk-on | |||
%control-Plant = if_abap_behv=>mk-on | |||
) | |||
). | |||
MODIFY ENTITIES OF r_purchasingsourcelisttp | |||
ENTITY PurchasingSourceItem | |||
CREATE FROM lt_creation | |||
FAILED DATA(ls_failed) | |||
MAPPED DATA(ls_mapped) | |||
REPORTED DATA(ls_reported). | |||
TRY. | |||
IF ls_failed-purchasingsourceitem IS INITIAL. | |||
COMMIT ENTITIES. | |||
IF sy-subrc = 0. | |||
out->write( ls_mapped-purchasingsourceitem[ 1 ]-SourceListRecord ). | |||
out->write( 'Created' ). | |||
ELSE. | |||
out->write( 'Failed Commmit' ). | |||
ENDIF. | |||
ELSE. | |||
out->write( 'failed modify step' ). | |||
ENDIF. | |||
CATCH cx_sy_itab_line_not_found. | |||
out->write( ls_failed-purchasingsourceitem[ 1 ]-%cid ). | |||
ENDTRY. | |||
</syntaxhighlight> | |||
=== Orderbuch lesen === | === Orderbuch lesen === | ||
Zeile 21: | Zeile 61: | ||
=== Orderbuch ändern === | === Orderbuch ändern === | ||
lt_update = CORRESPONDING #( lt_sourcelist ). | <syntaxhighlight line copy> | ||
ASSIGN lt_update[ 1 ] TO FIELD-SYMBOL(<ls_adapt>). | lt_update TYPE TABLE FOR UPDATE r_purchasingsourcelistitemtp. | ||
<ls_adapt>-%data-SupplierIsFixed = | |||
<ls_adapt>-%control-SupplierIsFixed = if_abap_behv=>mk-on. | lt_update = CORRESPONDING #( lt_sourcelist ). | ||
ASSIGN lt_update[ 1 ] TO FIELD-SYMBOL(<ls_adapt>). | |||
<ls_adapt>-%data-SupplierIsFixed = abap_true. | |||
<ls_adapt>-%control-SupplierIsFixed = if_abap_behv=>mk-on. | |||
MODIFY ENTITIES OF r_purchasingsourcelisttp | MODIFY ENTITIES OF r_purchasingsourcelisttp | ||
ENTITY purchasingsourceitem | ENTITY purchasingsourceitem | ||
Zeile 32: | Zeile 75: | ||
MAPPED DATA(ls_mapped) | MAPPED DATA(ls_mapped) | ||
REPORTED ls_reported. | REPORTED ls_reported. | ||
IF ls_failed-purchasingsourceitem IS INITIAL. | IF ls_failed-purchasingsourceitem IS INITIAL. | ||
COMMIT ENTITIES. | COMMIT ENTITIES. | ||
Zeile 43: | Zeile 86: | ||
out->write( 'Failed Modify' ). | out->write( 'Failed Modify' ). | ||
ENDIF. | ENDIF. | ||
</syntaxhighlight> | |||
=== Orderbuch löschen === | === Orderbuch löschen === | ||
=== | <syntaxhighlight line copy> | ||
DATA lt_deletion TYPE TABLE FOR DELETE r_purchasingsourcelistitemtp. | |||
lt_deletion = VALUE #( ( %key-Material = '000000000000000001' | |||
%key-Plant = '1990' | |||
%key-SourceListRecord = 00001 ) ). | |||
MODIFY ENTITIES OF r_purchasingsourcelisttp ENTITY purchasingsourceitem | |||
DELETE FROM lt_deletion | |||
FAILED ls_failed | |||
MAPPED ls_mapped | |||
REPORTED ls_reported. | |||
IF ls_failed-purchasingsourceitem IS INITIAL. | |||
COMMIT ENTITIES. | |||
IF sy-subrc = 0. | |||
out->write( 'Deleted' ). | |||
ELSE. | |||
out->write( 'Failed Commmit' ). | |||
ENDIF. | |||
ELSE. | |||
out->write( 'failed modify step' ). | |||
ENDIF. | |||
</syntaxhighlight> |
Aktuelle Version vom 21. Dezember 2024, 17:03 Uhr
Orderbuch erstellen
lt_creation = VALUE #(
(
%cid = cl_uuid_factory=>create_system_uuid( )->create_uuid_x16( )
%key-Material = '000000000000000001'
%key-Plant = '1990'
%data-ValidityStartDate = cl_abap_context_info=>get_system_date( )
%data-ValidityEndDate = '99991231'
%data-PurchasingOrganization = '1000'
%data-Supplier = '0000129302'
%control-Material = if_abap_behv=>mk-on
%control-Plant = if_abap_behv=>mk-on
)
).
MODIFY ENTITIES OF r_purchasingsourcelisttp
ENTITY PurchasingSourceItem
CREATE FROM lt_creation
FAILED DATA(ls_failed)
MAPPED DATA(ls_mapped)
REPORTED DATA(ls_reported).
TRY.
IF ls_failed-purchasingsourceitem IS INITIAL.
COMMIT ENTITIES.
IF sy-subrc = 0.
out->write( ls_mapped-purchasingsourceitem[ 1 ]-SourceListRecord ).
out->write( 'Created' ).
ELSE.
out->write( 'Failed Commmit' ).
ENDIF.
ELSE.
out->write( 'failed modify step' ).
ENDIF.
CATCH cx_sy_itab_line_not_found.
out->write( ls_failed-purchasingsourceitem[ 1 ]-%cid ).
ENDTRY.
Orderbuch lesen
DATA lt_selection TYPE TABLE FOR READ IMPORT r_purchasingsourcelistitemtp.
lt_selection = VALUE #( ( sourcelistrecord = 00001
material = '000000000000000001'
plant = '1990' ) ).
READ ENTITIES OF r_purchasingsourcelisttp
ENTITY purchasingsourceitem
ALL FIELDS WITH lt_selection
RESULT DATA(lt_sourcelist)
FAILED DATA(ls_failed)
REPORTED DATA(ls_reported).
Orderbuch ändern
lt_update TYPE TABLE FOR UPDATE r_purchasingsourcelistitemtp.
lt_update = CORRESPONDING #( lt_sourcelist ).
ASSIGN lt_update[ 1 ] TO FIELD-SYMBOL(<ls_adapt>).
<ls_adapt>-%data-SupplierIsFixed = abap_true.
<ls_adapt>-%control-SupplierIsFixed = if_abap_behv=>mk-on.
MODIFY ENTITIES OF r_purchasingsourcelisttp
ENTITY purchasingsourceitem
UPDATE FROM lt_update
FAILED ls_failed
MAPPED DATA(ls_mapped)
REPORTED ls_reported.
IF ls_failed-purchasingsourceitem IS INITIAL.
COMMIT ENTITIES.
IF sy-subrc = 0.
out->write( 'Updated' ).
ELSE.
out->write( 'Failed Commmit' ).
ENDIF.
ELSE.
out->write( 'Failed Modify' ).
ENDIF.
Orderbuch löschen
DATA lt_deletion TYPE TABLE FOR DELETE r_purchasingsourcelistitemtp.
lt_deletion = VALUE #( ( %key-Material = '000000000000000001'
%key-Plant = '1990'
%key-SourceListRecord = 00001 ) ).
MODIFY ENTITIES OF r_purchasingsourcelisttp ENTITY purchasingsourceitem
DELETE FROM lt_deletion
FAILED ls_failed
MAPPED ls_mapped
REPORTED ls_reported.
IF ls_failed-purchasingsourceitem IS INITIAL.
COMMIT ENTITIES.
IF sy-subrc = 0.
out->write( 'Deleted' ).
ELSE.
out->write( 'Failed Commmit' ).
ENDIF.
ELSE.
out->write( 'failed modify step' ).
ENDIF.