Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

code for validating the sales order

Former Member
0 Kudos

Hi,

can any body can send the code for validating sales order and shipment,when we enter the sales order or shipment as input in the selection screen.

It is very urgent....................

Thanks in advance.

1 ACCEPTED SOLUTION

kiran_k8
Active Contributor
0 Kudos

Sudarsan,

data: begin of itab occurs 0.

include structure tablename.

data:end of itab.

parameters:p_vbeln like vbak-vblen,

p_ship like vbak-fieldname.

select * from tablename into table itab where vbeln = p_vbeln and

fieldname = p_ship.

Note:- fieldname is the field for shipment,get it from the concerned table.

tablename is the table from which you are selecting the data.

K.Kiran.

Message was edited by:

Kiran K

3 REPLIES 3

kiran_k8
Active Contributor
0 Kudos

Sudarsan,

data: begin of itab occurs 0.

include structure tablename.

data:end of itab.

parameters:p_vbeln like vbak-vblen,

p_ship like vbak-fieldname.

select * from tablename into table itab where vbeln = p_vbeln and

fieldname = p_ship.

Note:- fieldname is the field for shipment,get it from the concerned table.

tablename is the table from which you are selecting the data.

K.Kiran.

Message was edited by:

Kiran K

Former Member
0 Kudos

hi,

You need write the select statment in the AT SELECTION SCREEN event to chekc the fields which you declared in the Selection screen.

parameters: P_VBELN like VBAK-VBELN.

<b>AT SELECTION-SCREEN.</b>

Select single * from VBAK where VBELN eq P_VBELN.

IF SY-SUBRC <> 0.

MESSAGE E000 with 'no sales order'

endif.

<b>Do the same way for Shipment also.</b>

<b>or</b>

you provide the logic for validate the user entered sales order number and shipment.

<b>AT SELECTION-SCREEN ON P_VBELN.</b>

Select single * from VBAK where VBELN eq P_VBELN.

IF SY-SUBRC <> 0.

MESSAGE E000 with 'no sales order'

endif.

<b>AT SELECTION-SCREEN ON <SHIPMENT>.</b>

Regards

Ashok

Message was edited by:

Ashok Reddy

Former Member
0 Kudos

HI,

SEE TO THIS CODE.

--


TABLE DECLARATION--

TABLES : VBAK,VBAP.

TYPE-POOLS : SLIS.

--


STRUCTURE DECLARATION--

TYPES : BEGIN OF TY_VBAK,

VBELN TYPE VBELN_VA,

ERDAT TYPE ERDAT,

ERZET TYPE ERZET,

ERNAM TYPE ERNAM,

END OF TY_VBAK.

--


SELECT OPTIONS--

SELECT-OPTIONS : S_VBAK FOR VBAK-VBELN.

--


START OF SELECTION--

START-OF-SELECTION.

SELECT VBELN

ERDAT

ERZET

ERNAM

FROM VBAK

INTO TABLE IT_VBAK

WHERE VBELN IN S_VBAK.