Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

insert date fields in output

REPORT ZREPORT14.

tables: kna1,vbak,vbap.

select-options : date for vbak-erdat.

DATA : BEGIN OF IT_ITAB occurs 0,

  • month(2) TYPE C ,

KUNNR LIKE KNA1-KUNNR,

NAME1 LIKE KNA1-NAME1,

VBELN LIKE VBAK-VBELN,

ERDAT LIKE VBAK-ERDAT,

meins like vbap-meins,

kwmeng like vbap-kwmeng,

end of IT_itab.

*

*DATA : LV_DAT TYPE TABLE OF IT_ITAB,

  • LS_VBAK TYPE TABLE OF IT_ITAB.

SELECT KNA1KUNNR KNA1NAME1 VBAKVBELN VBAKERDAT VBAP~MEINS

VBAP~KWMENG

INTO TABLE it_ITAB FROM ( ( KNA1 INNER JOIN vbaK ON KNA1~KUNNR =

VBAK~KUNNR )

INNER JOIN VBAP ON VBAKVBELN = VBAPVBELN ) WHERE

VBAK~ERDAT IN DATE.

DATA: BEGIN OF LS_DAT OCCURS 0,

month TYPE C ,

END OF LS_DAT.

LOOP AT LS_DAT.

*LS_DAT-MONTH = IT_ITAB-ERDAT+4(2).

*ITAB2-LS_DAT = IT_ITAB-ERDAT+4(2).

LS_DAT-MONTH = IT_ITAB-ERDAT.

*VBAP-ERDAT = ITAB2-MONTH.

CASE SY-DATUM.

WHEN 'LS_DAT-MONTH = 01'.

LS_DAT-MONTH = 'JAN_QUANTITY'.

WHEN 'LS_DAT-MONTH = 02'.

LS_DAT-MONTH = 'FEB_QUANTITY'.

WHEN 'LS_DAT-MONTH = 03'.

LS_DAT-MONTH = 'MARCH_QUANTITY'.

WHEN 'LS_DAT-MONTH = 04'.

LS_DAT-MONTH = 'APR_QUANTITY'.

WHEN 'LS_DAT-MONTH = 05'.

LS_DAT-MONTH = 'MAY_QUANTITY'.

WHEN 'LS_DAT-MONTH = 06'.

LS_DAT-MONTH = 'JUN_QUANTITY'.

WHEN 'LS_DAT-MONTH = 07'.

LS_DAT-MONTH = 'JUL_QUANTITY'.

WHEN 'LS_DAT-MONTH = 08'.

LS_DAT-MONTH = 'AUG_QUANTITY'.

WHEN 'LS_DAT-MONTH = 09'.

LS_DAT-MONTH = 'SEP_QUANTITY'.

WHEN 'LS_DAT-MONTH = 10'.

LS_DAT-MONTH = 'OCT_QUANTITY'.

WHEN 'LS_DAT-MONTH = 11'.

LS_DAT-MONTH = 'NOV_QUANTITY'.

WHEN 'LS_DAT-MONTH = 12'.

LS_DAT-MONTH = 'DEC_QUANTITY'.

ENDCASE.

  • endcase.

*APPEND ITAB2.

ENDLOOP.

LOOP AT it_itab.

LS_DAT-MONTH = IT_ITAB-ERDAT+4(2).

LOOP AT LS_DAT.

WRITE :/40 LS_DAT-MONTH.

ENDLOOP.

WRITE :/1 IT_ITAB-KUNNR,

15 IT_ITAB-NAME1.

ENDLOOP.

dear friends above is my coding ..but i am not able to display month field by abov logic

please suggest me any changes in the codin to display out put with date fields also along with fields in write statement.

rohan

Tags:
Not what you were looking for? View more on this topic or Ask a question