2007 Feb 13 5:47 AM
Hi All,
I have created this prog......... but it's not working...........
Just below this program, fun spec is given ....
anybody could help me out to solve this prog....
Thanks......
REPORT zmm_catering.
TABLES: bseg,lfa1, makt, bkpf, zcatering_structure.
TYPE-POOLS: slis.
DATA: BEGIN OF it_table OCCURS 0.
INCLUDE STRUCTURE zcatering_structure.
DATA : END OF it_table.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
v_repid TYPE sy-repid.
DATA: lt_layout TYPE slis_layout_alv.
DATA g_range.
DATA itab.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_bldat FOR bkpf-bldat OBLIGATORY,
s_lifnr FOR lfa1-lifnr.
g_range for bseg-belnr.
*SELECT-OPTIONS: s_hkont FOR bsis-hkont,
s_bschl FOR bsis-bschl.
SELECTION-SCREEN END OF BLOCK b1.
DATA: BEGIN OF it_docs OCCURS 0,
bukrs LIKE bseg-bukrs,
belnr LIKE bseg-belnr,
gjahr LIKE bseg-gjahr,
buzei LIKE bseg-buzei,
lifnr LIKE lfa1-lifnr,
matnr LIKE makt-matnr,
spras LIKE makt-spras,
bldat LIKE bkpf-bldat,
hkont LIKE bseg-hkont,
kostl LIKE bseg-kostl,
dmbtr LIKE bseg-dmbtr,
tcode LIKE bkpf-tcode,
saknr LIKE bseg-saknr,
END OF it_docs.
g_range for bseg-belnr.
g_range = '44010100' BIT-AND '44010125'
APPEND g_ranges.
INITIALIZATION.
PERFORM build_fieldcatlog.
CLEAR: v_repid.
v_repid = sy-repid.
START-OF-SELECTION.
SELECT * FROM bkpf INTO it_docs
WHERE bldat IN s_bldat
AND tcode = 'ML81N'.
ENDSELECT.
IF s_lifnr IS NOT INITIAL.
SELECT bukrs belnr gjahr buzei lifnr matnr spras bldat hkont kostl
dmbtr tcode INTO TABLE itab
FOR ALL ENTRIES IN it_docs FROM bseg
WHERE lifnr IN s_lifnr
AND hkont IN g_range
ENDSELECT.
ENDIF.
IF sy-subrc <> 0.
MESSAGE s000(zmess_catering).
ELSE.
PERFORM display_alv_report.
ENDIF.
END-OF-SELECTION.
&----
*& Form DISPLAY_ALV_REPORT
&----
text
----
FORM display_alv_report.
v_repid = sy-repid.
Set code for doubleclick
lt_layout-f2code = 'FB03'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'zcatering_structure'
is_layout = lt_layout
TABLES
t_outtab = it_table
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.
ENDFORM. "DISPLAY_ALV_REPORT
-
Functional spec of above mentioned program.....
TABLES: BSEG, LFA1,MAKT are to be used for having output of report.
Report has to be run for specific GL accounts only which are to be hard coded in the program logic. Based on users input Range of Date all the documents within the range are to be selected along with below criteria from Table BKPF
Transaction code = ML81N
If user enters vendor range then select vendors (input values) from Table BSEG after selecting documents from BKPF based on date & TC as above.
Once the Document are selected from BKPF give as input to BSEG along with below list of GL account (field- HKONT) Below GL to be hard coded in program.
10101 Services - Catering -Food/Beverages
10102 Services - Catering - Hi Lift
10113 Services - Catering - Handling
10114 Services - Catering - Stores
10125 Services - Catering - Laundry
10126 Services - Catering Offloading
Based on above selection the output data from BSEG will be-
Vendor Cost Centre Amount in LC
(LIFNR) (KOSTL) (DMBTR)
Hi All,
I have created this prog......... but it's not working...........
Just below this program, fun spec is given ....
anybody could help me out to solve this prog....
Thanks......
REPORT zmm_catering.
TABLES: bseg,lfa1, makt, bkpf, zcatering_structure.
TYPE-POOLS: slis.
DATA: BEGIN OF it_table OCCURS 0.
INCLUDE STRUCTURE zcatering_structure.
DATA : END OF it_table.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
v_repid TYPE sy-repid.
DATA: lt_layout TYPE slis_layout_alv.
DATA g_range.
DATA itab.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_bldat FOR bkpf-bldat OBLIGATORY,
s_lifnr FOR lfa1-lifnr.
g_range for bseg-belnr.
*SELECT-OPTIONS: s_hkont FOR bsis-hkont,
s_bschl FOR bsis-bschl.
SELECTION-SCREEN END OF BLOCK b1.
DATA: BEGIN OF it_docs OCCURS 0,
bukrs LIKE bseg-bukrs,
belnr LIKE bseg-belnr,
gjahr LIKE bseg-gjahr,
buzei LIKE bseg-buzei,
lifnr LIKE lfa1-lifnr,
matnr LIKE makt-matnr,
spras LIKE makt-spras,
bldat LIKE bkpf-bldat,
hkont LIKE bseg-hkont,
kostl LIKE bseg-kostl,
dmbtr LIKE bseg-dmbtr,
tcode LIKE bkpf-tcode,
saknr LIKE bseg-saknr,
END OF it_docs.
g_range for bseg-belnr.
g_range = '44010100' BIT-AND '44010125'
APPEND g_ranges.
INITIALIZATION.
PERFORM build_fieldcatlog.
CLEAR: v_repid.
v_repid = sy-repid.
START-OF-SELECTION.
SELECT * FROM bkpf INTO it_docs
WHERE bldat IN s_bldat
AND tcode = 'ML81N'.
ENDSELECT.
IF s_lifnr IS NOT INITIAL.
SELECT bukrs belnr gjahr buzei lifnr matnr spras bldat hkont kostl
dmbtr tcode INTO TABLE itab
FOR ALL ENTRIES IN it_docs FROM bseg
WHERE lifnr IN s_lifnr
AND hkont IN g_range
ENDSELECT.
ENDIF.
IF sy-subrc <> 0.
MESSAGE s000(zmess_catering).
ELSE.
PERFORM display_alv_report.
ENDIF.
END-OF-SELECTION.
&----
*& Form DISPLAY_ALV_REPORT
&----
text
----
FORM display_alv_report.
v_repid = sy-repid.
Set code for doubleclick
lt_layout-f2code = 'FB03'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'zcatering_structure'
is_layout = lt_layout
TABLES
t_outtab = it_table
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.
ENDFORM. "DISPLAY_ALV_REPORT
-
Functional spec of above mentioned program.....
TABLES: BSEG, LFA1,MAKT are to be used for having output of report.
Report has to be run for specific GL accounts only which are to be hard coded in the program logic. Based on users input Range of Date all the documents within the range are to be selected along with below criteria from Table BKPF
Transaction code = ML81N
If user enters vendor range then select vendors (input values) from Table BSEG after selecting documents from BKPF based on date & TC as above.
Once the Document are selected from BKPF give as input to BSEG along with below list of GL account (field- HKONT) Below GL to be hard coded in program.
10101 Services - Catering -Food/Beverages
10102 Services - Catering - Hi Lift
10113 Services - Catering - Handling
10114 Services - Catering - Stores
10125 Services - Catering - Laundry
10126 Services - Catering Offloading
Based on above selection the output data from BSEG will be-
Vendor Cost Centre Amount in LC
(LIFNR) (KOSTL) (DMBTR)
2007 Feb 13 5:57 AM
Hi,
Are you getting all the results in an internal table?
Then, change i_structure_name = 'zcatering_structure'
to
i_structure_name = 'ZCATERING_STRUCTURE'
regards
Subramanian
2007 Feb 13 6:00 AM
Chang,
Write the SELECT statement as:
SELECT abukrs abelnr agjahr bbuzei blifnr bmatnr bspras bbldat bhkont bkostl bdmbtr btcode b~saknr INTO TABLE itab
FROM bkpf as a
INNER JOIN bseg as b ON abelnr = bbelnr
WHERE a~bldat IN s_bldat
AND a~tcode = 'ML81N'
AND b~lifnr IN s_lifnr
AND h~hkont IN g_range.
Here g_range will have all the given below values
Thanks
2007 Feb 13 6:16 AM
Hi,
g_range for bseg-belnr.
g_range = '44010100' BIT-AND '44010125'
Wrong u have to specify the low, sign and then append.
START-OF-SELECTION.
SELECT * FROM bkpf INTO TABLE it_docs
WHERE bldat IN s_bldat
AND tcode = 'ML81N'.
If sy-subrc = 0.
SELECT bukrs belnr gjahr buzei lifnr matnr spras bldat hkont kostl
dmbtr tcode FROM bseg
INTO TABLE itab
FOR ALL ENTRIES IN it_docs
WHERE bukrs = it_docs-bukrs
AND belnr = it_docs-belnr
AND gjahr = it_docs-gjahr
AND lifnr IN s_lifnr
AND hkont IN g_range.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
* i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'ZCATERING_STRUCTURE' (bold)
is_layout = lt_layout
TABLES
t_outtab = it_table
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.
ENDFORM. "DISPLAY_ALV_REPORTExample code for ranges:
ranges: bukrs for zstock-bukrs.
bukrs-sign = 'E'. "Exclude
bukrs-option = 'CP'. "Pattern
bukrs-low = 'AB*'. "Low Value
bukrs-high = ''. "High Value
append bukrs.
Try this way or use join.
Message was edited by:
Judith Jessie Selvi
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |