Skip to Content

Business requirement : – For VENDOR_ATTR get the vendor Emil ID

But vendor Email id stores the table ADR6 but this table don’t have vendor.

First give the vender id in LFA1 table now you will get the address number.

Ex – 00000001 and address number – 1234567

1.PNG

Go to the ADR6 table

2.PNG

Give the address no 1234567
now you will get the E-mali address

  • But user want see the in VENDOR_ATTR related the reports.

according to user requirment wrtie the code in the CMOD

Then go to 0VENDOR_ATTR

3.PNG
extract structure and then creae the append structure ex- ZBW_EMAIL

4.PNG

Function exit – EXIT_SAPLRSAP_002 – Master data attribute

5.PNG

CMOD CODE

WHEN ‘0VENDOR_ATTR’.
  
FIELD-SYMBOLS : <FS_VEND> TYPE BIW_LFA1_S.
  
DATA : IT_VENDOR TYPE STANDARD TABLE OF BIW_LFA1_S.

TYPES : BEGIN OF LS_LFA1,
            LIFNR 
TYPE LIFNR,
            ADRNR 
TYPE ADRNR,
          
END OF LS_LFA1.
  
DATA : IT_LFA1 TYPE STANDARD TABLE OF LS_LFA1,
          WA_LFA1
LIKE LINE OF IT_LFA1.
 

TYPES : BEGIN OF LS_ADR6,
             ADDRNUMBER 
TYPE AD_ADDRNUM,
             SMTP_ADDR 
TYPE AD_SMTPADR,
          
END OF LS_ADR6.
DATA : IT_ADR6 TYPE STANDARD TABLE OF LS_ADR6,
       
  WA_ADR6 LIKE LINE OF IT_ADR6.

IT_VENDOR[] = I_T_DATA[].

     IF IT_VENDOR[] IS NOT INITIAL.

        SELECT LIFNR ADRNR FROM LFA1
         
INTO TABLE IT_LFA1 FOR ALL ENTRIES IN IT_VENDOR
         
WHERE LIFNR = IT_VENDOR-LIFNR.

          IF SY-SUBRC = 0.
           
SORT IT_LFA1 BY ADRNR.
           
SELECT ADDRNUMBER SMTP_ADDR FROM ADR6
             
INTO TABLE IT_ADR6 FOR ALL ENTRIES IN IT_LFA1
             
WHERE ADDRNUMBER = IT_LFA1-ADRNR.

              IF SY-SUBRC  = 0.
                
SORT IT_ADR6 BY ADDRNUMBER.
               
ENDIF.
            
ENDIF.
      
ENDIF
.

REFRESH IT_VENDOR[].
LOOP AT I_T_DATA ASSIGNING <FS_VEND>.
 
READ TABLE IT_LFA1 INTO WA_LFA1
    
WITH KEY LIFNR = <FS_VEND>-LIFNR BINARY SEARCH.
   
IF SY-SUBRC = 0.

      
READ TABLE IT_ADR6 INTO WA_ADR6
         
WITH KEY ADDRNUMBER = WA_LFA1-ADRNR BINARY SEARCH.

        IF SY-SUBRC = 0.
           <FS_VEND>-ZZSMTP_ADDR = WA_ADR6-SMTP_ADDR.
         
ENDIF.
     
ENDIF.
     
CLEAR : WA_LFA1, WA_ADR6.
 
ENDLOOP
.

0VENDOR_ATTR output with Vendor Email id

6.PNG

Hope it will help.

Thanks,

Phani

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply