Application Development and Automation 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: 
Read only

Programme for sales orders

Former Member
0 Likes
815

I want to make a programme that will create a xls or txt file containing the sales orders of a given period.

The txt file should contain some date from the header sales order (sales order number, sold to party, ship to party) and some data from the item sales order (material number and text, quantity)

Is any programme standard that can cover this? If not can you give some hints (coding) on how to create such a programme?

1 ACCEPTED SOLUTION
Read only

GauthamV
Active Contributor
0 Likes
787

hi,

use VA05 transaction.

5 REPLIES 5
Read only

Former Member
0 Likes
787

Hi,

Here is a program to see sales order for a particular period.

REPORT z101754_report.

TABLES: zvbak_101754,zvbap_101754,mara.

TYPE-POOLS: slis.

DATA : i_fieldcat TYPE slis_t_fieldcat_alv.

DATA: FLDNAME(24).

DATA : BEGIN OF itab_zvbap OCCURS 0,

zvbeln LIKE zvbap_101754-zvbeln,

zposnr LIKE zvbap_101754-zposnr,

zmatnr LIKE zvbap_101754-zmatnr,

zbrgew LIKE zvbap_101754-zbrgew,

zgi_qty LIKE zvbap_101754-zgi_qty,

zinv_qty LIKE zvbap_101754-zinv_qty,

END OF itab_zvbap.

SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-t01.

SELECT-OPTIONS : s_zvbeln FOR zvbak_101754-zvbeln,

s_zkunwe FOR zvbak_101754-zkunwe,

s_zerdat FOR zvbak_101754-zerdat,

s_zmatnr FOR zvbap_101754-zmatnr.

SELECTION-SCREEN END OF BLOCK block1.

SELECTION-SCREEN: BEGIN OF BLOCK block2 WITH FRAME TITLE t02.

PARAMETERS : invoiced AS CHECKBOX,

s_gi AS CHECKBOX .

SELECTION-SCREEN: END OF BLOCK block2.

SELECTION-SCREEN: BEGIN OF BLOCK block3 WITH FRAME TITLE t03.

PARAMETERS : alv_list RADIOBUTTON GROUP g1,

alv_grid RADIOBUTTON GROUP g1,

s_class RADIOBUTTON GROUP g1.

SELECTION-SCREEN: END OF BLOCK block3.

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

  • Screen Field Validation event

AT SELECTION-SCREEN ON s_zvbeln.

SELECT SINGLE *

FROM zvbak_101754 WHERE zvbeln IN s_zvbeln.

IF sy-subrc NE 0.

MESSAGE e000(z754).

ENDIF.

AT SELECTION-SCREEN ON s_zkunwe.

SELECT SINGLE *

FROM zvbak_101754 WHERE zkunwe IN s_zkunwe.

IF sy-subrc NE 0.

MESSAGE e001(z754).

ENDIF.

AT SELECTION-SCREEN ON s_zerdat.

SELECT SINGLE *

FROM zvbak_101754 WHERE zerdat IN s_zerdat.

IF sy-subrc NE 0.

MESSAGE e002(z754).

ENDIF.

AT SELECTION-SCREEN ON s_zmatnr.

SELECT SINGLE *

FROM zvbap_101754 WHERE zmatnr IN s_zmatnr.

IF sy-subrc NE 0.

MESSAGE e003(z754).

ENDIF.

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

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

  • Start-Of-Selection Event

START-OF-SELECTION.

PERFORM select-data.

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

  • End-Of-Selection Event

END-OF-SELECTION.

PERFORM display.

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

&----


*& Form select-data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM select-data .

SELECT zvbeln zposnr zmatnr zbrgew zgi_qty zinv_qty

INTO CORRESPONDING FIELDS OF TABLE itab_zvbap

FROM zvbap_101754

WHERE zvbeln IN s_zvbeln.

ENDFORM. " select-data3

  • TOP-OF-PAGE.

AT LINE-SELECTION.

FORMAT HOTSPOT.

*GET THE FIELD NAME ON LINE SELECTION

GET CURSOR FIELD FLDNAME . "value field_value.

IF FLDNAME = 'itab_zvbap-zvbeln'.

SET PARAMETER ID 'BES' FIELD itab_zvbap-zvbeln.

CALL TRANSACTION 'ZVA01_101754'.

ENDIF.

&----


*& Form DISPLAY

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM display .

IF s_class ='X'.

PERFORM display_header.

LOOP AT itab_zvbap.

WRITE : / sy-vline,

itab_zvbap-zvbeln ,

13 sy-vline,

itab_zvbap-zposnr ,

30 sy-vline,

itab_zvbap-zmatnr ,

45 sy-vline,

itab_zvbap-zbrgew UNIT mara-meins ,

65 sy-vline,

itab_zvbap-zgi_qty UNIT mara-meins,

85 sy-vline,

itab_zvbap-zinv_qty UNIT mara-meins,

105 sy-vline,

/ sy-uline(105).

ENDLOOP.

ENDIF.

&----


*& Creating the fieldcatalog.

&----


CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'ITAB_ZVBAP'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

i_inclname = sy-repid

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

ct_fieldcat = i_fieldcat

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

IF alv_list = 'X'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

i_callback_program = sy-repid

i_callback_pf_status_set = ' '

i_callback_user_command = 'USER_COMMAND '

  • I_STRUCTURE_NAME =

  • IS_LAYOUT =

it_fieldcat = i_fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IR_SALV_LIST_ADAPTER =

  • IT_EXCEPT_QINFO =

  • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = itab_zvbap[]

EXCEPTIONS

program_error = 1

OTHERS = 2

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDIF.

IF alv_grid = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

i_callback_program = sy-repid

i_callback_pf_status_set = ' '

i_callback_user_command = 'USER_COMMAND '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

it_fieldcat = i_fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = itab_zvbap[]

EXCEPTIONS

program_error = 1

OTHERS = 2

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDIF.

ENDFORM. " DISPLAY

&----


*& Form display_header

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM display_header .

WRITE : / sy-vline,

'ORDER NO',

13 sy-vline,

'ITEM NO',

30 sy-vline,

'MATERIAL NO',

45 sy-vline,

'ORDER QTY',

65 sy-vline,

'GI QTY',

85 sy-vline,

'INVOICED QTY',

105 sy-vline,

/ sy-uline(105).

ENDFORM. " display_header

Regards,

Amit.

Read only

0 Likes
787

I have made the programme you gave me. Though when I execute the programme for a sales order with 3 lines it displays to me 3 lines though with no data.

Can you imagine what I am doing wrong?

Read only

GauthamV
Active Contributor
0 Likes
788

hi,

use VA05 transaction.

Read only

Former Member
0 Likes
787

Transaction:

SDO1

From output list :List>Save>file>Spreed sheet.

Edited by: Amit Gujargoud on Oct 22, 2008 11:28 AM

Read only

Former Member
0 Likes
787

Hello Stilianos Spiroglou,

You can use this FM to create the sales order from the excel file data.

Pass the header and item details to FM.

I created the sales order with this FM only.

Call function

SD_SALESDOCUMENT_CREATE