adesso business consulting Stellenangebote
Software Engineer Trainee · Senior | (Senior) Cloud Software Engineer BTP | (Senior) Consultant Technologie
Werkstudent Softwareentwicklung · Fiori / UI5 · Consulting

R PURCHASINGSOURCELISTTP

Aus SAP Wiki ツ

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.

All in One


Dieses Wiki wird privat in Freizeit nach bestem Wissen und Gewissen gepflegt und dient primär als eigene Wissenssammlung für die tägliche Arbeit im SAP-ERP-Umfeld.
Alle dargestellten Softwareprodukte, auch in Form von Screenshots, sind Eigentum der SAP SE. Ihre Marken, vgl. Link, sind u.a.: SAP®, ABAP®, SAP Fiori®, SAP HANA®, SAP S/4HANA®, SAP S/4HANA® Cloud