Remove the Custmer information by entering the customer number: (Table:kna1, KNB1)

Source: Internet
Author: User

Report Zzw_get_customer.

***********************************************************************

*

* Author:Lilo.Zhu

*

* date:05/12/2006

*

* Keyword:knal (General Data in Customer Master)

* Reuse_alv_fieldcatalog_merge (Gird and Event)

* CONCATENATE

*

***********************************************************************

*

* Last Modified Data:

*

* Log:1.get_cust_no lenght=10 e.g:1031-0000001031

*

*

***********************************************************************

Type-pools:slis.

*----------------------------------------------------------------------

* TABLES

*----------------------------------------------------------------------

TABLES:KNA1, "General Data in Customer Master

KNB1. "Customer Master (company Code)

*----------------------------------------------------------------------

* INTERNAL TABLE

*----------------------------------------------------------------------

Data:begin of lt_alvtable occurs 0,

Kunnr like Kna1-kunnr, "Customer number

Bukrs like Knb1-bukrs, the company Code

NAME1 like Kna1-name1, "Name 1

NAME2 like Kna1-name2, "Name 2

Stras like Kna1-stras, "house number and street

Pstlz like Kna1-pstlz, "Postal Code

ORT01 like kna1-ort01, the city

Ktokd like KNA1-KTOKD, the Customer account group

END of Lt_alvtable.

*-----------------------------------------------------------------------

* Data-statements that is necessary for the use of the Alv-grid

*-----------------------------------------------------------------------

Data:gt_xevents TYPE slis_t_event.

Data:xs_event TYPE slis_alv_event.

Data:repid TYPE Sy-repid.

Data:zta_print TYPE Slis_t_fieldcat_alv with HEADER line.

Data:lo_layout TYPE Slis_layout_alv.

Data:lo_itabname TYPE Slis_tabname.

Data:ls_variant TYPE disvariant.

*-----------------------------------------------------------------------

* Initialization

*-----------------------------------------------------------------------

Initialization.

*-----------------------------------------------------------------------

* Parameters and Selection/selection-options

*-----------------------------------------------------------------------

Selection-screen BEGIN of BLOCK Charly

With FRAME TITLE TEXT-001.

*parameters cust_no like Kna1-kunnr.

Selection-screen END of BLOCK Charly.

Select-options cust_no for Kna1-kunnr.

*-----------------------------------------------------------------------

* Start of main programe

*-----------------------------------------------------------------------

Start-of-selection.

PERFORM Select_records.

PERFORM print_alvlist.

End-of-selection.

*-----------------------------------------------------------------------

* Form Select_records

*-----------------------------------------------------------------------

FORM Select_records.

* PERFORM Get_cust_no.

SELECT * into corresponding fields of lt_alvtable

From KNA1 as A

INNER JOIN KNB1 as B

On A~kunnr = B~kunnr

* WHERE A~kunnr = ' 0000001031 '.

* WHERE A~kunnr = cust_no.

WHERE A~kunnr in Cust_no.

* WRITE:/cust_no.

APPEND lt_alvtable.

Endselect.

EndForm.

*-----------------------------------------------------------------------

* Form Get customer number

*-----------------------------------------------------------------------

FORM Get_cust_no.

Data:lint_index TYPE I.

Data:zero (1).

Lint_index = 10-lint_index.

IF STRLEN (Cust_no) < 10.

Do lint_index times.

Concatenate ZERO cust_no into Cust_no.

Enddo.

ENDIF.

EndForm.

*-----------------------------------------------------------------------

* Form Print_alvlist

*-----------------------------------------------------------------------

FORM print_alvlist.

Repid = Sy-repid.

Lo_itabname = ' lt_alvtable '.

* Fill The variables of the Alv-grid.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.