Programming

Sale and Distribution (SD) Table in SAP


Table     Description
VBAK Sale Order Header
VBAP Sale Order Line Items
LIKP Delivery Order Header
LIPS Delivery Order Line Items
VEKP Shipping Unit Header
VEPO Shipping Unit Line Items
EIKP Foreign Trade: Header
EIPO Foreign Trade: Line Items
VBRK Billing Header
VBRP Billing Line Items
VBUK Sale Document Status Header
VBUP Sale Document Status Line Items

Generating dhcpd.conf from list of IP address, MAC address, and hostname

According to my last post, you might want to customize some part of information, e.g., order and name. For sorting, you can easily insert sort between the pipe chain.

[root@mail ip]# arp -n | sort -t "." -k 4 -g | ./arptodhcpd.sh 
        host host1 {
                hardware ethernet 00:13:F7:08:20:D2;
                fixed-address 192.168.10.1;
        }
        host host10 {
                hardware ethernet 00:11:2F:44:F9:44;
                fixed-address 192.168.10.10;
        }
        host server2000 {
                hardware ethernet 00:11:85:19:F0:D4;
                fixed-address 192.168.10.42;
        }

However, name and IP address cannot be modified at all. You could do it by redirecting result of arp -n to a file and then modified it first.

[root@mail ip]# arp -n > iplist.txt
[root@mail ip]# cat iplist.txt | ./arptodhcpd.sh

For shorter and more readability, I wrote another script to collect IP address, MAC address and its netbios name in tab separated value (TSV) format. It "s named as collectip.sh.

Generating dhcpd.conf using ARP

If you are leaving in a large network of workstation with static IP assignment, you might be interesting in conversion to dynamic IP assignment for administrative reasons. In the view of administrators, they are happy to control, change settings on centralized server instead of walking around to change settings one by one especially if you are in very large industrial site.

However, writing dhcpd.conf is not as easy as a single click for large unmanaged network. Why? People or applications might strictly rely on IP address or even netbios name. We have to smoothly migrate to DHCP based on current state of network configuration. That means we should assign current IP address of each machine as before and also assign current netbios name to support legacy people and appliations.

Fortunately, there are some trick to accomplish this task with less effort. The magic is ARP. ARP stands for Address Resolution Protocol. We can use ARP to obtain list of IP address and its associlate MAC address as follow.

How to Generate Value Request by ABAP/4

We can use function module "F4IF_INT_TABLE_VALUE_REQUEST" for generate value request by ABAP report.

Example


              

*** Screen Flow ***

PROCESS ON VALUE-REQUEST.

  FIELD scn_kokrs MODULE create_value_request.

*** ABAP Editor ***

MODULE create_value_request INPUT.

DATA: BEGIN OF itab_request OCCURS 0,

kokrs LIKE TKA01-KOKRS,

bezei LIKE TKA01-BEZEI,

END OF itab_request.


SELECT KOKRS BEZEI
       FROM TK


            

Reverse Lookup of NetBIOS Name

If you are a network administrator or must work with large Windows user, you may want to obtain the netbios name of each machine programmatically. Why? There are many reasons to know netbios name by given IP address.

  1. Create a list of IP and associate name
  2. Find name conflict
  3. Obtain machine information from IP

Fortunately, samba package provides a tool called "nmblookup" to help us in this situation. It is very easy to reverse lookup the name using option "-A". However, there are lots of information returned.

How to Read Table Dynamically in ABAP/4

About statement "READ TABLE", we can generate code for read key dynamic as below:


DATA: BEGIN OF itab OCCURS 0,
fld1(2),
fld2(2),
fld3(10),
fld4 TYPE i,
END OF itab,
wa_tab LIKE itab,
gv_key1(4) TYPE C VALUE ’FLD1’,
gv_key2(4) TYPE C VALUE ’FLD2’.
...
...
...

READ TABLE itab INTO wa_tab
WITH KEY (gv_key1) = ’AA’
(gv_key2) = ’BB’.