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

Adding table t005x to program rlb_invoice

Former Member
0 Likes
1,124

Hi everyone

I am trying to get my invoice to format the date by country using table t005x.

I already have the code to change the date around depending on the value of t005x-datfm within the smartform

and now I'm trying to get the data from the table.

First i went to NACE to find the program RLB_INVOICE now I've copied it to a Zprogram, But I'm not sure what to do next.

I'm going to try added the line

DATA: wa_t005x TYPE t005x.

to the program then add that to the FORM INTERFACE in the smartform.

first is this correct or is there something else I need to do?

and if this is correct how does the program know what to pull out of t005x to I need to assign some type

of value to t005x-land so that the table knows what data to retrieve?

I'm just starting to play with ABAP so please bear with me

thanks in advance.

1 ACCEPTED SOLUTION
Read only

brad_bohn
Active Contributor
0 Likes
1,046

You don't need to copy the driver program though. You can perform that logic within the form processing in the global definitions-initialization area by getting the T005X record corresponding to the payer's country (the address is a component of the IS_BIL_INVOICE structure in the interface). Get the value from T005X and assign it to a global variable (defined in the global data area), then you can perform the logic you require based on that value.

5 REPLIES 5
Read only

brad_bohn
Active Contributor
0 Likes
1,047

You don't need to copy the driver program though. You can perform that logic within the form processing in the global definitions-initialization area by getting the T005X record corresponding to the payer's country (the address is a component of the IS_BIL_INVOICE structure in the interface). Get the value from T005X and assign it to a global variable (defined in the global data area), then you can perform the logic you require based on that value.

Read only

Former Member
0 Likes
1,046

sorry I'm not an abaper so this might be a silly question.

I found this inside the smartform under one of the program line nodes

could I do something like this?

data: wa_t005t type t005t

select single * from t005t into wa_t005t where spras = sy-langu

and land1 = l_ship_adrc-COUNTRY.

and change it up to this

data: wa_t005x type t005x.

select single DATFM from t005x into wa_t005x where land = l_ship_adrc-COUNTRY.

then maybe pass DATFM to the rest of my code.

Read only

brad_bohn
Active Contributor
0 Likes
1,046

Correct. However, you must declare the variable or work area in the global definitions area in order to use it in the rest of the smartform. If you declare it in the initialization section or a code node, it's local and won't be usable outside of its area. Your code won't compile though - you need to use a single variable for the DATFM field value or use * to select into your declared work area.

Read only

Former Member
0 Likes
1,046

ok I think its working but my date came out crazy

this is my program node

*this is to replace l_date1

data: wa_t00tx type t005x.

select single * from t005x into wa_t005x where land = l_ship_adrc-COUNTRY.

DATA: ZTEMP(9), ZDD(2), ZMMM(3), ZYYYY(4).

CLEAR: ZTEMP, ZDD, ZMMM, ZYYYY.

CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'

EXPORTING

INPUT = IS_BIL_INVOICE-HD_GEN-BIL_DATE

IMPORTING

OUTPUT = ZTEMP.

ZDD = ZTEMP+3(2).

ZMMM = ZTEMP+0(3).

ZYYYY = ZTEMP+5(4).

case wa_t005x-datfm.

*DD.MM.YYYY

when '1'.

Concatenate zdd zmmm zyyyy into zdate SEPARATED BY '.'.

*MM/DD/YYYY

when '2'.

Concatenate zmmm zdd zyyyy into zdate SEPARATED BY '/'.

*MM-DD-YYYY

when '3'.

Concatenate zmmm zdd zyyyy into zdate SEPARATED BY '-'.

*YYYY.MM.DD

when '4'.

Concatenate zyyyy zmmm zdd into zdate SEPARATED BY '.'.

*YYYY/MM/DD

when '5'.

Concatenate zyyyy zmmm zdd into zdate SEPARATED BY '/'.

*YYYY-MM-DD

when '6'.

Concatenate zyyyy zmmm zdd into zdate SEPARATED BY '-'.

*YYYY/MM/DD JAPAN IS CURRENTLY SET UP AS FORMAT 5

when '7'.

Concatenate zyyyy zmmm zdd into zdate SEPARATED BY '/'.

*YYYY/MM/DD JAPAN IS CURRENTLY SET UP AS FORMAT 5

when '8'.

Concatenate zyyyy zmmm zdd into zdate SEPARATED BY '/'.

*YYYY/MM/DD JAPAN IS CURRENTLY SET UP AS FORMAT 5

when '9'.

Concatenate zyyyy zmmm zdd into zdate SEPARATED BY '/'.

*DD.MM.YYYY ISLAMIC DATES ARE CURRENTELY SET UP AS FORMAT 1

when 'A'.

Concatenate zdd zmmm zyyyy into zdate SEPARATED BY '.'.

*DD.MM.YYYY ISLAMIC DATES ARE CURRENTELY SET UP AS FORMAT 1

when 'B'.

Concatenate zdd zmmm zyyyy into zdate SEPARATED BY '.'.

*DD.MM.YYYY IRAN IS CURRENTLY SET UP AS FORMAT 1

when 'C'.

Concatenate zdd zmmm zyyyy into zdate SEPARATED BY '.'.

when ' '.

Concatenate zmmm zdd zyyyy into zdate SEPARATED BY '/'.

endcase.

this was my output

CT.130.2010 (I'm using a old invoice so the year is correct)

the country is spain which we have set to format 1 so the format came out correctly now i just need to know why these values where pased to my ZTEMP? did i use the wrong FM?

Read only

Former Member
0 Likes
1,046

Nevermind I fixed the date I took out the fm and just went with this

ZMMM = is_bil_invoice-hd_gen-bil_date+4(2).

ZDD = is_bil_invoice-hd_gen-bil_date+6(2).

ZYYYY = is_bil_invoice-hd_gen-bil_date+0(4).

and the date came out correctly as

13.10.2010

Thank you very much