2008 Jan 09 6:53 AM
I want to Report developed to list out all Sales Orders with Billing details and download into a local file, which is used to ensure whether all the Sales Orders has been posted into SAP system to compare with legacy system.
2008 Jan 09 9:16 AM
Hi Devi Vishwanath,
Use VBFA table to do this..
select VBELV POSNV VBELN POSNR from VBFA where VBTYP_V = 'C' and VBTYP_N = 'M' (if your invoices contain debit/credit memo, pro forma, or other types specify all type with or condition).
VBELV POSNV will contain Sales Order and Sales Order line item number. VBELN and POSNR will contain Billing document and Billing document line item number.
If you want more details for billing document query on VBRK / VBRP table with VBELN and / or POSNR field.
If you want more details for sales order query on VBAK / VBAP tabel with VBELV and / or POSNV field..
You can get all linkages between sales document from VBFA table..
Regards,
Mohaiyuddin
I want to Report developed to list out all Sales Orders with Billing details and download into a local file, which is used to ensure whether all the Sales Orders has been posted into SAP system to compare with legacy system.
2008 Jan 09 9:16 AM
Hi Devi Vishwanath,
Use VBFA table to do this..
select VBELV POSNV VBELN POSNR from VBFA where VBTYP_V = 'C' and VBTYP_N = 'M' (if your invoices contain debit/credit memo, pro forma, or other types specify all type with or condition).
VBELV POSNV will contain Sales Order and Sales Order line item number. VBELN and POSNR will contain Billing document and Billing document line item number.
If you want more details for billing document query on VBRK / VBRP table with VBELN and / or POSNR field.
If you want more details for sales order query on VBAK / VBAP tabel with VBELV and / or POSNV field..
You can get all linkages between sales document from VBFA table..
Regards,
Mohaiyuddin
2008 Jan 09 11:00 AM
Hi there
Use a variation on this program.
I've used VAPMA but select your own structure and use the same coding principle
To download your list just click the EXPORT button in the GRID - it is the LAST BUT ONE button.
Standard functions such as PRINT etc are on the GRID buttons.
You need to create a standard screen (SE51) with just a custom control on it called CCONTAINER1 and container on it . Create also a standard STATUS (SE41) with CANCEL BACK and EXIT buttons on it.
Here's the VERY VERY EASY code. It's completely general so all you need to do is just define your own structure in the s_elements structure and fill the table with your data instead of VAPMA data.
You can use the same principle for almost ANY structure so ALV lists now are REALLY EASY.
(For added functionality you can add events, data handling etc etc but the code here I've shown is quite sufficient for typical display lists and to download to local files).
PROGRAM zzz_simple_editable_grid.
* Define any structure
TYPES: BEGIN OF s_elements,
vbeln TYPE vapma-vbeln,
posnr TYPE vapma-posnr,
matnr TYPE vapma-matnr,
kunnr TYPE vapma-kunnr,
werks TYPE vapma-werks,
vkorg TYPE vapma-vkorg,
vkbur TYPE vapma-vkbur,
status TYPE c,
END OF s_elements.
* end of your structure
DATA lr_rtti_struc TYPE REF TO cl_abap_structdescr .
DATA:
zog LIKE LINE OF lr_rtti_struc->components .
DATA:
zogt LIKE TABLE OF zog,
wa_it_fldcat TYPE lvc_s_fcat,
it_fldcat TYPE lvc_t_fcat ,
dy_line TYPE REF TO data,
dy_table TYPE REF TO data.
DATA: dref TYPE REF TO data.
FIELD-SYMBOLS: <fs> TYPE ANY,
<dyn_table> TYPE STANDARD TABLE,
<dyn_wa>.
DATA grid_container1 TYPE REF TO cl_gui_custom_container .
DATA grid1 TYPE REF TO cl_gui_alv_grid .
DATA: ok_code TYPE sy-ucomm.
DATA: struct_grid_lset TYPE lvc_s_layo.
*now I want to build a field catalog
* First get your data structure into a field symbol
CREATE DATA dref TYPE s_elements.
ASSIGN dref->* TO <fs>.
lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( <fs> ).
* Now get the structure details into a table.
* table zogt[] contains the structure details
* From which we can build the field catalog
zogt[] = lr_rtti_struc->components.
LOOP AT zogt INTO zog.
CLEAR wa_it_fldcat.
wa_it_fldcat-fieldname = zog-name .
wa_it_fldcat-datatype = zog-type_kind.
wa_it_fldcat-inttype = zog-type_kind.
wa_it_fldcat-intlen = zog-length.
wa_it_fldcat-decimals = zog-decimals.
wa_it_fldcat-coltext = zog-name.
wa_it_fldcat-lowercase = 'X'.
APPEND wa_it_fldcat TO it_fldcat .
ENDLOOP.
*
* You can perform any modifications / additions to your field catalog
* here such as your own column names etc.
* Now using the field catalog created above we can
* build a dynamic table
* and populate it
* First build the dynamic table
* the table will contain entries for
* our structure defined at the start of the program
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fldcat
IMPORTING
ep_table = dy_table.
ASSIGN dy_table->* TO <dyn_table>.
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
* Now fill our table with data
SELECT vbeln posnr matnr kunnr werks vkorg vkbur
UP TO 200 ROWS
FROM vapma
INTO CORRESPONDING FIELDS OF TABLE <dyn_table>.
* Call the screen to display the grid
CALL SCREEN 100.
* PBO module
MODULE status_0100 OUTPUT.
IF grid_container1 IS INITIAL.
CREATE OBJECT grid_container1
EXPORTING
container_name = 'CCONTAINER1'.
CREATE OBJECT grid1
EXPORTING
i_parent = grid_container1.
struct_grid_lset-edit = 'X'. "To enable editing in ALV
CALL METHOD grid1->set_table_for_first_display
EXPORTING is_layout = struct_grid_lset
CHANGING
it_outtab = <dyn_table>
it_fieldcatalog = it_fldcat.
ENDIF.
SET PF-STATUS '001'.
SET TITLEBAR '000'.
ENDMODULE.
* PAI module
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'RETURN'.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.
ENDMODULE.
Now I don't want to see people complaining about how difficult ALV grids are or even seeing them use the old Dinosaur SLIS modules.
Cheers
jimbo
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |