Shared Top Border

Enterprise Resource
Planning Portal

 

Advertise | Founder BLOG

ERPGenie.COM ABAP Tips and Tricks Database

THE ultimate
ERP website

 

Forums | Vote for us |

Google    Other Search Options

Login

Login to view more content!!!





Lost Password?
No account yet? Register

Registered Access

Poll

What is your relationship with SAP?
 
Home
Setting and reading bits PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Anon.   
Wednesday, 30 May 2007

REPORT demo_data_set_get_bit .

* set bit

DATA hex(3) TYPE x.

SET BIT: 09 OF hex TO 1,
         10 OF hex TO 0,
         11 OF hex TO 1,
         12 OF hex TO 1,
         13 OF hex TO 0,
         14 OF hex TO 1,
         15 OF hex TO 0,
         16 OF hex TO 1.

WRITE hex.

ULINE.

* get bit

DATA: hex1(1) TYPE x VALUE 'B5',
      b(1) TYPE n.

DO 8 TIMES.
  GET BIT sy-index OF hex1 INTO b.
  WRITE b NO-GAP.
ENDDO.


BIT operation 

REPORT demo_data_bit_operations .

DATA: hex1(1) TYPE x VALUE 'B5',
      hex2(1) TYPE x VALUE '5B',
      hex3(1) TYPE x.

hex3 = BIT-NOT ( hex1 BIT-XOR hex2 ).

WRITE hex3.


Set operations with BIT sequences

REPORT demo_data_bit.

DATA: frankfurt(4) TYPE x,
      frisco(4)    TYPE x,
      intersect(4) TYPE x,
      union(4)     TYPE x,
      bit          TYPE i.

DATA: carrid TYPE spfli-carrid,
      carrier LIKE SORTED TABLE OF carrid
                          WITH UNIQUE KEY table_line.

DATA wa TYPE spfli.

SELECT carrid FROM scarr INTO TABLE carrier.

SELECT carrid cityfrom FROM spfli
                       INTO CORRESPONDING FIELDS OF wa.

  WRITE: / wa-carrid, wa-cityfrom.

  READ TABLE carrier FROM wa-carrid TRANSPORTING NO FIELDS.

  CASE wa-cityfrom.
    WHEN 'FRANKFURT'.
      SET BIT sy-tabix OF frankfurt.
    WHEN 'SAN FRANCISCO'.
      SET BIT sy-tabix OF frisco.
  ENDCASE.

ENDSELECT.

intersect = frankfurt BIT-AND frisco.
union     = frankfurt BIT-OR  frisco.

SKIP.

WRITE 'Airlines flying from Frankfurt and San Francisco:'.
DO 32 TIMES.
  GET BIT sy-index OF intersect INTO bit.
  IF bit = 1.
    READ TABLE carrier INDEX sy-index INTO carrid.
    WRITE carrid.
  ENDIF.
ENDDO.

SKIP.

WRITE 'Airlines flying from Frankfurt or San Francisco:'.
DO 32 TIMES.
  GET BIT sy-index OF union INTO bit.
  IF bit = 1.
    READ TABLE carrier INDEX sy-index INTO carrid.
    WRITE carrid.
  ENDIF.
ENDDO.


Last Updated ( Wednesday, 30 May 2007 )
 
< Prev   Next >

Google Search

Statistics

Contribution Activity
Utilities: 38
Tips and Tricks: 334
Sample Code: 166
Total Contributions: 553

Member Activity
Members: 6310 since 2/1/2007!
New: 1 since yesterday!
Visitors: 1183755
We have 4 guests online

Newest Members

Welcome our newest members:

Google Ads

Shared Bottom Border

Contact Us | Polls | Add URL | Contribute | Privacy | Terms | Feedback

Discussion Forum | BLOG | Consultants: Post your resume | Companies: Advertise on ERPGenie.COM | Post Job
Financials Consultant | Consultant Review | Gallia Consulting | Supply Chain Project | SAP Financials Forum
GenieHoldings.COM, Inc. | Genie Press | WorkflowGenie | ESAGenie | ERPTopSites | ABAP Tips and Tricks | SAP Solutions Database

EDIGenie | Searching Survivor