0% found this document useful (0 votes)
197 views5 pages

List of Sales Order

The document describes the steps to set up a selection screen, validate the user selections, extract relevant data from backend tables based on the selections, and display the extracted data in an ALV grid. Key steps include: 1) Setting up the selection screen with various fields for the user to select criteria 2) Validating the user selections against backend tables 3) Extracting data from various sales document tables like VBAK, VBAP, VBPA etc. based on the selection criteria and storing in internal tables 4) Populating missing fields like ship-to party details by reading other tables 5) Sorting and appending the extracted data in a final internal table 6) Display

Uploaded by

ZaheerAhmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
197 views5 pages

List of Sales Order

The document describes the steps to set up a selection screen, validate the user selections, extract relevant data from backend tables based on the selections, and display the extracted data in an ALV grid. Key steps include: 1) Setting up the selection screen with various fields for the user to select criteria 2) Validating the user selections against backend tables 3) Extracting data from various sales document tables like VBAK, VBAP, VBPA etc. based on the selection criteria and storing in internal tables 4) Populating missing fields like ship-to party details by reading other tables 5) Sorting and appending the extracted data in a final internal table 6) Display

Uploaded by

ZaheerAhmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

1.

Set the Selection Screen



1.1 Set the Selection Screen First Screen Report Req.EN)

1.1.1 Sales Document number <SO_vbeln>
1.1.2 Sold-to party<SO_KUNNR>
1.1.3 Ship-to party<SO_KUNNR>
1.1.4 Sales Organization <SO_VKORG> MANDATORY
1.1.5 Distribution Channel <SO_VTWEG>
1.1.6 Sales Document type <SO_AUART>
1.1.7 Purchase Order no <SO_BSTNK>
1.1.8 Requested Delivery date <SO_VDATU>
1.1.9Material <SO_MATNR>
1.1.10. Customer material <SO_KDMAT>
1.1.11 Material intered<SO_MATWA>
1.1.12.Plant <SO_WERKS>
1.1.13. Storage location <SO_LGORT>
1.1.14.Shipping point/reciving point <SO_VSTEL>
1.1.15.Rejection status<SO_ABSTA>
1.1.16.Overall status <SO_GBSTA>
1.1.17.Order reson <SO_AUGRU>
1.1.18.Created on <SO_ERDAT>
1.1.19.Created by <SO_ERNAM>

1.2. Validate Selection Sceen Selection Screen Validation'!A1


1.2.1 If Error exists
Display valid Error Message

1.2.2 validate material <MATNR>
<condition>
material <MATNR> IN <SO_MATNR>
Sales organization <VKORG> IN <SO_VKORG>
Distribution channel <VTWEG> IN <SO_VTWEG>
If Material doesn't exist,write message "No Material Master" on status bar.


1.2.2.1.Validate Sold to-party
<condition>
Sold-to party <KUNNR> IN <SO_KUNNR>
Sales organization <VKORG> IN <SO_VKORG>
Distribution channel <VTWEG> IN <SO_VTWEG>
If Sold to-party doesn't exist,write message "No Sold to-party" on status bar.


1.2.2.2. Validate Ship to-party <KUNNR>
<condition>
Ship-to party <KUNNR > IN <SO_KUNNR>
Sales organization <VKORG> IN <SO_VKORG>
Distribution channel <VTWEG> IN <SO_VTWEG>
If Sold to-party doesn't exist,write message "No Ship to-party" on status bar.



2. Process

2.1 If Sales document <SO_VBELN> is NOT INITIAL.
2.1.1 Process 3
2.1.2 Goto 6

2.2 If Material number <SO_MATNR> IS NOT INITIAL.
2.2.1 Process 5.1 - 5.3

2.3 If Customer number <SO_KUNNR> IS INIITIAL.
2.3.1 Process 3
2.3.2 Goto 6
Else.
2.3.3 Process 4.1 - 4.4

3. Data extraction-Get data from R3 tables.

3.1 Select from Sales Document: <VBAK>, Sales Document: ITEM <VBAP>

and Sales Document Item Status : <VBUP> into G_T_SOINFO
<Join Condition>
Sales document Number<VBAK-VBELN> = Sales document Number<VBAP-VBELN>
Sales document Number<VBAP-VBELN> = Sales document Number<VBUP-VBELN>
Sales document Number<VBAP-POSNR> = Sales document Number<VBUP-POSNR>
<Condition>
Sales document Number <VBAK-VBELN> IN so_vbeln
Sold-to party <VBAK-KUNNR> IN so_kunnr
Sales document type <VBAK-AUART> IN so_auart
Sales organization <VBAK-VKORG> IN so_vkorg
Distribution channel <VBAK-VTWEG> IN so_vtweg
Customer order no. <VBAK-BSTNK> IN so_bstnk
Order reason <VBAK-AUGRU> IN so_augru
Requested delivery date <VBAK-VDATU> IN so_vdatu
Material No <VBAP-MATNR> IN so_matnr
Material entered <VBAP-MATWA> IN so_matwa
Customer material <VBAP-KDMAT> IN so_kdmat
PLANT <VBAP-WERKS> IN so_werks
Storage location <VBAP-LGORT> IN so_lgort
Shipping point <VBAP-VSTEL> IN so_vstel
Created on <VBAP-ERDAT> IN so_erdat
Created by <VBAP-ERNAM> IN so_ernam
Rejection status <VBUP-ABSTA> IN so_absta
Overall status <VBUP-GBSTA> IN so_gbsta
<Getting Information>
Sold-to party VBAK-KUNNR
Sales document type VBAK-AUART
Sales organization VBAK-VKORG
Distribution channel VBAK-VTWEG
Customer order no. VBAK-BSTNK
Order reason VBAK-AUGRU
Shipping conditions VBAK-VSBED
Material No VBAP-MATNR
Material entered VBAP-MATWA
Customer material VBAP-KDMAT
PLANT VBAP-WERKS
Storage location VBAP-LGORT
Shipping point VBAP-VSTEL
Created on VBAP-ERDAT
Created by VBAP-ERNAM
Rejection status VBUP-ABSTA
Overall status VBUP-GBSTA

3.2 Select from Sales Document Partner : <VBPA> INTO G_T_VBPA
<Condition>
Sales document <VBELN> = G_T_SOINFO-VBELN
Item number <POSNR> = G_T_SOINFO-POSNR
Partner function <PARVW> = "WE'
FOR ALL ENTRIES IN G_T_SOINFO
<Getting Information>
Ship-to party VBPA-KUNNR
Sales document <VBPA-VBELN>
Item number <VBPA-POSNR>
Partner function <VBPA-PARVW>

3.3.. .Select from Sales Document Schedule Line : <VBEP> INTO G_T_VBEP

<Condition>
Sales document <VBELN> = G_T_SOINFO-VBELN
Item number <POSNR> = G_T_SOINFO-POSNR
FOR ALL ENTRIES IN G_T_SOINFO
<Getting Information>
Order qty SUM ( VBEP-WMENG )
Round qty SUM ( VBEP-CMENG )
Conformed quantity SUM ( VBEP-BMENG )
Sales document <VBEP-VBELN>
Item number <VBEP-POSNR>
Date MIN ( VBEP-EDATU )

Group by vbeln & posnr

3.4 Loop at g_t_vbep.
3.4.1 Back order qty <g_t_vbep-kwmeng> = g_t_vbep-cmeng - g_t_vbep-
bmeng.
3.4.2 MODIFY g_t_vbep.
Endloop.

3.5. .Select from <TVAUT> INTO G_T_TVAUT.
<Condition>
AUGRU = G_T_SOINFO-AUGRU
SPRAS = SY-LANGU
FOR ALL ENTRIES IN G_T_SOINFO
<Getting Information>
Description TVAUT-BEZEI

3.6.. .Select from Customer Master : <KNA1> INTO G_T_KNA1.
<Condition>
KUNNR = G_T_SOINFO-KUNNR
FOR ALL ENTRIES IN G_T_SOINFO
<Getting Information>
Sold-to party Text KNA1-NAME1
Sold-to party KNA1-KUNNR

3.7.. .Select from Customer Master : <KNA1> INTO G_T_NAME2.
<Condition>
KUNNR = G_T_VBPA-KUNRG
FOR ALL ENTRIES IN G_T_VBPA
<Getting Information>
Ship-to party Text KNA1-NAME1
Ship-to party KNA1-KUNNR


3.8 loop at g_t_soinfo.
3.8.1 move corresponding g_t_soinfo to g_t_ finaldata.


3.8.1(a) call function 'SAPGUI_PROGRESS_INDICATOR
EXPORTING
percentage = 1000
text = ' Sales order in progress'

3.8.2 read table g_t_vbep with key vbeln = g_t_soinfo-vbeln
posnr = g_t_soinfo-posnr.

3.8.3 if sy-subrc = 0.
3.8.4 move-corresponding g_t_vbep to g_t_finaldata.
3.8.5 Read table g_t_vbpa with key vbeln = g_t_soinfo-vbeln
vbeln = g_t_soinfo-vbeln.
posnr = '000000'

parvw = 'WE'.

3.8.6 if sy-subrc = 0.
3.8.7 g_t_finaldata-kunrg = g_t_vbpa-kunrg.
3.8.8 READ TABLE g_t_name2 INTO g_r_name2 WITH KEY kunnr = g_r_vbpa-kunrg.


3.8.9 IF sy-subrc = 0.
g_t_finaldata-name2 = g_r_name2-name1.


3.8.10 READ TABLE g_t_tvaut INTO g_r_tvaut WITH KEY augru = g_r_soinfo-augru
.
3.8.11 g_t_finaldata-bezei = g_r_tvaut-bezei.

3.8.12 READ TABLE g_t_kna1 INTO g_r_kna1 WITH KEY kunnr = g_r_soinfo-kunnr.

3.8.13 g_t_finaldata-name1 = g_r_kna1-name1.

3.8.14 APPEND g_t_finaldata.

3.8.15 Endloop.

3.9 SORT g_t_finaldata BY vbeln posnr.


4.1.Select from Sales Index by Partner Function <VAKPA> into G_T_VAKPA


<Condition>
Sold-to party <KUNDE> IN <SO_KUNNR>
Sales organization <VKORG> IN SO-VKORG
Distribution channel <VTWEG> IN SO_VTWEG
Sales document type <AUART> IN SO_AUART.
Customer number <KUNNR> IN SO_KURNG
Customer order no. <BSTNK> IN SO_BSTNK
Created By <ERNAM> IN SO_ERNAM.

<Getting Information>
Sales document< VAKPA-VBELN>
Sold-to party <VAKPA-KUNDE>

4.2 Populate the sales document <SO_VBELN> from internal table G_T_VAKPA.


4.3 Process 3
4.4 Goto 6

5.1.Select from Sales Index: <VAPMA > into G_T_VAPMA
<Condition>
Material <matnr> IN <SO_MATNR>
Sales organization <VKORG> IN SO-VKORG
Distribution channel <VTWEG> IN SO_VTWEG
Sales document type <AUART> IN SO_AUART.
Customer number <KUNNR> IN SO_KURNG
Customer order no. <BSTNK> IN SO_BSTNK
Created By <ERNAM> IN SO_ERNAM.

<Getting Information>
SD document number <vapma-vbeln>
Item number <vapma-posnr>

5.2 Populate the sales document <SO_VBELN> and Item number <SO_POSNR> from inte
rnal table G_T_VAPMA.

5.3 Process 3
5.4 Goto 6



6. ALV Grid display

6.1. Display ALV grid with information from g_t_finaldata Report L
ayout



7. Sales order Display

7.1 If Sales document number in the ALV Grid is double clicked.


7.1.1 SET PARAMETER ID 'AUN' FIELD g_t_finaldata-vbeln.
7.1.2 CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

You might also like